@tbox.cn/tboxcode-dsh-cli 0.1.0-rc.16 → 0.1.0-rc.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/lib/bin.js
CHANGED
|
@@ -3,4 +3,4 @@ import{n as e}from"./identity-DoyHEplh.js";import{readFileSync as t}from"node:fs
|
|
|
3
3
|
`)}const l=[[`-h, --help`,`显示本帮助并退出`],[`-v, --version`,`显示版本并退出`]];function u(){return[`tboxcode-dsh <command> [flags]`,``,`命令:`,c([...r.map(e=>[e,i[e].summary]),...l]),``,`每个命令的详细用法:tboxcode-dsh help <command>`].join(`
|
|
4
4
|
`)}function d(e){let t=i[e],n=[...t.flags.map(e=>[`--${e.name}${e.value===void 0?``:` ${e.value}`}`,e.repeatable===!0?`${e.desc}(可重复)`:e.desc]),...l],r=[`tboxcode-dsh ${e} — ${t.summary}`,``,`用法:`,` ${t.usage}`,``,`Flags:`,c(n)];return t.positionals!==void 0&&t.positionals.length>0&&r.push(``,`参数:`,c(t.positionals.map(e=>[e.name,e.desc]))),t.notes!==void 0&&t.notes.length>0&&r.push(``,`说明:`,t.notes.map(e=>` ${e}`).join(`
|
|
5
5
|
`)),r.push(``,`退出码:`,` ${t.exitCodes??`0 正常;2 用法错误;其余非零 = 运行时失败(spawn 类命令透传 dsh 退出码)`}`),r.join(`
|
|
6
|
-
`)}var f=class extends Error{};const p=new Set([`-h`,`--help`]),m=new Set([`-v`,`--version`]),h=new Set([`json`,`no-open`,`dry-run`,`repair-all`,`config`]);function g(e){let t=new Map,n=[],r=0;for(;r<e.length;){let i=e[r]??``;if(i.startsWith(`--`)){let n=i.slice(2);if(h.has(n)){t.set(n,!0),r+=1;continue}let a=e[r+1];if(a!==void 0&&!a.startsWith(`--`)){let e=t.get(n);e===void 0?t.set(n,a):typeof e==`string`?t.set(n,[e,a]):Array.isArray(e)&&t.set(n,[...e,a]),r+=2;continue}t.set(n,!0),r+=1;continue}n.push(i),r+=1}return{flags:t,positional:n}}function _(e,t){let n=o(t),r=s(t),i=new Map,a=[],c=[],l=!1,u=!1,d=!1;for(let t=0;t<e.length;t+=1){let o=e[t]??``;if(d){a.push(o);continue}if(o===`--`){d=!0;continue}if(o.startsWith(`--`)){let a=o.indexOf(`=`),s=a>=0?o.slice(2,a):o.slice(2),d=a>=0?o.slice(a+1):void 0;if(s===`help`||s===`version`){d===void 0?s===`help`?l=!0:u=!0:c.push(`--${s} 不接受值`);continue}if(n.has(s)){if(d!==void 0){c.push(`--${s} 不接受值`);continue}i.set(s,!0);continue}let f=r.get(s);if(f===void 0){c.push(`未知 flag --${s}`);continue}let p=d;if(p===void 0){let n=e[t+1];n!==void 0&&!n.startsWith(`--`)&&(p=n,t+=1)}if(p===void 0){c.push(`--${s} 需要值`);continue}if(f.repeatable===!0){let e=i.get(s);i.set(s,Array.isArray(e)?[...e,p]:typeof e==`string`?[e,p]:[p])}else i.set(s,p);continue}if(o.startsWith(`-`)&&o.length>1){if(o===`-h`){l=!0;continue}if(o===`-v`){u=!0;continue}c.push(`未知 flag ${o}`);continue}a.push(o)}return{flags:i,positional:a,help:l,version:u,errors:c}}function v(e,t){if(t.errors.length>0)throw new f(t.errors[0]??`用法错误`);let n=e.positionals??[];if(n.length===0){if(t.positional.length>0)throw new f(`不接受位置参数,实得 "${t.positional.join(` `)}"`);return}if(n[0]?.variadic!==!0&&t.positional.length>n.length)throw new f(`位置参数过多(最多 ${n.length} 个)`)}function y(){let e=JSON.parse(t(n(new URL(`../package.json`,import.meta.url)),`utf-8`));console.log(`tboxcode-dsh ${e.version??`unknown`}`)}function b(e){let t={},n=e.flags.get(`port`);if(typeof n==`string`){let e=Number(n);if(!Number.isInteger(e)||e<0||e>65535)throw new f(`--port 必须是 0..65535 的整数,实得 "${n}"`);t.port=e}let r=e.flags.get(`host`);typeof r==`string`&&(t.host=r),e.flags.get(`no-open`)===!0&&(t.noOpen=!0);let i=e.flags.get(`trusted-host`);return i!==void 0&&(t.trustedHost=(Array.isArray(i)?i:[i]).filter(e=>typeof e==`string`)),t}function x(e,t){let n={};e.flags.get(`config`)===!0&&(n.config=!0),e.flags.get(`dry-run`)===!0&&(n.dryRun=!0),e.flags.get(`repair-all`)===!0&&(n.repairAll=!0);let r=e.flags.get(`profile`);if(typeof r==`string`){if(!t.includes(r))throw new f(`--profile 仅接受四 profile 名(${t.join(` / `)}),实得 ${r}`);n.profile=r}return n}function S(e){let t={task:e.positional},n=e.flags.get(`session-id`);return typeof n==`string`&&(t.sessionId=n),e.flags.get(`json`)===!0&&(t.json=!0),t}async function C(e,t){switch(e){case`web`:{let{runWeb:e}=await import(`./web-dA-kJdsr.js`);return e(b(t))}case`headless`:{let{runHeadless:e}=await import(`./headless-ofA6qyIK.js`);return e(S(t))}case`acp`:{let{runAcp:e}=await import(`./forms-CQF321Hd.js`);return e()}case`init`:{let[{OWN_PROFILES:e},{runInit:n}]=await Promise.all([import(`./assembly-DNm73rzb.js`),import(`./init-
|
|
6
|
+
`)}var f=class extends Error{};const p=new Set([`-h`,`--help`]),m=new Set([`-v`,`--version`]),h=new Set([`json`,`no-open`,`dry-run`,`repair-all`,`config`]);function g(e){let t=new Map,n=[],r=0;for(;r<e.length;){let i=e[r]??``;if(i.startsWith(`--`)){let n=i.slice(2);if(h.has(n)){t.set(n,!0),r+=1;continue}let a=e[r+1];if(a!==void 0&&!a.startsWith(`--`)){let e=t.get(n);e===void 0?t.set(n,a):typeof e==`string`?t.set(n,[e,a]):Array.isArray(e)&&t.set(n,[...e,a]),r+=2;continue}t.set(n,!0),r+=1;continue}n.push(i),r+=1}return{flags:t,positional:n}}function _(e,t){let n=o(t),r=s(t),i=new Map,a=[],c=[],l=!1,u=!1,d=!1;for(let t=0;t<e.length;t+=1){let o=e[t]??``;if(d){a.push(o);continue}if(o===`--`){d=!0;continue}if(o.startsWith(`--`)){let a=o.indexOf(`=`),s=a>=0?o.slice(2,a):o.slice(2),d=a>=0?o.slice(a+1):void 0;if(s===`help`||s===`version`){d===void 0?s===`help`?l=!0:u=!0:c.push(`--${s} 不接受值`);continue}if(n.has(s)){if(d!==void 0){c.push(`--${s} 不接受值`);continue}i.set(s,!0);continue}let f=r.get(s);if(f===void 0){c.push(`未知 flag --${s}`);continue}let p=d;if(p===void 0){let n=e[t+1];n!==void 0&&!n.startsWith(`--`)&&(p=n,t+=1)}if(p===void 0){c.push(`--${s} 需要值`);continue}if(f.repeatable===!0){let e=i.get(s);i.set(s,Array.isArray(e)?[...e,p]:typeof e==`string`?[e,p]:[p])}else i.set(s,p);continue}if(o.startsWith(`-`)&&o.length>1){if(o===`-h`){l=!0;continue}if(o===`-v`){u=!0;continue}c.push(`未知 flag ${o}`);continue}a.push(o)}return{flags:i,positional:a,help:l,version:u,errors:c}}function v(e,t){if(t.errors.length>0)throw new f(t.errors[0]??`用法错误`);let n=e.positionals??[];if(n.length===0){if(t.positional.length>0)throw new f(`不接受位置参数,实得 "${t.positional.join(` `)}"`);return}if(n[0]?.variadic!==!0&&t.positional.length>n.length)throw new f(`位置参数过多(最多 ${n.length} 个)`)}function y(){let e=JSON.parse(t(n(new URL(`../package.json`,import.meta.url)),`utf-8`));console.log(`tboxcode-dsh ${e.version??`unknown`}`)}function b(e){let t={},n=e.flags.get(`port`);if(typeof n==`string`){let e=Number(n);if(!Number.isInteger(e)||e<0||e>65535)throw new f(`--port 必须是 0..65535 的整数,实得 "${n}"`);t.port=e}let r=e.flags.get(`host`);typeof r==`string`&&(t.host=r),e.flags.get(`no-open`)===!0&&(t.noOpen=!0);let i=e.flags.get(`trusted-host`);return i!==void 0&&(t.trustedHost=(Array.isArray(i)?i:[i]).filter(e=>typeof e==`string`)),t}function x(e,t){let n={};e.flags.get(`config`)===!0&&(n.config=!0),e.flags.get(`dry-run`)===!0&&(n.dryRun=!0),e.flags.get(`repair-all`)===!0&&(n.repairAll=!0);let r=e.flags.get(`profile`);if(typeof r==`string`){if(!t.includes(r))throw new f(`--profile 仅接受四 profile 名(${t.join(` / `)}),实得 ${r}`);n.profile=r}return n}function S(e){let t={task:e.positional},n=e.flags.get(`session-id`);return typeof n==`string`&&(t.sessionId=n),e.flags.get(`json`)===!0&&(t.json=!0),t}async function C(e,t){switch(e){case`web`:{let{runWeb:e}=await import(`./web-dA-kJdsr.js`);return e(b(t))}case`headless`:{let{runHeadless:e}=await import(`./headless-ofA6qyIK.js`);return e(S(t))}case`acp`:{let{runAcp:e}=await import(`./forms-CQF321Hd.js`);return e()}case`init`:{let[{OWN_PROFILES:e},{runInit:n}]=await Promise.all([import(`./assembly-DNm73rzb.js`),import(`./init-BovC7ikx.js`)]);return n(x(t,e))}case`doctor`:{let{runDoctor:e}=await import(`./doctor-5841wpA-.js`);return e()}}}async function w(e,t){let n=i[e];try{if(n.validation===`passthrough`){if(t.some(e=>p.has(e)))return console.log(d(e)),0;if(t.some(e=>m.has(e)))return y(),0;let n=g(t),{runServer:r}=await import(`./forms-CQF321Hd.js`);return await r({flags:n.flags,positional:n.positional})}let r=_(t,n);return r.help?(console.log(d(e)),0):r.version?(y(),0):(v(n,r),await C(e,r))}catch(t){if(t instanceof f)return console.error(`tboxcode-dsh ${e}: ${t.message}`),console.error(`运行 tboxcode-dsh ${e} --help 查看用法`),2;throw t}}async function T(){process.title=e.cli;let[t,...n]=process.argv.slice(2);if(t===void 0)return console.error(`tboxcode-dsh: 缺少命令`),console.error(u()),2;if(p.has(t))return console.log(u()),0;if(m.has(t))return y(),0;if(t===`help`){let e=n[0];return e===void 0?(console.log(u()),0):a(e)?(console.log(d(e)),0):(console.error(`tboxcode-dsh: 未知命令 "${e}"`),console.error(u()),2)}return a(t)?await w(t,n):(console.error(`tboxcode-dsh: 未知命令 "${t}"`),console.error(u()),2)}T().then(e=>{process.exit(e)}).catch(e=>{console.error(e instanceof Error?e.message:String(e)),process.exit(1)});export{};
|
|
@@ -8,6 +8,14 @@ import"./identity-DoyHEplh.js";import{h as e,o as t,s as n,t as r,u as i}from"./
|
|
|
8
8
|
// server/web 另支持 minimal / cordis。修改后需重启进程(startup-only)。
|
|
9
9
|
// "agent_preset": "ptc",
|
|
10
10
|
|
|
11
|
+
// 身份覆盖(可选):默认 = DSH 部署 persona + harness identity。
|
|
12
|
+
// 配置后由 tboxcode-identity 直读;新会话生效,子代理不覆盖。
|
|
13
|
+
// "identity": {
|
|
14
|
+
// "persona": "You are a coding agent, running inside Acme.",
|
|
15
|
+
// "suppress_harness": false,
|
|
16
|
+
// "interpolate": false
|
|
17
|
+
// },
|
|
18
|
+
|
|
11
19
|
// provider 定义(LlmAdapter:anthropic / openai / openai-compatible;全量接入归 llm-stack)
|
|
12
20
|
// "provider": {
|
|
13
21
|
// "<id>": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tbox.cn/tboxcode-dsh-cli",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "bin tboxcode-dsh:acp / server / web / headless / init / doctor——薄封装,spawn dsh --profile <name> --patch <generated>;装配模块住本包",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"node": ">=24.9.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@deepseek-ai/dsh": "0.2.2-rc.
|
|
25
|
-
"@deepseek-ai/dsh-atomic-write": "0.2.2-rc.
|
|
24
|
+
"@deepseek-ai/dsh": "0.2.2-rc.5",
|
|
25
|
+
"@deepseek-ai/dsh-atomic-write": "0.2.2-rc.5",
|
|
26
26
|
"yaml": "^2.8.0",
|
|
27
|
-
"@tbox.cn/tboxcode-dsh-runtime": "0.1.0-rc.
|
|
27
|
+
"@tbox.cn/tboxcode-dsh-runtime": "0.1.0-rc.17"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@deepseek-ai/dsh-llm-mock-server": "0.2.2-rc.
|
|
30
|
+
"@deepseek-ai/dsh-llm-mock-server": "0.2.2-rc.5"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "tsdown",
|