@jayyuen66/dsh-dir-prep-organize 0.1.17 → 0.1.18
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/CHANGELOG.md +4 -0
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/client.js +2 -2
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
[语义化版本](https://semver.org/lang/zh-CN/)。最新版本在最上。这里的偏离是刻意的:版本标题
|
|
5
5
|
不写发布日期,各版发布时间以 npm registry 为准(`npm view <包名> time` 取得到)。
|
|
6
6
|
|
|
7
|
+
## 0.1.18
|
|
8
|
+
|
|
9
|
+
shared 经 catalog 抬到 `^0.3.3`(两份 README 的 shared 下限同步):设置卡自有的按钮与行分隔横线改用 shared 0.3.3 的样式令牌(`--dsu-line` / `--dsu-hover` / `--dsu-text-tertiary`),与卡片其余部分同源,深浅色主题下不再各取一套宿主别名;共享样式表仍由 shared 的客户端行注册,本仓只保留自己的尺寸与排布。开发工具链 catalog 与 CI 同步到当期现量(oxfmt 0.81.0 / oxlint 1.96.0 / vite 8.4.1,pnpm 12.25.1)。测试夹具补两处组件树外的 hook 调用豁免注释。角色库、默认配置与整理行为不变。
|
|
10
|
+
|
|
7
11
|
## 0.1.17
|
|
8
12
|
|
|
9
13
|
shared 经 catalog 抬到 `^0.3.1`:运行期入口收敛为 `./tool` / `./client`,本仓导入与 Remote 读取器(`parseOrThrow` / `remoteMounterOf`)迁到新入口;本地的 `clampInt`、`hasMethods`、工作目录形状守卫与 `markRemote` 副本删除,改由 shared 提供,host 构建经 `toolImportTransform` 拆分 `/tool`;client 仍按 `dsh.client.external` 外置 `/client`。宿主基线同步切到 `dsh 0.2.3-alpha.3`(devDependencies 全族精确钉 alpha.3);客户端对 `ui-slots` / `ui-primitives` 的导入改走 `<包名>/client`(包根保留兼容,`ui-messages.ts` 的 `declare module` 同批改名);`dsh.client.immediately` 改为 `false`,不再进启动预取层(bundle 随 Loader 条目到达);`react` / `react-dom` 开发依赖抬到 `^19.3.1`,并以 optional peer 声明。devDependencies 补 `@deepseek-ai/dsh-fs-patch`、`@deepseek-ai/dsh-output-retention` 与 `@rolldown/plugin-transform-imports`(peer 同步)。设置卡的脏值判等改用 shared 的 `formValueEquals`(`null` / `undefined` / 缺键按同值处理);「一键导入内置角色库」的范围收窄为顶层 + 一层子目录(两份 README 同步)。角色库、默认配置与整理行为不变。
|
package/README.md
CHANGED
|
@@ -87,7 +87,7 @@ Remove with `dsh plugin --profile web remove @jayyuen66/dsh-dir-prep-organize`.
|
|
|
87
87
|
|
|
88
88
|
If your profile pins `@jayyuen66/dsh-plugin-shared` with a pnpm `overrides` entry, that pin must be at least the version this package declares. A lower pin installs a copy without the names imported at runtime, and the host then reports `N entries did not activate` together with `does not provide an export named ...` at boot - the package installs fine and never loads, and no per-repository CI run can see it.
|
|
89
89
|
|
|
90
|
-
Bundle order matters too: this package's patch inserts the `dsh-plugin-shared` row and declares shared in `dependencies`, so that row loads the copy this bundle imports. When several bundles insert a row for the same package, the bundle listed first in `dsh.profile.bundles` decides which copy it loads; a profile `cordis.patch.yml` row with the same package name loads the profile's copy. Keep whichever copy that row ends up with at least as new as this package declares. From this release on, the client stylesheets (`meta.stylesheets`) and `
|
|
90
|
+
Bundle order matters too: this package's patch inserts the `dsh-plugin-shared` row and declares shared in `dependencies`, so that row loads the copy this bundle imports. When several bundles insert a row for the same package, the bundle listed first in `dsh.profile.bundles` decides which copy it loads; a profile `cordis.patch.yml` row with the same package name loads the profile's copy. Keep whichever copy that row ends up with at least as new as this package declares. From this release on, the client stylesheets (`meta.stylesheets`), `ProgressBar` and the save-path `useInvalidFields.clear({ guard })` require shared `0.3.3` or later; the `^0.3.1` / `^0.3.2` ranges only keep older plugins compatible, so treat `0.3.3` as the effective floor for releases and single-repository CI.
|
|
91
91
|
|
|
92
92
|
## <img src="https://api.iconify.design/lucide/circle-check.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Verify it is live
|
|
93
93
|
|
package/README.zh-CN.md
CHANGED
|
@@ -87,7 +87,7 @@ dsh plugin --profile web add @jayyuen66/dsh-dir-prep-organize
|
|
|
87
87
|
|
|
88
88
|
如果你的 profile 用 pnpm `overrides` 把 `@jayyuen66/dsh-plugin-shared` 钉在某个版本,那个值必须不低于本包声明的那一版。钉得更低会装到一份缺少运行期所导入名字的产物,宿主起来时报 `N entries did not activate` 与 `does not provide an export named ...`——包装得上、永远不生效,而各仓单仓 CI 看不见这一类。
|
|
89
89
|
|
|
90
|
-
bundle 顺序也会决定这件事:本包的 patch 插入 `dsh-plugin-shared` 行,并在 `dependencies` 声明 shared,所以这行加载本 bundle 自己 import 的那份。多个 bundle 插入同一个包名的行时,`dsh.profile.bundles` 里排在最前的那个决定它加载哪份;profile 自己的 `cordis.patch.yml` 里写同一包名的行则加载 profile 的那份。请让这行最终拿到的那份不低于本包声明的版本。本版起的客户端样式表(`meta.stylesheets
|
|
90
|
+
bundle 顺序也会决定这件事:本包的 patch 插入 `dsh-plugin-shared` 行,并在 `dependencies` 声明 shared,所以这行加载本 bundle 自己 import 的那份。多个 bundle 插入同一个包名的行时,`dsh.profile.bundles` 里排在最前的那个决定它加载哪份;profile 自己的 `cordis.patch.yml` 里写同一包名的行则加载 profile 的那份。请让这行最终拿到的那份不低于本包声明的版本。本版起的客户端样式表(`meta.stylesheets`)、`ProgressBar` 与保存回路的 `useInvalidFields.clear({ guard })` 需要 shared `0.3.3` 或更晚;`^0.3.1` / `^0.3.2` 的范围只为兼容旧插件,发布与单仓 CI 请以 `0.3.3` 作为实际下限。
|
|
91
91
|
|
|
92
92
|
## <img src="https://api.iconify.design/lucide/circle-check.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> 确认它真的在工作
|
|
93
93
|
|
package/client.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// GENERATED by buildClient() in build-client.mjs — edit src/*.ts, then run `node build-client.mjs`.
|
|
2
2
|
window.__ModuleLoader__.load({
|
|
3
3
|
id: "@jayyuen66/dsh-dir-prep-organize",
|
|
4
|
-
meta: () => ({ stylesheets: { "src/client-styles.ts": { text: () => ".dpi-btn{appearance:none;border:1px solid var(--
|
|
4
|
+
meta: () => ({ stylesheets: { ["src/client-styles.ts"]: { text: () => ".dpi-btn{appearance:none;border:1px solid var(--dsu-line,currentColor);background:var(--dsw-alias-bg-layer-1,transparent);color:var(--dsw-alias-label-primary,inherit);font:inherit;font-size:13px;line-height:1;height:32px;border-radius:6px;padding:0 10px;cursor:pointer;display:inline-flex;align-items:center;gap:6px;transition:background .16s,border-color .16s,color .16s}\n.dpi-btn:hover:not(:disabled){border-color:var(--dsw-alias-border-l3,currentColor);background:var(--dsu-hover,transparent)}\n.dpi-btn:disabled{opacity:.55;cursor:not-allowed}\n.dpi-btn:disabled[data-state=\"loading\"]{cursor:progress}\n.dpi-btn:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,currentColor);outline-offset:1px}\n.dpi-btn svg{width:14px;height:14px;flex:none}\n.dpi-btn-err{border-color:var(--dsw-alias-state-error-primary,currentColor);color:var(--dsw-alias-state-error-secondary,currentColor)}\n.dpi-btn-err:hover:not(:disabled){border-color:var(--dsw-alias-state-error-primary,currentColor)}\n.dpi-spin{animation:dpi-rotate .8s linear infinite}\n@keyframes dpi-rotate{to{transform:rotate(360deg)}}\n@media (prefers-reduced-motion:reduce){.dpi-spin{animation:none}.dpi-btn{transition:none}}\n.dpi-wrap{position:relative;display:inline-flex;isolation:isolate}\n.dpi-caretWrap{display:inline-flex}\n.dpi-polish-menu{width:280px}\n.dpi-split{display:inline-flex;align-items:stretch}\n.dpi-split .dpi-main{border-top-right-radius:0;border-bottom-right-radius:0;padding-right:10px}\n.dpi-split .dpi-caret{width:32px;min-width:32px;padding:0;justify-content:center;border-left:0;border-top-left-radius:0;border-bottom-left-radius:0}\n.dpi-split .dpi-caret svg{width:16px;height:16px;display:block;flex:none}\n.dpic-row{padding:10px 0;border-bottom:1px dashed var(--dsu-line,currentColor)}\n.dpic-name{flex:1;min-width:0}\n.dpic-rowhead .dpic-name{width:auto}\n.dpic-rowhead .dpic-emoji{width:44px;flex:none;text-align:center}\n.dpic-rowhead .dpic-group{width:84px;flex:none}\n.dpic-desc{width:100%;margin-top:6px}\n.dpic-text{width:100%;margin-top:6px}\n.dpic-importpath{flex:1;min-width:0}\n.dpic-rowhead .dpic-importpath{width:auto}\n.dpic-del{flex:none}\n.dpic-toolbar{display:flex;gap:8px;flex-wrap:wrap;padding:8px 0}\n.dpic-rowhead{display:flex;gap:8px;align-items:center}\n.dpic-idx{font-size:12px;color:var(--dsu-text-tertiary,inherit);flex:none;min-width:26px}\n.dpic-importrow{padding:12px 0;border-bottom:1px dashed var(--dsu-line,currentColor)}" } } }),
|
|
5
5
|
factory: (require) => {
|
|
6
6
|
'use strict';
|
|
7
7
|
const module = { exports: {} };
|
|
8
8
|
let exports = module.exports;
|
|
9
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@deepseek-ai/dsh-client-ui-primitives/client"),t=require("react"),n=require("@jayyuen66/dsh-plugin-shared/client"),r=require("zod");function i(e,t,n,r){if(e===`direct`){n();return}if(e===`builtin-retry`){r();return}if(!e.startsWith(`tpl:`))return;let i=t.find(t=>`tpl:${t.id}`===e);i!==void 0&&n(i.text)}function a(e,t,n,r){if(e===`builtin-retry`)return r(),!1;if(!e.startsWith(`tpl:`))return!0;let i=t.find(t=>`tpl:${t.id}`===e);return i!==void 0&&n(i.text),!0}function o(e){if(typeof e!=`object`||!e)return!1;try{return!Array.isArray(e)}catch{return!1}}function s(e,t){if(t<1||Number.isNaN(t))return``;let n=0,r=0;for(let i of e){if(r>=t)break;n+=i.length,r+=1}return e.slice(0,n)}function c(e,t,n){if(e!==``&&!n.has(e))return e;let r=`tpl-${t}`;for(;n.has(r);)r=`${r}-${t}`;return r}function l(e,t){let n=new Set(e.map(({id:e})=>e)),r=[...e];for(let{id:e,...i}of t){let t=e.trim();if(t===``)t=c(``,r.length,n);else if(n.has(t))for(t=`${t}-i`;n.has(t);)t=`${t}i`;n.add(t),r.push({...i,id:t})}return r}function u(e){return typeof e==`string`?e.trim():``}function d(e,t,n){let r;if(o(e)){let{id:i,name:a,description:o,text:l,group:d,emoji:f}=e,p=u(a),m=u(l);if(p!==``&&m!==``){let e=c(u(i),t,n);n.add(e),r={id:e,name:p,description:u(o),text:m,group:u(d),emoji:s(u(f),12)}}}return r}function f(e){if(!Array.isArray(e))return[];let t=new Set,n=[];for(let[r,i]of e.entries()){let e=d(i,r,t);e!==void 0&&n.push(e)}return n}const p=String.fromCodePoint(92),m=/^[A-Za-z]:$/u,h=/[/\\]+$/u;function g(e){let t=m.test(e.slice(0,2))&&(e[2]===`/`||e[2]===p);return e.startsWith(`/`)||t||e.startsWith(p+p)}function _(e){let t=e.replace(h,``);return t.length===0||m.test(t)?e:t}function v(e){let t=[];if(Array.isArray(e))for(let n of e){let e=typeof n==`string`?n.trim():``,r=_(e);e.length>0&&g(r)&&!t.includes(r)&&t.push(r)}return t}const y=0x7fffffff,b=12e4;function x(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function S(e){let t=e.organizeTimeoutMs;return x(t)?(0,n.clampInt)(t,1,y,1):void 0}function C(e){let t=x(e)?e:b;return(0,n.clampInt)(Math.min(t,0x7fffec77)+5e3,1,y,b)}const w={zh:{rolesSection:`角色库`,rolesEmptyTitle:`角色库还是空的`,rolesEmptyNote:`点「导入角色」拉取内置角色库,或用「+ 新增模板」手工写一条;空表时下拉会回落到内置精选角色集。`,rolesCount:`{count} 条`,rolesHint:`输入框「模板」下拉与「润色」▾ 角色菜单共用这一份列表,空表即回落到内置精选角色集(生成自插件 agents/ 角色库)。留空点「导入角色」可导入内置角色库(顶层 + 一层子目录);填路径则按「会话 cwd + 内置角色库 + 下方导入允许目录」放行。编辑后点「保存」生效,重启不丢。`,statusReadOnly:`设置源不可写:编辑已禁用;下拉仍按当前列表生效。`,statusNotReady:`设置源未就绪:显示当前生效列表,就绪后可编辑。`,addTemplate:`+ 新增模板`,saveTitleDirty:`写入模板列表与导入允许目录(模板生效于新拉开的菜单)`,saveTitleClean:`无未保存修改`,saving:`保存中…`,save:`保存`,revert:`撤销`,resetTitle:`恢复默认?`,resetDefault:`恢复默认`,resetConfirmDescription:`将丢弃模板列表的全部自定义并写回内置默认:立即写盘、不可撤销(撤销按钮只回滚未保存的草稿)。已登记的导入允许目录不受影响。`,resetConfirmAcknowledge:`我知道这会立即写盘且不可撤销`,resetConfirmCancel:`取消`,resetConfirmClose:`关闭`,resetConfirmAction:`确认恢复默认`,footHint:`说明:编辑/新增/删除先在本地暂存,点「保存」一次写入(模板与导入允许目录同理);清空名称或正文的条目保存时会被剔除(删除请用行内「删除」);恢复默认只回滚模板列表。`,saveFailed:`保存失败:`,newTemplateName:`新模板 {index}`,persistUnconfirmed:`{action}结果不可确认:设置源未就绪(宿主未回读成功)`,persistRejected:`{action}未生效:宿主拒绝了本次写入(当前 revision {revision})`,rowAriaEmoji:`模板 {index} 视觉标记`,rowEmojiTitle:`可选视觉标记(emoji 或短文本),下拉菜单显示在名称前`,rowPlaceholderName:`菜单显示名`,rowAriaName:`模板 {index} 名称`,rowPlaceholderGroup:`分组`,rowAriaGroup:`模板 {index} 分组`,rowGroupTitle:`下拉按此分组展示;留空归入「通用」`,rowDeleteTitle:`删除此模板`,rowDelete:`删除`,rowPlaceholderDescription:`一句话介绍(下拉悬停时显示;如:威胁建模与 OWASP 代码审计)`,rowAriaDescription:`模板 {index} 一句话介绍`,rowPlaceholderText:`模板正文(点选后插入输入框,随你的消息一起发给模型)`,rowAriaText:`模板 {index} 正文`,importFailedUnknown:`导入失败(未知错误)`,importEmpty:`目录下没有符合条件的角色 .md(需含 name 的 frontmatter)`,importAllDone:`已从内置角色库(顶层 + 一层子目录)导入 {count} 条{skips},编辑后点「保存」生效`,importFromDone:`已从 {path} 导入 {count} 条{skips},编辑后点「保存」生效`,importTruncated:`(回执标记本次导入有内容被上限截断)`,importPlaceholder:`留空 = 导入内置角色库(顶层 + 一层子目录);或填 .md / 目录路径(须在允许根内)`,importAriaPath:`角色导入路径`,importBtnTitle:`留空 = 一键导入内置角色库(顶层 + 一层子目录);填路径 = 导入该 .md 或目录下的角色(路径须在允许根内)`,importing:`导入中…`,importRoles:`导入角色`,importErrorPrefix:`导入失败:`,importHint:`导入说明:留空导入内置角色库(agents/,顶层 + 一层子目录);填路径时只放行「会话 cwd」「内置角色库 agents/」与下方「导入允许目录」之内的路径——绝对路径默认拒绝,越界会直接报「导入路径越界」并回显解析后的路径。本卡没有会话上下文,故只能填内置库或已登记目录里的路径。目录扫描顶层 + 一层子目录 .md(跳过隐藏项),文件须含 name 的 frontmatter,正文将提炼为模板正文。`,skipDeeper:`{count} 个更深层 .md 未扫描(导入只扫两层)`,skipTooLarge:`{count} 个文件超字节上限被跳过`,skipUnreadable:`{count} 个文件读取失败`,skipUnnamed:`{count} 个非角色文件(frontmatter 无 name)`,skipEscaped:`{count} 个文件的真实目标在允许根之外(符号链接),已按安全策略排除`,skipSummary:`({list})`,skipSeparator:`,`,rootsHeading:`导入允许目录(importAllowRoots)`,rootsAriaRow:`导入允许目录 {index}`,rootsRowTitle:`该目录(含其子目录)内的角色 .md 可经「导入角色」读取`,rootsRemoveTitle:`移除此允许目录`,rootsRemove:`移除`,rootsAddPlaceholder:`新增一个允许导入的目录绝对路径`,rootsAddAria:`新增导入允许目录`,rootsAddTitle:`加入待保存的允许目录列表`,rootsAdd:`登记目录`,rootsHint:`绝对路径默认拒绝:只有「当前会话 cwd」「插件内置角色库 agents/」与本列表登记的目录之内可导入。设置页没有会话上下文,卡上填的路径必须落在内置库或本列表内。改完点底部「保存」生效。`,dockOrganizeEntry:`润色`,dockTemplatesEntry:`模板`,inputPlaceholder:`输入消息,或描述要整理的目录;✦ 一键润色可整理输入框草稿。`,organizeIdle:`一键润色`,organizeLoading:`润色中`,organizeFailedShort:`失败`,organizeIdleTitle:`结合当前目录润色输入框内容(主键直接润色;▾ 可选角色风格)`,organizeFailedTitle:`润色失败:{message}`,organizeErrContextFailed:`目录上下文读取失败:{message}`,organizeErrModelFailed:`读取模型失败:{message}`,organizeErrEmpty:`输入框为空,无内容可润色`,organizeErrTimeout:`润色请求超时:宿主没有在时限内回报结果`,organizeErrUnknownReason:`未知错误`,organizeErrUnknown:`润色失败(未知错误)`,organizeCaretAria:`选择润色的角色风格`,organizeCaretTitle:`按某个角色的风格润色(角色来自下方模板库)`,organizeMainAria:`润色输入框内容`,organizeRoleGroup:`角色`,organizeDirectItem:`直接润色(默认,不带角色)`,organizeNoTemplates:`无模板可选作角色风格`,organizeRoleItem:`以「{name}」的风格润色`,organizeWriteBackUnavailable:`输入框动作不可用,无法写回`,organizeWriteBackStale:`输入框内容已变化,润色结果未写回`,organizeBusyTitle:`输入框正在提交,暂不能润色`,templatesIdleTitle:`选择一条模板插入光标处(按分组展示)`,templatesBrokenTitle:`输入框动作不可用,无法插入`,templatesBusyTitle:`输入框正在提交,暂不能插入模板`,templatesGroupCommon:`通用`,templatesAria:`插入模板`,templatesEmptyHint:`无模板:在设置页「角色库」中添加或恢复默认`,builtinLoading:`正在载入内置角色模板…`,builtinFailed:`内置模板加载失败:{message}`,builtinBadPayload:`内置模板响应不是合法载荷`,builtinRetry:`重试`},en:{rolesSection:`Role library`,rolesEmptyTitle:`The role library is empty`,rolesEmptyNote:`Press "Import roles" to pull in the built-in library, or use "+ Add template" to write one by hand; while the list is empty the dropdown falls back to the built-in curated role set.`,rolesCount:`{count} items`,rolesHint:`The input-box "Template" dropdown and the "Polish" ▾ role menu share this one list; an empty list falls back to the built-in curated role set (generated from this plugin's agents/ role library). Leave the path empty and press "Import roles" to import the built-in role library (top level plus one sub-directory level); an explicit path is allowed within "session cwd + built-in role library + the import allowed directories below". Press "Save" after editing — it survives restarts.`,statusReadOnly:`Settings source is read-only: editing is disabled; the dropdown still uses the current list.`,statusNotReady:`Settings source is not ready yet: showing the list currently in effect, editing unlocks once it is ready.`,addTemplate:`+ Add template`,saveTitleDirty:`Write the template list and the import allowed directories (templates take effect in newly opened menus)`,saveTitleClean:`No unsaved changes`,saving:`Saving…`,save:`Save`,revert:`Revert`,resetTitle:`Restore defaults?`,resetDefault:`Restore defaults`,resetConfirmDescription:`Discards every customization of the template list and writes the built-in defaults back: immediate, irreversible (Revert only rolls back unsaved drafts). Registered import directories are untouched.`,resetConfirmAcknowledge:`I understand this writes immediately and cannot be undone`,resetConfirmCancel:`Cancel`,resetConfirmClose:`Close`,resetConfirmAction:`Restore defaults`,footHint:`Note: edits, additions and deletions are staged locally first and written in one go when you press "Save" (same for templates and import directories); entries whose name or body is empty are dropped on save (use the inline "Delete" instead); "Restore defaults" only rolls back the template list.`,saveFailed:`Save failed: `,newTemplateName:`New template {index}`,persistUnconfirmed:`{action} cannot be confirmed: the settings source is not ready (host read-back failed)`,persistRejected:`{action} did not take effect: the host rejected this write (current revision {revision})`,rowAriaEmoji:`Visual mark of template {index}`,rowEmojiTitle:`Optional visual mark (emoji or short text), shown before the name in the dropdown`,rowPlaceholderName:`Menu display name`,rowAriaName:`Name of template {index}`,rowPlaceholderGroup:`Group`,rowAriaGroup:`Group of template {index}`,rowGroupTitle:`The dropdown groups entries by this value; leave empty to fall into "General"`,rowDeleteTitle:`Delete this template`,rowDelete:`Delete`,rowPlaceholderDescription:`One-line intro (shown on dropdown hover; e.g. threat modelling and OWASP code auditing)`,rowAriaDescription:`One-line intro of template {index}`,rowPlaceholderText:`Template body (inserted into the input box and sent to the model with your message)`,rowAriaText:`Body of template {index}`,importFailedUnknown:`Import failed (unknown error)`,importEmpty:`No qualifying role .md in that directory (frontmatter must contain name)`,importAllDone:`Imported {count} entries from the built-in role library (top level plus one sub-directory level){skips}; press "Save" after editing`,importFromDone:`Imported {count} entries from {path}{skips}; press "Save" after editing`,importTruncated:` (the reply flagged some content as truncated by a limit)`,importPlaceholder:`Empty = import the built-in role library (top level plus one sub-directory level); or a .md / directory path (must be inside an allowed root)`,importAriaPath:`Role import path`,importBtnTitle:`Empty imports the built-in role library in one click (top level plus one sub-directory level); a path imports that .md or the roles in that directory (must be inside an allowed root)`,importing:`Importing…`,importRoles:`Import roles`,importErrorPrefix:`Import failed: `,importHint:`Import notes: an empty path imports the built-in role library (agents/, top level plus one sub-directory level); an explicit path is only allowed inside "session cwd", "built-in role library agents/" and the "import allowed directories" below — absolute paths are refused by default, and anything out of bounds reports "import path out of bounds" with the resolved path echoed back. This card has no session context, so explicit paths must live in the built-in library or a registered directory. Directory scans cover the top level plus one level of sub-directory .md files (hidden entries skipped), each file needs a frontmatter name, and its body is condensed into the template text.`,skipDeeper:`{count} deeper .md files were not scanned (imports cover two levels)`,skipTooLarge:`{count} files were skipped for exceeding the byte limit`,skipUnreadable:`{count} files could not be read`,skipUnnamed:`{count} non-role files (no name in frontmatter)`,skipEscaped:`{count} files whose real target lies outside the allowed roots (symlinks) were excluded by policy`,skipSummary:` ({list})`,skipSeparator:`, `,rootsHeading:`Import allowed directories (importAllowRoots)`,rootsAriaRow:`Import allowed directory {index}`,rootsRowTitle:`Role .md files inside this directory (and its subdirectories) can be read by "Import roles"`,rootsRemoveTitle:`Remove this allowed directory`,rootsRemove:`Remove`,rootsAddPlaceholder:`Absolute path of a directory newly allowed for imports`,rootsAddAria:`Add an import allowed directory`,rootsAddTitle:`Add it to the pending allowed-directory list`,rootsAdd:`Register directory`,rootsHint:`Absolute paths are refused by default: imports only succeed inside "the current session cwd", "the plugin's built-in role library agents/" and the directories registered below. The settings page has no session context, so a path typed here must fall inside the built-in library or this list. Press "Save" at the bottom to apply.`,dockOrganizeEntry:`Polish`,dockTemplatesEntry:`Templates`,inputPlaceholder:`Type a message or describe a directory; ✦ Polish can tidy the draft.`,organizeIdle:`Polish`,organizeLoading:`Polishing`,organizeFailedShort:`Failed`,organizeIdleTitle:`Polish the input-box content against the current directory (main key polishes directly; ▾ picks a role style)`,organizeFailedTitle:`Polish failed: {message}`,organizeErrContextFailed:`Failed to read the directory context: {message}`,organizeErrModelFailed:`Failed to read the model: {message}`,organizeErrEmpty:`The input box is empty; nothing to polish`,organizeErrTimeout:`Polish request timed out: the host did not reply in time`,organizeErrUnknownReason:`unknown error`,organizeErrUnknown:`Polish failed (unknown error)`,organizeCaretAria:`Choose a role style to polish with`,organizeCaretTitle:`Polish in a role's style (roles come from the template library below)`,organizeMainAria:`Polish the input-box content`,organizeRoleGroup:`Roles`,organizeDirectItem:`Polish directly (default, no role)`,organizeNoTemplates:`No templates available as a role style`,organizeRoleItem:`Polish in the style of "{name}"`,organizeWriteBackUnavailable:`Input-box actions unavailable; cannot write back`,organizeWriteBackStale:`The input box changed; the polished text was not applied`,organizeBusyTitle:`The input box is submitting; cannot polish right now`,templatesIdleTitle:`Pick a template to insert at the caret (shown grouped)`,templatesBrokenTitle:`Input-box actions unavailable; cannot insert`,templatesBusyTitle:`The input box is submitting; cannot insert a template`,templatesGroupCommon:`General`,templatesAria:`Insert a template`,templatesEmptyHint:`No templates: add or restore defaults under "Role library" in the settings page`,builtinLoading:`Loading built-in role templates…`,builtinFailed:`Failed to load built-in templates: {message}`,builtinBadPayload:`The built-in template response is not a valid payload`,builtinRetry:`Retry`}};function T(e){return e!==void 0&&typeof e.setDraft==`function`}function E(e){return e!==void 0&&typeof e.captureInsertion==`function`&&typeof e.insertText==`function`}function ee(e,n){let r=(0,t.useRef)(e),i=(0,t.useRef)(void 0);return(0,t.useEffect)(()=>{r.current=e;let t=i.current;t!==void 0&&(t.sessionId!==e.sessionId||t.actions!==e.actions||e.phase!==`plain`)&&(t.invalidated=!0)},[e]),(0,t.useEffect)(()=>()=>{let e=i.current;e!==void 0&&(e.invalidated=!0,i.current=void 0)},[]),{begin:()=>{let e={sessionId:r.current.sessionId,draftRev:r.current.draftRev,actions:r.current.actions,invalidated:!1};return i.current=e,e},finish:e=>{i.current===e&&(i.current=void 0)},commit:(e,t)=>{let i=r.current,{actions:a}=i;if(!T(a))throw Error(n.unavailable);if(t.sessionId!==i.sessionId||i.phase!==`plain`)throw Error(n.stale);let o=i.draftRev;if(E(a)&&(o=a.captureInsertion().draftRev),t.invalidated||o!==t.draftRev)throw Error(n.stale);a.setDraft(e)}}}const D=`dirPrepOrganize`,O=`remote.${D}`,k=`@jayyuen66/dsh-dir-prep-organize`,A=`session request requires a string sessionId`,te=r.z.object({sessionId:r.z.string({error:A})},{error:A}),j=`organize request requires string sessionId, prompt and entriesSummary`,ne=r.z.object({sessionId:r.z.string({error:j}),prompt:r.z.string({error:j}),entriesSummary:r.z.string({error:j}),roleText:r.z.string({error:`organize request roleText must be a string when present`}).optional()},{error:j}),M=`import request requires string path and sessionId`,re=r.z.object({path:r.z.string({error:M}),sessionId:r.z.string({error:M})},{error:M}),ie={mode:`strict`,typeSymbol:`${k}#session-request`,create:()=>({parse(e){return(0,n.parseOrThrow)(te,e,r.z.prettifyError)}})},ae=[{id:`${k}#${D}/defaults`,service:D,namespace:D,method:`defaults`,invocation:{kind:`direct`},parameters:[],result:{mode:`src-json`}},{id:`${k}#${D}/context`,service:D,namespace:D,method:`context`,invocation:{kind:`direct`},parameters:[{name:`request`,wire:`request`,source:`json`,codec:ie}],result:{mode:`src-json`}},{id:`${k}#${D}/model`,service:D,namespace:D,method:`model`,invocation:{kind:`direct`},parameters:[{name:`request`,wire:`request`,source:`json`,codec:ie}],result:{mode:`src-json`}},{id:`${k}#${D}/organize`,service:D,namespace:D,method:`organize`,invocation:{kind:`direct`},parameters:[{name:`request`,wire:`request`,source:`json`,codec:{mode:`strict`,typeSymbol:`${k}#organize-request`,create:()=>({parse(e){let t=(0,n.parseOrThrow)(ne,e,r.z.prettifyError);return t.roleText===void 0?{sessionId:t.sessionId,prompt:t.prompt,entriesSummary:t.entriesSummary}:{...t,roleText:t.roleText}}})}}],result:{mode:`src-json`}},{id:`${k}#${D}/importTemplates`,service:D,namespace:D,method:`importTemplates`,invocation:{kind:`direct`},parameters:[{name:`request`,wire:`request`,source:`json`,codec:{mode:`strict`,typeSymbol:`${k}#import-request`,create:()=>({parse(e){return(0,n.parseOrThrow)(re,e,r.z.prettifyError)}})}}],result:{mode:`src-json`}}],oe=e=>(0,n.isRecord)(e)&&typeof e.defaults==`function`&&typeof e.context==`function`&&typeof e.model==`function`&&typeof e.organize==`function`&&typeof e.importTemplates==`function`,se=e=>{if(!(0,n.isRecord)(e)||typeof e.ok!=`boolean`)throw TypeError(`Typert Remote 应答不是 RemoteResult:缺少布尔字段 ok`);if(!e.ok){let{error:t}=e;throw!(0,n.isRecord)(t)||typeof t.code!=`string`||typeof t.message!=`string`?TypeError(`Typert Remote 应答的 error 分支缺 code/message`):Error(`${t.code}: ${t.message}`)}if(!(`value`in e))throw TypeError(`Typert Remote 应答的 ok 分支缺 value 字段`);return e.value};function ce(e,t){let n,r=async()=>{n??=t.$mount({package:k,descriptors:ae});try{await n}catch(e){throw n=void 0,e}let r=e.get?.(O,!1);if(!oe(r))throw Error(`${O} 未提供:宿主网关没有挂上这枚命名空间`);return r},i=async e=>{let t=await r();return se(await e(t))};return{defaults:async()=>i(e=>e.defaults()),context:async e=>i(t=>t.context({sessionId:e})),model:async e=>i(t=>t.model({sessionId:e})),organize:async e=>i(t=>t.organize(e)),importTemplates:async e=>i(t=>t.importTemplates(e))}}function le(e){let t=(0,n.remoteMounterOf)(e,!1);return t===void 0?void 0:ce(e,t)}const N=`dir-prep-organize`,P=125e3,F=`dpic-rowhead`,I=`dpic-importpath`,L=`conversation.input.right`,ue=`conversation.input.placeholder`;function de(e){let{name:t,isDir:r,sizeBytes:i,snippet:a}=(0,n.isRecord)(e)?e:{};return{name:typeof t==`string`?t:``,isDir:r===!0,sizeBytes:typeof i==`number`?i:0,...typeof a==`string`?{snippet:a}:{}}}function R(e,t){let n=e[t];return typeof n==`string`?n:void 0}function z(e,t){return e===void 0?{}:{[t]:e}}function fe(e){return[[`skipDeeper`,e.deeper],[`skipTooLarge`,e.tooLarge],[`skipUnreadable`,e.unreadable],[`skipUnnamed`,e.unnamed],[`skipEscaped`,e.escaped]]}function pe(e){let t=(0,n.isRecord)(e)?e:{},{ok:r,truncated:i,entries:a}=t,o=Array.isArray(a)?a.map(e=>de(e)):void 0;return{ok:r===!0,...z(R(t,`error`),`error`),...z(R(t,`cwd`),`cwd`),...i===!0?{truncated:!0}:{},...o===void 0?{}:{entries:o}}}function me(e){let t=(0,n.isRecord)(e)?e:{};return{ok:t.ok===!0,...z(R(t,`error`),`error`),...z(R(t,`provider`),`provider`),...z(R(t,`model`),`model`),...z(R(t,`reasoningEffort`),`reasoningEffort`)}}function he(e){let t=(0,n.isRecord)(e)?e:{};return{ok:t.ok===!0,...z(R(t,`error`),`error`),...z(R(t,`content`),`content`)}}function B(e){return typeof e==`number`&&e>0?e:0}function ge(e){return{tooLarge:B(e.tooLarge),unreadable:B(e.unreadable),deeper:B(e.deeper),unnamed:B(e.unnamed),escaped:B(e.escaped)}}function _e(e,t){if(t===void 0)return``;let n=[];for(let[r,i]of fe(t))i>0&&n.push(e(r,{count:i}));return n.length===0?``:e(`skipSummary`,{list:n.join(e(`skipSeparator`))})}function ve(e){let{ok:t,error:r,count:i,truncated:a,skipped:o,entries:s}=(0,n.isRecord)(e)?e:{},c=Array.isArray(s)?f(s):void 0;return{ok:t===!0,...typeof r==`string`?{error:r}:{},...typeof i==`number`?{count:i}:{},...a===!0?{truncated:!0}:{},...(0,n.isRecord)(o)?{skipped:ge(o)}:{},...c===void 0?{}:{entries:c}}}function ye(e){let t=e.entries??[],n=[`当前目录: ${e.cwd??`(未提供)`}`],r=t.filter(e=>!e.isDir),i=t.filter(e=>e.isDir);n.push(`文件 ${r.length} 个, 目录 ${i.length} 个`),e.truncated===!0&&n.push(`(以上条目按上限截断,目录树并未完整列出,勿据此判断文件不存在)`);for(let e of i)n.push(`📁 ${e.name}/`);for(let e of r){let t=e.sizeBytes>1024?`${(e.sizeBytes/1024).toFixed(1)}KB`:`${e.sizeBytes}B`,r=`📄 ${e.name} (${t})`;e.snippet!==void 0&&e.snippet.length>0&&(r+=` ↳ ${e.snippet.replaceAll(`
|
|
9
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@deepseek-ai/dsh-client-ui-primitives/client"),t=require("react"),n=require("@jayyuen66/dsh-plugin-shared/client"),r=require("zod");function i(e,t,n,r){if(e===`direct`){n();return}if(e===`builtin-retry`){r();return}if(!e.startsWith(`tpl:`))return;let i=t.find(t=>`tpl:${t.id}`===e);i!==void 0&&n(i.text)}function a(e,t,n,r){if(e===`builtin-retry`)return r(),!1;if(!e.startsWith(`tpl:`))return!0;let i=t.find(t=>`tpl:${t.id}`===e);return i!==void 0&&n(i.text),!0}function o(e){if(typeof e!=`object`||!e)return!1;try{return!Array.isArray(e)}catch{return!1}}function s(e,t){if(t<1||Number.isNaN(t))return``;let n=Math.floor(t),r=0,i=0;for(let t of e){if(i>=n)break;r+=t.length,i+=1}return e.slice(0,r)}function c(e,t,n){if(e!==``&&!n.has(e))return e;let r=`tpl-${t}`;for(;n.has(r);)r=`${r}-${t}`;return r}function l(e,t){let n=new Set(e.map(({id:e})=>e)),r=[...e];for(let{id:e,...i}of t){let t=e.trim();if(t===``)t=c(``,r.length,n);else if(n.has(t))for(t=`${t}-i`;n.has(t);)t=`${t}i`;n.add(t),r.push({...i,id:t})}return r}function u(e){return typeof e==`string`?e.trim():``}function d(e,t,n){let r;if(o(e)){let{id:i,name:a,description:o,text:l,group:d,emoji:f}=e,p=u(a),m=u(l);if(p!==``&&m!==``){let e=c(u(i),t,n);n.add(e),r={id:e,name:p,description:u(o),text:m,group:u(d),emoji:s(u(f),12)}}}return r}function f(e){if(!Array.isArray(e))return[];let t=new Set,n=[];for(let[r,i]of e.entries()){let e=d(i,r,t);e!==void 0&&n.push(e)}return n}const p=String.fromCodePoint(92),m=/^[A-Za-z]:$/u,h=/[/\\]+$/u;function g(e){let t=m.test(e.slice(0,2))&&(e[2]===`/`||e[2]===p);return e.startsWith(`/`)||t||e.startsWith(p+p)}function _(e){let t=e.replace(h,``);return t.length===0||m.test(t)?e:t}function v(e){let t=[];if(Array.isArray(e))for(let n of e){let e=typeof n==`string`?n.trim():``,r=_(e);e.length>0&&g(r)&&!t.includes(r)&&t.push(r)}return t}const y=0x7fffffff,b=12e4;function x(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function S(e){let t=e.organizeTimeoutMs;return x(t)?(0,n.clampInt)(t,1,y,1):void 0}function C(e){let t=x(e)?e:b;return(0,n.clampInt)(Math.min(t,0x7fffec77)+5e3,1,y,b)}const w={zh:{rolesSection:`角色库`,rolesEmptyTitle:`角色库还是空的`,rolesEmptyNote:`点「导入角色」拉取内置角色库,或用「+ 新增模板」手工写一条;空表时下拉会回落到内置精选角色集。`,rolesCount:`{count} 条`,rolesHint:`输入框「模板」下拉与「润色」▾ 角色菜单共用这一份列表,空表即回落到内置精选角色集(生成自插件 agents/ 角色库)。留空点「导入角色」可导入内置角色库(顶层 + 一层子目录);填路径则按「会话 cwd + 内置角色库 + 下方导入允许目录」放行。编辑后点「保存」生效,重启不丢。`,statusReadOnly:`设置源不可写:编辑已禁用;下拉仍按当前列表生效。`,statusNotReady:`设置源未就绪:显示当前生效列表,就绪后可编辑。`,addTemplate:`+ 新增模板`,saveTitleDirty:`写入模板列表与导入允许目录(模板生效于新拉开的菜单)`,saveTitleClean:`无未保存修改`,saving:`保存中…`,save:`保存`,revert:`撤销`,resetTitle:`恢复默认?`,resetDefault:`恢复默认`,resetConfirmDescription:`将丢弃模板列表的全部自定义并写回内置默认:立即写盘、不可撤销(撤销按钮只回滚未保存的草稿)。已登记的导入允许目录不受影响。`,resetConfirmAcknowledge:`我知道这会立即写盘且不可撤销`,resetConfirmCancel:`取消`,resetConfirmClose:`关闭`,resetConfirmAction:`确认恢复默认`,footHint:`说明:编辑/新增/删除先在本地暂存,点「保存」一次写入(模板与导入允许目录同理);清空名称或正文的条目保存时会被剔除(删除请用行内「删除」);恢复默认只回滚模板列表。`,saveFailed:`保存失败:`,newTemplateName:`新模板 {index}`,persistUnconfirmed:`{action}结果不可确认:设置源未就绪(宿主未回读成功)`,persistRejected:`{action}未生效:宿主拒绝了本次写入(当前 revision {revision})`,rowAriaEmoji:`模板 {index} 视觉标记`,rowEmojiTitle:`可选视觉标记(emoji 或短文本),下拉菜单显示在名称前`,rowPlaceholderName:`菜单显示名`,rowAriaName:`模板 {index} 名称`,rowPlaceholderGroup:`分组`,rowAriaGroup:`模板 {index} 分组`,rowGroupTitle:`下拉按此分组展示;留空归入「通用」`,rowDeleteTitle:`删除此模板`,rowDelete:`删除`,rowPlaceholderDescription:`一句话介绍(下拉悬停时显示;如:威胁建模与 OWASP 代码审计)`,rowAriaDescription:`模板 {index} 一句话介绍`,rowPlaceholderText:`模板正文(点选后插入输入框,随你的消息一起发给模型)`,rowAriaText:`模板 {index} 正文`,importFailedUnknown:`导入失败(未知错误)`,importEmpty:`目录下没有符合条件的角色 .md(需含 name 的 frontmatter)`,importAllDone:`已从内置角色库(顶层 + 一层子目录)导入 {count} 条{skips},编辑后点「保存」生效`,importFromDone:`已从 {path} 导入 {count} 条{skips},编辑后点「保存」生效`,importTruncated:`(回执标记本次导入有内容被上限截断)`,importPlaceholder:`留空 = 导入内置角色库(顶层 + 一层子目录);或填 .md / 目录路径(须在允许根内)`,importAriaPath:`角色导入路径`,importBtnTitle:`留空 = 一键导入内置角色库(顶层 + 一层子目录);填路径 = 导入该 .md 或目录下的角色(路径须在允许根内)`,importing:`导入中…`,importRoles:`导入角色`,importErrorPrefix:`导入失败:`,importHint:`导入说明:留空导入内置角色库(agents/,顶层 + 一层子目录);填路径时只放行「会话 cwd」「内置角色库 agents/」与下方「导入允许目录」之内的路径——绝对路径默认拒绝,越界会直接报「导入路径越界」并回显解析后的路径。本卡没有会话上下文,故只能填内置库或已登记目录里的路径。目录扫描顶层 + 一层子目录 .md(跳过隐藏项),文件须含 name 的 frontmatter,正文将提炼为模板正文。`,skipDeeper:`{count} 个更深层 .md 未扫描(导入只扫两层)`,skipTooLarge:`{count} 个文件超字节上限被跳过`,skipUnreadable:`{count} 个文件读取失败`,skipUnnamed:`{count} 个非角色文件(frontmatter 无 name)`,skipEscaped:`{count} 个文件的真实目标在允许根之外(符号链接),已按安全策略排除`,skipSummary:`({list})`,skipSeparator:`,`,rootsHeading:`导入允许目录(importAllowRoots)`,rootsAriaRow:`导入允许目录 {index}`,rootsRowTitle:`该目录(含其子目录)内的角色 .md 可经「导入角色」读取`,rootsRemoveTitle:`移除此允许目录`,rootsRemove:`移除`,rootsAddPlaceholder:`新增一个允许导入的目录绝对路径`,rootsAddAria:`新增导入允许目录`,rootsAddTitle:`加入待保存的允许目录列表`,rootsAdd:`登记目录`,rootsHint:`绝对路径默认拒绝:只有「当前会话 cwd」「插件内置角色库 agents/」与本列表登记的目录之内可导入。设置页没有会话上下文,卡上填的路径必须落在内置库或本列表内。改完点底部「保存」生效。`,dockOrganizeEntry:`润色`,dockTemplatesEntry:`模板`,inputPlaceholder:`输入消息,或描述要整理的目录;✦ 一键润色可整理输入框草稿。`,organizeIdle:`一键润色`,organizeLoading:`润色中`,organizeFailedShort:`失败`,organizeIdleTitle:`结合当前目录润色输入框内容(主键直接润色;▾ 可选角色风格)`,organizeFailedTitle:`润色失败:{message}`,organizeErrContextFailed:`目录上下文读取失败:{message}`,organizeErrModelFailed:`读取模型失败:{message}`,organizeErrEmpty:`输入框为空,无内容可润色`,organizeErrTimeout:`润色请求超时:宿主没有在时限内回报结果`,organizeErrUnknownReason:`未知错误`,organizeErrUnknown:`润色失败(未知错误)`,organizeCaretAria:`选择润色的角色风格`,organizeCaretTitle:`按某个角色的风格润色(角色来自下方模板库)`,organizeMainAria:`润色输入框内容`,organizeRoleGroup:`角色`,organizeDirectItem:`直接润色(默认,不带角色)`,organizeNoTemplates:`无模板可选作角色风格`,organizeRoleItem:`以「{name}」的风格润色`,organizeWriteBackUnavailable:`输入框动作不可用,无法写回`,organizeWriteBackStale:`输入框内容已变化,润色结果未写回`,organizeBusyTitle:`输入框正在提交,暂不能润色`,templatesIdleTitle:`选择一条模板插入光标处(按分组展示)`,templatesBrokenTitle:`输入框动作不可用,无法插入`,templatesBusyTitle:`输入框正在提交,暂不能插入模板`,templatesGroupCommon:`通用`,templatesAria:`插入模板`,templatesEmptyHint:`无模板:在设置页「角色库」中添加或恢复默认`,builtinLoading:`正在载入内置角色模板…`,builtinFailed:`内置模板加载失败:{message}`,builtinBadPayload:`内置模板响应不是合法载荷`,builtinRetry:`重试`},en:{rolesSection:`Role library`,rolesEmptyTitle:`The role library is empty`,rolesEmptyNote:`Press "Import roles" to pull in the built-in library, or use "+ Add template" to write one by hand; while the list is empty the dropdown falls back to the built-in curated role set.`,rolesCount:`{count} items`,rolesHint:`The input-box "Template" dropdown and the "Polish" ▾ role menu share this one list; an empty list falls back to the built-in curated role set (generated from this plugin's agents/ role library). Leave the path empty and press "Import roles" to import the built-in role library (top level plus one sub-directory level); an explicit path is allowed within "session cwd + built-in role library + the import allowed directories below". Press "Save" after editing — it survives restarts.`,statusReadOnly:`Settings source is read-only: editing is disabled; the dropdown still uses the current list.`,statusNotReady:`Settings source is not ready yet: showing the list currently in effect, editing unlocks once it is ready.`,addTemplate:`+ Add template`,saveTitleDirty:`Write the template list and the import allowed directories (templates take effect in newly opened menus)`,saveTitleClean:`No unsaved changes`,saving:`Saving…`,save:`Save`,revert:`Revert`,resetTitle:`Restore defaults?`,resetDefault:`Restore defaults`,resetConfirmDescription:`Discards every customization of the template list and writes the built-in defaults back: immediate, irreversible (Revert only rolls back unsaved drafts). Registered import directories are untouched.`,resetConfirmAcknowledge:`I understand this writes immediately and cannot be undone`,resetConfirmCancel:`Cancel`,resetConfirmClose:`Close`,resetConfirmAction:`Restore defaults`,footHint:`Note: edits, additions and deletions are staged locally first and written in one go when you press "Save" (same for templates and import directories); entries whose name or body is empty are dropped on save (use the inline "Delete" instead); "Restore defaults" only rolls back the template list.`,saveFailed:`Save failed: `,newTemplateName:`New template {index}`,persistUnconfirmed:`{action} cannot be confirmed: the settings source is not ready (host read-back failed)`,persistRejected:`{action} did not take effect: the host rejected this write (current revision {revision})`,rowAriaEmoji:`Visual mark of template {index}`,rowEmojiTitle:`Optional visual mark (emoji or short text), shown before the name in the dropdown`,rowPlaceholderName:`Menu display name`,rowAriaName:`Name of template {index}`,rowPlaceholderGroup:`Group`,rowAriaGroup:`Group of template {index}`,rowGroupTitle:`The dropdown groups entries by this value; leave empty to fall into "General"`,rowDeleteTitle:`Delete this template`,rowDelete:`Delete`,rowPlaceholderDescription:`One-line intro (shown on dropdown hover; e.g. threat modelling and OWASP code auditing)`,rowAriaDescription:`One-line intro of template {index}`,rowPlaceholderText:`Template body (inserted into the input box and sent to the model with your message)`,rowAriaText:`Body of template {index}`,importFailedUnknown:`Import failed (unknown error)`,importEmpty:`No qualifying role .md in that directory (frontmatter must contain name)`,importAllDone:`Imported {count} entries from the built-in role library (top level plus one sub-directory level){skips}; press "Save" after editing`,importFromDone:`Imported {count} entries from {path}{skips}; press "Save" after editing`,importTruncated:` (the reply flagged some content as truncated by a limit)`,importPlaceholder:`Empty = import the built-in role library (top level plus one sub-directory level); or a .md / directory path (must be inside an allowed root)`,importAriaPath:`Role import path`,importBtnTitle:`Empty imports the built-in role library in one click (top level plus one sub-directory level); a path imports that .md or the roles in that directory (must be inside an allowed root)`,importing:`Importing…`,importRoles:`Import roles`,importErrorPrefix:`Import failed: `,importHint:`Import notes: an empty path imports the built-in role library (agents/, top level plus one sub-directory level); an explicit path is only allowed inside "session cwd", "built-in role library agents/" and the "import allowed directories" below — absolute paths are refused by default, and anything out of bounds reports "import path out of bounds" with the resolved path echoed back. This card has no session context, so explicit paths must live in the built-in library or a registered directory. Directory scans cover the top level plus one level of sub-directory .md files (hidden entries skipped), each file needs a frontmatter name, and its body is condensed into the template text.`,skipDeeper:`{count} deeper .md files were not scanned (imports cover two levels)`,skipTooLarge:`{count} files were skipped for exceeding the byte limit`,skipUnreadable:`{count} files could not be read`,skipUnnamed:`{count} non-role files (no name in frontmatter)`,skipEscaped:`{count} files whose real target lies outside the allowed roots (symlinks) were excluded by policy`,skipSummary:` ({list})`,skipSeparator:`, `,rootsHeading:`Import allowed directories (importAllowRoots)`,rootsAriaRow:`Import allowed directory {index}`,rootsRowTitle:`Role .md files inside this directory (and its subdirectories) can be read by "Import roles"`,rootsRemoveTitle:`Remove this allowed directory`,rootsRemove:`Remove`,rootsAddPlaceholder:`Absolute path of a directory newly allowed for imports`,rootsAddAria:`Add an import allowed directory`,rootsAddTitle:`Add it to the pending allowed-directory list`,rootsAdd:`Register directory`,rootsHint:`Absolute paths are refused by default: imports only succeed inside "the current session cwd", "the plugin's built-in role library agents/" and the directories registered below. The settings page has no session context, so a path typed here must fall inside the built-in library or this list. Press "Save" at the bottom to apply.`,dockOrganizeEntry:`Polish`,dockTemplatesEntry:`Templates`,inputPlaceholder:`Type a message or describe a directory; ✦ Polish can tidy the draft.`,organizeIdle:`Polish`,organizeLoading:`Polishing`,organizeFailedShort:`Failed`,organizeIdleTitle:`Polish the input-box content against the current directory (main key polishes directly; ▾ picks a role style)`,organizeFailedTitle:`Polish failed: {message}`,organizeErrContextFailed:`Failed to read the directory context: {message}`,organizeErrModelFailed:`Failed to read the model: {message}`,organizeErrEmpty:`The input box is empty; nothing to polish`,organizeErrTimeout:`Polish request timed out: the host did not reply in time`,organizeErrUnknownReason:`unknown error`,organizeErrUnknown:`Polish failed (unknown error)`,organizeCaretAria:`Choose a role style to polish with`,organizeCaretTitle:`Polish in a role's style (roles come from the template library below)`,organizeMainAria:`Polish the input-box content`,organizeRoleGroup:`Roles`,organizeDirectItem:`Polish directly (default, no role)`,organizeNoTemplates:`No templates available as a role style`,organizeRoleItem:`Polish in the style of "{name}"`,organizeWriteBackUnavailable:`Input-box actions unavailable; cannot write back`,organizeWriteBackStale:`The input box changed; the polished text was not applied`,organizeBusyTitle:`The input box is submitting; cannot polish right now`,templatesIdleTitle:`Pick a template to insert at the caret (shown grouped)`,templatesBrokenTitle:`Input-box actions unavailable; cannot insert`,templatesBusyTitle:`The input box is submitting; cannot insert a template`,templatesGroupCommon:`General`,templatesAria:`Insert a template`,templatesEmptyHint:`No templates: add or restore defaults under "Role library" in the settings page`,builtinLoading:`Loading built-in role templates…`,builtinFailed:`Failed to load built-in templates: {message}`,builtinBadPayload:`The built-in template response is not a valid payload`,builtinRetry:`Retry`}};function T(e){return e!==void 0&&typeof e.setDraft==`function`}function E(e){return e!==void 0&&typeof e.captureInsertion==`function`&&typeof e.insertText==`function`}function ee(e,n){let r=(0,t.useRef)(e),i=(0,t.useRef)(void 0);return(0,t.useEffect)(()=>{r.current=e;let t=i.current;t!==void 0&&(t.sessionId!==e.sessionId||t.actions!==e.actions||e.phase!==`plain`)&&(t.invalidated=!0)},[e]),(0,t.useEffect)(()=>()=>{let e=i.current;e!==void 0&&(e.invalidated=!0,i.current=void 0)},[]),{begin:()=>{let e={sessionId:r.current.sessionId,draftRev:r.current.draftRev,actions:r.current.actions,invalidated:!1};return i.current=e,e},finish:e=>{i.current===e&&(i.current=void 0)},commit:(e,t)=>{let i=r.current,{actions:a}=i;if(!T(a))throw Error(n.unavailable);if(t.sessionId!==i.sessionId||i.phase!==`plain`)throw Error(n.stale);let o=i.draftRev;if(E(a)&&(o=a.captureInsertion().draftRev),t.invalidated||o!==t.draftRev)throw Error(n.stale);a.setDraft(e)}}}const D=`dirPrepOrganize`,O=`remote.${D}`,k=`@jayyuen66/dsh-dir-prep-organize`,A=`session request requires a string sessionId`,te=r.z.object({sessionId:r.z.string({error:A})},{error:A}),j=`organize request requires string sessionId, prompt and entriesSummary`,ne=r.z.object({sessionId:r.z.string({error:j}),prompt:r.z.string({error:j}),entriesSummary:r.z.string({error:j}),roleText:r.z.string({error:`organize request roleText must be a string when present`}).optional()},{error:j}),M=`import request requires string path and sessionId`,re=r.z.object({path:r.z.string({error:M}),sessionId:r.z.string({error:M})},{error:M}),ie={mode:`strict`,typeSymbol:`${k}#session-request`,create:()=>({parse(e){return(0,n.parseOrThrow)(te,e,r.z.prettifyError)}})},ae=[{id:`${k}#${D}/defaults`,service:D,namespace:D,method:`defaults`,invocation:{kind:`direct`},parameters:[],result:{mode:`src-json`}},{id:`${k}#${D}/context`,service:D,namespace:D,method:`context`,invocation:{kind:`direct`},parameters:[{name:`request`,wire:`request`,source:`json`,codec:ie}],result:{mode:`src-json`}},{id:`${k}#${D}/model`,service:D,namespace:D,method:`model`,invocation:{kind:`direct`},parameters:[{name:`request`,wire:`request`,source:`json`,codec:ie}],result:{mode:`src-json`}},{id:`${k}#${D}/organize`,service:D,namespace:D,method:`organize`,invocation:{kind:`direct`},parameters:[{name:`request`,wire:`request`,source:`json`,codec:{mode:`strict`,typeSymbol:`${k}#organize-request`,create:()=>({parse(e){let t=(0,n.parseOrThrow)(ne,e,r.z.prettifyError);return t.roleText===void 0?{sessionId:t.sessionId,prompt:t.prompt,entriesSummary:t.entriesSummary}:{...t,roleText:t.roleText}}})}}],result:{mode:`src-json`}},{id:`${k}#${D}/importTemplates`,service:D,namespace:D,method:`importTemplates`,invocation:{kind:`direct`},parameters:[{name:`request`,wire:`request`,source:`json`,codec:{mode:`strict`,typeSymbol:`${k}#import-request`,create:()=>({parse(e){return(0,n.parseOrThrow)(re,e,r.z.prettifyError)}})}}],result:{mode:`src-json`}}],oe=e=>(0,n.isRecord)(e)&&typeof e.defaults==`function`&&typeof e.context==`function`&&typeof e.model==`function`&&typeof e.organize==`function`&&typeof e.importTemplates==`function`,se=e=>{if(!(0,n.isRecord)(e)||typeof e.ok!=`boolean`)throw TypeError(`Typert Remote 应答不是 RemoteResult:缺少布尔字段 ok`);if(!e.ok){let{error:t}=e;throw!(0,n.isRecord)(t)||typeof t.code!=`string`||typeof t.message!=`string`?TypeError(`Typert Remote 应答的 error 分支缺 code/message`):Error(`${t.code}: ${t.message}`)}if(!(`value`in e))throw TypeError(`Typert Remote 应答的 ok 分支缺 value 字段`);return e.value};function ce(e,t){let n,r=async()=>{n??=t.$mount({package:k,descriptors:ae});try{await n}catch(e){throw n=void 0,e}let r=e.get?.(O,!1);if(!oe(r))throw Error(`${O} 未提供:宿主网关没有挂上这枚命名空间`);return r},i=async e=>{let t=await r();return se(await e(t))};return{defaults:async()=>i(e=>e.defaults()),context:async e=>i(t=>t.context({sessionId:e})),model:async e=>i(t=>t.model({sessionId:e})),organize:async e=>i(t=>t.organize(e)),importTemplates:async e=>i(t=>t.importTemplates(e))}}function le(e){let t=(0,n.remoteMounterOf)(e,!1);return t===void 0?void 0:ce(e,t)}const N=`dir-prep-organize`,P=125e3,F=`dpic-rowhead`,I=`dpic-importpath`,L=`conversation.input.right`,ue=`conversation.input.placeholder`;function de(e){let{name:t,isDir:r,sizeBytes:i,snippet:a}=(0,n.isRecord)(e)?e:{};return{name:typeof t==`string`?t:``,isDir:r===!0,sizeBytes:typeof i==`number`?i:0,...typeof a==`string`?{snippet:a}:{}}}function R(e,t){let n=e[t];return typeof n==`string`?n:void 0}function z(e,t){return e===void 0?{}:{[t]:e}}function fe(e){return[[`skipDeeper`,e.deeper],[`skipTooLarge`,e.tooLarge],[`skipUnreadable`,e.unreadable],[`skipUnnamed`,e.unnamed],[`skipEscaped`,e.escaped]]}function pe(e){let t=(0,n.isRecord)(e)?e:{},{ok:r,truncated:i,entries:a}=t,o=Array.isArray(a)?a.map(e=>de(e)):void 0;return{ok:r===!0,...z(R(t,`error`),`error`),...z(R(t,`cwd`),`cwd`),...i===!0?{truncated:!0}:{},...o===void 0?{}:{entries:o}}}function me(e){let t=(0,n.isRecord)(e)?e:{};return{ok:t.ok===!0,...z(R(t,`error`),`error`),...z(R(t,`provider`),`provider`),...z(R(t,`model`),`model`),...z(R(t,`reasoningEffort`),`reasoningEffort`)}}function he(e){let t=(0,n.isRecord)(e)?e:{};return{ok:t.ok===!0,...z(R(t,`error`),`error`),...z(R(t,`content`),`content`)}}function B(e){return typeof e==`number`&&e>0?e:0}function ge(e){return{tooLarge:B(e.tooLarge),unreadable:B(e.unreadable),deeper:B(e.deeper),unnamed:B(e.unnamed),escaped:B(e.escaped)}}function _e(e,t){if(t===void 0)return``;let n=[];for(let[r,i]of fe(t))i>0&&n.push(e(r,{count:i}));return n.length===0?``:e(`skipSummary`,{list:n.join(e(`skipSeparator`))})}function ve(e){let{ok:t,error:r,count:i,truncated:a,skipped:o,entries:s}=(0,n.isRecord)(e)?e:{},c=Array.isArray(s)?f(s):void 0;return{ok:t===!0,...typeof r==`string`?{error:r}:{},...typeof i==`number`?{count:i}:{},...a===!0?{truncated:!0}:{},...(0,n.isRecord)(o)?{skipped:ge(o)}:{},...c===void 0?{}:{entries:c}}}function ye(e){let t=e.entries??[],n=[`当前目录: ${e.cwd??`(未提供)`}`],r=t.filter(e=>!e.isDir),i=t.filter(e=>e.isDir);n.push(`文件 ${r.length} 个, 目录 ${i.length} 个`),e.truncated===!0&&n.push(`(以上条目按上限截断,目录树并未完整列出,勿据此判断文件不存在)`);for(let e of i)n.push(`📁 ${e.name}/`);for(let e of r){let t=e.sizeBytes>1024?`${(e.sizeBytes/1024).toFixed(1)}KB`:`${e.sizeBytes}B`,r=`📄 ${e.name} (${t})`;e.snippet!==void 0&&e.snippet.length>0&&(r+=` ↳ ${e.snippet.replaceAll(`
|
|
10
10
|
`,` `)}`),n.push(r)}return n.join(`
|
|
11
11
|
`)}const V={phase:`idle`,list:[],error:``};let H=V,U=null,W=0;const G=new Set;function K(e){if(e===H)return H;H=e;for(let e of G)e();return e}let q;function J(){if(q===void 0)throw Error(`远程读面不可用:宿主网关没有挂上 ${D}`);return q}var Y=class extends Error{messageKey;params;constructor(e,t={}){super(e),this.name=`LocalizedOrganizeError`,this.messageKey=e,this.params=t}};async function X(e,t){return(0,n.raceTimeout)(e,t,()=>new Y(`organizeErrTimeout`))}async function Z(e=()=>w.zh.builtinBadPayload){if(H.phase===`ready`)return H;if(U!==null)return await U;let t=W;return U=(async()=>{K({phase:`loading`,list:H.list,error:``});let r;try{let t=await X(J().defaults(),P),i=(0,n.isRecord)(t)?t:void 0,a=i?.error;r=i?.ok===!0?{phase:`ready`,list:f(i.templates),error:``}:{phase:`error`,list:[],error:typeof a==`string`&&a.trim()!==``?a:e(`builtinBadPayload`)}}catch(e){r={phase:`error`,list:[],error:(0,n.errorText)(e)}}finally{W===t&&(U=null)}return W===t?K(r):r})(),await U}function be(e){return G.add(e),()=>{G.delete(e)}}function xe(e,n){return e.fromSettings||e.builtinPhase===`ready`?[]:e.builtinPhase===`error`?[{id:`builtin-state`,label:(0,t.createElement)(`span`,{"data-field":`dpi-builtin-state`},n(`builtinFailed`,{message:e.builtinError})),disabled:!0},{id:`builtin-retry`,label:n(`builtinRetry`)}]:[{id:`builtin-state`,label:(0,t.createElement)(`span`,{"data-field":`dpi-builtin-state`},n(`builtinLoading`)),disabled:!0}]}function Se(e,t,n,r){if(!e.ok)throw new Y(`organizeErrContextFailed`,{message:e.error??r});if(!t.ok||t.provider===void 0||t.model===void 0)throw new Y(`organizeErrModelFailed`,{message:t.error??r});if(n.trim().length===0)throw new Y(`organizeErrEmpty`)}async function Ce(e){let{ctxRes:t,prompt:n,sessionId:r,roleText:i,timeoutMs:a}=e,o=ye(t),s=he(await X(J().organize({sessionId:r,prompt:n,entriesSummary:o,...i===void 0?{}:{roleText:i}}),a));if(!s.ok||s.content===void 0)throw s.error===void 0?new Y(`organizeErrUnknown`):Error(s.error);return s.content}async function we(e){let t=J(),[n,r]=await Promise.all([X(t.context(e.sessionId),P),X(t.model(e.sessionId),P)]),i=pe(n);return Se(i,me(r),e.prompt,e.unknownReason),Ce({ctxRes:i,prompt:e.prompt,sessionId:e.sessionId,roleText:e.roleText,timeoutMs:e.timeoutMs})}function Te(e){let{value:t,status:n,writable:r,revision:i}=e;return{value:t??{},ready:n===`ready`,writable:r,revision:i??0}}function Ee(e){return e.templates}function De(e){return e.importAllowRoots}function Oe(e){let t=null,n=H,r={templates:V.list,fromSettings:!1,builtinPhase:`idle`,builtinError:``,allowRoots:[],ready:!1,writable:!1,organizeTimeoutMs:void 0};return{getSnapshot(){let i=e.getSnapshot();if(i===t&&H===n)return r;t=i,n=H;let a=Te(i),o=Ee(a.value),s=Array.isArray(o)&&o.length>0;return r={templates:s?f(o):n.list,fromSettings:s,builtinPhase:n.phase,builtinError:n.error,allowRoots:v(De(a.value)),ready:a.ready,writable:a.writable,organizeTimeoutMs:S(a.value)},r},subscribe(t){let n=e.subscribe(t),r=be(t);return()=>{n(),r()}},readBack(){let t=Te(e.getSnapshot());return{ready:t.ready,revision:t.revision,templates:f(Ee(t.value)),allowRoots:v(De(t.value))}}}}function ke(e,t,r,i,a){let o,s=a?.treatEmptyAsReverted===!0&&t.templates.length===0&&r.length>0;return t.ready?!s&&!(0,n.formValueEquals)(t.templates,r)&&(o=e(`persistRejected`,{action:i,revision:t.revision})):o=e(`persistUnconfirmed`,{action:i}),o}function Ae(e,t,r,i){let a;return t.ready?(0,n.formValueEquals)(t.allowRoots,r)||(a=e(`persistRejected`,{action:i,revision:t.revision})):a=e(`persistUnconfirmed`,{action:i}),a}function je(e){return`${e.emoji===``?``:`${e.emoji} `}${e.name}`}function Me(e,t){let n=new Map;for(let r of e){let e=r.group.trim()===``?t(`templatesGroupCommon`):r.group,i=n.get(e)??[];i.push(r),n.set(e,i)}return Array.from(n.entries(),([e,t])=>({group:e,items:t}))}function Q(e,t=!1){let n=[[`d`,e],[`fill`,`none`],[`stroke`,`currentColor`],[`strokeWidth`,1.5],[`strokeLinecap`,`round`]];return t&&n.push([`strokeLinejoin`,`round`]),Object.fromEntries(n)}function Ne(){return Object.fromEntries([[`cx`,7],[`cy`,7],[`r`,5.5],[`fill`,`none`],[`stroke`,`currentColor`],[`strokeWidth`,1.5],[`strokeDasharray`,`26 10`],[`strokeLinecap`,`round`]])}function Pe(){return(0,t.createElement)(`svg`,{width:14,height:14,viewBox:`0 0 14 14`,"aria-hidden":!0},(0,t.createElement)(`path`,{d:`M7 1.6l1.45 3.95L12.4 7 8.45 8.45 7 12.4 5.55 8.45 1.6 7l3.95-1.45Z`,fill:`currentColor`,stroke:`none`}))}function Fe(){return(0,t.createElement)(`svg`,{width:14,height:14,viewBox:`0 0 14 14`,"aria-hidden":!0,className:`dpi-spin`},(0,t.createElement)(`circle`,Ne()))}function Ie(){return(0,t.createElement)(`svg`,{width:14,height:14,viewBox:`0 0 14 14`,"aria-hidden":!0},(0,t.createElement)(`path`,Q(`M3 3l8 8M11 3l-8 8`)))}function Le(){return(0,t.createElement)(`svg`,{width:14,height:14,viewBox:`0 0 14 14`,"aria-hidden":!0},(0,t.createElement)(`path`,Q(`M2.5 3.5h9M2.5 7h9M2.5 10.5h5.5`)))}function Re(){return(0,t.createElement)(`svg`,{width:16,height:16,viewBox:`0 0 16 16`,"aria-hidden":!0},(0,t.createElement)(`path`,Q(`M3 6l5 5 5-5`,!0)))}async function ze(e){let{t,loading:r,inFlight:i,seq:a,prompt:o,sessionId:s,timeoutMs:c,roleText:l,setLoading:u,setMenuOpen:d,setFailed:f,flashTimer:p,writeDraft:m}=e;if(r||i.current)return;i.current=!0,a.current+=1;let h=a.current;u(!0),f(void 0),d(!1);try{let e=await we({prompt:o,sessionId:s,...l===void 0?{}:{roleText:l},timeoutMs:c,unknownReason:t(`organizeErrUnknownReason`)});if(a.current!==h)return;m(e)}catch(e){if(a.current!==h)return;f(e instanceof Y?t(e.messageKey,e.params):(0,n.errorText)(e)),p.current!==null&&clearTimeout(p.current),p.current=setTimeout(()=>{f(void 0)},4e3)}finally{i.current=!1,a.current===h&&u(!1)}}const Be=`organizeWriteBackUnavailable`;function Ve(e){let{t:n,icon:r,label:i,state:a,errClass:o,errTitle:s,loading:c,canWrite:l,onRun:u}=e;return(0,t.createElement)(`button`,{type:`button`,className:`dpi-btn dpi-main${o}`,"aria-label":n(`organizeMainAria`),title:s,"data-field":`dpi-organize-btn`,"data-state":a,disabled:c||!l,onClick:()=>{u()}},r,i)}function He(e,n){let{t:r,errClass:i,menuOpen:a,loading:o,onToggleMenu:s}=e;return(0,t.createElement)(`button`,{ref:n,type:`button`,className:`dpi-btn dpi-caret${i}`,"aria-label":r(`organizeCaretAria`),"aria-haspopup":`menu`,"aria-expanded":a,title:r(`organizeCaretTitle`),"data-field":`dpi-organize-caret`,"data-state":a?`open`:`idle`,disabled:o,onClick:s},(0,t.createElement)(Re))}function Ue(e){let{t:n,templates:r,roleGroupLabel:i,directItemLabel:a,noTemplatesLabel:o,builtinEntries:s,loading:c,canWrite:l,errTitle:u}=e,d=c||!l,f=l?void 0:u,p=[{type:`label`,id:`roles`,text:i},{id:`direct`,label:(0,t.createElement)(`span`,f===void 0?null:{title:f},a),disabled:d}];if(r.length===0)return p.push(...s,{id:`empty`,label:o,disabled:!0}),p;for(let e of r){let r=`${e.emoji===``?``:`${e.emoji} `}${n(`organizeRoleItem`,{name:e.name})}`;p.push({id:`tpl:${e.id}`,label:(0,t.createElement)(`span`,{title:f??(e.description===``?e.text:e.description)},r),disabled:d})}return p}function We(e,n,r){return e===void 0?n?{icon:(0,t.createElement)(Fe),label:r(`organizeLoading`),state:`loading`}:{icon:(0,t.createElement)(Pe),label:r(`organizeIdle`),state:`idle`}:{icon:(0,t.createElement)(Ie),label:r(`organizeFailedShort`),state:`error`}}function Ge(){return function(n){let[r,a]=(0,t.useState)(!1),[o,s]=(0,t.useState)(void 0),[c,l]=(0,t.useState)(!1),u=(0,t.useRef)(0),d=(0,t.useRef)(!1),f=(0,t.useRef)(null),p=(0,t.useRef)(null),m=n.useInput===void 0?``:n.useInput(e=>e.draft)??``,h=n.useInput===void 0?0:n.useInput(e=>e.draftRev),g=n.useInput===void 0?`plain`:n.useInput(e=>e.phase),_=n.useCard(e=>e),v=ee({sessionId:n.sessionId??``,actions:n.inputActions,draftRev:h,phase:g},{unavailable:n.t(Be),stale:n.t(`organizeWriteBackStale`)});(0,t.useEffect)(()=>()=>{u.current+=1,f.current!==null&&clearTimeout(f.current)},[]);async function y(e){let t=v.begin();try{await ze({t:n.t,loading:r,inFlight:d,seq:u,prompt:m,sessionId:n.sessionId??``,timeoutMs:C(_.organizeTimeoutMs),roleText:e,setLoading:a,setMenuOpen:l,setFailed:s,flashTimer:f,writeDraft:e=>{v.commit(e,t)}})}finally{v.finish(t)}}function b(){_.fromSettings||Z(n.t),l(e=>!e)}let x=We(o,r,n.t),S=T(n.inputActions),w=S&&g===`plain`,E=n.t(`organizeIdleTitle`);o===void 0?S?g!==`plain`&&(E=n.t(`organizeBusyTitle`)):E=n.t(Be):E=n.t(`organizeFailedTitle`,{message:o});let D={t:n.t,errTitle:E,icon:x.icon,label:x.label,state:x.state,errClass:o===void 0?``:` dpi-btn-err`,roleGroupLabel:n.t(`organizeRoleGroup`),directItemLabel:n.t(`organizeDirectItem`),noTemplatesLabel:n.t(`organizeNoTemplates`),builtinEntries:xe(_,n.t),loading:r,menuOpen:c,canWrite:w,templates:_.templates,onRun:y,onToggleMenu:b},O=Ue(D),k=He(D,p),A=(0,t.createElement)(e.Menu,{open:c,anchor:k,items:O,side:`top`,portal:!0,anchorRef:p,className:`dpi-caretWrap`,listClassName:`dpi-polish-menu dpi-organize-menu`,returnFocus:()=>p.current,onClose:()=>{l(!1)},onSelect:e=>{l(!1),i(e,_.templates,y,()=>{Z(n.t)})}});return(0,t.createElement)(`span`,{className:`dpi-wrap dpi-split`},Ve(D),A)}}function Ke(e,n){let{templates:r}=e,i=Me(r,n),a=[];if(r.length===0){let t=xe(e,n);return a.push(...t),t.length===0&&a.push({id:`templates-empty`,label:n(`templatesEmptyHint`),disabled:!0}),a}for(let e of i){a.push({type:`label`,id:`group:${e.group}`,text:e.group});for(let n of e.items)a.push({id:`tpl:${n.id}`,label:(0,t.createElement)(`span`,{title:n.description===``?n.text:n.description},je(n))})}return a}function qe(){return function(n){let[r,i]=(0,t.useState)(!1),o=(0,t.useRef)(null),s=n.useInput===void 0?`plain`:n.useInput(e=>e.phase),c=n.useCard(e=>e),{templates:l}=c;function u(e){i(!1);let t=n.inputActions;E(t)&&t.insertText(e,t.captureInsertion())}let d=E(n.inputActions),f=d&&s===`plain`,p=n.t(`templatesBrokenTitle`);f?p=n.t(`templatesIdleTitle`):d&&(p=n.t(`templatesBusyTitle`));let m=Ke(c,n.t),h=(0,t.createElement)(`button`,{ref:o,type:`button`,className:`dpi-btn`,"aria-label":n.t(`templatesAria`),"aria-haspopup":`menu`,"aria-expanded":r,title:p,"data-field":`dpi-template-btn`,"data-state":r?`open`:`idle`,disabled:!f,onClick:()=>{c.fromSettings||Z(n.t),i(e=>!e)}},(0,t.createElement)(Le),n.t(`dockTemplatesEntry`));return(0,t.createElement)(e.Menu,{open:r,anchor:h,items:m,side:`top`,portal:!0,anchorRef:o,listClassName:`dpi-polish-menu dpi-template-menu`,returnFocus:()=>o.current,onClose:()=>{i(!1)},onSelect:e=>{a(e,l,u,()=>{Z(n.t)})&&i(!1)}})}}function Je(){let e;try{e=`tpl-${crypto.randomUUID()}`}catch{e=`tpl-${Date.now().toString(36)}-${Math.floor(Math.random()*1e9).toString(36)}`}return e}function Ye(e){let{t:n,rowNum:r,disabled:i,values:a,setters:o}=e,s=(0,t.createElement)(`span`,{className:`dpic-idx`},`#${r}`),c=(0,t.createElement)(`input`,{type:`text`,className:`dpic-emoji dsu-input`,value:a.emoji,placeholder:`😀`,disabled:i,"aria-label":n(`rowAriaEmoji`,{index:r}),title:n(`rowEmojiTitle`),onChange:e=>{o.emoji(e.target.value)},onBlur:e.onBlur}),l=(0,t.createElement)(`input`,{type:`text`,className:`dpic-name dsu-input`,value:a.name,placeholder:n(`rowPlaceholderName`),disabled:i,"aria-label":n(`rowAriaName`,{index:r}),onChange:e=>{o.name(e.target.value)},onBlur:e.onBlur}),u=(0,t.createElement)(`input`,{type:`text`,className:`dpic-group dsu-input`,value:a.group,placeholder:n(`rowPlaceholderGroup`),disabled:i,"aria-label":n(`rowAriaGroup`,{index:r}),title:n(`rowGroupTitle`),onChange:e=>{o.group(e.target.value)},onBlur:e.onBlur}),d=(0,t.createElement)(`button`,{type:`button`,className:`dpic-del dsu-btn dsu-btnDanger`,disabled:i,title:n(`rowDeleteTitle`),onClick:()=>{e.onDelete(e.templateId)}},n(`rowDelete`)),f=(0,t.createElement)(`input`,{type:`text`,className:`dpic-desc dsu-input`,value:a.description,placeholder:n(`rowPlaceholderDescription`),disabled:i,"aria-label":n(`rowAriaDescription`,{index:r}),onChange:e=>{o.description(e.target.value)},onBlur:e.onBlur}),p=(0,t.createElement)(`textarea`,{className:`dpic-text dsu-input dsu-textarea dsu-mono`,value:a.text,rows:6,placeholder:n(`rowPlaceholderText`),disabled:i,"aria-label":n(`rowAriaText`,{index:r}),onChange:e=>{o.text(e.target.value)},onBlur:e.onBlur});return(0,t.createElement)(`div`,{className:`dpic-row`},(0,t.createElement)(`div`,{className:F},s,c,l,u,d),f,p)}function Xe(e){let{t:n}=e,[r,i]=(0,t.useState)(e.template.name),[a,o]=(0,t.useState)(e.template.emoji),[s,c]=(0,t.useState)(e.template.group),[l,u]=(0,t.useState)(e.template.description),[d,f]=(0,t.useState)(e.template.text),p=String(e.index+1);(0,t.useEffect)(()=>{i(e.template.name),o(e.template.emoji),c(e.template.group),u(e.template.description),f(e.template.text)},[e.template.id,e.template.name,e.template.emoji,e.template.group,e.template.description,e.template.text]);function m(){let t=r.trim(),n=d.trim();if(t===``||n===``)return;let i=a.trim(),o=s.trim(),c=l.trim();(t!==e.template.name||i!==e.template.emoji||o!==e.template.group||c!==e.template.description||n!==e.template.text)&&e.onCommit(e.template.id,{name:t,emoji:i,group:o,description:c,text:n})}return Ye({t:n,rowNum:p,disabled:e.disabled,templateId:e.template.id,values:{name:r,emoji:a,group:s,description:l,text:d},setters:{name:i,emoji:o,group:c,text:f,description:u},onBlur:m,onDelete:e.onDelete})}function Ze(e){let{t:r}=e,[i,a]=(0,t.useState)(``),[o,s]=(0,t.useState)(!1),[c,l]=(0,t.useState)(``),[u,d]=(0,t.useState)(``);async function f(){if(o)return;let t=i.trim();s(!0),d(``),l(``);try{let n=ve(await X(J().importTemplates({path:t,sessionId:``}),P));if(!n.ok||n.entries===void 0)throw Error(n.error??r(`importFailedUnknown`));let i=n.entries.length,o=B(n.count),s=o===0?i:Math.min(o,i);if(s===0){d(r(`importEmpty`));return}e.onImported(n.entries),a(``);let c=n.truncated===!0?r(`importTruncated`):``,u=`${_e(r,n.skipped)}${c}`;l(t.length===0?r(`importAllDone`,{count:s,skips:u}):r(`importFromDone`,{path:t,count:s,skips:u}))}catch(e){d((0,n.errorText)(e))}finally{s(!1)}}let p=e.editable&&!o,m=(0,t.createElement)(`input`,{type:`text`,className:`${I} dsu-input`,value:i,placeholder:r(`importPlaceholder`),disabled:!p,"aria-label":r(`importAriaPath`),onChange:e=>{a(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&f()}}),h=(0,t.createElement)(`button`,{type:`button`,className:`dsu-btn`,disabled:!p,title:r(`importBtnTitle`),onClick:f},r(o?`importing`:`importRoles`)),g=c===``?null:(0,t.createElement)(`div`,{className:`dsu-hint`},c),_=u===``?null:(0,t.createElement)(`div`,{className:`dsu-hint dsu-error`},`${r(`importErrorPrefix`)}${u}`),v=(0,t.createElement)(`div`,{className:`dsu-hint`},r(`importHint`)),y=o?(0,t.createElement)(n.ProgressBar,{label:r(`importing`)}):null;return(0,t.createElement)(`div`,{className:`dpic-importrow`},(0,t.createElement)(`div`,{className:F},m,h),y,g,_,v)}function Qe(e){let{t:n}=e,[r,i]=(0,t.useState)(``),a=!e.disabled&&r.trim().length>0,o=n(`rootsRowTitle`),s=n(`rootsRemoveTitle`),c=n(`rootsRemove`),l=e.roots.map((r,i)=>{let a=n(`rootsAriaRow`,{index:i+1}),l=(0,t.createElement)(`input`,{type:`text`,className:`${I} dsu-input`,value:r,placeholder:`/Users/me/roles`,disabled:e.disabled,"aria-label":a,title:o,onChange:t=>{e.onChangeRoot(i,t.target.value)}}),u=(0,t.createElement)(`button`,{type:`button`,className:`dpic-del dsu-btn dsu-btnDanger`,disabled:e.disabled,title:s,onClick:()=>{e.onDeleteRoot(i)}},c);return(0,t.createElement)(`div`,{className:F,key:`allow-root-${String(i)}`},l,u)}),u=n(`rootsAddPlaceholder`),d=n(`rootsAddAria`),f=n(`rootsAddTitle`),p=n(`rootsAdd`),m=(0,t.createElement)(`input`,{type:`text`,className:`${I} dsu-input`,value:r,placeholder:u,disabled:e.disabled,"aria-label":d,onChange:e=>{i(e.target.value)},onKeyDown:t=>{t.key===`Enter`&&a&&(e.onAddRoot(r.trim()),i(``))}}),h=(0,t.createElement)(`button`,{type:`button`,className:`dsu-btn`,disabled:!a,title:f,onClick:()=>{e.onAddRoot(r.trim()),i(``)}},p),g=(0,t.createElement)(`div`,{className:F},m,h);return(0,t.createElement)(`div`,{className:`dpic-importrow`,"data-field":`allow-roots`},(0,t.createElement)(`div`,{className:`dsu-hint`},n(`rootsHeading`)),l,g,(0,t.createElement)(`div`,{className:`dsu-hint`},n(`rootsHint`)))}function $e(n){let{t:r,busy:i,onCancel:a,onConfirm:o}=n,[s,c]=(0,t.useState)(!1);return(0,t.createElement)(e.RiskConfirmation,{open:!0,title:r(`resetTitle`),description:r(`resetConfirmDescription`),acknowledgeLabel:r(`resetConfirmAcknowledge`),cancelLabel:r(`resetConfirmCancel`),closeLabel:r(`resetConfirmClose`),confirmLabel:r(`resetConfirmAction`),acknowledged:s,disabled:i,onAcknowledgedChange:c,onCancel:a,onConfirm:o})}function et(e){let{foot:n,editable:r,busy:i}=e;return(0,t.createElement)(`div`,{className:`dpic-toolbar`},(0,t.createElement)(`button`,{type:`button`,className:`dsu-btn`,disabled:!r,onClick:e.onAdd},n.add),(0,t.createElement)(`button`,{type:`button`,className:`dsu-btn dsu-btnDanger`,disabled:!r||i,title:n.resetTitle,onClick:e.onReset},n.reset))}function tt(e,t){return{title:e(`rolesSection`),hint:e(`rolesHint`),count:e(`rolesCount`,{count:String(t)})}}function nt(e){return{add:e(`addTemplate`),save:e(`save`),saving:e(`saving`),revert:e(`revert`),reset:e(`resetDefault`),saveTitleDirty:e(`saveTitleDirty`),saveTitleClean:e(`saveTitleClean`),resetTitle:e(`resetTitle`)}}function rt(e,t){let n;return n=e.ready?e.writable?``:t(`statusReadOnly`):t(`statusNotReady`),n}function it(e,t,n,r,i){function a(e,n){r(t.map(t=>t.id===e?{...t,...n}:t))}function o(e){r(t.filter(t=>t.id!==e))}function s(){r([...t,{id:Je(),name:e(`newTemplateName`,{index:t.length+1}),description:``,text:``,group:``,emoji:``}])}function c(e){r(t=>l(t,e))}function u(e,t){i(n.map((n,r)=>r===e?t:n))}function d(e){i(n.filter((t,n)=>n!==e))}function f(e){i([...n,e])}return{onCommit:a,onDelete:o,onAdd:s,onImported:c,onRootChange:u,onRootDelete:d,onRootAdd:f}}function $(e,t,n,r,i){let a=ke(e,t,n,e(r),i);if(a!==void 0)throw Error(a)}function at(e,t,n){let r=Ae(e,t,n,e(`save`));if(r!==void 0)throw Error(r)}function ot(e){let{t,editable:r,dirty:i,rootsDirty:a,anythingDirty:o,templates:s,allowRoots:c,draft:l,rootsDraft:u,set:d,unset:p,readBack:m,setDraft:h,setDraftFor:g,setRootsDraft:_,setBusy:y,setSaveError:b}=e;function x(e){console.error(`[dir-prep-organize] templates settings write failed:`,e),b((0,n.errorText)(e))}async function S(){if(!r||!o)return;y(!0),b(``);let e=f(l),n=v(u);try{i&&(await d(`templates`,e),$(t,m(),e,`save`)),a&&(await d(`importAllowRoots`,n),at(t,m(),n)),y(!1),h(t=>t===l?e:t),_(e=>e===u?n:e)}catch(e){y(!1),x(e)}}function C(){h(s),_(c),b(``)}function w(){y(!0),(async()=>{try{let e=await Z(t);if(e.phase!==`ready`)throw Error(e.error);await p(`templates`),$(t,m(),e.list,`resetDefault`,{treatEmptyAsReverted:!0}),b(``),h(e.list),g(e.list),_(c)}catch(e){x(e)}finally{y(!1)}})()}return{onSave:S,onDiscard:C,onReset:w}}function st(e){let{t:r,statusHint:i,draft:a,rootsDraft:o,foot:s,editable:c,anythingDirty:l,busy:u,saveError:d,onRequestReset:f}=e,{onCommit:p,onDelete:m,onAdd:h,onImported:g,onRootChange:_,onRootDelete:v,onRootAdd:y}=e.draftActions,{onSave:b,onDiscard:x}=e.persistActions,S=(0,t.createElement)(`p`,{className:`dsu-hint`},r(`footHint`)),C=(0,t.createElement)(n.EmptyState,{title:r(`rolesEmptyTitle`),plain:!0},r(`rolesEmptyNote`)),w=(0,t.createElement)(n.SaveBar,{dirty:l,busy:u,writable:c,error:d===``?null:`${r(`saveFailed`)}${d}`,saveLabel:r(`save`),savingLabel:r(`saving`),revertLabel:r(`revert`),dirtyLabel:r(`saveTitleDirty`),cleanLabel:r(`saveTitleClean`),readOnlyLabel:r(`statusReadOnly`),onSave:()=>{b()},onDiscard:x});return(0,t.createElement)(n.CardForm,null,i===``?null:(0,t.createElement)(`p`,{className:`dsu-hint`},i),(0,t.createElement)(n.Section,tt(r,a.length),(0,t.createElement)(et,{foot:s,editable:c,busy:u,onAdd:h,onReset:f}),a.length===0?C:a.map((e,n)=>(0,t.createElement)(Xe,{key:e.id,t:r,index:n,template:e,disabled:!c||u,onCommit:p,onDelete:m})),(0,t.createElement)(Ze,{t:r,editable:c&&!u,onImported:g}),(0,t.createElement)(Qe,{t:r,roots:o,disabled:!c||u,onChangeRoot:_,onDeleteRoot:v,onAddRoot:y}),S),w)}function ct(e){let{t:r}=e,[i,a]=(0,t.useState)(!1),[o,s]=(0,t.useState)(``),[c,l]=(0,t.useState)(!1),u=nt(r),d=e.useCard(e=>e),{templates:f}=d,p=d.ready&&d.writable,m=rt(d,r);(0,t.useEffect)(()=>{d.fromSettings||Z(r)},[d.fromSettings,r]);let[h,g]=(0,t.useState)(f),[_,y]=(0,t.useState)(f);(0,t.useEffect)(()=>{_!==f&&(y(f),g(e=>(0,n.formValueEquals)(e,_)?f:e))},[f,_]);let[b,x]=(0,t.useState)(d.allowRoots),[S,C]=(0,t.useState)(d.allowRoots);(0,t.useEffect)(()=>{S!==d.allowRoots&&(C(d.allowRoots),x(e=>(0,n.formValueEquals)(e,S)?d.allowRoots:e))},[S,d.allowRoots]);let w=!(0,n.formValueEquals)(h,f),T=!(0,n.formValueEquals)(v(b),d.allowRoots),E=w||T,ee=it(r,h,b,g,x),D=ot({t:r,editable:p,dirty:w,rootsDirty:T,anythingDirty:E,templates:f,allowRoots:d.allowRoots,draft:h,rootsDraft:b,set:e.set,unset:e.unset,readBack:e.readBack,setDraft:g,setDraftFor:y,setRootsDraft:x,setBusy:l,setSaveError:s}),O=st({t:r,statusHint:m,draft:h,rootsDraft:b,foot:u,editable:p,anythingDirty:E,busy:c,saveError:o,onRequestReset:()=>{a(!0)},draftActions:ee,persistActions:D});return(0,t.createElement)(t.Fragment,null,O,i?(0,t.createElement)($e,{t:r,busy:c,onCancel:()=>{a(!1)},onConfirm:()=>{a(!1),D.onReset()}}):null)}const lt=[`slots`,`configForms`,`locale`];function ut(e,t,n){let r=()=>({hooks:{card:t}});e.slots.inject(L,()=>{let t=e.slots.register({name:L,id:N,order:99,label:()=>n(`dockOrganizeEntry`),locale:N,inject:r},Ge()),i=e.slots.register({name:L,id:`${N}-templates`,order:100,label:()=>n(`dockTemplatesEntry`),locale:N,inject:r},qe());return()=>{t(),i()}})}function dt(e,t){e.slots.inject(ue,()=>e.slots.register({name:ue,select:()=>!0,inject:()=>({t})},e=>e.t(`inputPlaceholder`)))}function ft(e,t,n,r){e.slots.inject(`plugins.bundle.config`,()=>e.slots.register({name:`plugins.bundle.config`,key:`@jayyuen66/dsh-dir-prep-organize`,inject:()=>({t:n,hooks:{card:t},set:(e,t)=>r.set(e,t),unset:e=>r.unset(e),readBack:()=>t.readBack()})},ct))}exports.apply=function(e){let t=le(e);q=t,e.effect(()=>()=>{q===t&&(q=void 0)},`dir-prep-organize: remote reader`);let n=e.configForms.get(N),r=Oe(n);e.effect(()=>e.locale.register(N,w),`dir-prep-organize-card: locale dictionaries`);let i=e.locale.bind(N);ut(e,r,i),dt(e,i),ft(e,r,i,n)},exports.builtinTemplatesSnapshot=function(){return H},exports.formatContextSummary=ye,exports.formatImportSkips=_e,exports.inject=lt,exports.loadBuiltinTemplates=Z,exports.parseContextResponse=pe,exports.parseOrganizeResponse=he,exports.persistError=ke,exports.resetBuiltinTemplates=function(){W+=1,U=null,K(V)},exports.rootsPersistError=Ae,exports.setDirPrepReader=function(e){q=e},exports.subscribeBuiltinTemplates=be;
|
|
12
12
|
return module.exports;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jayyuen66/dsh-dir-prep-organize",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"description": "dsh 插件:对话输入框「润色」按钮(主键直接润色/▾ 以角色风格润色,结合当前目录 + session 模型润色草稿)+「模板」下拉(内置精选角色集生成自插件 agents/ 角色库,可按部门分组;设置卡可增删改/一键导入内置全部/导入本地角色 .md)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cordis",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"registry": "https://registry.npmjs.org"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@jayyuen66/dsh-plugin-shared": "^0.3.
|
|
59
|
+
"@jayyuen66/dsh-plugin-shared": "^0.3.3",
|
|
60
60
|
"zod": "4.6.7"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
@@ -99,14 +99,14 @@
|
|
|
99
99
|
"eslint-plugin-zod": "5.4.0",
|
|
100
100
|
"fast-check": "4.11.0",
|
|
101
101
|
"happy-dom": "21.0.4",
|
|
102
|
-
"oxfmt": "0.
|
|
103
|
-
"oxlint": "1.
|
|
102
|
+
"oxfmt": "0.81.0",
|
|
103
|
+
"oxlint": "1.96.0",
|
|
104
104
|
"oxlint-tsgolint": "7.0.2009",
|
|
105
105
|
"react": "19.3.1",
|
|
106
106
|
"react-dom": "19.3.1",
|
|
107
107
|
"rolldown": "1.3.4",
|
|
108
108
|
"typescript": "7.0.2",
|
|
109
|
-
"vite": "8.4.
|
|
109
|
+
"vite": "8.4.1",
|
|
110
110
|
"vitest": "5.1.2"
|
|
111
111
|
},
|
|
112
112
|
"peerDependencies": {
|