@zhama/tego-plugin-sdk 1.37.1 → 1.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -9
- package/agent/RULES.md +34 -11
- package/agent/guides/agent-templates.md +51 -0
- package/agent/guides/backend.md +8 -0
- package/agent/guides/host-api-versions.md +3 -0
- package/agent/reference/plugin-sdk-api.md +1 -0
- package/agent/rules.json +500 -0
- package/agent/skills/add-agent-template/SKILL.md +19 -0
- package/agent/skills/add-claw-tool/SKILL.md +21 -0
- package/agent/skills/add-i18n-strings/SKILL.md +19 -0
- package/agent/skills/add-migration/SKILL.md +22 -0
- package/agent/skills/add-route-with-access/SKILL.md +30 -0
- package/agent/skills/add-screen/SKILL.md +27 -0
- package/bin/tego-plugin.mjs +7 -3
- package/dist/access.d.cts +1 -0
- package/dist/access.d.ts +1 -0
- package/dist/{chunk-EIVA5BR6.js → chunk-2KXEYXM2.js} +1 -1
- package/dist/{chunk-I5Z3ECC4.js → chunk-44LPR67H.js} +1 -1
- package/dist/chunk-66LDWN4T.cjs +1 -0
- package/dist/{chunk-HZ4YWRYX.cjs → chunk-6EKQMOYT.cjs} +2 -2
- package/dist/{chunk-SKNPNPJP.cjs → chunk-H6GXDFLP.cjs} +1 -1
- package/dist/{chunk-6HNG5OZI.cjs → chunk-IOZFHJ4F.cjs} +1 -1
- package/dist/chunk-JV2G2Z33.js +1 -0
- package/dist/{chunk-4LKRXDYY.cjs → chunk-QQOUNXLC.cjs} +8 -8
- package/dist/{chunk-FCYAAOHC.js → chunk-UZBWS5AR.js} +2 -2
- package/dist/{chunk-56QOZQTY.js → chunk-XOXUS4VI.js} +1 -1
- package/dist/decision-card-IF2c4wvM.d.cts +161 -0
- package/dist/decision-card-IF2c4wvM.d.ts +161 -0
- package/dist/dev.cjs +8 -3
- package/dist/dev.d.cts +33 -2
- package/dist/dev.d.ts +33 -2
- package/dist/dev.js +13 -8
- package/dist/doctor.cjs +15 -8
- package/dist/doctor.d.cts +99 -2
- package/dist/doctor.d.ts +99 -2
- package/dist/doctor.js +15 -8
- package/dist/eslint.cjs +1 -0
- package/dist/eslint.d.cts +29 -0
- package/dist/eslint.d.ts +29 -0
- package/dist/eslint.js +1 -0
- package/dist/hono.d.cts +1 -0
- package/dist/hono.d.ts +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +1 -1
- package/dist/manifest.cjs +1 -1
- package/dist/manifest.js +1 -1
- package/dist/pack.cjs +1 -1
- package/dist/pack.d.cts +5 -0
- package/dist/pack.d.ts +5 -0
- package/dist/pack.js +1 -1
- package/dist/publish.cjs +1 -1
- package/dist/publish.js +1 -1
- package/dist/scaffold.cjs +53 -8
- package/dist/scaffold.js +59 -14
- package/dist/server-runtime.cjs +1 -1
- package/dist/server-runtime.d.cts +1 -0
- package/dist/server-runtime.d.ts +1 -0
- package/dist/server-runtime.js +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +25 -0
- package/dist/server.d.ts +25 -0
- package/dist/server.js +1 -1
- package/dist/testing.d.cts +1 -0
- package/dist/testing.d.ts +1 -0
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/package.json +8 -1
- /package/dist/{chunk-QKSPPMVN.js → chunk-CDJQ7OPA.js} +0 -0
- /package/dist/{chunk-BN6TGHSB.cjs → chunk-SR5V7ZC2.cjs} +0 -0
package/dist/pack.d.cts
CHANGED
|
@@ -162,6 +162,11 @@ interface BuildPluginBackendOptions {
|
|
|
162
162
|
outDir: string;
|
|
163
163
|
/** Source entry, relative to root. Defaults to `<dir>/src/index.ts`. */
|
|
164
164
|
entry?: string;
|
|
165
|
+
/**
|
|
166
|
+
* Inline source maps (the local preview, so stack traces and a debugger
|
|
167
|
+
* point at the TypeScript). Releases ship without.
|
|
168
|
+
*/
|
|
169
|
+
sourcemap?: boolean;
|
|
165
170
|
/** Extra modules to leave unbundled, on top of the built-in list. */
|
|
166
171
|
external?: string[];
|
|
167
172
|
}
|
package/dist/pack.d.ts
CHANGED
|
@@ -162,6 +162,11 @@ interface BuildPluginBackendOptions {
|
|
|
162
162
|
outDir: string;
|
|
163
163
|
/** Source entry, relative to root. Defaults to `<dir>/src/index.ts`. */
|
|
164
164
|
entry?: string;
|
|
165
|
+
/**
|
|
166
|
+
* Inline source maps (the local preview, so stack traces and a debugger
|
|
167
|
+
* point at the TypeScript). Releases ship without.
|
|
168
|
+
*/
|
|
169
|
+
sourcemap?: boolean;
|
|
165
170
|
/** Extra modules to leave unbundled, on top of the built-in list. */
|
|
166
171
|
external?: string[];
|
|
167
172
|
}
|
package/dist/pack.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{buildAgentTemplate,buildPluginBackend,buildPluginTemplates,lockPlugin,packPlugin,readManifest,watchPluginFrontend}from"./chunk-
|
|
1
|
+
export{buildAgentTemplate,buildPluginBackend,buildPluginTemplates,lockPlugin,packPlugin,readManifest,watchPluginFrontend}from"./chunk-UZBWS5AR.js";import"./chunk-44LPR67H.js";import"./chunk-2KXEYXM2.js";import"./chunk-2NTAWYCG.js";import"./chunk-IVJECPGG.js";import"./chunk-INCA3GFW.js";import"./chunk-XOXUS4VI.js";import"./chunk-VMCGDDGP.js";import"./chunk-SNUCO2MK.js";
|
package/dist/publish.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var $=Object.defineProperty;var s=(e,a)=>$(e,"name",{value:a,configurable:!0});var
|
|
1
|
+
"use strict";var $=Object.defineProperty;var s=(e,a)=>$(e,"name",{value:a,configurable:!0});var chunkQQOUNXLC_cjs=require("./chunk-QQOUNXLC.cjs");require("./chunk-6EKQMOYT.cjs"),require("./chunk-H6GXDFLP.cjs"),require("./chunk-45Y4CR4R.cjs");var chunk2P6UEAPV_cjs=require("./chunk-2P6UEAPV.cjs");require("./chunk-N4SXZZPY.cjs"),require("./chunk-IOZFHJ4F.cjs"),require("./chunk-AJY7ZHXK.cjs"),require("./chunk-OP64Y4IN.cjs");var promises=require("fs/promises"),path=require("path"),API_PREFIX="/api/v1/tego-os";async function publishPlugin(e){const a=e.log===null?()=>{}:e.log??(t=>console.log(t)),n=await chunkQQOUNXLC_cjs.packPlugin({root:e.root,log:a});return publishPackedPlugin(n,e)}s(publishPlugin,"publishPlugin");async function publishPackedPlugin(e,a){const n=a.log===null?()=>{}:a.log??(p=>console.log(p)),t=a.fetchImpl??fetch,r=createCaller(a.server,a.token,t),u=await promises.readFile(e.file),o=path.basename(e.file);n("\u203A presigning upload");const l=await r("POST","/admin/runtime-plugins/presign-stream",{filename:o,mimeType:"application/zip",size:u.byteLength});n(`\u203A uploading ${o} (${u.byteLength} bytes)`),await putArchive(a.server,l.uploadUrl,u,t),n("\u203A inspecting package");const c=await r("POST","/admin/runtime-plugins/inspect",{uploadToken:l.uploadToken});n(` ${c.pluginId}@${c.semanticVersion} \u2014 ${describeParts(c)}${c.isUpgrade?" (upgrade)":""}${c.requiresConfig?", needs config":""}`),n("\u203A finalizing release");const g=await r("POST","/admin/runtime-plugins/upload",{uploadToken:l.uploadToken,...a.meta});let i=g.release;n(` release ${i.id} (${i.status})`),(a.approve??!0)&&(n("\u203A approving release"),i=await r("POST",`/admin/runtime-plugins/releases/${encodeURIComponent(i.id)}/approve`,{}),n(` release ${i.id} (${i.status})`));let d=null;if(a.install??!0){const p=chunk2P6UEAPV_cjs.resolvePluginScope(e.manifest),f=p==="avatar"?{releaseId:i.id,avatarIds:a.avatarIds??[]}:{releaseId:i.id};n(`\u203A installing for tenant (${p}-scoped)`),d=await r("POST","/admin/runtime-plugins/installs",f),reportInstall(d,n)}return{packed:e,preview:c,catalog:g.catalog,release:i,install:d}}s(publishPackedPlugin,"publishPackedPlugin");function describeParts(e){const a=[];return e.parts.frontend&&a.push(`frontend (${e.parts.frontend.locales.length} locales)`),e.parts.backend&&a.push(`backend (${e.parts.backend.migrationCount} migrations)`),e.parts.claw&&a.push("claw"),a.join(", ")||"no parts"}s(describeParts,"describeParts");function reportInstall(e,a){const n=e.avatars;if(!n||n.attempted===0){a(` installed ${e.pluginId}@${e.version}`);return}const t=n.attempted-n.failures.length;a(` installed ${e.pluginId}@${e.version} \u2014 ${t}/${n.attempted} avatars`);for(const r of n.failures)a(` \u2717 ${r.avatarId}: ${r.message}`)}s(reportInstall,"reportInstall");function createCaller(e,a,n){const t=e.replace(/\/+$/,"");return s(async function(u,o,l){const c=await n(`${t}${API_PREFIX}${o}`,{method:u,headers:{authorization:`Bearer ${a}`,...l===void 0?{}:{"content-type":"application/json"}},...l===void 0?{}:{body:JSON.stringify(l)}});return unwrap(c,`${u} ${o}`)},"call")}s(createCaller,"createCaller");async function putArchive(e,a,n,t){const r=e.replace(/\/+$/,""),u=await t(`${r}${a}`,{method:"PUT",headers:{"content-type":"application/zip"},body:n});await unwrap(u,"PUT upload")}s(putArchive,"putArchive");async function unwrap(e,a){let n;try{n=await e.json()}catch{n=null}if(!e.ok||!n?.success){const t=n?.error?.message??`HTTP ${e.status}`;throw new Error(`${a} failed: ${t}`)}return n.data}s(unwrap,"unwrap"),exports.publishPackedPlugin=publishPackedPlugin,exports.publishPlugin=publishPlugin;
|
package/dist/publish.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var h=Object.defineProperty;var o=(e,a)=>h(e,"name",{value:a,configurable:!0});import{packPlugin as v}from"./chunk-
|
|
1
|
+
var h=Object.defineProperty;var o=(e,a)=>h(e,"name",{value:a,configurable:!0});import{packPlugin as v}from"./chunk-UZBWS5AR.js";import"./chunk-44LPR67H.js";import"./chunk-2KXEYXM2.js";import"./chunk-2NTAWYCG.js";import{resolvePluginScope as P}from"./chunk-IVJECPGG.js";import"./chunk-INCA3GFW.js";import"./chunk-XOXUS4VI.js";import"./chunk-VMCGDDGP.js";import"./chunk-SNUCO2MK.js";import{readFile as w}from"fs/promises";import{basename as y}from"path";var I="/api/v1/tego-os";async function T(e){const a=e.log===null?()=>{}:e.log??(n=>console.log(n)),t=await v({root:e.root,log:a});return m(t,e)}o(T,"publishPlugin");async function m(e,a){const t=a.log===null?()=>{}:a.log??(p=>console.log(p)),n=a.fetchImpl??fetch,r=A(a.server,a.token,n),s=await w(e.file),c=y(e.file);t("\u203A presigning upload");const u=await r("POST","/admin/runtime-plugins/presign-stream",{filename:c,mimeType:"application/zip",size:s.byteLength});t(`\u203A uploading ${c} (${s.byteLength} bytes)`),await S(a.server,u.uploadUrl,s,n),t("\u203A inspecting package");const l=await r("POST","/admin/runtime-plugins/inspect",{uploadToken:u.uploadToken});t(` ${l.pluginId}@${l.semanticVersion} \u2014 ${b(l)}${l.isUpgrade?" (upgrade)":""}${l.requiresConfig?", needs config":""}`),t("\u203A finalizing release");const g=await r("POST","/admin/runtime-plugins/upload",{uploadToken:u.uploadToken,...a.meta});let i=g.release;t(` release ${i.id} (${i.status})`),(a.approve??!0)&&(t("\u203A approving release"),i=await r("POST",`/admin/runtime-plugins/releases/${encodeURIComponent(i.id)}/approve`,{}),t(` release ${i.id} (${i.status})`));let d=null;if(a.install??!0){const p=P(e.manifest),$=p==="avatar"?{releaseId:i.id,avatarIds:a.avatarIds??[]}:{releaseId:i.id};t(`\u203A installing for tenant (${p}-scoped)`),d=await r("POST","/admin/runtime-plugins/installs",$),k(d,t)}return{packed:e,preview:l,catalog:g.catalog,release:i,install:d}}o(m,"publishPackedPlugin");function b(e){const a=[];return e.parts.frontend&&a.push(`frontend (${e.parts.frontend.locales.length} locales)`),e.parts.backend&&a.push(`backend (${e.parts.backend.migrationCount} migrations)`),e.parts.claw&&a.push("claw"),a.join(", ")||"no parts"}o(b,"describeParts");function k(e,a){const t=e.avatars;if(!t||t.attempted===0){a(` installed ${e.pluginId}@${e.version}`);return}const n=t.attempted-t.failures.length;a(` installed ${e.pluginId}@${e.version} \u2014 ${n}/${t.attempted} avatars`);for(const r of t.failures)a(` \u2717 ${r.avatarId}: ${r.message}`)}o(k,"reportInstall");function A(e,a,t){const n=e.replace(/\/+$/,"");return o(async function(s,c,u){const l=await t(`${n}${I}${c}`,{method:s,headers:{authorization:`Bearer ${a}`,...u===void 0?{}:{"content-type":"application/json"}},...u===void 0?{}:{body:JSON.stringify(u)}});return f(l,`${s} ${c}`)},"call")}o(A,"createCaller");async function S(e,a,t,n){const r=e.replace(/\/+$/,""),s=await n(`${r}${a}`,{method:"PUT",headers:{"content-type":"application/zip"},body:t});await f(s,"PUT upload")}o(S,"putArchive");async function f(e,a){let t;try{t=await e.json()}catch{t=null}if(!e.ok||!t?.success){const n=t?.error?.message??`HTTP ${e.status}`;throw new Error(`${a} failed: ${n}`)}return t.data}o(f,"unwrap");export{m as publishPackedPlugin,T as publishPlugin};
|
package/dist/scaffold.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var g=Object.defineProperty;var o=(e,t)=>g(e,"name",{value:t,configurable:!0});var
|
|
1
|
+
"use strict";var g=Object.defineProperty;var o=(e,t)=>g(e,"name",{value:t,configurable:!0});var chunkIOZFHJ4F_cjs=require("./chunk-IOZFHJ4F.cjs"),fs=require("fs"),path=require("path"),ACCESS_SQL=`-- Generated by \`pnpm -F @tego/plugin-sdk access:sql\` from src/access/drizzle.ts. Do not edit.
|
|
2
2
|
CREATE TABLE IF NOT EXISTS "tego_access_assignments" (
|
|
3
3
|
"id" text PRIMARY KEY NOT NULL,
|
|
4
4
|
"tenant_id" text NOT NULL,
|
|
@@ -363,6 +363,18 @@ export default definePluginFrontend({
|
|
|
363
363
|
const { t } = useTranslation();
|
|
364
364
|
const access = useAccess();
|
|
365
365
|
if (access.loading) return <Loading />;
|
|
366
|
+
// Not knowing is not being refused: say why (the backend is down, the network
|
|
367
|
+
// failed) and offer a retry instead of a misleading "no permission".
|
|
368
|
+
if (access.error) {
|
|
369
|
+
const { key, message } = describeApiError(access.error, '${t}');
|
|
370
|
+
return (
|
|
371
|
+
<EmptyState
|
|
372
|
+
icon={<TriangleAlert />}
|
|
373
|
+
title={key ? t(key, { defaultValue: message }) : message}
|
|
374
|
+
action={{ label: t('${t}.crashed.retry'), onClick: access.refetch }}
|
|
375
|
+
/>
|
|
376
|
+
);
|
|
377
|
+
}
|
|
366
378
|
// The catalog's \`menus\` decide who sees a page; the backend still checks every call.
|
|
367
379
|
if (route.page !== 'notFound' && !access.sees(route.page)) {
|
|
368
380
|
return <EmptyState icon={<Lock />} title={t('${t}.errors.permission_required')} />;
|
|
@@ -370,7 +382,8 @@ export default definePluginFrontend({
|
|
|
370
382
|
${s}import { pluginI18nNamespace } from '@tego/plugin-sdk';
|
|
371
383
|
import type { PluginHostContext } from '@tego/plugin-sdk/frontend';
|
|
372
384
|
import {
|
|
373
|
-
|
|
385
|
+
${n?`describeApiError,
|
|
386
|
+
`:""}HostProvider,
|
|
374
387
|
PluginErrorBoundary,
|
|
375
388
|
usePluginRoute,
|
|
376
389
|
} from '@tego/plugin-sdk/react';
|
|
@@ -652,7 +665,7 @@ export function SettingsScreen() {
|
|
|
652
665
|
</section>
|
|
653
666
|
);
|
|
654
667
|
}
|
|
655
|
-
`}o(settingsTsx,"settingsTsx");function standardAccessCatalog(e){return{$schema:"../node_modules/@tego/plugin-sdk/access-catalog.schema.json",version:1,groups:[{key:"notes",labelKey:`${e}.access.group.notes`}],scopes:{},permissions:{"note.view":{group:"notes",labelKey:`${e}.access.permission.view`},"note.create":{group:"notes",labelKey:`${e}.access.permission.create`,implies:["note.view"]},"note.delete":{group:"notes",labelKey:`${e}.access.permission.delete`,implies:["note.view"]}},menus:{home:"note.view"},roles:{admin:{nameKey:`${e}.access.role.admin`,descriptionKey:`${e}.access.role.adminDescription`,grants:{"note.view":!0,"note.create":!0,"note.delete":!0,"access.manage":!0}},member:{nameKey:`${e}.access.role.member`,descriptionKey:`${e}.access.role.memberDescription`,grants:{"note.view":!0,"note.create":!0}}},hostRoleBindings:{admin:["admin"],super_admin:["admin"]},defaults:{unassigned:"member"},assignment:{principals:["user","unit"]}}}o(standardAccessCatalog,"standardAccessCatalog");var ZH={nav:{settings:"\u8BBE\u7F6E"},home:{placeholder:"\u5199\u4E00\u6761\u7B14\u8BB0",add:"\u6DFB\u52A0",empty:"\u8FD8\u6CA1\u6709\u7B14\u8BB0",delete:"\u5220\u9664"},settings:{title:"\u8BBE\u7F6E",access:"\u6743\u9650"},crashed:{title:"\u9875\u9762\u51FA\u9519\u4E86",description:"\u8FD9\u4E00\u9875\u6CA1\u80FD\u663E\u793A\u51FA\u6765\u3002\u4F60\u53EF\u4EE5\u91CD\u8BD5\uFF0C\u95EE\u9898\u6301\u7EED\u65F6\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u3002",retry:"\u91CD\u8BD5"},errors:{invalid_json:"\u8BF7\u6C42\u683C\u5F0F\u4E0D\u6B63\u786E\u3002",invalid_body:"\u586B\u5199\u7684\u5185\u5BB9\u4E0D\u5B8C\u6574\u6216\u683C\u5F0F\u4E0D\u5BF9\u3002",permission_required:"\u4F60\u6CA1\u6709\u6267\u884C\u8FD9\u4E2A\u64CD\u4F5C\u7684\u6743\u9650\u3002",not_found:"\u6CA1\u6709\u627E\u5230\uFF0C\u6216\u4F60\u65E0\u6743\u67E5\u770B\u3002",no_route:"\u8FD9\u4E2A\u529F\u80FD\u6682\u4E0D\u53EF\u7528\u3002",rate_limited:"\u64CD\u4F5C\u592A\u9891\u7E41\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\u3002",internal:"\u64CD\u4F5C\u6CA1\u6709\u5B8C\u6210\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"},access:{group:{notes:"\u7B14\u8BB0"},permission:{view:"\u67E5\u770B\u7B14\u8BB0",create:"\u6DFB\u52A0\u7B14\u8BB0",delete:"\u5220\u9664\u7B14\u8BB0"},role:{admin:"\u7BA1\u7406\u5458",adminDescription:"\u7BA1\u7406\u5168\u90E8\u7B14\u8BB0\u4E0E\u6743\u9650",member:"\u6210\u5458",memberDescription:"\u67E5\u770B\u4E0E\u6DFB\u52A0\u7B14\u8BB0"}}},ZH_TW={nav:{settings:"\u8A2D\u5B9A"},home:{placeholder:"\u5BEB\u4E00\u5247\u7B46\u8A18",add:"\u65B0\u589E",empty:"\u9084\u6C92\u6709\u7B46\u8A18",delete:"\u522A\u9664"},settings:{title:"\u8A2D\u5B9A",access:"\u6B0A\u9650"},crashed:{title:"\u9801\u9762\u51FA\u932F\u4E86",description:"\u9019\u4E00\u9801\u6C92\u80FD\u986F\u793A\u51FA\u4F86\u3002\u4F60\u53EF\u4EE5\u91CD\u8A66\uFF0C\u554F\u984C\u6301\u7E8C\u6642\u8ACB\u806F\u7D61\u7BA1\u7406\u54E1\u3002",retry:"\u91CD\u8A66"},errors:{invalid_json:"\u8ACB\u6C42\u683C\u5F0F\u4E0D\u6B63\u78BA\u3002",invalid_body:"\u586B\u5BEB\u7684\u5167\u5BB9\u4E0D\u5B8C\u6574\u6216\u683C\u5F0F\u4E0D\u5C0D\u3002",permission_required:"\u4F60\u6C92\u6709\u57F7\u884C\u9019\u500B\u64CD\u4F5C\u7684\u6B0A\u9650\u3002",not_found:"\u6C92\u6709\u627E\u5230\uFF0C\u6216\u4F60\u7121\u6B0A\u67E5\u770B\u3002",no_route:"\u9019\u500B\u529F\u80FD\u66AB\u4E0D\u53EF\u7528\u3002",rate_limited:"\u64CD\u4F5C\u592A\u983B\u7E41\uFF0C\u8ACB\u7A0D\u5F8C\u518D\u8A66\u3002",internal:"\u64CD\u4F5C\u6C92\u6709\u5B8C\u6210\uFF0C\u8ACB\u7A0D\u5F8C\u91CD\u8A66\u3002"},access:{group:{notes:"\u7B46\u8A18"},permission:{view:"\u67E5\u770B\u7B46\u8A18",create:"\u65B0\u589E\u7B46\u8A18",delete:"\u522A\u9664\u7B46\u8A18"},role:{admin:"\u7BA1\u7406\u54E1",adminDescription:"\u7BA1\u7406\u5168\u90E8\u7B46\u8A18\u8207\u6B0A\u9650",member:"\u6210\u54E1",memberDescription:"\u67E5\u770B\u8207\u65B0\u589E\u7B46\u8A18"}}},EN={nav:{settings:"Settings"},home:{placeholder:"Write a note",add:"Add",empty:"No notes yet",delete:"Delete"},settings:{title:"Settings",access:"Access"},crashed:{title:"Something went wrong",description:"This page couldn't be shown. Try again, or contact your admin if it keeps happening.",retry:"Try again"},errors:{invalid_json:"The request was malformed.",invalid_body:"Some fields are missing or invalid.",permission_required:"You don't have permission to do that.",not_found:"Not found, or you can't see it.",no_route:"This feature isn't available.",rate_limited:"Too many requests; try again shortly.",internal:"That didn't go through. Try again later."},access:{group:{notes:"Notes"},permission:{view:"View notes",create:"Add notes",delete:"Delete notes"},role:{admin:"Admin",adminDescription:"Manages all notes and access",member:"Member",memberDescription:"Views and adds notes"}}},JA={nav:{settings:"\u8A2D\u5B9A"},home:{placeholder:"\u30E1\u30E2\u3092\u66F8\u304F",add:"\u8FFD\u52A0",empty:"\u30E1\u30E2\u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093",delete:"\u524A\u9664"},settings:{title:"\u8A2D\u5B9A",access:"\u6A29\u9650"},crashed:{title:"\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F",description:"\u3053\u306E\u30DA\u30FC\u30B8\u3092\u8868\u793A\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u518D\u8A66\u884C\u3057\u3001\u89E3\u6C7A\u3057\u306A\u3044\u5834\u5408\u306F\u7BA1\u7406\u8005\u306B\u9023\u7D61\u3057\u3066\u304F\u3060\u3055\u3044\u3002",retry:"\u518D\u8A66\u884C"},errors:{invalid_json:"\u30EA\u30AF\u30A8\u30B9\u30C8\u306E\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002",invalid_body:"\u5165\u529B\u5185\u5BB9\u304C\u4E0D\u8DB3\u3057\u3066\u3044\u308B\u304B\u3001\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002",permission_required:"\u3053\u306E\u64CD\u4F5C\u3092\u884C\u3046\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002",not_found:"\u898B\u3064\u304B\u3089\u306A\u3044\u304B\u3001\u8868\u793A\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002",no_route:"\u3053\u306E\u6A5F\u80FD\u306F\u5229\u7528\u3067\u304D\u307E\u305B\u3093\u3002",rate_limited:"\u30EA\u30AF\u30A8\u30B9\u30C8\u304C\u591A\u3059\u304E\u307E\u3059\u3002\u3057\u3070\u3089\u304F\u3057\u3066\u304B\u3089\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",internal:"\u51E6\u7406\u3092\u5B8C\u4E86\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u5F8C\u3067\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002"},access:{group:{notes:"\u30E1\u30E2"},permission:{view:"\u30E1\u30E2\u3092\u8868\u793A",create:"\u30E1\u30E2\u3092\u8FFD\u52A0",delete:"\u30E1\u30E2\u3092\u524A\u9664"},role:{admin:"\u7BA1\u7406\u8005",adminDescription:"\u3059\u3079\u3066\u306E\u30E1\u30E2\u3068\u6A29\u9650\u3092\u7BA1\u7406",member:"\u30E1\u30F3\u30D0\u30FC",memberDescription:"\u30E1\u30E2\u306E\u8868\u793A\u3068\u8FFD\u52A0"}}},KO={nav:{settings:"\uC124\uC815"},home:{placeholder:"\uBA54\uBAA8 \uC791\uC131",add:"\uCD94\uAC00",empty:"\uC544\uC9C1 \uBA54\uBAA8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4",delete:"\uC0AD\uC81C"},settings:{title:"\uC124\uC815",access:"\uAD8C\uD55C"},crashed:{title:"\uBB38\uC81C\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4",description:"\uC774 \uD398\uC774\uC9C0\uB97C \uD45C\uC2DC\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uACE0, \uACC4\uC18D\uB418\uBA74 \uAD00\uB9AC\uC790\uC5D0\uAC8C \uBB38\uC758\uD558\uC138\uC694.",retry:"\uB2E4\uC2DC \uC2DC\uB3C4"},errors:{invalid_json:"\uC694\uCCAD \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",invalid_body:"\uC785\uB825 \uB0B4\uC6A9\uC774 \uB204\uB77D\uB418\uC5C8\uAC70\uB098 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",permission_required:"\uC774 \uC791\uC5C5\uC744 \uC218\uD589\uD560 \uAD8C\uD55C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.",not_found:"\uCC3E\uC744 \uC218 \uC5C6\uAC70\uB098 \uBCFC \uAD8C\uD55C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.",no_route:"\uC774 \uAE30\uB2A5\uC740 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",rate_limited:"\uC694\uCCAD\uC774 \uB108\uBB34 \uB9CE\uC2B5\uB2C8\uB2E4. \uC7A0\uC2DC \uD6C4 \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC138\uC694.",internal:"\uC791\uC5C5\uC744 \uC644\uB8CC\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. \uB098\uC911\uC5D0 \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC138\uC694."},access:{group:{notes:"\uBA54\uBAA8"},permission:{view:"\uBA54\uBAA8 \uBCF4\uAE30",create:"\uBA54\uBAA8 \uCD94\uAC00",delete:"\uBA54\uBAA8 \uC0AD\uC81C"},role:{admin:"\uAD00\uB9AC\uC790",adminDescription:"\uBAA8\uB4E0 \uBA54\uBAA8\uC640 \uAD8C\uD55C \uAD00\uB9AC",member:"\uBA64\uBC84",memberDescription:"\uBA54\uBAA8 \uBCF4\uAE30 \uBC0F \uCD94\uAC00"}}},DE={nav:{settings:"Einstellungen"},home:{placeholder:"Notiz schreiben",add:"Hinzuf\xFCgen",empty:"Noch keine Notizen",delete:"L\xF6schen"},settings:{title:"Einstellungen",access:"Zugriff"},crashed:{title:"Etwas ist schiefgelaufen",description:"Diese Seite konnte nicht angezeigt werden. Versuche es erneut oder wende dich an deinen Admin.",retry:"Erneut versuchen"},errors:{invalid_json:"Die Anfrage war fehlerhaft.",invalid_body:"Einige Felder fehlen oder sind ung\xFCltig.",permission_required:"Dazu fehlt dir die Berechtigung.",not_found:"Nicht gefunden oder nicht sichtbar f\xFCr dich.",no_route:"Diese Funktion ist nicht verf\xFCgbar.",rate_limited:"Zu viele Anfragen; versuche es gleich noch einmal.",internal:"Das hat nicht geklappt. Versuche es sp\xE4ter erneut."},access:{group:{notes:"Notizen"},permission:{view:"Notizen ansehen",create:"Notizen hinzuf\xFCgen",delete:"Notizen l\xF6schen"},role:{admin:"Admin",adminDescription:"Verwaltet alle Notizen und Zugriffe",member:"Mitglied",memberDescription:"Sieht und erstellt Notizen"}}},ES={nav:{settings:"Ajustes"},home:{placeholder:"Escribe una nota",add:"A\xF1adir",empty:"A\xFAn no hay notas",delete:"Eliminar"},settings:{title:"Ajustes",access:"Acceso"},crashed:{title:"Algo sali\xF3 mal",description:"No se pudo mostrar esta p\xE1gina. Int\xE9ntalo de nuevo o contacta con tu administrador.",retry:"Reintentar"},errors:{invalid_json:"La solicitud no tiene un formato v\xE1lido.",invalid_body:"Faltan campos o no son v\xE1lidos.",permission_required:"No tienes permiso para hacer eso.",not_found:"No se encontr\xF3 o no puedes verlo.",no_route:"Esta funci\xF3n no est\xE1 disponible.",rate_limited:"Demasiadas solicitudes; int\xE9ntalo en un momento.",internal:"No se pudo completar. Int\xE9ntalo m\xE1s tarde."},access:{group:{notes:"Notas"},permission:{view:"Ver notas",create:"A\xF1adir notas",delete:"Eliminar notas"},role:{admin:"Administrador",adminDescription:"Gestiona todas las notas y el acceso",member:"Miembro",memberDescription:"Ve y a\xF1ade notas"}}},FR={nav:{settings:"Param\xE8tres"},home:{placeholder:"\xC9crire une note",add:"Ajouter",empty:"Aucune note pour le moment",delete:"Supprimer"},settings:{title:"Param\xE8tres",access:"Acc\xE8s"},crashed:{title:"Un probl\xE8me est survenu",description:"Cette page n'a pas pu s'afficher. R\xE9essayez ou contactez votre administrateur.",retry:"R\xE9essayer"},errors:{invalid_json:"La requ\xEAte n'est pas valide.",invalid_body:"Des champs sont manquants ou invalides.",permission_required:"Vous n'avez pas l'autorisation de faire cela.",not_found:"Introuvable, ou vous ne pouvez pas le voir.",no_route:"Cette fonctionnalit\xE9 n'est pas disponible.",rate_limited:"Trop de requ\xEAtes ; r\xE9essayez dans un instant.",internal:"L'op\xE9ration n'a pas abouti. R\xE9essayez plus tard."},access:{group:{notes:"Notes"},permission:{view:"Voir les notes",create:"Ajouter des notes",delete:"Supprimer des notes"},role:{admin:"Administrateur",adminDescription:"G\xE8re toutes les notes et les acc\xE8s",member:"Membre",memberDescription:"Voit et ajoute des notes"}}},IT={nav:{settings:"Impostazioni"},home:{placeholder:"Scrivi una nota",add:"Aggiungi",empty:"Ancora nessuna nota",delete:"Elimina"},settings:{title:"Impostazioni",access:"Accesso"},crashed:{title:"Qualcosa \xE8 andato storto",description:"Impossibile mostrare questa pagina. Riprova o contatta l'amministratore.",retry:"Riprova"},errors:{invalid_json:"La richiesta non \xE8 valida.",invalid_body:"Alcuni campi mancano o non sono validi.",permission_required:"Non hai il permesso per farlo.",not_found:"Non trovato, o non puoi vederlo.",no_route:"Questa funzione non \xE8 disponibile.",rate_limited:"Troppe richieste; riprova tra poco.",internal:"Operazione non riuscita. Riprova pi\xF9 tardi."},access:{group:{notes:"Note"},permission:{view:"Vedere le note",create:"Aggiungere note",delete:"Eliminare note"},role:{admin:"Amministratore",adminDescription:"Gestisce tutte le note e gli accessi",member:"Membro",memberDescription:"Vede e aggiunge note"}}},PT={nav:{settings:"Configura\xE7\xF5es"},home:{placeholder:"Escreva uma nota",add:"Adicionar",empty:"Ainda n\xE3o h\xE1 notas",delete:"Excluir"},settings:{title:"Configura\xE7\xF5es",access:"Acesso"},crashed:{title:"Algo deu errado",description:"N\xE3o foi poss\xEDvel mostrar esta p\xE1gina. Tente novamente ou fale com o administrador.",retry:"Tentar novamente"},errors:{invalid_json:"A solicita\xE7\xE3o est\xE1 malformada.",invalid_body:"Alguns campos est\xE3o faltando ou s\xE3o inv\xE1lidos.",permission_required:"Voc\xEA n\xE3o tem permiss\xE3o para fazer isso.",not_found:"N\xE3o encontrado, ou voc\xEA n\xE3o pode v\xEA-lo.",no_route:"Este recurso n\xE3o est\xE1 dispon\xEDvel.",rate_limited:"Muitas solicita\xE7\xF5es; tente novamente em instantes.",internal:"N\xE3o foi poss\xEDvel concluir. Tente novamente mais tarde."},access:{group:{notes:"Notas"},permission:{view:"Ver notas",create:"Adicionar notas",delete:"Excluir notas"},role:{admin:"Administrador",adminDescription:"Gerencia todas as notas e acessos",member:"Membro",memberDescription:"V\xEA e adiciona notas"}}},STRINGS={"zh-CN":ZH,"zh-TW":ZH_TW,en:EN,ja:JA,ko:KO,de:DE,es:ES,fr:FR,it:IT,pt:PT};function standardStrings(e,t){const n=STRINGS[e]??EN,{nav:s,settings:a,access:i,...r}=n;return t?{...r,nav:s,settings:a,access:i}:r}o(standardStrings,"standardStrings");var PLUGIN_TEMPLATES=["standard","minimal"];function standardAccess(e){return e.template==="standard"&&e.parts.includes("frontend")&&e.parts.includes("backend")}o(standardAccess,"standardAccess");var PUBLISHED_SDK_PACKAGES={"@tego/plugin-access-ui":"@zhama/tego-plugin-access-ui","@tego/plugin-sdk":"@zhama/tego-plugin-sdk","@tego/ui":"@zhama/tego-ui"};function sdkSpec(e,t,n){if(n==="workspace")return"workspace:*";const s=PUBLISHED_SDK_PACKAGES[e];if(!s)throw new Error(`${e} is not a published SDK package`);return`npm:${s}@${t.hostApiRange}`}o(sdkSpec,"sdkSpec");var STANDALONE_PRETTIER={semi:!0,trailingComma:"es5",singleQuote:!0,printWidth:80,tabWidth:2,useTabs:!1,bracketSpacing:!0,bracketSameLine:!1,arrowParens:"avoid",endOfLine:"lf",quoteProps:"as-needed",jsxSingleQuote:!0,proseWrap:"preserve"},STANDALONE_GITIGNORE=`node_modules/
|
|
668
|
+
`}o(settingsTsx,"settingsTsx");function standardAccessCatalog(e){return{$schema:"../node_modules/@tego/plugin-sdk/access-catalog.schema.json",version:1,groups:[{key:"notes",labelKey:`${e}.access.group.notes`}],scopes:{},permissions:{"note.view":{group:"notes",labelKey:`${e}.access.permission.view`},"note.create":{group:"notes",labelKey:`${e}.access.permission.create`,implies:["note.view"]},"note.delete":{group:"notes",labelKey:`${e}.access.permission.delete`,implies:["note.view"]}},menus:{home:"note.view"},roles:{admin:{nameKey:`${e}.access.role.admin`,descriptionKey:`${e}.access.role.adminDescription`,grants:{"note.view":!0,"note.create":!0,"note.delete":!0,"access.manage":!0}},member:{nameKey:`${e}.access.role.member`,descriptionKey:`${e}.access.role.memberDescription`,grants:{"note.view":!0,"note.create":!0}}},hostRoleBindings:{admin:["admin"],super_admin:["admin"]},defaults:{unassigned:"member"},assignment:{principals:["user","unit"]}}}o(standardAccessCatalog,"standardAccessCatalog");var ZH={nav:{settings:"\u8BBE\u7F6E"},home:{placeholder:"\u5199\u4E00\u6761\u7B14\u8BB0",add:"\u6DFB\u52A0",empty:"\u8FD8\u6CA1\u6709\u7B14\u8BB0",delete:"\u5220\u9664"},settings:{title:"\u8BBE\u7F6E",access:"\u6743\u9650"},crashed:{title:"\u9875\u9762\u51FA\u9519\u4E86",description:"\u9875\u9762\u6CA1\u80FD\u663E\u793A\uFF0C\u8BF7\u91CD\u8BD5\u6216\u8054\u7CFB\u7BA1\u7406\u5458\u3002",retry:"\u91CD\u8BD5"},errors:{invalid_json:"\u8BF7\u6C42\u683C\u5F0F\u4E0D\u6B63\u786E\u3002",invalid_body:"\u586B\u5199\u7684\u5185\u5BB9\u4E0D\u5B8C\u6574\u6216\u683C\u5F0F\u4E0D\u5BF9\u3002",permission_required:"\u4F60\u6CA1\u6709\u6267\u884C\u8FD9\u4E2A\u64CD\u4F5C\u7684\u6743\u9650\u3002",not_found:"\u6CA1\u6709\u627E\u5230\uFF0C\u6216\u4F60\u65E0\u6743\u67E5\u770B\u3002",no_route:"\u8FD9\u4E2A\u529F\u80FD\u6682\u4E0D\u53EF\u7528\u3002",rate_limited:"\u64CD\u4F5C\u592A\u9891\u7E41\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\u3002",internal:"\u64CD\u4F5C\u6CA1\u6709\u5B8C\u6210\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"},access:{group:{notes:"\u7B14\u8BB0"},permission:{view:"\u67E5\u770B\u7B14\u8BB0",create:"\u6DFB\u52A0\u7B14\u8BB0",delete:"\u5220\u9664\u7B14\u8BB0"},role:{admin:"\u7BA1\u7406\u5458",adminDescription:"\u7BA1\u7406\u5168\u90E8\u7B14\u8BB0\u4E0E\u6743\u9650",member:"\u6210\u5458",memberDescription:"\u67E5\u770B\u4E0E\u6DFB\u52A0\u7B14\u8BB0"}}},ZH_TW={nav:{settings:"\u8A2D\u5B9A"},home:{placeholder:"\u5BEB\u4E00\u5247\u7B46\u8A18",add:"\u65B0\u589E",empty:"\u9084\u6C92\u6709\u7B46\u8A18",delete:"\u522A\u9664"},settings:{title:"\u8A2D\u5B9A",access:"\u6B0A\u9650"},crashed:{title:"\u9801\u9762\u51FA\u932F\u4E86",description:"\u9801\u9762\u6C92\u80FD\u986F\u793A\uFF0C\u8ACB\u91CD\u8A66\u6216\u806F\u7D61\u7BA1\u7406\u54E1\u3002",retry:"\u91CD\u8A66"},errors:{invalid_json:"\u8ACB\u6C42\u683C\u5F0F\u4E0D\u6B63\u78BA\u3002",invalid_body:"\u586B\u5BEB\u7684\u5167\u5BB9\u4E0D\u5B8C\u6574\u6216\u683C\u5F0F\u4E0D\u5C0D\u3002",permission_required:"\u4F60\u6C92\u6709\u57F7\u884C\u9019\u500B\u64CD\u4F5C\u7684\u6B0A\u9650\u3002",not_found:"\u6C92\u6709\u627E\u5230\uFF0C\u6216\u4F60\u7121\u6B0A\u67E5\u770B\u3002",no_route:"\u9019\u500B\u529F\u80FD\u66AB\u4E0D\u53EF\u7528\u3002",rate_limited:"\u64CD\u4F5C\u592A\u983B\u7E41\uFF0C\u8ACB\u7A0D\u5F8C\u518D\u8A66\u3002",internal:"\u64CD\u4F5C\u6C92\u6709\u5B8C\u6210\uFF0C\u8ACB\u7A0D\u5F8C\u91CD\u8A66\u3002"},access:{group:{notes:"\u7B46\u8A18"},permission:{view:"\u67E5\u770B\u7B46\u8A18",create:"\u65B0\u589E\u7B46\u8A18",delete:"\u522A\u9664\u7B46\u8A18"},role:{admin:"\u7BA1\u7406\u54E1",adminDescription:"\u7BA1\u7406\u5168\u90E8\u7B46\u8A18\u8207\u6B0A\u9650",member:"\u6210\u54E1",memberDescription:"\u67E5\u770B\u8207\u65B0\u589E\u7B46\u8A18"}}},EN={nav:{settings:"Settings"},home:{placeholder:"Write a note",add:"Add",empty:"No notes yet",delete:"Delete"},settings:{title:"Settings",access:"Access"},crashed:{title:"Something went wrong",description:"This page couldn't be shown. Try again, or contact your admin if it keeps happening.",retry:"Try again"},errors:{invalid_json:"The request was malformed.",invalid_body:"Some fields are missing or invalid.",permission_required:"You don't have permission to do that.",not_found:"Not found, or you can't see it.",no_route:"This feature isn't available.",rate_limited:"Too many requests; try again shortly.",internal:"That didn't go through. Try again later."},access:{group:{notes:"Notes"},permission:{view:"View notes",create:"Add notes",delete:"Delete notes"},role:{admin:"Admin",adminDescription:"Manages all notes and access",member:"Member",memberDescription:"Views and adds notes"}}},JA={nav:{settings:"\u8A2D\u5B9A"},home:{placeholder:"\u30E1\u30E2\u3092\u66F8\u304F",add:"\u8FFD\u52A0",empty:"\u30E1\u30E2\u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093",delete:"\u524A\u9664"},settings:{title:"\u8A2D\u5B9A",access:"\u6A29\u9650"},crashed:{title:"\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F",description:"\u3053\u306E\u30DA\u30FC\u30B8\u3092\u8868\u793A\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u518D\u8A66\u884C\u3057\u3001\u89E3\u6C7A\u3057\u306A\u3044\u5834\u5408\u306F\u7BA1\u7406\u8005\u306B\u9023\u7D61\u3057\u3066\u304F\u3060\u3055\u3044\u3002",retry:"\u518D\u8A66\u884C"},errors:{invalid_json:"\u30EA\u30AF\u30A8\u30B9\u30C8\u306E\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002",invalid_body:"\u5165\u529B\u5185\u5BB9\u304C\u4E0D\u8DB3\u3057\u3066\u3044\u308B\u304B\u3001\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002",permission_required:"\u3053\u306E\u64CD\u4F5C\u3092\u884C\u3046\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002",not_found:"\u898B\u3064\u304B\u3089\u306A\u3044\u304B\u3001\u8868\u793A\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002",no_route:"\u3053\u306E\u6A5F\u80FD\u306F\u5229\u7528\u3067\u304D\u307E\u305B\u3093\u3002",rate_limited:"\u30EA\u30AF\u30A8\u30B9\u30C8\u304C\u591A\u3059\u304E\u307E\u3059\u3002\u3057\u3070\u3089\u304F\u3057\u3066\u304B\u3089\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",internal:"\u51E6\u7406\u3092\u5B8C\u4E86\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u5F8C\u3067\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002"},access:{group:{notes:"\u30E1\u30E2"},permission:{view:"\u30E1\u30E2\u3092\u8868\u793A",create:"\u30E1\u30E2\u3092\u8FFD\u52A0",delete:"\u30E1\u30E2\u3092\u524A\u9664"},role:{admin:"\u7BA1\u7406\u8005",adminDescription:"\u3059\u3079\u3066\u306E\u30E1\u30E2\u3068\u6A29\u9650\u3092\u7BA1\u7406",member:"\u30E1\u30F3\u30D0\u30FC",memberDescription:"\u30E1\u30E2\u306E\u8868\u793A\u3068\u8FFD\u52A0"}}},KO={nav:{settings:"\uC124\uC815"},home:{placeholder:"\uBA54\uBAA8 \uC791\uC131",add:"\uCD94\uAC00",empty:"\uC544\uC9C1 \uBA54\uBAA8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4",delete:"\uC0AD\uC81C"},settings:{title:"\uC124\uC815",access:"\uAD8C\uD55C"},crashed:{title:"\uBB38\uC81C\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4",description:"\uC774 \uD398\uC774\uC9C0\uB97C \uD45C\uC2DC\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uACE0, \uACC4\uC18D\uB418\uBA74 \uAD00\uB9AC\uC790\uC5D0\uAC8C \uBB38\uC758\uD558\uC138\uC694.",retry:"\uB2E4\uC2DC \uC2DC\uB3C4"},errors:{invalid_json:"\uC694\uCCAD \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",invalid_body:"\uC785\uB825 \uB0B4\uC6A9\uC774 \uB204\uB77D\uB418\uC5C8\uAC70\uB098 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",permission_required:"\uC774 \uC791\uC5C5\uC744 \uC218\uD589\uD560 \uAD8C\uD55C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.",not_found:"\uCC3E\uC744 \uC218 \uC5C6\uAC70\uB098 \uBCFC \uAD8C\uD55C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.",no_route:"\uC774 \uAE30\uB2A5\uC740 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",rate_limited:"\uC694\uCCAD\uC774 \uB108\uBB34 \uB9CE\uC2B5\uB2C8\uB2E4. \uC7A0\uC2DC \uD6C4 \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC138\uC694.",internal:"\uC791\uC5C5\uC744 \uC644\uB8CC\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. \uB098\uC911\uC5D0 \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC138\uC694."},access:{group:{notes:"\uBA54\uBAA8"},permission:{view:"\uBA54\uBAA8 \uBCF4\uAE30",create:"\uBA54\uBAA8 \uCD94\uAC00",delete:"\uBA54\uBAA8 \uC0AD\uC81C"},role:{admin:"\uAD00\uB9AC\uC790",adminDescription:"\uBAA8\uB4E0 \uBA54\uBAA8\uC640 \uAD8C\uD55C \uAD00\uB9AC",member:"\uBA64\uBC84",memberDescription:"\uBA54\uBAA8 \uBCF4\uAE30 \uBC0F \uCD94\uAC00"}}},DE={nav:{settings:"Einstellungen"},home:{placeholder:"Notiz schreiben",add:"Hinzuf\xFCgen",empty:"Noch keine Notizen",delete:"L\xF6schen"},settings:{title:"Einstellungen",access:"Zugriff"},crashed:{title:"Etwas ist schiefgelaufen",description:"Diese Seite konnte nicht angezeigt werden. Versuche es erneut oder wende dich an deinen Admin.",retry:"Erneut versuchen"},errors:{invalid_json:"Die Anfrage war fehlerhaft.",invalid_body:"Einige Felder fehlen oder sind ung\xFCltig.",permission_required:"Dazu fehlt dir die Berechtigung.",not_found:"Nicht gefunden oder nicht sichtbar f\xFCr dich.",no_route:"Diese Funktion ist nicht verf\xFCgbar.",rate_limited:"Zu viele Anfragen; versuche es gleich noch einmal.",internal:"Das hat nicht geklappt. Versuche es sp\xE4ter erneut."},access:{group:{notes:"Notizen"},permission:{view:"Notizen ansehen",create:"Notizen hinzuf\xFCgen",delete:"Notizen l\xF6schen"},role:{admin:"Admin",adminDescription:"Verwaltet alle Notizen und Zugriffe",member:"Mitglied",memberDescription:"Sieht und erstellt Notizen"}}},ES={nav:{settings:"Ajustes"},home:{placeholder:"Escribe una nota",add:"A\xF1adir",empty:"A\xFAn no hay notas",delete:"Eliminar"},settings:{title:"Ajustes",access:"Acceso"},crashed:{title:"Algo sali\xF3 mal",description:"No se pudo mostrar esta p\xE1gina. Int\xE9ntalo de nuevo o contacta con tu administrador.",retry:"Reintentar"},errors:{invalid_json:"La solicitud no tiene un formato v\xE1lido.",invalid_body:"Faltan campos o no son v\xE1lidos.",permission_required:"No tienes permiso para hacer eso.",not_found:"No se encontr\xF3 o no puedes verlo.",no_route:"Esta funci\xF3n no est\xE1 disponible.",rate_limited:"Demasiadas solicitudes; int\xE9ntalo en un momento.",internal:"No se pudo completar. Int\xE9ntalo m\xE1s tarde."},access:{group:{notes:"Notas"},permission:{view:"Ver notas",create:"A\xF1adir notas",delete:"Eliminar notas"},role:{admin:"Administrador",adminDescription:"Gestiona todas las notas y el acceso",member:"Miembro",memberDescription:"Ve y a\xF1ade notas"}}},FR={nav:{settings:"Param\xE8tres"},home:{placeholder:"\xC9crire une note",add:"Ajouter",empty:"Aucune note pour le moment",delete:"Supprimer"},settings:{title:"Param\xE8tres",access:"Acc\xE8s"},crashed:{title:"Un probl\xE8me est survenu",description:"Cette page n'a pas pu s'afficher. R\xE9essayez ou contactez votre administrateur.",retry:"R\xE9essayer"},errors:{invalid_json:"La requ\xEAte n'est pas valide.",invalid_body:"Des champs sont manquants ou invalides.",permission_required:"Vous n'avez pas l'autorisation de faire cela.",not_found:"Introuvable, ou vous ne pouvez pas le voir.",no_route:"Cette fonctionnalit\xE9 n'est pas disponible.",rate_limited:"Trop de requ\xEAtes ; r\xE9essayez dans un instant.",internal:"L'op\xE9ration n'a pas abouti. R\xE9essayez plus tard."},access:{group:{notes:"Notes"},permission:{view:"Voir les notes",create:"Ajouter des notes",delete:"Supprimer des notes"},role:{admin:"Administrateur",adminDescription:"G\xE8re toutes les notes et les acc\xE8s",member:"Membre",memberDescription:"Voit et ajoute des notes"}}},IT={nav:{settings:"Impostazioni"},home:{placeholder:"Scrivi una nota",add:"Aggiungi",empty:"Ancora nessuna nota",delete:"Elimina"},settings:{title:"Impostazioni",access:"Accesso"},crashed:{title:"Qualcosa \xE8 andato storto",description:"Impossibile mostrare questa pagina. Riprova o contatta l'amministratore.",retry:"Riprova"},errors:{invalid_json:"La richiesta non \xE8 valida.",invalid_body:"Alcuni campi mancano o non sono validi.",permission_required:"Non hai il permesso per farlo.",not_found:"Non trovato, o non puoi vederlo.",no_route:"Questa funzione non \xE8 disponibile.",rate_limited:"Troppe richieste; riprova tra poco.",internal:"Operazione non riuscita. Riprova pi\xF9 tardi."},access:{group:{notes:"Note"},permission:{view:"Vedere le note",create:"Aggiungere note",delete:"Eliminare note"},role:{admin:"Amministratore",adminDescription:"Gestisce tutte le note e gli accessi",member:"Membro",memberDescription:"Vede e aggiunge note"}}},PT={nav:{settings:"Configura\xE7\xF5es"},home:{placeholder:"Escreva uma nota",add:"Adicionar",empty:"Ainda n\xE3o h\xE1 notas",delete:"Excluir"},settings:{title:"Configura\xE7\xF5es",access:"Acesso"},crashed:{title:"Algo deu errado",description:"N\xE3o foi poss\xEDvel mostrar esta p\xE1gina. Tente novamente ou fale com o administrador.",retry:"Tentar novamente"},errors:{invalid_json:"A solicita\xE7\xE3o est\xE1 malformada.",invalid_body:"Alguns campos est\xE3o faltando ou s\xE3o inv\xE1lidos.",permission_required:"Voc\xEA n\xE3o tem permiss\xE3o para fazer isso.",not_found:"N\xE3o encontrado, ou voc\xEA n\xE3o pode v\xEA-lo.",no_route:"Este recurso n\xE3o est\xE1 dispon\xEDvel.",rate_limited:"Muitas solicita\xE7\xF5es; tente novamente em instantes.",internal:"N\xE3o foi poss\xEDvel concluir. Tente novamente mais tarde."},access:{group:{notes:"Notas"},permission:{view:"Ver notas",create:"Adicionar notas",delete:"Excluir notas"},role:{admin:"Administrador",adminDescription:"Gerencia todas as notas e acessos",member:"Membro",memberDescription:"V\xEA e adiciona notas"}}},STRINGS={"zh-CN":ZH,"zh-TW":ZH_TW,en:EN,ja:JA,ko:KO,de:DE,es:ES,fr:FR,it:IT,pt:PT};function standardStrings(e,t){const n=STRINGS[e]??EN,{nav:s,settings:a,access:i,...r}=n;return t?{...r,nav:s,settings:a,access:i}:r}o(standardStrings,"standardStrings");var PLUGIN_TEMPLATES=["standard","minimal"];function standardAccess(e){return e.template==="standard"&&e.parts.includes("frontend")&&e.parts.includes("backend")}o(standardAccess,"standardAccess");var PUBLISHED_SDK_PACKAGES={"@tego/plugin-access-ui":"@zhama/tego-plugin-access-ui","@tego/plugin-sdk":"@zhama/tego-plugin-sdk","@tego/ui":"@zhama/tego-ui"};function sdkSpec(e,t,n){if(n==="workspace")return"workspace:*";const s=PUBLISHED_SDK_PACKAGES[e];if(!s)throw new Error(`${e} is not a published SDK package`);return`npm:${s}@${t.hostApiRange}`}o(sdkSpec,"sdkSpec");var STANDALONE_PRETTIER={semi:!0,trailingComma:"es5",singleQuote:!0,printWidth:80,tabWidth:2,useTabs:!1,bracketSpacing:!0,bracketSameLine:!1,arrowParens:"avoid",endOfLine:"lf",quoteProps:"as-needed",jsxSingleQuote:!0,proseWrap:"preserve"},STANDALONE_GITIGNORE=`node_modules/
|
|
656
669
|
build/
|
|
657
670
|
dist/
|
|
658
671
|
frontend/dist/
|
|
@@ -664,6 +677,7 @@ coverage/
|
|
|
664
677
|
`,STANDALONE_PNPM_WORKSPACE=`allowBuilds:
|
|
665
678
|
esbuild: true
|
|
666
679
|
`,STANDALONE_TSCONFIG_FILES={"tsconfig.base.json":{$schema:"https://json.schemastore.org/tsconfig",compilerOptions:{strict:!0,useUnknownInCatchVariables:!0,allowJs:!0,skipLibCheck:!0,forceConsistentCasingInFileNames:!0,resolveJsonModule:!0,isolatedModules:!0,verbatimModuleSyntax:!0,declaration:!0,declarationMap:!0,esModuleInterop:!0,incremental:!1,noUncheckedIndexedAccess:!0,moduleDetection:"force",exactOptionalPropertyTypes:!0,target:"ES2022",lib:["ES2022","DOM","DOM.Iterable"],module:"ESNext",moduleResolution:"bundler"},exclude:["node_modules"]},"tsconfig.frontend.json":{$schema:"https://json.schemastore.org/tsconfig",extends:"./tsconfig.base.json",compilerOptions:{target:"ES2020",lib:["ES2020","DOM","DOM.Iterable"],module:"ESNext",moduleResolution:"bundler",jsx:"react-jsx",noEmit:!1,declaration:!0,declarationMap:!0,outDir:"dist"}},"tsconfig.backend.json":{$schema:"https://json.schemastore.org/tsconfig",extends:"./tsconfig.base.json",compilerOptions:{target:"ES2022",lib:["ES2022"],module:"ESNext",moduleResolution:"bundler",types:["node"],noEmit:!1,declaration:!0,declarationMap:!0,outDir:"dist"}}};function tsconfigPreset(e,t){return t==="workspace"?`@tego/tsconfig/plugin-${e}.json`:`../tsconfig.${e}.json`}o(tsconfigPreset,"tsconfigPreset");var STANDALONE_ESLINT_CONFIG=`import js from '@eslint/js';
|
|
680
|
+
import { tegoPluginEslint } from '@tego/plugin-sdk/eslint';
|
|
667
681
|
import prettierConfig from 'eslint-config-prettier';
|
|
668
682
|
import prettier from 'eslint-plugin-prettier';
|
|
669
683
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
@@ -677,6 +691,8 @@ export default tseslint.config(
|
|
|
677
691
|
'dist/**',
|
|
678
692
|
'**/dist/**',
|
|
679
693
|
'.turbo/**',
|
|
694
|
+
// The local preview's generated shell and backend build.
|
|
695
|
+
'.tego-dev/**',
|
|
680
696
|
'node_modules/**',
|
|
681
697
|
],
|
|
682
698
|
},
|
|
@@ -693,15 +709,17 @@ export default tseslint.config(
|
|
|
693
709
|
'prettier/prettier': 'warn',
|
|
694
710
|
},
|
|
695
711
|
},
|
|
712
|
+
// The platform's rules (TP-* ids from tego-plugin doctor), flagged while you type.
|
|
713
|
+
...tegoPluginEslint(),
|
|
696
714
|
prettierConfig
|
|
697
715
|
);
|
|
698
716
|
`,STANDALONE_LINT_DEPENDENCIES={"@eslint/js":"^9.16.0","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.4","eslint-plugin-react-hooks":"^5.2.0",globals:"^15.13.0","typescript-eslint":"^8.17.0"};function standaloneRootFiles(){return[{path:".prettierrc.json",contents:json(STANDALONE_PRETTIER)},{path:".gitignore",contents:STANDALONE_GITIGNORE},{path:"pnpm-workspace.yaml",contents:STANDALONE_PNPM_WORKSPACE},...Object.entries(STANDALONE_TSCONFIG_FILES).map(([e,t])=>({path:e,contents:json(t)}))]}o(standaloneRootFiles,"standaloneRootFiles");var STANDALONE_TOOLCHAIN={"@typescript/native-preview":"7.0.0-dev.20260519.1",eslint:"^9.39.1",prettier:"^3.7.4",typescript:"^5.9.3"},SUPPORTED_LOCALES=["zh-CN","zh-TW","en","ja","ko","de","es","fr","it","pt"];function packageNameFor(e){return`@tego/plugin-${e.replace(/^tego-/,"")}`}o(packageNameFor,"packageNameFor");function keyNamespaceFor(e){return e.replace(/^tego-/,"")}o(keyNamespaceFor,"keyNamespaceFor");function json(e){return`${JSON.stringify(e,null,2)}
|
|
699
|
-
`}o(json,"json");function manifest(e){const t=keyNamespaceFor(e.id),n=e.parts.includes("frontend"),s=e.parts.includes("backend"),a=e.parts.includes("claw"),i={};n&&(i.frontend={icon:"puzzle",nav:[{key:"home",labelKey:`${t}.nav.home`,icon:"layout-dashboard",order:0,path:"/home"}]}),s&&(i.backend={limits:{memoryMb:256,requestTimeoutMs:15e3}}),a&&(i.claw={hooks:{}});const r={manifestVersion:1,id:e.id,version:"0.1.0",displayName:{"zh-CN":e.displayNameZh,en:e.displayNameEn},description:{"zh-CN":e.descriptionZh,en:e.descriptionEn},author:"Tego"};return(n||s)&&(r.hostApiRange=e.hostApiRange),r.scope=e.scope,s&&(r.declares={database:!0}),r.parts=i,standardAccess(e)&&(i.frontend.nav.push({key:"settings",labelKey:`${t}.nav.settings`,icon:"settings",order:1,path:"/settings"}),r.access={catalog:"shared/access.json"},r.permissions={required:["directory.read"]},r.declares={database:!0,events:!0}),{path:"tego.plugin.json",contents:json(r)}}o(manifest,"manifest");function rootPackageJson(e,t){const n=e.parts.includes("frontend"),s=e.parts.includes("backend"),a=e.parts.includes("claw"),i=["tsgo --noEmit -p shared/tsconfig.json"];n&&i.push("tsgo --noEmit -p frontend/tsconfig.json"),s&&i.push("tsgo --noEmit -p backend/tsconfig.json"),a&&i.push("tsgo --noEmit -p claw/tsconfig.json");const r={"@tego/plugin-sdk":sdkSpec("@tego/plugin-sdk",e,t),"@types/node":"^22.10.1",vitest:"^4.1.10"};t==="workspace"&&Object.assign(r,{"@tego/eslint-config":"workspace:*","@tego/tsconfig":"workspace:*"}),n&&Object.assign(r,{"@tanstack/react-query":"^5.62.7","@tego/ui":sdkSpec("@tego/ui",e,t),"@types/react":"^19.2.1","@types/react-dom":"^19.2.1","lucide-react":"^0.469.0",react:"^19.0.0","react-dom":"^19.0.0","react-i18next":"15.4.1",vite:"^6.3.5"}),s&&Object.assign(r,{"@types/pg":"^8.11.10",hono:"^4.10.7",pg:"^8.13.1"}),a&&(r.typebox="1.3.16"),e.template==="standard"&&(n&&(r.tailwindcss="^3.4.19"),s&&(r.zod="^3.24.1"),standardAccess(e)&&(r["@tego/plugin-access-ui"]=sdkSpec("@tego/plugin-access-ui",e,t))),t==="npm"&&Object.assign(r,STANDALONE_TOOLCHAIN,STANDALONE_LINT_DEPENDENCIES);const u={name:packageNameFor(e.id),version:"0.1.0",private:!0,type:"module",description:e.descriptionEn,scripts:{build:"tego-plugin-pack",watch:"tego-plugin-pack --watch",dev:"tego-plugin dev",doctor:"tego-plugin doctor","type-check":i.join(" && "),lint:"eslint .","lint:fix":"eslint . --fix",test:"vitest run"},devDependencies:sortedRecord(r)};return{path:"package.json",contents:json(u)}}o(rootPackageJson,"rootPackageJson");function sortedRecord(e){const t={};for(const n of Object.keys(e).sort())t[n]=e[n];return t}o(sortedRecord,"sortedRecord");function eslintConfig(e){return e==="npm"?{path:"eslint.config.js",contents:STANDALONE_ESLINT_CONFIG}:{path:"eslint.config.js",contents:`import baseConfig from '@tego/eslint-config';
|
|
717
|
+
`}o(json,"json");function manifest(e){const t=keyNamespaceFor(e.id),n=e.parts.includes("frontend"),s=e.parts.includes("backend"),a=e.parts.includes("claw"),i={};n&&(i.frontend={icon:"puzzle",nav:[{key:"home",labelKey:`${t}.nav.home`,icon:"layout-dashboard",order:0,path:"/home"}]}),s&&(i.backend={limits:{memoryMb:256,requestTimeoutMs:15e3}}),a&&(i.claw={hooks:{}});const r={manifestVersion:1,id:e.id,version:"0.1.0",displayName:{"zh-CN":e.displayNameZh,en:e.displayNameEn},description:{"zh-CN":e.descriptionZh,en:e.descriptionEn},author:"Tego"};return(n||s)&&(r.hostApiRange=e.hostApiRange),r.scope=e.scope,s&&(r.declares={database:!0}),r.parts=i,standardAccess(e)&&(i.frontend.nav.push({key:"settings",labelKey:`${t}.nav.settings`,icon:"settings",order:1,path:"/settings"}),r.access={catalog:"shared/access.json"},r.permissions={required:["directory.read"]},r.declares={database:!0,events:!0}),{path:"tego.plugin.json",contents:json(r)}}o(manifest,"manifest");function rootPackageJson(e,t){const n=e.parts.includes("frontend"),s=e.parts.includes("backend"),a=e.parts.includes("claw"),i=["tsgo --noEmit -p shared/tsconfig.json"];n&&i.push("tsgo --noEmit -p frontend/tsconfig.json"),s&&i.push("tsgo --noEmit -p backend/tsconfig.json"),a&&i.push("tsgo --noEmit -p claw/tsconfig.json");const r={"@tego/plugin-sdk":sdkSpec("@tego/plugin-sdk",e,t),"@types/node":"^22.10.1",vitest:"^4.1.10"};t==="workspace"&&Object.assign(r,{"@tego/eslint-config":"workspace:*","@tego/tsconfig":"workspace:*"}),n&&Object.assign(r,{"@tanstack/react-query":"^5.62.7","@tego/ui":sdkSpec("@tego/ui",e,t),"@types/react":"^19.2.1","@types/react-dom":"^19.2.1","lucide-react":"^0.469.0",react:"^19.0.0","react-dom":"^19.0.0","react-i18next":"15.4.1",vite:"^6.3.5"}),s&&Object.assign(r,{"@types/pg":"^8.11.10",hono:"^4.10.7",pg:"^8.13.1"}),a&&(r.typebox="1.3.16"),e.template==="standard"&&(n&&(r.tailwindcss="^3.4.19"),s&&(r.zod="^3.24.1"),standardAccess(e)&&(r["@tego/plugin-access-ui"]=sdkSpec("@tego/plugin-access-ui",e,t))),t==="npm"&&Object.assign(r,STANDALONE_TOOLCHAIN,STANDALONE_LINT_DEPENDENCIES);const u={name:packageNameFor(e.id),version:"0.1.0",private:!0,type:"module",description:e.descriptionEn,scripts:{build:"tego-plugin-pack",watch:"tego-plugin-pack --watch",dev:"tego-plugin dev",doctor:"tego-plugin doctor",check:"tego-plugin check","type-check":i.join(" && "),lint:"eslint .","lint:fix":"eslint . --fix",test:"vitest run",...t==="npm"?{format:"prettier --write .","format:check":"prettier --check ."}:{}},devDependencies:sortedRecord(r)};return{path:"package.json",contents:json(u)}}o(rootPackageJson,"rootPackageJson");function sortedRecord(e){const t={};for(const n of Object.keys(e).sort())t[n]=e[n];return t}o(sortedRecord,"sortedRecord");function eslintConfig(e){return e==="npm"?{path:"eslint.config.js",contents:STANDALONE_ESLINT_CONFIG}:{path:"eslint.config.js",contents:`import baseConfig from '@tego/eslint-config';
|
|
700
718
|
|
|
701
719
|
export default [
|
|
702
720
|
...baseConfig,
|
|
703
721
|
{
|
|
704
|
-
ignores: ['build/**', 'dist/**', '**/dist/**', '.turbo/**'],
|
|
722
|
+
ignores: ['build/**', 'dist/**', '**/dist/**', '.turbo/**', '.tego-dev/**'],
|
|
705
723
|
},
|
|
706
724
|
];
|
|
707
725
|
`}}o(eslintConfig,"eslintConfig");function sharedFiles(e){return[{path:"shared/tsconfig.json",contents:json({extends:tsconfigPreset("backend",e),compilerOptions:{noEmit:!0,declaration:!1,declarationMap:!1},include:["**/*.ts"]})},{path:"shared/index.ts",contents:`export {};
|
|
@@ -749,7 +767,30 @@ pnpm -F ${n} build
|
|
|
749
767
|
|
|
750
768
|
Run \`pnpm install\` once after generating, so the new package links into the
|
|
751
769
|
workspace and \`@tego/plugin-sdk\` resolves.
|
|
752
|
-
`}}o(readme,"readme");function
|
|
770
|
+
`}}o(readme,"readme");function agentFiles(e,t){const n="node_modules/@tego/plugin-sdk",s=t==="npm"?"npm run":"pnpm";return[{path:"AGENTS.md",contents:`# ${e.displayNameEn} \u2014 agent guide
|
|
771
|
+
|
|
772
|
+
This is a Tego platform plugin (\`tego.plugin.json\`). It runs inside Tego: its frontend in both
|
|
773
|
+
the web app and the desktop app, its backend in a platform container. Follow the platform's rules;
|
|
774
|
+
they ship with the SDK this plugin installed:
|
|
775
|
+
|
|
776
|
+
- \`${n}/agent/RULES.md\` \u2014 every rule, with the guide that explains it. Read it first.
|
|
777
|
+
- \`${n}/agent/guides/*.md\` \u2014 read the guide for the kind of code you are about to write
|
|
778
|
+
(frontend, ui, i18n, backend, storage, access, migrations, claw, testing, agent-templates\u2026).
|
|
779
|
+
- \`${n}/agent/skills/*/SKILL.md\` \u2014 step-by-step playbooks for common changes (a route with
|
|
780
|
+
access control, a screen, a migration, strings, a claw tool, an agent template).
|
|
781
|
+
- \`${n}/agent/reference/plugin-sdk-api.md\` \u2014 the full API; look signatures up instead of guessing.
|
|
782
|
+
|
|
783
|
+
## Working loop
|
|
784
|
+
|
|
785
|
+
1. Read the rules, the relevant guide and the code you change.
|
|
786
|
+
2. Make focused changes with the SDK's helpers (\`@tego/plugin-sdk/react\`, \`/hono\`, \`/testing\`)
|
|
787
|
+
and \`@tego/ui\` components.
|
|
788
|
+
3. Run \`${s} check\` (doctor, lint, type-check, test) and fix everything it reports. Never weaken a
|
|
789
|
+
check, a rule or a test to make it pass; a \`tego-doctor-ignore\` needs a real reason.
|
|
790
|
+
4. Every new user-visible string goes into all ten locales.
|
|
791
|
+
5. \`${s} build\` writes the uploadable archive; \`${s} dev\` previews the plugin locally.
|
|
792
|
+
`},{path:"CLAUDE.md",contents:`@AGENTS.md
|
|
793
|
+
`}]}o(agentFiles,"agentFiles");function standaloneReadme(e){return{path:"README.md",contents:`# ${e.displayNameEn}
|
|
753
794
|
|
|
754
795
|
${e.descriptionEn}
|
|
755
796
|
|
|
@@ -892,7 +933,8 @@ import { backend } from './app';
|
|
|
892
933
|
* headers; everything below it is a plain fetch handler.
|
|
893
934
|
*/
|
|
894
935
|
serveBackend(backend);
|
|
895
|
-
`,a=`import {
|
|
936
|
+
`,a=`import { pluginErrorHandler } from '@tego/plugin-sdk/hono';
|
|
937
|
+
import { definePluginBackend } from '@tego/plugin-sdk/server';
|
|
896
938
|
import type { PluginHostApi, PluginUserContext } from '@tego/plugin-sdk/server';
|
|
897
939
|
import { Hono } from 'hono';
|
|
898
940
|
|
|
@@ -910,6 +952,9 @@ interface Env {
|
|
|
910
952
|
|
|
911
953
|
const app = new Hono<Env>();
|
|
912
954
|
|
|
955
|
+
// Every error becomes JSON the frontend can show; a 500 never echoes SQL.
|
|
956
|
+
app.onError(pluginErrorHandler());
|
|
957
|
+
|
|
913
958
|
app.get('/ping', c => c.json({ ok: true }));
|
|
914
959
|
|
|
915
960
|
app.get('/notes', async c => {
|
|
@@ -1175,4 +1220,4 @@ export default definePluginEntry({
|
|
|
1175
1220
|
// refuses the registration.
|
|
1176
1221
|
},
|
|
1177
1222
|
});
|
|
1178
|
-
`;return[{path:"claw/openclaw.plugin.json",contents:n},{path:"claw/package.json",contents:s},{path:"claw/tsconfig.json",contents:a},{path:"claw/types/openclaw-plugin-sdk.d.ts",contents:i},{path:"claw/src/index.ts",contents:r}]}o(clawFiles,"clawFiles");function buildPluginFiles(e,{dependencies:t="workspace"}={}){const n=[manifest(e),rootPackageJson(e,t),eslintConfig(t),...sharedFiles(t),vitestConfig(),readme(e,t)];return t==="npm"&&n.push(...standaloneRootFiles()),e.parts.includes("frontend")&&n.push(...frontendFiles(e,t)),e.parts.includes("backend")&&n.push(...backendFiles(t,e)),standardAccess(e)&&n.push({path:"shared/access.json",contents:json(standardAccessCatalog(keyNamespaceFor(e.id)))}),e.parts.includes("claw")&&n.push(...clawFiles(e,t)),n}o(buildPluginFiles,"buildPluginFiles");var PLUGIN_ID_PATTERN=/^[a-z0-9][a-z0-9._-]*$/,PLUGIN_PARTS=["frontend","backend","claw"],PLUGIN_SCOPES=["avatar","tenant"],PLUGIN_ID_HINT="lowercase letters and digits, may contain . _ -, starting with a letter or digit";function validatePluginAnswers(e,t){if(typeof e!="object"||e===null||Array.isArray(e))throw new Error("answers must be a JSON object");const n=e,s=o(c=>{const d=n[c];if(typeof d!="string"||d.trim()==="")throw new Error(`${c} is required`);return d.trim()},"text"),a=s("id");if(!PLUGIN_ID_PATTERN.test(a))throw new Error(`id must be ${PLUGIN_ID_HINT}`);const i=n.parts;if(!Array.isArray(i)||i.length===0||i.some(c=>!PLUGIN_PARTS.includes(c)))throw new Error(`parts must be a non-empty list of ${PLUGIN_PARTS.join(", ")}`);const r=n.scope??"avatar";if(!PLUGIN_SCOPES.includes(r))throw new Error(`scope must be one of ${PLUGIN_SCOPES.join(", ")}`);const u=n.template??"standard";if(!PLUGIN_TEMPLATES.includes(u))throw new Error(`template must be one of ${PLUGIN_TEMPLATES.join(", ")}`);return{id:a,displayNameZh:s("displayNameZh"),displayNameEn:s("displayNameEn"),descriptionZh:s("descriptionZh"),descriptionEn:s("descriptionEn"),parts:[...new Set(i)],scope:r,hostApiRange:t,template:u}}o(validatePluginAnswers,"validatePluginAnswers");function writePlugin(e,t){return writePluginDirectory(path.join(e,"plugins"),t,buildPluginFiles(t))}o(writePlugin,"writePlugin");async function writeStandalonePlugin(e,t){return writePluginDirectory(e,t,await formatPluginFiles(buildPluginFiles(t,{dependencies:"npm"})))}o(writeStandalonePlugin,"writeStandalonePlugin");var FORMATTED=/\.(?:[cm]?[jt]sx?|json|css)$/;async function formatPluginFiles(e){const t=await import("prettier");return Promise.all(e.map(async n=>FORMATTED.test(n.path)?{...n,contents:await t.format(n.contents,{...STANDALONE_PRETTIER,filepath:n.path})}:n))}o(formatPluginFiles,"formatPluginFiles");function writePluginDirectory(e,t,n){const s=path.join(e,t.id);if(fs.existsSync(s))throw new Error(`${s} already exists \u2014 pick another id or remove it first`);fs.mkdirSync(e,{recursive:!0});const a=fs.mkdtempSync(path.join(e,`.${t.id}-`));try{for(const i of n){const r=path.join(a,i.path);fs.mkdirSync(path.dirname(r),{recursive:!0}),fs.writeFileSync(r,i.contents)}fs.renameSync(a,s)}catch(i){throw fs.rmSync(a,{recursive:!0,force:!0}),i}return{directory:s,files:n.map(i=>i.path)}}o(writePluginDirectory,"writePluginDirectory");async function createStandalonePlugin(e,t){let n;try{n=JSON.parse(e)}catch(a){throw new Error(`answers must be JSON: ${a instanceof Error?a.message:String(a)}`)}const s=validatePluginAnswers(n,`^${
|
|
1223
|
+
`;return[{path:"claw/openclaw.plugin.json",contents:n},{path:"claw/package.json",contents:s},{path:"claw/tsconfig.json",contents:a},{path:"claw/types/openclaw-plugin-sdk.d.ts",contents:i},{path:"claw/src/index.ts",contents:r}]}o(clawFiles,"clawFiles");function buildPluginFiles(e,{dependencies:t="workspace"}={}){const n=[manifest(e),rootPackageJson(e,t),eslintConfig(t),...sharedFiles(t),vitestConfig(),readme(e,t),...agentFiles(e,t)];return t==="npm"&&n.push(...standaloneRootFiles()),e.parts.includes("frontend")&&n.push(...frontendFiles(e,t)),e.parts.includes("backend")&&n.push(...backendFiles(t,e)),standardAccess(e)&&n.push({path:"shared/access.json",contents:json(standardAccessCatalog(keyNamespaceFor(e.id)))}),e.parts.includes("claw")&&n.push(...clawFiles(e,t)),n}o(buildPluginFiles,"buildPluginFiles");var PLUGIN_ID_PATTERN=/^[a-z0-9][a-z0-9._-]*$/,PLUGIN_PARTS=["frontend","backend","claw"],PLUGIN_SCOPES=["avatar","tenant"],PLUGIN_ID_HINT="lowercase letters and digits, may contain . _ -, starting with a letter or digit";function validatePluginAnswers(e,t){if(typeof e!="object"||e===null||Array.isArray(e))throw new Error("answers must be a JSON object");const n=e,s=o(c=>{const d=n[c];if(typeof d!="string"||d.trim()==="")throw new Error(`${c} is required`);return d.trim()},"text"),a=s("id");if(!PLUGIN_ID_PATTERN.test(a))throw new Error(`id must be ${PLUGIN_ID_HINT}`);const i=n.parts;if(!Array.isArray(i)||i.length===0||i.some(c=>!PLUGIN_PARTS.includes(c)))throw new Error(`parts must be a non-empty list of ${PLUGIN_PARTS.join(", ")}`);const r=n.scope??"avatar";if(!PLUGIN_SCOPES.includes(r))throw new Error(`scope must be one of ${PLUGIN_SCOPES.join(", ")}`);const u=n.template??"standard";if(!PLUGIN_TEMPLATES.includes(u))throw new Error(`template must be one of ${PLUGIN_TEMPLATES.join(", ")}`);return{id:a,displayNameZh:s("displayNameZh"),displayNameEn:s("displayNameEn"),descriptionZh:s("descriptionZh"),descriptionEn:s("descriptionEn"),parts:[...new Set(i)],scope:r,hostApiRange:t,template:u}}o(validatePluginAnswers,"validatePluginAnswers");function writePlugin(e,t){return writePluginDirectory(path.join(e,"plugins"),t,buildPluginFiles(t))}o(writePlugin,"writePlugin");async function writeStandalonePlugin(e,t){return writePluginDirectory(e,t,await formatPluginFiles(buildPluginFiles(t,{dependencies:"npm"})))}o(writeStandalonePlugin,"writeStandalonePlugin");var FORMATTED=/\.(?:[cm]?[jt]sx?|json|css)$/;async function formatPluginFiles(e){const t=await import("prettier");return Promise.all(e.map(async n=>FORMATTED.test(n.path)?{...n,contents:await t.format(n.contents,{...STANDALONE_PRETTIER,filepath:n.path})}:n))}o(formatPluginFiles,"formatPluginFiles");function writePluginDirectory(e,t,n){const s=path.join(e,t.id);if(fs.existsSync(s))throw new Error(`${s} already exists \u2014 pick another id or remove it first`);fs.mkdirSync(e,{recursive:!0});const a=fs.mkdtempSync(path.join(e,`.${t.id}-`));try{for(const i of n){const r=path.join(a,i.path);fs.mkdirSync(path.dirname(r),{recursive:!0}),fs.writeFileSync(r,i.contents)}fs.renameSync(a,s)}catch(i){throw fs.rmSync(a,{recursive:!0,force:!0}),i}return{directory:s,files:n.map(i=>i.path)}}o(writePluginDirectory,"writePluginDirectory");async function createStandalonePlugin(e,t){let n;try{n=JSON.parse(e)}catch(a){throw new Error(`answers must be JSON: ${a instanceof Error?a.message:String(a)}`)}const s=validatePluginAnswers(n,`^${chunkIOZFHJ4F_cjs.HOST_API_VERSION}`);return writeStandalonePlugin(path.resolve(t.cwd,t.parent),s)}o(createStandalonePlugin,"createStandalonePlugin"),exports.PLUGIN_ID_HINT=PLUGIN_ID_HINT,exports.PLUGIN_ID_PATTERN=PLUGIN_ID_PATTERN,exports.PLUGIN_PARTS=PLUGIN_PARTS,exports.PLUGIN_SCOPES=PLUGIN_SCOPES,exports.PLUGIN_TEMPLATES=PLUGIN_TEMPLATES,exports.PUBLISHED_SDK_PACKAGES=PUBLISHED_SDK_PACKAGES,exports.STANDALONE_PRETTIER=STANDALONE_PRETTIER,exports.STANDALONE_TSCONFIG_FILES=STANDALONE_TSCONFIG_FILES,exports.buildPluginFiles=buildPluginFiles,exports.createStandalonePlugin=createStandalonePlugin,exports.formatPluginFiles=formatPluginFiles,exports.packageNameFor=packageNameFor,exports.validatePluginAnswers=validatePluginAnswers,exports.writePlugin=writePlugin,exports.writeStandalonePlugin=writeStandalonePlugin;
|