@jayyuen66/dsh-dir-prep-organize 0.1.15 → 0.1.17
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 +12 -0
- package/README.md +29 -27
- package/README.zh-CN.md +29 -27
- package/THIRD_PARTY_NOTICES.md +5 -3
- package/client.js +4 -38
- package/docs/DETAIL.md +5 -26
- package/docs/DETAIL.zh.md +5 -26
- package/docs/images/capability-map.svg +66 -0
- package/docs/images/capability-map.zh.svg +74 -0
- package/docs/images/import-boundary.svg +64 -0
- package/docs/images/import-boundary.zh.svg +66 -0
- package/docs/images/organize-flow.svg +83 -0
- package/docs/images/organize-flow.zh.svg +71 -0
- package/docs/images/templates-card.svg +66 -0
- package/docs/images/templates-card.zh.svg +74 -0
- package/host.js +21 -1685
- package/package.json +72 -69
- package/templates.data.mjs +11840 -685
- package/types/host.d.ts +0 -474
- package/types/src/client-entry.d.ts +0 -99
- package/types/src/client-styles.d.ts +0 -1
- package/types/src/client-timeouts.d.ts +0 -30
- package/types/src/default-templates.generated.d.ts +0 -3
- package/types/src/group-labels.generated.d.ts +0 -2
- package/types/src/host-messages.d.ts +0 -96
- package/types/src/input-writeback.d.ts +0 -32
- package/types/src/remote.d.ts +0 -33
- package/types/src/templates.d.ts +0 -96
- package/types/src/ui-messages.d.ts +0 -224
package/client.js
CHANGED
|
@@ -1,48 +1,14 @@
|
|
|
1
|
-
// GENERATED by buildClient() in build-client.mjs — edit src
|
|
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(--dsw-alias-border-l2,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(--dsw-alias-interactive-bg-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(--dsw-alias-border-l2,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(--dsw-alias-label-tertiary,inherit);flex:none;min-width:26px}\n.dpic-importrow{padding:12px 0;border-bottom:1px dashed var(--dsw-alias-border-l2,currentColor)}" } } }),
|
|
4
5
|
factory: (require) => {
|
|
5
6
|
'use strict';
|
|
6
7
|
const module = { exports: {} };
|
|
7
8
|
let exports = module.exports;
|
|
8
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@deepseek-ai/dsh-client-ui-primitives"),t=require("react"),n=require("@jayyuen66/dsh-plugin-shared/client"),r=require("zod");function i(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}new TextEncoder,new TextDecoder;function a(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 o(e,t,n){if(e!==``&&!n.has(e))return e;let r=`tpl-${t}`;for(;n.has(r);)r=`${r}-${t}`;return r}function s(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=o(``,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 c(e){return typeof e==`string`?e.trim():``}function l(e,t,n){let r;if(i(e)){let{id:i,name:s,description:l,text:u,group:d,emoji:f}=e,p=c(s),m=c(u);if(p!==``&&m!==``){let e=o(c(i),t,n);n.add(e),r={id:e,name:p,description:c(l),text:m,group:c(d),emoji:a(c(f),12)}}}return r}function u(e){if(!Array.isArray(e))return[];let t=new Set,n=[];for(let[r,i]of e.entries()){let e=l(i,r,t);e!==void 0&&n.push(e)}return n}const d=String.fromCodePoint(92),f=/^[A-Za-z]:$/u,p=/[/\\]+$/u;function m(e){let t=f.test(e.slice(0,2))&&(e[2]===`/`||e[2]===d);return e.startsWith(`/`)||t||e.startsWith(d+d)}function h(e){let t=e.replace(p,``);return t.length===0||f.test(t)?e:t}function g(e){let t=[];if(Array.isArray(e))for(let n of e){let e=typeof n==`string`?n.trim():``,r=h(e);e.length>0&&m(r)&&!t.includes(r)&&t.push(r)}return t}const _=0x7fffffff;function v(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function y(e){let t=e.organizeTimeoutMs;return v(t)?Math.min(Math.max(Math.trunc(t),1),_):void 0}function b(e){let t=v(e)?e:12e4;return Math.trunc(Math.min(Math.max(Math.min(t,0x7fffec77)+5e3,1),_))}const x={zh:{rolesSection:`角色库`,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:`模板`,organizeIdle:`润色`,organizeLoading:`润色中`,organizeFailedShort:`失败`,organizeIdleTitle:`结合当前目录润色输入框内容(主键直接润色;▾ 可选角色风格)`,organizeFailedTitle:`润色失败:{message}`,organizeErrContextFailed:`目录上下文读取失败:{message}`,organizeErrModelFailed:`读取模型失败:{message}`,organizeErrEmpty:`输入框为空,无内容可润色`,organizeErrTimeout:`润色请求超时:宿主没有在时限内回报结果`,organizeErrUnknownReason:`未知错误`,organizeErrUnknown:`润色失败(未知错误)`,organizeCaretAria:`选择润色的角色风格`,organizeCaretTitle:`按某个角色的风格润色(角色来自下方模板库)`,organizeMainAria:`润色输入框内容`,organizeDirectItem:`直接润色(默认,不带角色)`,organizeNoTemplates:`无模板可选作角色风格`,organizeRoleItem:`以「{name}」的风格润色`,organizeWriteBackUnavailable:`输入框动作不可用,无法写回`,organizeWriteBackStale:`输入框内容已变化,润色结果未写回`,organizeBusyTitle:`输入框正在提交,暂不能润色`,templatesIdleTitle:`选择一条模板插入光标处(按分组展示)`,templatesBrokenTitle:`输入框动作不可用,无法插入`,templatesBusyTitle:`输入框正在提交,暂不能插入模板`,templatesGroupCommon:`通用`,templatesAria:`插入模板`,templatesEmptyHint:`无模板:在设置页「角色库」中添加或恢复默认`,builtinLoading:`正在载入内置角色模板…`,builtinFailed:`内置模板加载失败:{message}`,builtinRetry:`重试`},en:{rolesSection:`Role library`,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 whole built-in library; 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 all {count} entries from the built-in role library{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 every built-in role; or a .md / directory path (must be inside an allowed root)`,importAriaPath:`Role import path`,importBtnTitle:`Empty imports the whole built-in role library in one click; 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 whole built-in role library (agents/); 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`,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`,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}`,builtinRetry:`Retry`}};async function S(e,t,n){let{promise:r,reject:i}=Promise.withResolvers(),a=setTimeout(()=>{i(n())},t);try{return await Promise.race([e,r])}finally{clearTimeout(a)}}function C(e){return e!==void 0&&typeof e.setDraft==`function`}function w(e){return e!==void 0&&typeof e.captureInsertion==`function`&&typeof e.insertText==`function`}function T(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(!C(a))throw Error(n.unavailable);if(t.sessionId!==i.sessionId||i.phase!==`plain`)throw Error(n.stale);let o=i.draftRev;if(w(a)&&(o=a.captureInsertion().draftRev),t.invalidated||o!==t.draftRev)throw Error(n.stale);a.setDraft(e)}}}const E=e=>i(e)&&typeof e.$mount==`function`,D=`dirPrepOrganize`,O=`remote.${D}`,k=`@jayyuen66/dsh-dir-prep-organize`;function A(e,t){let n=e.safeParse(t);if(!n.success)throw TypeError(r.z.prettifyError(n.error));return n.data}const ee=`session request requires a string sessionId`,te=r.z.object({sessionId:r.z.string({error:ee})},{error:ee}),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 A(te,e)}})},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=A(ne,e);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 A(re,e)}})}}],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;try{t=e.get?.(`remote`,!1)}catch{t=void 0}return E(t)?ce(e,t):void 0}const N=`dir-prep-organize`,P=125e3,F=`dpi-item-empty`,I=`dpic-rowhead`,L=`dpic-importpath`,R=`conversation.input.right`;function ue(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 z(e,t){let n=e[t];return typeof n==`string`?n:void 0}function B(e,t){return e===void 0?{}:{[t]:e}}function de(e){return[[`skipDeeper`,e.deeper],[`skipTooLarge`,e.tooLarge],[`skipUnreadable`,e.unreadable],[`skipUnnamed`,e.unnamed],[`skipEscaped`,e.escaped]]}function fe(e){let t=(0,n.isRecord)(e)?e:{},{ok:r,truncated:i,entries:a}=t,o=Array.isArray(a)?a.map(e=>ue(e)):void 0;return{ok:r===!0,...B(z(t,`error`),`error`),...B(z(t,`cwd`),`cwd`),...i===!0?{truncated:!0}:{},...o===void 0?{}:{entries:o}}}function pe(e){let t=(0,n.isRecord)(e)?e:{};return{ok:t.ok===!0,...B(z(t,`error`),`error`),...B(z(t,`provider`),`provider`),...B(z(t,`model`),`model`),...B(z(t,`reasoningEffort`),`reasoningEffort`)}}function me(e){let t=(0,n.isRecord)(e)?e:{};return{ok:t.ok===!0,...B(z(t,`error`),`error`),...B(z(t,`content`),`content`)}}function V(e){return typeof e==`number`&&e>0?e:0}function he(e){return{tooLarge:V(e.tooLarge),unreadable:V(e.unreadable),deeper:V(e.deeper),unnamed:V(e.unnamed),escaped:V(e.escaped)}}function ge(e,t){if(t===void 0)return``;let n=[];for(let[r,i]of de(t))i>0&&n.push(e(r,{count:i}));return n.length===0?``:e(`skipSummary`,{list:n.join(e(`skipSeparator`))})}function _e(e){let{ok:t,error:r,count:i,truncated:a,skipped:o,entries:s}=(0,n.isRecord)(e)?e:{},c=Array.isArray(s)?u(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:he(o)}:{},...c===void 0?{}:{entries:c}}}function ve(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=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
10
|
`,` `)}`),n.push(r)}return n.join(`
|
|
10
|
-
`)}const H={phase:`idle`,list:[],error:``};let U=H,W=null,G=0;const K=new Set;function q(e){if(e===U)return U;U=e;for(let e of K)e();return e}let J;function Y(){if(J===void 0)throw Error(`远程读面不可用:宿主网关没有挂上 ${D}`);return J}var X=class extends Error{messageKey;params;constructor(e,t={}){super(e),this.name=`LocalizedOrganizeError`,this.messageKey=e,this.params=t}};async function Z(e,t){return S(e,t,()=>new X(`organizeErrTimeout`))}async function Q(){if(U.phase===`ready`)return U;if(W!==null)return await W;let e=G;return W=(async()=>{q({phase:`loading`,list:U.list,error:``});let t;try{let e=await Z(Y().defaults(),P),r=(0,n.isRecord)(e)?e:void 0,i=r?.error;t=r?.ok===!0?{phase:`ready`,list:u(r.templates),error:``}:{phase:`error`,list:[],error:typeof i==`string`&&i.trim()!==``?i:`内置模板响应不是合法载荷`}}catch(e){t={phase:`error`,list:[],error:(0,n.errorText)(e)}}finally{G===e&&(W=null)}return G===e?q(t):t})(),await W}function ye(e){return K.add(e),()=>{K.delete(e)}}function be(e,n){let r={className:F,"data-field":`dpi-builtin-state`},i=(0,t.createElement)(`button`,{type:`button`,className:`dsu-btn`,"data-field":`dpi-builtin-retry`,onClick:()=>{Q()}},n(`builtinRetry`)),a;return!e.fromSettings&&e.builtinPhase!==`ready`&&(a=e.builtinPhase===`error`?(0,t.createElement)(`div`,r,n(`builtinFailed`,{message:e.builtinError}),i):(0,t.createElement)(`div`,r,n(`builtinLoading`))),a}function xe(e,t,n,r){if(!e.ok)throw new X(`organizeErrContextFailed`,{message:e.error??r});if(!t.ok||t.provider===void 0||t.model===void 0)throw new X(`organizeErrModelFailed`,{message:t.error??r});if(n.trim().length===0)throw new X(`organizeErrEmpty`)}async function Se(e){let{ctxRes:t,prompt:n,sessionId:r,roleText:i,timeoutMs:a}=e,o=ve(t),s=me(await Z(Y().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 X(`organizeErrUnknown`):Error(s.error);return s.content}async function Ce(e){let t=Y(),[n,r]=await Promise.all([Z(t.context(e.sessionId),P),Z(t.model(e.sessionId),P)]),i=fe(n);return xe(i,pe(r),e.prompt,e.unknownReason),Se({ctxRes:i,prompt:e.prompt,sessionId:e.sessionId,roleText:e.roleText,timeoutMs:e.timeoutMs})}function we(e){let{value:t,status:n,writable:r,revision:i}=e;return{value:t??{},ready:n===`ready`,writable:r,revision:i??0}}function Te(e){return e.templates}function Ee(e){return e.importAllowRoots}function De(e){let t=null,n=U,r={templates:H.list,fromSettings:!1,builtinPhase:`idle`,builtinError:``,allowRoots:[],ready:!1,writable:!1,organizeTimeoutMs:void 0};return{getSnapshot(){let i=e.getSnapshot();if(i===t&&U===n)return r;t=i,n=U;let a=we(i),o=Te(a.value),s=Array.isArray(o)&&o.length>0;return r={templates:s?u(o):n.list,fromSettings:s,builtinPhase:n.phase,builtinError:n.error,allowRoots:g(Ee(a.value)),ready:a.ready,writable:a.writable,organizeTimeoutMs:y(a.value)},r},subscribe(t){let n=e.subscribe(t),r=ye(t);return()=>{n(),r()}},readBack(){let t=we(e.getSnapshot());return{ready:t.ready,revision:t.revision,templates:u(Te(t.value)),allowRoots:g(Ee(t.value))}}}}function Oe(e,t,n,r,i){let a,o=i?.treatEmptyAsReverted===!0&&t.templates.length===0&&n.length>0;return t.ready?!o&&JSON.stringify(t.templates)!==JSON.stringify(n)&&(a=e(`persistRejected`,{action:r,revision:t.revision})):a=e(`persistUnconfirmed`,{action:r}),a}function ke(e,t,n,r){let i;return t.ready?JSON.stringify(t.allowRoots)!==JSON.stringify(n)&&(i=e(`persistRejected`,{action:r,revision:t.revision})):i=e(`persistUnconfirmed`,{action:r}),i}function Ae(e){return`${e.emoji===``?``:`${e.emoji} `}${e.name}`}function je(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 $(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 Me(){return Object.fromEntries([[`cx`,7],[`cy`,7],[`r`,5.5],[`fill`,`none`],[`stroke`,`currentColor`],[`strokeWidth`,1.5],[`strokeDasharray`,`26 10`],[`strokeLinecap`,`round`]])}function Ne(){return(0,t.createElement)(`svg`,{width:14,height:14,viewBox:`0 0 14 14`,"aria-hidden":!0},(0,t.createElement)(`path`,$(`M2 4l5 4 5-4`,!0)),(0,t.createElement)(`path`,$(`M2 8.5l5 4 5-4`,!0)))}function Pe(){return(0,t.createElement)(`svg`,{width:14,height:14,viewBox:`0 0 14 14`,"aria-hidden":!0,className:`dpi-spin`},(0,t.createElement)(`circle`,Me()))}function Fe(){return(0,t.createElement)(`svg`,{width:14,height:14,viewBox:`0 0 14 14`,"aria-hidden":!0},(0,t.createElement)(`path`,$(`M3 3l8 8M11 3l-8 8`)))}function Ie(){return(0,t.createElement)(`svg`,{width:14,height:14,viewBox:`0 0 14 14`,"aria-hidden":!0},(0,t.createElement)(`path`,$(`M2.5 3.5h9M2.5 7h9M2.5 10.5h5.5`)))}function Le(){return(0,t.createElement)(`svg`,{width:14,height:14,viewBox:`0 0 14 14`,"aria-hidden":!0},(0,t.createElement)(`path`,$(`M2.5 5.5L7 9.5l4.5-4`,!0)))}function Re(e,n,r){(0,t.useEffect)(()=>{function t(e){n.current!==null&&e.target instanceof Node&&!n.current.contains(e.target)&&r()}function i(e){e.key===`Escape`&&r()}return e&&(document.addEventListener(`mousedown`,t),document.addEventListener(`keydown`,i)),()=>{document.removeEventListener(`mousedown`,t),document.removeEventListener(`keydown`,i)}},[r,e,n])}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 Ce({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 X?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){let{t:n,errClass:r,menuOpen:i,loading:a,onToggleMenu:o}=e;return(0,t.createElement)(`button`,{type:`button`,className:`dpi-btn dpi-caret${r}`,"aria-label":n(`organizeCaretAria`),"aria-haspopup":`menu`,"aria-expanded":i,title:n(`organizeCaretTitle`),"data-field":`dpi-organize-caret`,"data-state":i?`open`:`idle`,disabled:a,onClick:o},(0,t.createElement)(Le))}function Ue(e){let{t:n,templates:r,onRun:i,directItemLabel:a,noTemplatesLabel:o,builtinRow:s,loading:c,canWrite:l,errTitle:u}=e,d=c||!l,f=l?void 0:u;return(0,t.createElement)(`div`,{className:`dpi-menu`,role:`menu`,"data-field":`dpi-organize-menu`},(0,t.createElement)(`button`,{type:`button`,className:`dpi-item`,role:`menuitem`,"data-field":`dpi-organize-role-direct`,disabled:d,...f===void 0?{}:{title:f},onClick:()=>{i()}},a),r.length===0?s??(0,t.createElement)(`div`,{className:F},o):r.map(e=>(0,t.createElement)(`button`,{key:e.id,type:`button`,className:`dpi-item`,role:`menuitem`,"data-field":`dpi-organize-role-item`,disabled:d,title:f??(e.description===``?e.text:e.description),onClick:()=>{i(e.text)}},`${e.emoji===``?``:`${e.emoji} `}${n(`organizeRoleItem`,{name:e.name})}`)))}function We(e,n,r){return e===void 0?n?{icon:(0,t.createElement)(Pe),label:r(`organizeLoading`),state:`loading`}:{icon:(0,t.createElement)(Ne),label:r(`organizeIdle`),state:`idle`}:{icon:(0,t.createElement)(Fe),label:r(`organizeFailedShort`),state:`error`}}function Ge(){return function(e){let[n,r]=(0,t.useState)(!1),[i,a]=(0,t.useState)(void 0),[o,s]=(0,t.useState)(!1),c=(0,t.useRef)(0),l=(0,t.useRef)(!1),u=(0,t.useRef)(null),d=(0,t.useRef)(null),f=e.useInput===void 0?``:e.useInput(e=>e.draft)??``,p=e.useInput===void 0?0:e.useInput(e=>e.draftRev),m=e.useInput===void 0?`plain`:e.useInput(e=>e.phase),h=e.useCard(e=>e),{templates:g}=h,_=T({sessionId:e.sessionId??``,actions:e.inputActions,draftRev:p,phase:m},{unavailable:e.t(Be),stale:e.t(`organizeWriteBackStale`)});Re(o,d,()=>{s(!1)}),(0,t.useEffect)(()=>()=>{c.current+=1,u.current!==null&&clearTimeout(u.current)},[]);async function v(t){let i=_.begin();try{await ze({t:e.t,loading:n,inFlight:l,seq:c,prompt:f,sessionId:e.sessionId??``,timeoutMs:b(h.organizeTimeoutMs),roleText:t,setLoading:r,setMenuOpen:s,setFailed:a,flashTimer:u,writeDraft:e=>{_.commit(e,i)}})}finally{_.finish(i)}}function y(){h.fromSettings||Q(),s(e=>!e)}let x=We(i,n,e.t),S=C(e.inputActions),w=S&&m===`plain`,E=e.t(`organizeIdleTitle`);i===void 0?S?m!==`plain`&&(E=e.t(`organizeBusyTitle`)):E=e.t(Be):E=e.t(`organizeFailedTitle`,{message:i});let D={t:e.t,errTitle:E,icon:x.icon,label:x.label,state:x.state,errClass:i===void 0?``:` dpi-btn-err`,directItemLabel:e.t(`organizeDirectItem`),noTemplatesLabel:e.t(`organizeNoTemplates`),builtinRow:be(h,e.t),loading:n,menuOpen:o,canWrite:w,templates:g,onRun:v,onToggleMenu:y};return(0,t.createElement)(`span`,{className:`dpi-wrap dpi-split`,ref:d},Ve(D),He(D),o?Ue(D):null)}}function Ke(){return function(e){let[n,r]=(0,t.useState)(!1),i=(0,t.useRef)(null),a=e.useInput===void 0?`plain`:e.useInput(e=>e.phase),o=e.useCard(e=>e),{templates:s}=o;Re(n,i,()=>{r(!1)});function c(t){r(!1);let n=e.inputActions;w(n)&&n.insertText(t,n.captureInsertion())}let l=w(e.inputActions),u=l&&a===`plain`,d=e.t(`templatesBrokenTitle`);u?d=e.t(`templatesIdleTitle`):l&&(d=e.t(`templatesBusyTitle`));let f=je(s,e.t),p=e.t(`templatesEmptyHint`),m=be(o,e.t);return(0,t.createElement)(`span`,{className:`dpi-wrap`,ref:i},(0,t.createElement)(`button`,{type:`button`,className:`dpi-btn`,"aria-label":e.t(`templatesAria`),"aria-haspopup":`menu`,"aria-expanded":n,title:d,"data-field":`dpi-template-btn`,"data-state":n?`open`:`idle`,disabled:!u,onClick:()=>{o.fromSettings||Q(),r(e=>!e)}},(0,t.createElement)(Ie),e.t(`dockTemplatesEntry`)),n?(0,t.createElement)(`div`,{className:`dpi-menu`,role:`menu`,"data-field":`dpi-template-menu`},s.length===0?m??(0,t.createElement)(`div`,{className:F},p):f.map(e=>(0,t.createElement)(`div`,{key:e.group,className:`dpi-group`},(0,t.createElement)(`div`,{className:`dpi-grouph`,role:`presentation`},e.group),e.items.map(e=>(0,t.createElement)(`button`,{key:e.id,type:`button`,className:`dpi-item`,role:`menuitem`,"data-field":`dpi-template-item`,title:e.description===``?e.text:e.description,onClick:()=>{c(e.text)}},Ae(e)))))):null)}}function qe(){let e;try{e=`tpl-${crypto.randomUUID()}`}catch{e=`tpl-${Date.now().toString(36)}-${Math.floor(Math.random()*1e9).toString(36)}`}return e}function Je(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:I},s,c,l,u,d),f,p)}function Ye(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 Je({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 Xe(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=_e(await Z(Y().importTemplates({path:t,sessionId:``}),P));if(!n.ok||n.entries===void 0)throw Error(n.error??r(`importFailedUnknown`));let i=n.entries.length,o=V(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=`${ge(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:`${L} 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`));return(0,t.createElement)(`div`,{className:`dpic-importrow`},(0,t.createElement)(`div`,{className:I},m,h),g,_,v)}function Ze(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:`${L} 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:I,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:`${L} 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:I},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 Qe(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 $e(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 et(e,t){return{title:e(`rolesSection`),hint:e(`rolesHint`),count:e(`rolesCount`,{count:String(t)})}}function tt(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 nt(e,t){let n;return n=e.ready?e.writable?``:t(`statusReadOnly`):t(`statusNotReady`),n}function rt(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 c(){r([...t,{id:qe(),name:e(`newTemplateName`,{index:t.length+1}),description:``,text:``,group:``,emoji:``}])}function l(e){r(t=>s(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:c,onImported:l,onRootChange:u,onRootDelete:d,onRootAdd:f}}function it(e,t,n,r,i){let a=Oe(e,t,n,e(r),i);if(a!==void 0)throw Error(a)}function at(e,t,n){let r=ke(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:d,set:f,unset:p,readBack:m,setDraft:h,setDraftFor:_,setRootsDraft:v,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=u(l),n=g(d);try{i&&(await f(`templates`,e),it(t,m(),e,`save`)),a&&(await f(`importAllowRoots`,n),at(t,m(),n)),y(!1),h(t=>t===l?e:t),v(e=>e===d?n:e)}catch(e){y(!1),x(e)}}function C(){h(s),v(c),b(``)}function w(){y(!0),(async()=>{try{let e=await Q();if(e.phase!==`ready`)throw Error(e.error);await p(`templates`),it(t,m(),e.list,`resetDefault`,{treatEmptyAsReverted:!0}),b(``),h(e.list),_(e.list),v(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.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,et(r,a.length),(0,t.createElement)($e,{foot:s,editable:c,busy:u,onAdd:h,onReset:f}),a.map((e,n)=>(0,t.createElement)(Ye,{key:e.id,t:r,index:n,template:e,disabled:!c||u,onCommit:p,onDelete:m})),(0,t.createElement)(Xe,{t:r,editable:c&&!u,onImported:g}),(0,t.createElement)(Ze,{t:r,roots:o,disabled:!c||u,onChangeRoot:_,onDeleteRoot:v,onAddRoot:y}),S),C)}function ct(e){let{t:n}=e,[r,i]=(0,t.useState)(!1),[a,o]=(0,t.useState)(``),[s,c]=(0,t.useState)(!1),l=tt(n),u=e.useCard(e=>e),{templates:d}=u,f=u.ready&&u.writable,p=nt(u,n);(0,t.useEffect)(()=>{u.fromSettings||Q()},[u.fromSettings]);let[m,h]=(0,t.useState)(d),[_,v]=(0,t.useState)(d);(0,t.useEffect)(()=>{_!==d&&(v(d),h(e=>JSON.stringify(e)===JSON.stringify(_)?d:e))},[d,_]);let[y,b]=(0,t.useState)(u.allowRoots),[x,S]=(0,t.useState)(u.allowRoots);(0,t.useEffect)(()=>{x!==u.allowRoots&&(S(u.allowRoots),b(e=>JSON.stringify(e)===JSON.stringify(x)?u.allowRoots:e))},[x,u.allowRoots]);let C=JSON.stringify(m)!==JSON.stringify(d),w=JSON.stringify(g(y))!==JSON.stringify(u.allowRoots),T=C||w,E=rt(n,m,y,h,b),D=ot({t:n,editable:f,dirty:C,rootsDirty:w,anythingDirty:T,templates:d,allowRoots:u.allowRoots,draft:m,rootsDraft:y,set:e.set,unset:e.unset,readBack:e.readBack,setDraft:h,setDraftFor:v,setRootsDraft:b,setBusy:c,setSaveError:o}),O=st({t:n,statusHint:p,draft:m,rootsDraft:y,foot:l,editable:f,anythingDirty:T,busy:s,saveError:a,onRequestReset:()=>{i(!0)},draftActions:E,persistActions:D});return(0,t.createElement)(t.Fragment,null,O,r?(0,t.createElement)(Qe,{t:n,busy:s,onCancel:()=>{i(!1)},onConfirm:()=>{i(!1),D.onReset()}}):null)}const lt=[`slots`,`configForms`,`locale`];function ut(e,t,n){let r=()=>({hooks:{card:t}});e.slots.inject(R,()=>{let t=e.slots.register({name:R,id:N,order:99,label:()=>n(`dockOrganizeEntry`),locale:N,inject:r},Ge()),i=e.slots.register({name:R,id:`${N}-templates`,order:100,label:()=>n(`dockTemplatesEntry`),locale:N,inject:r},Ke());return()=>{t(),i()}})}function dt(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);J=t,e.effect(()=>()=>{J===t&&(J=void 0)},`dir-prep-organize: remote reader`),e.effect(()=>{let e=(0,n.ensureCardUiCss)(),t=document.createElement(`style`);return t.id=`dir-prep-organize-css`,t.textContent=`.dpi-btn{appearance:none;border:1px solid var(--dsw-alias-border-l2,currentColor);background:var(--dsw-alias-bg-layer-1,transparent);color:var(--dsw-alias-label-primary,inherit);font:inherit;font-size:12px;line-height:1;border-radius:8px;padding:6px 10px;cursor:pointer;display:inline-flex;align-items:center;gap:6px;transition:background .16s,border-color .16s,color .16s}
|
|
11
|
-
.dpi-btn:hover:not(:disabled){border-color:var(--dsw-alias-label-dimmed,currentColor);background:var(--dsw-alias-bg-layer-2,transparent)}
|
|
12
|
-
.dpi-btn:disabled{opacity:.55;cursor:not-allowed}
|
|
13
|
-
.dpi-btn:disabled[data-state="loading"]{cursor:progress}
|
|
14
|
-
.dpi-btn:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,currentColor);outline-offset:1px}
|
|
15
|
-
.dpi-btn svg{width:14px;height:14px;flex:none}
|
|
16
|
-
.dpi-btn-err{border-color:var(--dsw-alias-state-error-primary,currentColor);color:var(--dsw-alias-state-error-secondary,currentColor)}
|
|
17
|
-
.dpi-btn-err:hover:not(:disabled){border-color:var(--dsw-alias-state-error-primary,currentColor)}
|
|
18
|
-
.dpi-spin{animation:dpi-rotate .8s linear infinite}
|
|
19
|
-
@keyframes dpi-rotate{to{transform:rotate(360deg)}}
|
|
20
|
-
@media (prefers-reduced-motion:reduce){.dpi-spin{animation:none}.dpi-btn{transition:none}}
|
|
21
|
-
.dpi-wrap{position:relative;display:inline-flex;isolation:isolate}
|
|
22
|
-
.dpi-menu{position:absolute;bottom:calc(100% + 6px);right:0;z-index:50;min-width:224px;max-height:340px;overflow-y:auto;background:var(--dsw-menu-surface-fill,transparent);backdrop-filter:var(--dsw-menu-backdrop-filter,none);border:0;border-radius:10px;padding:4px;display:flex;flex-direction:column;gap:2px;box-shadow:var(--dsw-elevation-panel,none)}
|
|
23
|
-
.dpi-item{appearance:none;border:none;background:transparent;color:var(--dsw-alias-label-primary,inherit);font:inherit;font-size:12px;line-height:1.4;text-align:left;border-radius:6px;padding:8px 10px;cursor:pointer;white-space:nowrap}
|
|
24
|
-
.dpi-item:hover,.dpi-item:focus-visible{background:var(--dsw-alias-bg-layer-2,transparent)}
|
|
25
|
-
.dpi-item-empty{color:var(--dsw-alias-label-tertiary,inherit);cursor:default;font-size:12px;padding:8px 10px;white-space:nowrap}
|
|
26
|
-
.dpi-split{display:inline-flex;align-items:stretch}
|
|
27
|
-
.dpi-split .dpi-main{border-top-right-radius:0;border-bottom-right-radius:0;padding-right:8px}
|
|
28
|
-
.dpi-split .dpi-caret{border-left:none;border-top-left-radius:0;border-bottom-left-radius:0;padding-left:4px;padding-right:6px}
|
|
29
|
-
.dpi-split .dpi-caret svg{width:10px;height:10px}
|
|
30
|
-
.dpi-group{padding:2px 0}
|
|
31
|
-
.dpi-grouph{font-size:11px;font-weight:600;color:var(--dsw-alias-label-tertiary,inherit);padding:6px 10px 2px;letter-spacing:.02em}
|
|
32
|
-
.dpic-row{padding:10px 0;border-bottom:1px dashed var(--dsw-alias-border-l2,currentColor)}
|
|
33
|
-
.dpic-name{flex:1;min-width:0}
|
|
34
|
-
.dpic-rowhead .dpic-name{width:auto}
|
|
35
|
-
.dpic-rowhead .dpic-emoji{width:44px;flex:none;text-align:center}
|
|
36
|
-
.dpic-rowhead .dpic-group{width:84px;flex:none}
|
|
37
|
-
.dpic-desc{width:100%;margin-top:6px}
|
|
38
|
-
.dpic-text{width:100%;margin-top:6px}
|
|
39
|
-
.dpic-importpath{flex:1;min-width:0}
|
|
40
|
-
.dpic-rowhead .dpic-importpath{width:auto}
|
|
41
|
-
.dpic-del{flex:none}
|
|
42
|
-
.dpic-toolbar{display:flex;gap:8px;flex-wrap:wrap;padding:8px 0}
|
|
43
|
-
.dpic-rowhead{display:flex;gap:8px;align-items:center}
|
|
44
|
-
.dpic-idx{font-size:12px;color:var(--dsw-alias-label-tertiary,inherit);flex:none;min-width:26px}
|
|
45
|
-
.dpic-importrow{padding:12px 0;border-bottom:1px dashed var(--dsw-alias-border-l2,currentColor)}`,document.head.append(t),()=>{t.remove(),e()}},`dir-prep-organize: styles`);let r=e.configForms.get(N),i=De(r);e.effect(()=>e.locale.register(N,x),`dir-prep-organize-card: locale dictionaries`);let a=e.locale.bind(N);ut(e,i,a),dt(e,i,a,r)},exports.builtinTemplatesSnapshot=function(){return U},exports.formatContextSummary=ve,exports.formatImportSkips=ge,exports.inject=lt,exports.loadBuiltinTemplates=Q,exports.parseContextResponse=fe,exports.parseOrganizeResponse=me,exports.persistError=Oe,exports.resetBuiltinTemplates=function(){G+=1,W=null,q(H)},exports.rootsPersistError=ke,exports.setDirPrepReader=function(e){J=e},exports.subscribeBuiltinTemplates=ye;
|
|
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;
|
|
46
12
|
return module.exports;
|
|
47
13
|
},
|
|
48
14
|
});
|
package/docs/DETAIL.md
CHANGED
|
@@ -1,32 +1,11 @@
|
|
|
1
1
|
# Draft polish and templates
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+

|
|
4
4
|
|
|
5
|
-
|
|
5
|
+

|
|
6
6
|
|
|
7
|
-
|
|
7
|
+

|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- **Import-allowed roots** — additional absolute directories whose role files may be imported. An empty list adds nothing: this card has no session context, so only the bundled `agents/` role library stays importable; the endpoint called with a session also accepts paths inside that session's cwd. Absolute paths outside those zones stay refused. It is not a placeholder waiting to be filled.
|
|
9
|
+

|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## Values that are not on the card
|
|
15
|
-
|
|
16
|
-
`organizeTimeoutMs` is marked as a live value but has no knob here: the client reads it only to size its own fetch timeout, and the host times out first.
|
|
17
|
-
|
|
18
|
-
`maxSnippetBytes` and `readConcurrency` are deployment assumptions kept off the card deliberately. Set them in the `config:` block of this plugin's row in `cordis.patch.yml`; they take effect on restart.
|
|
19
|
-
|
|
20
|
-
## What it needs from outside
|
|
21
|
-
|
|
22
|
-
No external CLI, interpreter or credential of its own. It uses the host's model runtime and model selection (the live agent's current choice, falling back to the default selection), the session store and the filesystem service; polish follows the model selected for that conversation, so switching the model in the input area changes what the next polish call uses.
|
|
23
|
-
|
|
24
|
-
## Further detail
|
|
25
|
-
|
|
26
|
-
The vendored role library, the generated default-template table and the import-scan depth rules are developer-facing and live in the package README (`README.md` / `README.zh-CN.md`).
|
|
27
|
-
|
|
28
|
-
## Feedback
|
|
29
|
-
|
|
30
|
-
Issues and pull requests are welcome: [https://github.com/JayYuen666/dsh-dir-prep-organize/issues](https://github.com/JayYuen666/dsh-dir-prep-organize/issues).
|
|
31
|
-
|
|
32
|
-
If a plugin fails to boot, include the dsh host version, the profile install shape, and the browser console line. The `missed the module table` line is especially useful: it tells us whether the shared client row was materialized.
|
|
11
|
+
Issues and PRs: https://github.com/JayYuen666/dsh-dir-prep-organize/issues
|
package/docs/DETAIL.zh.md
CHANGED
|
@@ -1,32 +1,11 @@
|
|
|
1
1
|
# 输入框润色与模板
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+

|
|
4
4
|
|
|
5
|
-
|
|
5
|
+

|
|
6
6
|
|
|
7
|
-
|
|
7
|
+

|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- **允许导入的目录** — 额外允许导入角色文件的绝对目录。留空不额外放行:这张卡没有会话上下文,因此只剩随包内置的 `agents/` 角色库可导入;带会话调用的端点还接受该会话 cwd 之内的路径。这些区域之外的绝对路径仍被拒绝,而不是等着填的占位。
|
|
9
|
+

|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## 卡上没有的值
|
|
15
|
-
|
|
16
|
-
`organizeTimeoutMs` 虽标为即时生效,但卡上没有它的旋钮:客户端只读它来对齐自己的 fetch 超时,真正先超时的是宿主那侧。
|
|
17
|
-
|
|
18
|
-
`maxSnippetBytes` 与 `readConcurrency` 是刻意留在卡外的部署假定值。写在本插件注册行的 `config:` 块,改值随重启生效。
|
|
19
|
-
|
|
20
|
-
## 需要外部提供什么
|
|
21
|
-
|
|
22
|
-
不需要外部 CLI、解释器或自有凭据。它用宿主的模型运行时与模型选择(会话活 Agent 的当前选择,取不到时回落默认选择)、会话存储与文件系统服务;润色跟随当前会话选定的模型,所以在输入区换模型会改变下一次润色用的是哪个。
|
|
23
|
-
|
|
24
|
-
## 更完整的说明
|
|
25
|
-
|
|
26
|
-
vendored 角色库、生成的默认模板表、导入扫描的层数规则都属于开发内容,写在随包 README(`README.md` / `README.zh-CN.md`)。
|
|
27
|
-
|
|
28
|
-
## 反馈
|
|
29
|
-
|
|
30
|
-
欢迎提 issue 和 PR:[https://github.com/JayYuen666/dsh-dir-prep-organize/issues](https://github.com/JayYuen666/dsh-dir-prep-organize/issues)。
|
|
31
|
-
|
|
32
|
-
插件启动失败时,请附上 dsh 宿主版本、profile 安装形态和浏览器控制台原文。`missed the module table` 这一行尤其有用:它能直接说明 shared 客户端供应行有没有被物化。
|
|
11
|
+
问题与 PR:https://github.com/JayYuen666/dsh-dir-prep-organize/issues
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1180" height="720" viewBox="0 0 1180 720" role="img" aria-labelledby="title desc" aria-describedby="desc" font-family="Inter, system-ui, -apple-system, 'Segoe UI', sans-serif">
|
|
2
|
+
<title id="title">DSH PLUGIN · INPUT DOCK — Polish and templates beside the composer</title>
|
|
3
|
+
<desc id="desc">A split polish button and a template dropdown live right next to the input box.</desc>
|
|
4
|
+
<defs>
|
|
5
|
+
<linearGradient id="dsh-bg" x2="100%" y2="100%"><stop stop-color="#0b1218"/><stop offset="1" stop-color="#080d12"/></linearGradient>
|
|
6
|
+
<linearGradient id="dsh-accent"><stop stop-color="#56c2f0"/><stop offset="1" stop-color="#8a91ff"/></linearGradient>
|
|
7
|
+
<linearGradient id="dsh-edge"><stop stop-color="#56c2f0"/><stop offset=".5" stop-color="#8a91ff"/><stop offset="1" stop-color="#56c2f0"/></linearGradient>
|
|
8
|
+
<linearGradient id="dsh-wash"><stop stop-color="#56c2f0" stop-opacity=".16"/><stop offset="1" stop-color="#8a91ff" stop-opacity=".10"/></linearGradient>
|
|
9
|
+
<linearGradient id="dsh-icon-bg" x2="100%" y2="100%"><stop stop-color="#56c2f0" stop-opacity=".20"/><stop offset="1" stop-color="#2a7fc0" stop-opacity=".24"/></linearGradient>
|
|
10
|
+
<linearGradient id="dsh-polish" x2="0%" y2="100%"><stop stop-color="#56c2f0"/><stop offset="1" stop-color="#2a7fc0"/></linearGradient>
|
|
11
|
+
<radialGradient id="dsh-glow-top" gradientUnits="userSpaceOnUse" cx="1014.8" cy="0" r="330"><stop stop-color="#56c2f0" stop-opacity=".22"/><stop offset="1" stop-color="#56c2f0" stop-opacity="0"/></radialGradient>
|
|
12
|
+
<radialGradient id="dsh-glow-bottom" gradientUnits="userSpaceOnUse" cx="0" cy="720" r="300"><stop stop-color="#8a91ff" stop-opacity=".14"/><stop offset="1" stop-color="#8a91ff" stop-opacity="0"/></radialGradient>
|
|
13
|
+
<pattern id="dsh-grid" width="34" height="34" patternUnits="userSpaceOnUse"><path d="M.5 34V.5H34" fill="none" stroke="#fff" stroke-opacity=".05"/></pattern>
|
|
14
|
+
<circle id="dsh-dot" r="2.2" fill="#56c2f0" fill-opacity=".8"/>
|
|
15
|
+
<symbol id="dsh-tree" viewBox="0 0 24 24"><rect x="2.5" y="10" width="7" height="4" rx="1"/><rect x="15" y="4" width="7" height="4" rx="1"/><rect x="15" y="16" width="7" height="4" rx="1"/><path d="M9.5 12H12M15 6h-2a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h2"/></symbol>
|
|
16
|
+
<symbol id="dsh-wand" viewBox="0 0 24 24"><path d="m15 4 5 5L7 22l-5-5zM14 7l3 3M9 2h2M19 12h2M2 9h2"/></symbol>
|
|
17
|
+
<symbol id="dsh-download" viewBox="0 0 24 24"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4m4-5 5 5 5-5m-5 5V3"/></symbol>
|
|
18
|
+
<symbol id="dsh-caret-icon" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M22 12h-4M6 12H2M12 6V2M12 22v-4"/></symbol>
|
|
19
|
+
<symbol id="dsh-pen" viewBox="0 0 24 24"><path d="M21.17 6.81a1 1 0 0 0-3.09-3.09L3 18.75V21h3.25Z"/></symbol>
|
|
20
|
+
<symbol id="dsh-shield" viewBox="0 0 24 24"><path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1zM9 12l2 2 4-4"/></symbol>
|
|
21
|
+
<symbol id="dsh-chevron" viewBox="0 0 24 24"><path d="m6 9 6 6 6-6"/></symbol>
|
|
22
|
+
<g id="dsh-card-base">
|
|
23
|
+
<rect width="258" height="150" rx="18" fill="#fff" fill-opacity=".045" stroke="#fff" stroke-opacity=".10"/>
|
|
24
|
+
<rect x="16" y="16" width="36" height="36" rx="11" fill="url(#dsh-icon-bg)" stroke="#56c2f0" stroke-opacity=".28"/>
|
|
25
|
+
<use href="#dsh-dot" x="18" y="62"/><use href="#dsh-dot" x="18" y="82"/><use href="#dsh-dot" x="18" y="102"/>
|
|
26
|
+
<rect x="16" y="116" width="226" height="22" rx="11" fill="url(#dsh-wash)" stroke="currentColor" stroke-opacity=".35"/>
|
|
27
|
+
</g>
|
|
28
|
+
</defs>
|
|
29
|
+
<style>
|
|
30
|
+
.dsh-strong{fill:#f2f5fb;font-weight:700} .dsh-copy{fill:#d6deec;fill-opacity:.82} .dsh-muted{fill:#94a0b6;fill-opacity:.9}
|
|
31
|
+
.dsh-icon{fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round} .dsh-status{fill:currentColor;font-size:11.5px;font-weight:600;text-anchor:middle}
|
|
32
|
+
.dsh-outline{fill:#fff;fill-opacity:.03;stroke:#56c2f0;stroke-opacity:.45;stroke-width:1.1} .dsh-soft{fill:#fff;fill-opacity:.03;stroke:#fff;stroke-opacity:.07}
|
|
33
|
+
</style>
|
|
34
|
+
<g aria-hidden="true"><rect width="1180" height="720" fill="url(#dsh-bg)"/><rect width="1180" height="720" fill="url(#dsh-glow-top)"/><rect width="1180" height="720" fill="url(#dsh-glow-bottom)"/><rect width="1180" height="720" fill="url(#dsh-grid)"/><rect width="1180" height="3" fill="url(#dsh-edge)" opacity=".495"/></g>
|
|
35
|
+
<text x="56" y="48" font-size="12.5" font-weight="700" fill="url(#dsh-accent)">DSH PLUGIN · INPUT DOCK</text>
|
|
36
|
+
<text x="56" y="86" font-size="31" class="dsh-strong">Polish and templates beside the composer</text>
|
|
37
|
+
<text x="56" y="120" font-size="15" class="dsh-muted">A split polish button and a template dropdown live right next to the input box.</text>
|
|
38
|
+
<rect x="870" y="45" width="186" height="30" rx="15" fill="url(#dsh-wash)" stroke="#56c2f0" stroke-opacity=".4"/><circle cx="886" cy="60" r="3.5" fill="#56c2f0"/><text x="898" y="64.5" font-size="12.5" font-weight="600" fill="#56c2f0">6 capability surfaces</text>
|
|
39
|
+
<rect x="1072" y="34" width="52" height="52" rx="16" fill="url(#dsh-icon-bg)" stroke="#56c2f0" stroke-opacity=".28"/><use href="#dsh-tree" x="1086" y="48" width="24" height="24" class="dsh-icon" color="#56c2f0" aria-hidden="true"/>
|
|
40
|
+
<g aria-hidden="true"><path d="M314 235H326V559H314M314 397H326M326 337H338M866 235H854V559H866M866 397H854M854 337H842" fill="none" stroke="#94a0b6" stroke-opacity=".42" stroke-width="1.2" stroke-dasharray="4 4"/><use href="#dsh-dot" x="326" y="337"/><use href="#dsh-dot" x="854" y="337"/></g>
|
|
41
|
+
<g font-size="12.2" color="#56c2f0">
|
|
42
|
+
<g transform="translate(56 160)"><use href="#dsh-card-base"/><use href="#dsh-wand" x="24.5" y="24.5" width="19" height="19" class="dsh-icon"/><text x="64" y="39" class="dsh-strong" font-size="15">Split polish button</text>
|
|
43
|
+
<text x="32" y="66" class="dsh-copy">main key: direct polish<tspan x="32" dy="20">▾ menu: role-styled rewrite</tspan><tspan x="32" dy="20">role text only in <data> fence</tspan></text><text x="129" y="131" class="dsh-status">error flashes 4s · draft intact</text></g>
|
|
44
|
+
<g transform="translate(56 322)"><use href="#dsh-card-base"/><use href="#dsh-tree" x="24.5" y="24.5" width="19" height="19" class="dsh-icon"/><text x="64" y="39" class="dsh-strong" font-size="15">Allowed roots</text>
|
|
45
|
+
<text x="32" y="66" class="dsh-copy">absolute dirs only; ~ dropped<tspan x="32" dy="20">cwd · built-ins · roots</tspan><tspan x="32" dy="20">. / .. / hidden segments denied</tspan></text><text x="129" y="131" class="dsh-status">out-of-root → 403 + roots listed</text></g>
|
|
46
|
+
<g transform="translate(56 484)"><use href="#dsh-card-base"/><use href="#dsh-download" x="24.5" y="24.5" width="19" height="19" class="dsh-icon"/><text x="64" y="39" class="dsh-strong" font-size="15">Import</text>
|
|
47
|
+
<text x="32" y="66" class="dsh-copy">empty path: built-in agents/<tspan x="32" dy="20">explicit paths pass roots first</tspan><tspan x="32" dy="20">skip counts reported as-is</tspan></text><text x="129" y="131" class="dsh-status">read-only · zero model calls</text></g>
|
|
48
|
+
<g transform="translate(866 160)" color="#8a91ff"><use href="#dsh-card-base"/><use href="#dsh-caret-icon" x="24.5" y="24.5" width="19" height="19" class="dsh-icon" color="#56c2f0"/><text x="64" y="39" class="dsh-strong" font-size="15">Caret-safe insertion</text>
|
|
49
|
+
<text x="32" y="66" class="dsh-copy">captureInsertion() takes caret<tspan x="32" dy="20">insertText validates the span</tspan><tspan x="32" dy="20">stale or submitting → refused</tspan></text><text x="129" y="131" class="dsh-status">no whole-draft fallback</text></g>
|
|
50
|
+
<g transform="translate(866 322)" color="#8a91ff"><use href="#dsh-card-base"/><use href="#dsh-pen" x="24.5" y="24.5" width="19" height="19" class="dsh-icon" color="#56c2f0"/><text x="64" y="39" class="dsh-strong" font-size="15">Template library</text>
|
|
51
|
+
<text x="32" y="66" class="dsh-copy">row-level CRUD per template<tspan x="32" dy="20">groups; emoji ≤ 12 code points</tspan><tspan x="32" dy="20">save once from a local draft</tspan></text><text x="129" y="131" class="dsh-status">reset = unset(templates)</text></g>
|
|
52
|
+
<g transform="translate(866 484)" color="#8a91ff"><use href="#dsh-card-base"/><use href="#dsh-shield" x="24.5" y="24.5" width="19" height="19" class="dsh-icon" color="#56c2f0"/><text x="64" y="39" class="dsh-strong" font-size="15">Model & write-back</text>
|
|
53
|
+
<text x="32" y="66" class="dsh-copy">live agent model first<tspan x="32" dy="20">finish.kind === stop only</tspan><tspan x="32" dy="20">rechecks session/rev/phase</tspan></text><text x="129" y="131" class="dsh-status">stale results never written</text></g>
|
|
54
|
+
</g>
|
|
55
|
+
<rect x="338" y="160" width="504" height="222" rx="16" class="dsh-outline"/>
|
|
56
|
+
<text x="362" y="210" font-size="15.5" class="dsh-muted">Draft a refactor plan for the auth module…<tspan dx="2" fill="#56c2f0" fill-opacity="1" font-size="18" aria-hidden="true">|</tspan></text>
|
|
57
|
+
<text x="362" y="248" font-size="12.2" class="dsh-muted">cursor at | — templates insert right here,<tspan x="362" dy="19">quotes and attachments untouched</tspan></text>
|
|
58
|
+
<path d="M362 294H818" stroke="#94a0b6" stroke-opacity=".22"/>
|
|
59
|
+
<rect x="496" y="316" width="158" height="42" rx="21" fill="url(#dsh-polish)"/><path d="M612 316h21a21 21 0 0 1 0 42h-21Z" fill="#0a0f16" fill-opacity=".08"/><path d="M612 316v42" stroke="#0a0f16" stroke-opacity=".32"/>
|
|
60
|
+
<text x="554" y="342" text-anchor="middle" font-size="13.5" font-weight="700" fill="#0a0f16">Polish</text><use href="#dsh-chevron" x="624" y="328" width="18" height="18" class="dsh-icon" color="#0a0f16"/>
|
|
61
|
+
<rect x="666" y="316" width="152" height="42" rx="21" class="dsh-outline"/><text x="686" y="342" font-size="13.5" font-weight="700" fill="#56c2f0">Templates</text><use href="#dsh-chevron" x="781" y="328" width="18" height="18" class="dsh-icon" color="#56c2f0"/>
|
|
62
|
+
<rect x="338" y="414" width="504" height="174" rx="18" class="dsh-soft"/><text x="362" y="448" font-size="12" font-weight="700" fill="#56c2f0">WHERE IT MOUNTS</text>
|
|
63
|
+
<use href="#dsh-dot" x="364" y="473"/><use href="#dsh-dot" x="364" y="499"/><use href="#dsh-dot" x="364" y="525"/>
|
|
64
|
+
<text x="378" y="477" font-size="12.2" class="dsh-copy">dock slot conversation.input.right · order 99 / 100<tspan x="378" dy="26">placeholder chain slot conversation.input.placeholder</tspan><tspan x="378" dy="26">card data plane: dirPrepOrganize remote</tspan><tspan x="378" dy="20">over the host /api gateway</tspan></text>
|
|
65
|
+
<rect x="56" y="650" width="1068" height="46" rx="14" class="dsh-soft"/><rect x="72" y="662" width="3" height="22" rx="1.5" fill="url(#dsh-accent)"/><text x="88" y="678" font-size="13.5" class="dsh-copy">No model tools, no plugin HTTP routes; the role library is vendored upstream MIT data, never hand-edited.</text>
|
|
66
|
+
</svg>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1180" height="720" viewBox="0 0 1180 720" overflow="hidden" xml:lang="zh-CN" role="img" aria-labelledby="title desc" aria-describedby="desc" font-family="Inter, system-ui, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', 'Noto Sans SC', sans-serif">
|
|
2
|
+
<title id="title">DSH 插件 · 输入框组件 — 输入框旁的润色与模板</title>
|
|
3
|
+
<desc id="desc">一个拆分式润色按钮和一个模板下拉,就长在输入框旁边。</desc>
|
|
4
|
+
<style>
|
|
5
|
+
.dsh-heading { fill:#f2f5fb; font-weight:700 } .dsh-copy { fill:#d6deec; fill-opacity:.82 } .dsh-muted { fill:#94a0b6; fill-opacity:.9 }
|
|
6
|
+
.dsh-panel { fill:#fff; fill-opacity:.045; stroke:#fff; stroke-opacity:.10 } .dsh-soft { fill:#fff; fill-opacity:.03; stroke:#fff; stroke-opacity:.07 }
|
|
7
|
+
.dsh-focus { fill:#fff; fill-opacity:.03; stroke:#56c2f0; stroke-opacity:.45; stroke-width:1.1 } .dsh-tile { fill:url(#dsh-tile-ink); stroke:#56c2f0; stroke-opacity:.28 }
|
|
8
|
+
.dsh-icon { fill:none; stroke:#56c2f0; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round } .dsh-dot { fill:#56c2f0; fill-opacity:.8 }
|
|
9
|
+
.dsh-chip { fill:url(#dsh-chip-ink); stroke:#56c2f0; stroke-opacity:.35 } .dsh-chip-violet { stroke:#8a91ff }
|
|
10
|
+
.dsh-tag { fill:#56c2f0; font-size:12px; font-weight:600 } .dsh-tag-violet { fill:#8a91ff }
|
|
11
|
+
</style>
|
|
12
|
+
<defs>
|
|
13
|
+
<linearGradient id="dsh-bg" x2="100%" y2="100%"><stop stop-color="#0b1218"/><stop offset="100%" stop-color="#080d12"/></linearGradient>
|
|
14
|
+
<linearGradient id="dsh-title-ink"><stop stop-color="#56c2f0"/><stop offset="100%" stop-color="#8a91ff"/></linearGradient>
|
|
15
|
+
<linearGradient id="dsh-top"><stop stop-color="#56c2f0" stop-opacity=".55"/><stop offset="50%" stop-color="#8a91ff" stop-opacity=".55"/><stop offset="100%" stop-color="#56c2f0" stop-opacity=".55"/></linearGradient>
|
|
16
|
+
<linearGradient id="dsh-polish" x2="0%" y2="100%"><stop stop-color="#56c2f0"/><stop offset="100%" stop-color="#2a7fc0"/></linearGradient>
|
|
17
|
+
<linearGradient id="dsh-tile-ink" x2="100%" y2="100%"><stop stop-color="#56c2f0" stop-opacity=".20"/><stop offset="100%" stop-color="#2a7fc0" stop-opacity=".24"/></linearGradient>
|
|
18
|
+
<linearGradient id="dsh-chip-ink"><stop stop-color="#56c2f0" stop-opacity=".16"/><stop offset="100%" stop-color="#8a91ff" stop-opacity=".10"/></linearGradient>
|
|
19
|
+
<radialGradient id="dsh-glow-cyan"><stop stop-color="#56c2f0" stop-opacity=".22"/><stop offset="100%" stop-color="#56c2f0" stop-opacity="0"/></radialGradient>
|
|
20
|
+
<radialGradient id="dsh-glow-violet"><stop stop-color="#8a91ff" stop-opacity=".14"/><stop offset="100%" stop-color="#8a91ff" stop-opacity="0"/></radialGradient>
|
|
21
|
+
<pattern id="dsh-grid" width="34" height="34" patternUnits="userSpaceOnUse"><path d="M34 .5H.5V34" fill="none" stroke="#fff" stroke-opacity=".05"/></pattern>
|
|
22
|
+
<symbol id="dsh-wand" viewBox="0 0 24 24"><path d="m15 4 5 5L7 22l-5-5z M14 7l3 3 M9 2h2 M19 12h2 M2 9h2"/></symbol>
|
|
23
|
+
<symbol id="dsh-folder-tree" viewBox="0 0 24 24"><rect x="2" y="9" width="7" height="6" rx="1"/><rect x="15" y="3" width="7" height="6" rx="1"/><rect x="15" y="15" width="7" height="6" rx="1"/><path d="M9 12h3m3-6h-3v12h3"/></symbol>
|
|
24
|
+
<symbol id="dsh-download" viewBox="0 0 24 24"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4 M7 10l5 5 5-5 M12 15V3"/></symbol>
|
|
25
|
+
<symbol id="dsh-crosshair" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><path d="M22 12h-4 M6 12H2 M12 6V2 M12 22v-4"/></symbol>
|
|
26
|
+
<symbol id="dsh-pen" viewBox="0 0 24 24"><path d="M4 16l-1 5 5-1L20 8a2.83 2.83 0 0 0-4-4Z M13.5 6.5l4 4"/></symbol>
|
|
27
|
+
<symbol id="dsh-shield-check" viewBox="0 0 24 24"><path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z M9 12l2 2 4-4"/></symbol>
|
|
28
|
+
<g id="dsh-card-base"><rect width="256" height="150" rx="18" class="dsh-panel"/><rect x="16" y="14" width="34" height="34" rx="10" class="dsh-tile"/><g class="dsh-dot"><circle cx="20" cy="63" r="2.2"/><circle cx="20" cy="83" r="2.2"/><circle cx="20" cy="103" r="2.2"/></g></g>
|
|
29
|
+
</defs>
|
|
30
|
+
<rect width="1180" height="720" fill="url(#dsh-bg)"/>
|
|
31
|
+
<circle cx="1014.8" cy="0" r="330" fill="url(#dsh-glow-cyan)"/><circle cx="0" cy="720" r="300" fill="url(#dsh-glow-violet)"/>
|
|
32
|
+
<rect width="1180" height="720" fill="url(#dsh-grid)"/><rect width="1180" height="3" fill="url(#dsh-top)" opacity=".9"/>
|
|
33
|
+
<text x="56" y="48" font-size="12.5" font-weight="700" fill="url(#dsh-title-ink)">DSH 插件 · 输入框组件</text>
|
|
34
|
+
<text x="56" y="86" font-size="31" class="dsh-heading">输入框旁的润色与模板</text><text x="56" y="120" font-size="15" class="dsh-muted">一个拆分式润色按钮和一个模板下拉,就长在输入框旁边。</text>
|
|
35
|
+
<rect x="944" y="45" width="112" height="30" rx="15" class="dsh-chip"/><circle cx="960" cy="60" r="3.5" fill="#56c2f0"/><text x="971" y="64.5" font-size="12.5" font-weight="600" fill="#56c2f0">6 个能力面</text>
|
|
36
|
+
<rect x="1072" y="34" width="52" height="52" rx="16" class="dsh-tile"/><use href="#dsh-folder-tree" xlink:href="#dsh-folder-tree" x="1086" y="48" width="24" height="24" class="dsh-icon"/>
|
|
37
|
+
<path d="M312 235H328V559H312 M312 397H328 M328 334H344 M868 235H852V559H868 M868 397H852 M852 334H836" fill="none" stroke="#94a0b6" stroke-opacity=".42" stroke-width="1.2"/>
|
|
38
|
+
<rect x="344" y="160" width="492" height="224" rx="16" class="dsh-focus"/><circle cx="344" cy="334" r="2.5" class="dsh-dot"/><circle cx="836" cy="334" r="2.5" class="dsh-dot"/>
|
|
39
|
+
<rect x="368" y="196" width="2" height="24" rx="1" fill="#56c2f0"/><text x="377" y="214" font-size="16" class="dsh-copy">帮我起草 auth 模块的重构计划…</text>
|
|
40
|
+
<text x="368" y="249" font-size="12.5" class="dsh-muted">光标在 | 处 —— 模板就插在这里,引用块与附件原样</text>
|
|
41
|
+
<path d="M368 286.5H812" stroke="#56c2f0" stroke-opacity=".18"/>
|
|
42
|
+
<rect x="520" y="312" width="158" height="44" rx="22" fill="url(#dsh-polish)" opacity=".9"/><path d="M634 320v28" stroke="#0a0f16" stroke-opacity=".42" stroke-linecap="round"/>
|
|
43
|
+
<text x="577" y="339" text-anchor="middle" fill="#0a0f16" font-size="14" font-weight="700">润色</text><path d="M651 332h10l-5 5z" fill="#0a0f16"/>
|
|
44
|
+
<rect x="690" y="312" width="122" height="44" rx="22" class="dsh-focus"/><text x="740" y="339" text-anchor="middle" fill="#56c2f0" font-size="14" font-weight="700">模板</text><path d="M766 332h10l-5 5z" fill="#56c2f0"/>
|
|
45
|
+
<g transform="translate(56 160)"><use href="#dsh-card-base" xlink:href="#dsh-card-base"/><use href="#dsh-wand" xlink:href="#dsh-wand" x="23.5" y="21.5" width="19" height="19" class="dsh-icon"/>
|
|
46
|
+
<text x="62" y="36" font-size="15" class="dsh-heading">拆分式润色按钮</text>
|
|
47
|
+
<text font-size="13" class="dsh-copy"><tspan x="32" y="67">主键直接润色,不带角色</tspan><tspan x="32" y="87">▾ 展开:按角色风格润色</tspan><tspan x="32" y="107">角色正文只进 <data> 围栏</tspan></text>
|
|
48
|
+
<rect x="18" y="117" width="168" height="23" rx="11.5" class="dsh-chip"/><text x="30" y="133" class="dsh-tag">失败闪错 4 秒 · 不碰草稿</text></g>
|
|
49
|
+
<g transform="translate(56 322)"><use href="#dsh-card-base" xlink:href="#dsh-card-base"/><use href="#dsh-folder-tree" xlink:href="#dsh-folder-tree" x="23.5" y="21.5" width="19" height="19" class="dsh-icon"/>
|
|
50
|
+
<text x="62" y="36" font-size="15" class="dsh-heading">允许目录</text>
|
|
51
|
+
<text font-size="13" class="dsh-copy"><tspan x="32" y="67">只收绝对目录;~ 丢弃</tspan><tspan x="32" y="87">会话 cwd · 内置库 · 登记根</tspan><tspan x="32" y="107">「.」「..」与隐藏段拒绝</tspan></text>
|
|
52
|
+
<rect x="18" y="117" width="154" height="23" rx="11.5" class="dsh-chip"/><text x="30" y="133" class="dsh-tag">越界 403 并点名允许区</text></g>
|
|
53
|
+
<g transform="translate(56 484)"><use href="#dsh-card-base" xlink:href="#dsh-card-base"/><use href="#dsh-download" xlink:href="#dsh-download" x="23.5" y="21.5" width="19" height="19" class="dsh-icon"/>
|
|
54
|
+
<text x="62" y="36" font-size="15" class="dsh-heading">导入</text>
|
|
55
|
+
<text font-size="13" class="dsh-copy"><tspan x="32" y="67">路径留空:内置 agents/ 两层</tspan><tspan x="32" y="87">显式路径先过允许根再读</tspan><tspan x="32" y="107">跳过计数如实回报</tspan></text>
|
|
56
|
+
<rect x="18" y="117" width="126" height="23" rx="11.5" class="dsh-chip"/><text x="30" y="133" class="dsh-tag">只读 · 零模型调用</text></g>
|
|
57
|
+
<g transform="translate(868 160)"><use href="#dsh-card-base" xlink:href="#dsh-card-base"/><use href="#dsh-crosshair" xlink:href="#dsh-crosshair" x="23.5" y="21.5" width="19" height="19" class="dsh-icon"/>
|
|
58
|
+
<text x="62" y="36" font-size="15" class="dsh-heading">光标安全插入</text>
|
|
59
|
+
<text font-size="13" class="dsh-copy"><tspan x="32" y="67">captureInsertion() 取光标</tspan><tspan x="32" y="87">insertText 校验捕获选区</tspan><tspan x="32" y="107">已变化或提交期 → 拒绝</tspan></text>
|
|
60
|
+
<rect x="18" y="117" width="112" height="23" rx="11.5" class="dsh-chip dsh-chip-violet"/><text x="30" y="133" class="dsh-tag dsh-tag-violet">不回落整稿替换</text></g>
|
|
61
|
+
<g transform="translate(868 322)"><use href="#dsh-card-base" xlink:href="#dsh-card-base"/><use href="#dsh-pen" xlink:href="#dsh-pen" x="23.5" y="21.5" width="19" height="19" class="dsh-icon"/>
|
|
62
|
+
<text x="62" y="36" font-size="15" class="dsh-heading">模板库管理</text>
|
|
63
|
+
<text font-size="13" class="dsh-copy"><tspan x="32" y="67">行级新增 / 编辑 / 删除</tspan><tspan x="32" y="87">分组字段;emoji ≤ 12 码点</tspan><tspan x="32" y="107">本地草稿,保存一次写入</tspan></text>
|
|
64
|
+
<rect x="18" y="117" width="198" height="23" rx="11.5" class="dsh-chip dsh-chip-violet"/><text x="30" y="133" class="dsh-tag dsh-tag-violet">恢复默认 = unset(templates)</text></g>
|
|
65
|
+
<g transform="translate(868 484)"><use href="#dsh-card-base" xlink:href="#dsh-card-base"/><use href="#dsh-shield-check" xlink:href="#dsh-shield-check" x="23.5" y="21.5" width="19" height="19" class="dsh-icon"/>
|
|
66
|
+
<text x="62" y="36" font-size="15" class="dsh-heading">模型与写回保护</text>
|
|
67
|
+
<text font-size="13" class="dsh-copy"><tspan x="32" y="67">会话活 Agent 模型优先</tspan><tspan x="32" y="87">只有 finish.kind === stop 算成功</tspan><tspan x="32" y="107">复核会话 · draftRev · phase</tspan></text>
|
|
68
|
+
<rect x="18" y="117" width="124" height="23" rx="11.5" class="dsh-chip dsh-chip-violet"/><text x="30" y="133" class="dsh-tag dsh-tag-violet">过期结果绝不写回</text></g>
|
|
69
|
+
<rect x="344" y="426" width="492" height="208" rx="18" class="dsh-soft"/><text x="368" y="462" font-size="13" font-weight="700" fill="#56c2f0">挂载位置</text>
|
|
70
|
+
<path d="M368 477.5H812 M368 523.5H812 M368 569.5H812" stroke="#fff" stroke-opacity=".08"/><g class="dsh-dot"><circle cx="370" cy="501" r="2.2"/><circle cx="370" cy="547" r="2.2"/><circle cx="370" cy="593" r="2.2"/></g>
|
|
71
|
+
<text font-size="13" class="dsh-copy"><tspan x="384" y="506">dock 槽位 conversation.input.right · order 99 / 100</tspan><tspan x="384" y="552">占位符链槽 conversation.input.placeholder</tspan><tspan x="384" y="598">卡片数据面:dirPrepOrganize remote,走宿主 /api 网关</tspan></text>
|
|
72
|
+
<rect x="56" y="648" width="1068" height="48" rx="14" class="dsh-soft"/><rect x="58" y="660" width="3" height="24" rx="1.5" fill="url(#dsh-title-ink)"/>
|
|
73
|
+
<text x="80" y="677" font-size="13.5" class="dsh-copy">不注册模型工具、无自有 HTTP 路由;角色库是上游 MIT 的 vendored 数据,不手改;内置精选模板由同一库经代码生成产出。</text>
|
|
74
|
+
</svg>
|