@tbox.cn/tboxcode-dsh-presets 0.0.0-stage → 0.1.0-rc.14
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/headless-preset.d.ts +16 -0
- package/lib/headless-preset.js +1 -0
- package/lib/index.d.ts +12 -0
- package/lib/index.js +1 -0
- package/lib/ptc-filter.d.ts +9 -0
- package/lib/ptc-filter.js +1 -0
- package/package.json +44 -3
- package/presets.patch.yml +43 -0
- package/README.md +0 -3
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
|
|
3
|
+
//#region src/headless-preset.d.ts
|
|
4
|
+
|
|
5
|
+
declare module '@deepseek-ai/dsh-session' {
|
|
6
|
+
interface PluginRecordMap {
|
|
7
|
+
'plugin:tboxcode/agent-preset': {
|
|
8
|
+
agentPreset: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
declare const name = "tboxcode-headless-preset";
|
|
13
|
+
declare const inject: readonly ["agentPresets"];
|
|
14
|
+
declare function apply(ctx: Context): void;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { apply, inject, name };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{appendPluginRecord as e,pluginRecordOf as t}from"@deepseek-ai/dsh-session";async function n(e,t){let n=t.defaultId;if((await t.list()).some(e=>e.id===n&&e.broken===void 0))return n;let r=t.config.default;return n!==r&&e.logger.warn(`[tboxcode-preset] selectedDefault="${n}" 不在当前 profile roster,回退 ${r}`),r}const r=`tboxcode-headless-preset`,i=[`agentPresets`],a=`plugin:tboxcode/agent-preset`;function o(e){let n;for(let r=0;r<e.seq;r++){let i=e.eventAt(r);if(i?.type!==a)continue;let o=t(i);if(o===void 0)continue;let s=o.data;typeof s?.agentPreset==`string`&&s.agentPreset.length>0&&(n=s.agentPreset)}return n}function s(e){for(let t=0;t<e.seq;t++)if(e.eventAt(t)?.type===`turn/start`)return!0;return!1}function c(t,n,r,i){if(o(r)!==i)try{e(r,a,{agentPreset:i})}catch(e){t.logger.warn(`[tboxcode-preset] headless ${n}: preset 标记写入失败(不影响本次运行):${e instanceof Error?e.message:String(e)}`)}}function l(e){let t=e.get(`agentPresets`);if(t===void 0)return;let r=Date.now(),i=e.on;i(`agent/created`,async i=>{if(e.get(`headlessStartup`)===void 0)return;let a=i.agent,l=a.session.header;if(l.origin===`subagent`||l.parentSession!==void 0||l.isSeeded===!0||t.composedPreset?.(a.ctx)!==void 0)return;let u=o(a.session),d=l.createdAt!==void 0&&l.createdAt<r,f=l.agentPreset??u??(s(a.session)||d?`standard`:await n(e,t));await t.mount(a.ctx,f),c(e,a.id,a.session,f),e.logger.info(`[tboxcode-preset] headless ${a.id}: ${f}`)})}export{l as apply,i as inject,r as name};
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/index.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* tboxcode-dsh-presets:acp / headless 薄 preset 轴。
|
|
4
|
+
*
|
|
5
|
+
* registry default = standard;preset-ptc = tool-executor-ptc + ptc-filter;
|
|
6
|
+
* preset-standard = 空树(host plane 即 standard)。
|
|
7
|
+
*/
|
|
8
|
+
declare const PACKAGE_NAME = "@tbox.cn/tboxcode-dsh-presets";
|
|
9
|
+
declare const PRESET_IDS: readonly ["ptc", "standard"];
|
|
10
|
+
type PresetId = (typeof PRESET_IDS)[number];
|
|
11
|
+
//#endregion
|
|
12
|
+
export { PACKAGE_NAME, PRESET_IDS, PresetId };
|
package/lib/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=`@tbox.cn/tboxcode-dsh-presets`,t=[`ptc`,`standard`];export{e as PACKAGE_NAME,t as PRESET_IDS};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
|
|
3
|
+
//#region src/ptc-filter.d.ts
|
|
4
|
+
|
|
5
|
+
declare const name = "tboxcode-ptc-filter";
|
|
6
|
+
declare const inject: readonly ["tools"];
|
|
7
|
+
declare function apply(ctx: Context): void;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { apply, inject, name };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=`tboxcode-ptc-filter`,t=[`tools`],n=[`workflow`,`subagent_fork`];function r(e){let t=e.tools,r,i=[],a=!1,o=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),s=(t,n)=>{if(t!==void 0)try{return Promise.resolve(t()).then(()=>void 0,t=>{e.logger.warn(`tboxcode-ptc-filter: ${n}:${t instanceof Error?t.message:String(t)}`)})}catch(t){e.logger.warn(`tboxcode-ptc-filter: ${n}:${t instanceof Error?t.message:String(t)}`)}},c=()=>{if(!a){a=!0;try{let a=n.filter(e=>t.get(e)!==void 0);if(o(a,i))return;if(a.length===0){let e=r;r=void 0,i=[],s(e,`解除限制失败`);return}try{let e=t.restrict({deny:[...a]});if(typeof e!=`function`)throw Error(`tools.restrict() 未返回 disposer`);let n=r;r=e,i=[...a],s(n,`旧限制解除失败(新限制已生效)`)}catch(t){e.logger.debug(`tboxcode-ptc-filter: restrict 暂不可用(等待 tools/change):${t instanceof Error?t.message:String(t)}`)}}finally{a=!1}}};c();let l=e.on;e.effect(()=>{let e=l(`tools/change`,c);return()=>{e();let t=r;return r=void 0,i=[],s(t,`解除限制失败`)}},`tboxcode-ptc-filter`)}export{r as apply,t as inject,e as name};
|
package/package.json
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tbox.cn/tboxcode-dsh-presets",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
3
|
+
"version": "0.1.0-rc.14",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "acp/headless 薄 preset 轴:ptc executor + standard host plane",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"types": "lib/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib/index.d.ts",
|
|
11
|
+
"default": "./lib/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./ptc-filter": {
|
|
14
|
+
"types": "./lib/ptc-filter.d.ts",
|
|
15
|
+
"default": "./lib/ptc-filter.js"
|
|
16
|
+
},
|
|
17
|
+
"./presets.patch.yml": "./presets.patch.yml",
|
|
18
|
+
"./headless-preset": {
|
|
19
|
+
"types": "./lib/headless-preset.d.ts",
|
|
20
|
+
"default": "./lib/headless-preset.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"lib",
|
|
25
|
+
"presets.patch.yml"
|
|
26
|
+
],
|
|
27
|
+
"dsh": {
|
|
28
|
+
"bundle": {
|
|
29
|
+
"patch": [
|
|
30
|
+
"./presets.patch.yml"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@deepseek-ai/dsh-agent-preset": "0.2.2-rc.1",
|
|
36
|
+
"@deepseek-ai/dsh-agent-preset-registry": "0.2.2-rc.1",
|
|
37
|
+
"@deepseek-ai/dsh-session": "0.2.2-rc.1"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@deepseek-ai/cordis": "4.1.0",
|
|
41
|
+
"@deepseek-ai/dsh-tools": "0.2.2-rc.1"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsdown",
|
|
45
|
+
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
46
|
+
}
|
|
6
47
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# tboxcode-presets:acp / headless 薄 preset 轴。
|
|
2
|
+
#
|
|
3
|
+
# 口径(决策:默认 preset 改为 standard;架构沿用 preset-axis-thin):
|
|
4
|
+
# - acp / headless 的 host plane 即 standard;
|
|
5
|
+
# - ptc 直挂 tool-executor-ptc(0.2.2 presentation 选择器退役)与最小工具 deny;
|
|
6
|
+
# - standard 是空树(零插件),是默认树,也用于旧会话 resume 与显式回退;
|
|
7
|
+
# - default = standard,config.jsonc 的 agent_preset 可覆盖(启动期生效)。
|
|
8
|
+
#
|
|
9
|
+
# 本文件不挂 server / web 链——两形态继续使用官方 preset 轴
|
|
10
|
+
# (standard / ptc / minimal / cordis)。
|
|
11
|
+
- insert:
|
|
12
|
+
- id: agent-preset-registry
|
|
13
|
+
name: '@deepseek-ai/dsh-agent-preset-registry'
|
|
14
|
+
config:
|
|
15
|
+
default: standard
|
|
16
|
+
|
|
17
|
+
- id: preset-ptc
|
|
18
|
+
name: '@deepseek-ai/dsh-agent-preset'
|
|
19
|
+
config:
|
|
20
|
+
id: ptc
|
|
21
|
+
name: PTC
|
|
22
|
+
description: PTC execution over the host tool plane
|
|
23
|
+
order: 2
|
|
24
|
+
plugins:
|
|
25
|
+
- id: tool-executor-ptc
|
|
26
|
+
name: '@deepseek-ai/dsh-tool-executor-ptc'
|
|
27
|
+
- id: tboxcode-ptc-filter
|
|
28
|
+
name: '@tbox.cn/tboxcode-dsh-presets/ptc-filter'
|
|
29
|
+
|
|
30
|
+
- id: preset-standard
|
|
31
|
+
name: '@deepseek-ai/dsh-agent-preset'
|
|
32
|
+
config:
|
|
33
|
+
id: standard
|
|
34
|
+
name: Standard
|
|
35
|
+
description: Host-plane standard composition
|
|
36
|
+
order: 1
|
|
37
|
+
plugins: []
|
|
38
|
+
|
|
39
|
+
# headless 专用桥(acp 链上 headlessStartup 缺席 → 插件 no-op)。
|
|
40
|
+
# 上游 dsh-headless 支持 preset 后可删除本行与 src/headless-preset.ts。
|
|
41
|
+
- id: tboxcode-headless-preset
|
|
42
|
+
name: '@tbox.cn/tboxcode-dsh-presets/headless-preset'
|
|
43
|
+
inject: [agentPresets]
|
package/README.md
DELETED