@tbox.cn/tboxcode-dsh-bundle 0.0.0-stage → 0.1.0-rc.2

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.
@@ -0,0 +1,105 @@
1
+ # tboxcode-bundle 结构行集(四 profile 链恒挂)。
2
+ # 行组规格见 .agents/designs/implemented/2026-10-01-overview.md「bundle patch 行清单」(行组级)。
3
+ # 禁用行组 = repo-bootstrap 落位;llm / tools / subagent 宿主行 / persona-identity /
4
+ # 补挂 行组随 llm-stack C4/C5 落位(prompts / remote 行组随 C6 / serve-gateway)。
5
+ #
6
+ # 行位规则(overview「行投放分类」真源):自有插件行 → bundle host 行(agent 平面行,
7
+ # 四链恒挂;explore 面差异靠 subagent toolFilter 不靠行差分);同 id 覆盖行携带 name
8
+ # 防护 + 完整 config(S1a 首验:顶层键整替换 + name mismatch skip)。
9
+ #
10
+ # 禁用行组(同 id 覆盖,disabled 字段替换;未命中目标 warn + skip——acp / headless 链上
11
+ # tool-web 等行缺席属预期,冗余禁用 = 两形态一致纪律,决策:web-tools-layered-disable):
12
+ # plan-mode(guidance 单源 = 权限说明 section——plan-mode-mount-exclusion,两形态统一禁用)
13
+ # DeepSeek 专有行族:deepseek-llm-api-extensions / deepseek-account / session-log-deepseek /
14
+ # session-telemetry-otel(数据外发)/ web-search-deepseek / web-deepseek-api
15
+ # (0.2.1 新增 DeepSeek Search/Fetch API 行——专有族同纪律禁用)
16
+ # tool-web 整行(tboxcode 层唯一 web 工具 = 本仓 webfetch 移植版,双工具与提示词段落随行消失)
17
+ # hmr(profile 只做装配——静态化决策,实测 spike-hmr-granularity)
18
+ # tool-subagent-fork(0.2.1 base host 层 fork 默认行——fork 维持裁剪,tboxcode 基线
19
+ # 无 fork 能力面)。tool-subagent host 默认行**不禁用**(subagent-native-adoption:
20
+ # 原生 spawn 行采纳——官方 standard 同构语义即 base 行 + 树行共存;manifest 序
21
+ # full-app 先于本 bundle,禁用行会命中 full-app insert 行致 acp 链委派工具缺席
22
+ # 〔e2e 实证〕;深度钉扎由树行与 full-app 行的 maxDepth: 1 承载,base 行 Host 缺省
23
+ # 同值〔1〕但 Volatile——已知形态,行级确定性表达在消费侧行)
24
+ # 注:working-directory / tool-working-directory(0.2.1 base 新行)采纳原生不设禁用行——
25
+ # 注入 Current working directory 且带 working_directory 工具联动,本仓 environment
26
+ # 的 Working directory 行同步退役消双通道(subagent-native-adoption / note B)。
27
+ # 注:agent-instructions 不在禁用组(原生采纳——agent-instructions-native-adoption;web/server
28
+ # 链由 presets 树重建行接管,acp/headless 走 base 挂载行)。
29
+ # 注:persona 无禁用行——persona 无 host 行(base / web-app 均无),只活 preset 树内;
30
+ # identity 单点化 = 四树删行 + system-prompt 覆盖行(上方),dsh 内建 preset 树的
31
+ # persona 行属 dsh 内建面不动(reminders-plugin-dissolution 实施校准)。
32
+ - id: plan-mode
33
+ disabled: true
34
+ - id: deepseek-llm-api-extensions
35
+ disabled: true
36
+ - id: deepseek-account
37
+ disabled: true
38
+ - id: session-log-deepseek
39
+ disabled: true
40
+ - id: session-telemetry-otel
41
+ disabled: true
42
+ - id: web-search-deepseek
43
+ disabled: true
44
+ - id: web-deepseek-api
45
+ disabled: true
46
+ - id: tool-web
47
+ disabled: true
48
+ - id: hmr
49
+ disabled: true
50
+ - id: tool-subagent-fork
51
+ disabled: true
52
+
53
+ # ── 新增行组(insert 语义——裸行 = 覆盖语义会 not found,新增行必须包 insert 块;
54
+ # persona-identity 与 skill-filesystem 是覆盖行保持裸行)──
55
+ - insert:
56
+ # ── llm 行组(host 服务行;零 config——插件零 Config 导出纪律,C2)──
57
+ - id: tboxcode-llm
58
+ name: '@tbox.cn/tboxcode-dsh-llm'
59
+
60
+ # ── tools 行组(C4 五件插件;agent 平面 host 行)──
61
+ # webfetch:截断参数走缺省(2000 行 / 50KB——tools.output 翻译域经 overlay 覆盖)
62
+ - id: tboxcode-webfetch
63
+ name: '@tbox.cn/tboxcode-dsh-tools/webfetch'
64
+ # skill 兼容 provider(rank 50 cwd-up roots;skills.paths 翻译域经行 config 注入)
65
+ - id: tboxcode-skill-provider
66
+ name: '@tbox.cn/tboxcode-dsh-tools/skill-provider'
67
+ # slash-only 限制(skills: slash-only 翻译域经行 config 注入;零 config = 零限制常驻)
68
+ - id: tboxcode-restrict
69
+ name: '@tbox.cn/tboxcode-dsh-tools/restrict'
70
+ # permission 拦截器(permission / mcpDenyPatterns 翻译域经行 config 注入)
71
+ - id: tboxcode-pre-execute
72
+ name: '@tbox.cn/tboxcode-dsh-tools/pre-execute'
73
+ # scratch 三件(常驻注册——工具目录跨模式稳定,plan-mode-sandbox-composition 硬约束④)
74
+ - id: tboxcode-scratch
75
+ name: '@tbox.cn/tboxcode-dsh-tools/scratch'
76
+
77
+ # ── prompts 行组(C6:七 section + 三 context + 重排器 + complete 整接管;
78
+ # systemPrompt / rules 翻译域经行 config 注入)──
79
+ - id: tboxcode-prompts
80
+ name: '@tbox.cn/tboxcode-dsh-bundle/prompts'
81
+
82
+ # ── 收敛环(C8:config 结构级热载——watcher 触发翻译比对、session/event
83
+ # open-turn 门、profileContext.overlays 原位更新 + reconcile;零 config——
84
+ # configDir 走 env 探测点)──
85
+ - id: tboxcode-convergence
86
+ name: '@tbox.cn/tboxcode-dsh-bundle/convergence'
87
+ - id: tboxcode-remote
88
+ name: '@tbox.cn/tboxcode-dsh-bundle/remote'
89
+
90
+ # ── persona-identity 单点化(同 id 覆盖 dsh-base system-prompt 服务行;
91
+ # decisions:reminders-plugin-dissolution——品牌串纯静态零插值,{{model}} 退出 prompt
92
+ # 改由 tboxcode:model context 承载〔C6〕;includeHarnessIdentity 关闭 harness 身份段;
93
+ # personaSuffix 键不出现 → schema 默认空串生效)──
94
+ - id: system-prompt
95
+ name: '@deepseek-ai/dsh-system-prompt'
96
+ config:
97
+ personaPrefix: You are a coding agent, running inside tboxcode.
98
+ includeHarnessIdentity: false
99
+
100
+ # ── 补挂行组:host skill-filesystem 启用行(server 形态生态融合义务——web 基座
101
+ # host 层禁用〔provider 注册进 preset 层〕,本行重开 global 层挂载;skill-filesystem
102
+ # 为分层 provider 设计〔host global 层 + preset 层共存〕,与 presets 树行不冲突;
103
+ # acp/headless 链 base 已启用,同 id 冗余覆盖 = 两形态一致纪律)──
104
+ - id: skill-filesystem
105
+ name: '@deepseek-ai/dsh-skill-filesystem'
@@ -0,0 +1,105 @@
1
+ import { t as createConvergenceCore } from "./convergence-core-CbS-hTjK.js";
2
+ import { existsSync } from "node:fs";
3
+ import { dirname, join } from "node:path";
4
+ import { pathToFileURL } from "node:url";
5
+ import { OVERLAY_ROW_IDS, loadConfig, resolveConfigDir, rowsToPatchElements, translateConfig, watchConfigFiles } from "@tbox.cn/tboxcode-dsh-runtime";
6
+
7
+ //#region src/convergence.ts
8
+ const name = "tboxcode-convergence";
9
+ const inject = [];
10
+ /** 翻译产出行 id 是否我方(覆盖行闭集——OVERLAY_ROW_IDS 契约共享,runtime patch.ts;
11
+ * 0.2.1 原生采纳后翻译产物全量落在闭集内,agents 域新增行前缀已随类型面退役删除)。 */
12
+ function isMineRowId(id) {
13
+ return OVERLAY_ROW_IDS.has(id);
14
+ }
15
+ /** patch 元素是否为我方行(覆盖行 id 判定 / insert 块内行 id 判定)。 */
16
+ function isMineElement(element) {
17
+ if (element === null || typeof element !== "object") return false;
18
+ const el = element;
19
+ if (typeof el["id"] === "string" && isMineRowId(el["id"])) return true;
20
+ if (Array.isArray(el["insert"])) return el["insert"].some((row) => typeof row?.["id"] === "string" && isMineRowId(row["id"]));
21
+ return false;
22
+ }
23
+ /** host 主包根(app-boot 同源解析 base)——argv[1] = <主包>/lib/bin.js → <主包>/。 */
24
+ function hostBaseUrl() {
25
+ return pathToFileURL(join(dirname(process.argv[1] ?? ""), "..")).href + "/";
26
+ }
27
+ /** 存量 agents/ 目录退役提示的去重标记(per-process 一次性)。 */
28
+ let agentsDirWarned = false;
29
+ function apply(ctx) {
30
+ const root = ctx.root;
31
+ const configDir = resolveConfigDir();
32
+ const pc = root.profileContext;
33
+ if (pc === void 0) return () => {};
34
+ const io = {
35
+ translate() {
36
+ const loaded = loadConfig(configDir);
37
+ let translation;
38
+ try {
39
+ translation = translateConfig(loaded.config, configDir, loaded.path !== null);
40
+ } catch (error) {
41
+ if (error.code === "MODEL_NOT_SET") return [];
42
+ throw error;
43
+ }
44
+ if (translation.warnings.length > 0) for (const warning of translation.warnings) console.warn(`[tboxcode-convergence] ${warning.field}: ${warning.reason}`);
45
+ if (!agentsDirWarned && existsSync(join(configDir, "agents"))) {
46
+ agentsDirWarned = true;
47
+ console.warn("[tboxcode-convergence] agents/ 目录已退役(subagent-native-adoption——0.2.1 类型面弃用),其中文件被忽略;可安全删除");
48
+ }
49
+ return translation.rows;
50
+ },
51
+ async apply(rows) {
52
+ const internal = root.loader?.internal;
53
+ if (internal === void 0) throw new Error("convergence: loader.internal 不可达(非 dsh launch 形态)");
54
+ const bootMod = await internal.import("@deepseek-ai/dsh-app-boot", hostBaseUrl(), {});
55
+ const boot = bootMod.default ?? bootMod;
56
+ pc.overlays = [...pc.overlays.filter((element) => !isMineElement(element)), ...rowsToPatchElements(rows)];
57
+ const patches = boot.readProfilePatches("tboxcode-convergence", pc);
58
+ const diags = await boot.reconcileProfilePatches(root, patches, "tboxcode-convergence");
59
+ if (diags.length > 0) console.warn(`[tboxcode-convergence] reconcile diags: ${diags.join(" | ")}`);
60
+ const myIds = patches.flatMap((element) => {
61
+ const el = element;
62
+ const own = typeof el.id === "string" && isMineRowId(el.id) ? [el.id] : [];
63
+ const nested = Array.isArray(el.insert) ? el.insert.flatMap((row) => typeof row?.id === "string" && isMineRowId(row.id) ? [row.id] : []) : [];
64
+ return [...own, ...nested];
65
+ });
66
+ console.warn(`[tboxcode-convergence] applied rows=[${myIds.join(", ")}] overlays=${pc.overlays.length}`);
67
+ },
68
+ openTurns: () => openTurns
69
+ };
70
+ let openTurns = 0;
71
+ const core = createConvergenceCore(io);
72
+ ctx.provide("tboxcodeConvergence", core);
73
+ const onSessionEvent = (_session, event) => {
74
+ const type = event?.type;
75
+ if (typeof type !== "string") return;
76
+ let boundary = false;
77
+ if (type === "turn/start") openTurns++;
78
+ else if (type === "turn/end") {
79
+ openTurns = Math.max(0, openTurns - 1);
80
+ boundary = true;
81
+ } else if (type === "session/disposed" || type === "agent/disposed") openTurns = 0;
82
+ if (boundary && core.state() === "dirty") core.onTurnBoundary().catch((error) => {
83
+ console.warn(`[tboxcode-convergence] 边界应用失败(下一边界重试):${error instanceof Error ? error.message : String(error)}`);
84
+ });
85
+ };
86
+ root.on("session/event", onSessionEvent);
87
+ let watchHandle;
88
+ const onDirty = () => {
89
+ core.onConfigChanged().catch((error) => {
90
+ console.warn(`[tboxcode-convergence] 配置收敛失败(下一边界重试):${error instanceof Error ? error.message : String(error)}`);
91
+ });
92
+ };
93
+ try {
94
+ watchHandle = watchConfigFiles(configDir, ["config.jsonc", "config.json"], onDirty);
95
+ } catch {}
96
+ return () => {
97
+ watchHandle?.dispose();
98
+ try {
99
+ root.off?.("session/event", onSessionEvent);
100
+ } catch {}
101
+ };
102
+ }
103
+
104
+ //#endregion
105
+ export { inject as n, name as r, apply as t };
@@ -0,0 +1,8 @@
1
+ import { Context } from "@deepseek-ai/cordis";
2
+
3
+ //#region src/convergence.d.ts
4
+ declare const name = "tboxcode-convergence";
5
+ declare const inject: never[];
6
+ declare function apply(ctx: Context): () => void;
7
+ //#endregion
8
+ export { inject as n, name as r, apply as t };
@@ -0,0 +1,43 @@
1
+ //#region src/convergence-core.d.ts
2
+ /**
3
+ * 收敛环核心(纯状态机——cordis 壳与 IO 全部注入,L2 可测)。
4
+ *
5
+ * 规格 = config-translation-contract「惰性收敛环」节(spike-hmr-granularity 全链
6
+ * 活体 + probe-convergence-deps acp 形态复验):
7
+ * clean →(翻译输出 ≠ 已应用行集,封闭 id 集结构比对)→ dirty →
8
+ * open-turn 空 → applying(原位更新 + reconcile)→ clean
9
+ * open-turn 忙 → dirty 挂边界(turn/end 触发检查;闲时立即路径共用 tryApply)
10
+ *
11
+ * 失败处置:apply 抛错 → dirty + 错误上抛(调用方分通道:watcher 静默日志 /
12
+ * Remote 显式拒绝)——下一边界重试。
13
+ */
14
+ interface ConvergenceRow {
15
+ id: string;
16
+ name?: string;
17
+ config?: unknown;
18
+ [k: string]: unknown;
19
+ }
20
+ /** 状态机对外行为面(cordis 壳实装;L2 用内存 stub)。 */
21
+ interface ConvergenceIO {
22
+ /** 翻译当前 config → 新行集。 */
23
+ translate(): ConvergenceRow[];
24
+ /** 应用行集到进程(原位更新 + reconcile)。抛错 = 应用失败。 */
25
+ apply(rows: ConvergenceRow[]): Promise<void>;
26
+ /** open turn 计数(session/event 扇出维护;disposed 防御重置也在壳侧)。 */
27
+ openTurns(): number;
28
+ }
29
+ type ConvergenceState = 'clean' | 'dirty' | 'applying';
30
+ interface ConvergenceCore {
31
+ state(): ConvergenceState;
32
+ /** 配置变化入口(watcher 通道):翻译 → 比对 → clean 退回 / dirty + tryApply。 */
33
+ onConfigChanged(): Promise<'clean' | 'dirty' | 'applied'>;
34
+ /** turn/end 边界入口:dirty 时尝试应用(忙时挂边界的解锁检查)。 */
35
+ onTurnBoundary(): Promise<'idle' | 'applied'>;
36
+ /** 外部显式触发(Remote 通道语义由调用方包装;忙时抛 RETRY_AFTER_TURN)。 */
37
+ reloadNow(): Promise<void>;
38
+ }
39
+ /** 行集结构比对(封闭 id 集:翻译产出行 id 全集——逐行稳定序列化,键排序键序无关)。 */
40
+ declare function rowsEqual(a: ConvergenceRow[], b: ConvergenceRow[]): boolean;
41
+ declare function createConvergenceCore(io: ConvergenceIO): ConvergenceCore;
42
+ //#endregion
43
+ export { createConvergenceCore as a, ConvergenceState as i, ConvergenceIO as n, rowsEqual as o, ConvergenceRow as r, ConvergenceCore as t };
@@ -0,0 +1,70 @@
1
+ //#region src/convergence-core.ts
2
+ /** 行集结构比对(封闭 id 集:翻译产出行 id 全集——逐行稳定序列化,键排序键序无关)。 */
3
+ function rowsEqual(a, b) {
4
+ if (a.length !== b.length) return false;
5
+ const key = (row) => {
6
+ const stable = (value) => {
7
+ if (Array.isArray(value)) return value.map(stable);
8
+ if (value !== null && typeof value === "object") return Object.fromEntries(Object.entries(value).sort(([x], [y]) => x < y ? -1 : x > y ? 1 : 0).map(([k, v]) => [k, stable(v)]));
9
+ return value;
10
+ };
11
+ return JSON.stringify([
12
+ row.id,
13
+ row.name ?? null,
14
+ stable(row.config ?? null)
15
+ ]);
16
+ };
17
+ return a.every((row, i) => key(row) === key(b[i]));
18
+ }
19
+ function createConvergenceCore(io) {
20
+ let state = "clean";
21
+ let applied = io.translate();
22
+ let pending;
23
+ const tryApply = async () => {
24
+ if (state !== "dirty" || pending === void 0) return "idle";
25
+ if (io.openTurns() > 0) return "idle";
26
+ const rows = pending;
27
+ pending = void 0;
28
+ state = "applying";
29
+ try {
30
+ await io.apply(rows);
31
+ applied = rows;
32
+ state = "clean";
33
+ return "applied";
34
+ } catch (error) {
35
+ pending = rows;
36
+ state = "dirty";
37
+ throw error;
38
+ }
39
+ };
40
+ return {
41
+ state: () => state,
42
+ async onConfigChanged() {
43
+ const fresh = io.translate();
44
+ if (rowsEqual(fresh, applied)) return state === "dirty" ? "dirty" : "clean";
45
+ pending = fresh;
46
+ state = "dirty";
47
+ return await tryApply() === "applied" ? "applied" : "dirty";
48
+ },
49
+ async onTurnBoundary() {
50
+ return tryApply();
51
+ },
52
+ async reloadNow() {
53
+ const fresh = io.translate();
54
+ if (rowsEqual(fresh, applied) && state === "clean") return;
55
+ if (io.openTurns() > 0) {
56
+ const error = /* @__PURE__ */ new Error("RETRY_AFTER_TURN");
57
+ error.code = "RETRY_AFTER_TURN";
58
+ pending = fresh;
59
+ state = "dirty";
60
+ throw error;
61
+ }
62
+ pending = fresh;
63
+ state = "dirty";
64
+ await tryApply();
65
+ }
66
+ };
67
+ }
68
+
69
+ //#endregion
70
+ export { rowsEqual as n, createConvergenceCore as t };
@@ -0,0 +1,2 @@
1
+ import { a as createConvergenceCore, i as ConvergenceState, n as ConvergenceIO, o as rowsEqual, r as ConvergenceRow, t as ConvergenceCore } from "./convergence-core-C1ZtU17g.js";
2
+ export { ConvergenceCore, ConvergenceIO, ConvergenceRow, ConvergenceState, createConvergenceCore, rowsEqual };
@@ -0,0 +1,3 @@
1
+ import { n as rowsEqual, t as createConvergenceCore } from "./convergence-core-CbS-hTjK.js";
2
+
3
+ export { createConvergenceCore, rowsEqual };
@@ -0,0 +1,2 @@
1
+ import { n as inject, r as name, t as apply } from "./convergence-CvqBcQv2.js";
2
+ export { apply, inject, name };
@@ -0,0 +1,4 @@
1
+ import "./convergence-core-CbS-hTjK.js";
2
+ import { n as inject, r as name, t as apply } from "./convergence-BfoAE48C.js";
3
+
4
+ export { apply, inject, name };
package/lib/index.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ import { a as createConvergenceCore, i as ConvergenceState, n as ConvergenceIO, o as rowsEqual, r as ConvergenceRow, t as ConvergenceCore } from "./convergence-core-C1ZtU17g.js";
2
+ import { r as name, t as apply } from "./convergence-CvqBcQv2.js";
3
+ import { a as SweepResult, l as sweepSessions, n as RetentionKnobs, o as isOwnedHome, r as RetentionScheduler, s as startRetentionScheduler, t as DEFAULT_KNOBS } from "./retention-B2V8Plpx.js";
4
+ import { a as TboxcodeRemoteServices, c as handleCommandsList, d as handleMode, f as handleReload, g as handleSkillsUserInvocable, i as TboxcodeRemoteGateway, l as handleDefaultSelection, m as handleSessionsFlush, p as handleRetentionRun, s as handleCommandsExecute, u as handleHealth, y as name$1 } from "./remote-Ci33eojc.js";
5
+ import { a as redactTokens, i as createLogger, n as Logger, t as LogLevel } from "./logger-DcHqQwUI.js";
6
+
7
+ //#region src/index.d.ts
8
+ /**
9
+ * tboxcode-dsh-bundle:tboxcode 组合点(骨架)。
10
+ * bundle 行是结构契约——漂移即真 bug,装配器自有行集校正(profile-cohabitation-assembly)。
11
+ */
12
+ declare const PACKAGE_NAME = "@tbox.cn/tboxcode-dsh-bundle";
13
+ //#endregion
14
+ export { type ConvergenceCore, type ConvergenceIO, type ConvergenceRow, type ConvergenceState, DEFAULT_KNOBS, type LogLevel, type Logger, PACKAGE_NAME, type RetentionKnobs, type RetentionScheduler, type SweepResult, TboxcodeRemoteGateway, type TboxcodeRemoteServices, apply as convergenceApply, name as convergenceName, createConvergenceCore, createLogger, handleCommandsExecute, handleCommandsList, handleDefaultSelection, handleHealth, handleMode, handleReload, handleRetentionRun, handleSessionsFlush, handleSkillsUserInvocable, isOwnedHome, redactTokens, name$1 as remoteName, rowsEqual, startRetentionScheduler, sweepSessions };
package/lib/index.js ADDED
@@ -0,0 +1,15 @@
1
+ import { n as rowsEqual, t as createConvergenceCore } from "./convergence-core-CbS-hTjK.js";
2
+ import { r as name, t as apply } from "./convergence-BfoAE48C.js";
3
+ import { a as sweepSessions, n as isOwnedHome, r as startRetentionScheduler, t as DEFAULT_KNOBS } from "./retention-DNEdnIxC.js";
4
+ import { n as redactTokens, t as createLogger } from "./logger-BGwLHZXY.js";
5
+ import { a as handleDefaultSelection, c as handleReload, f as handleSkillsUserInvocable, h as name$1, i as handleCommandsList, l as handleRetentionRun, o as handleHealth, r as handleCommandsExecute, s as handleMode, t as TboxcodeRemoteGateway, u as handleSessionsFlush } from "./remote-DjawPq5z.js";
6
+
7
+ //#region src/index.ts
8
+ /**
9
+ * tboxcode-dsh-bundle:tboxcode 组合点(骨架)。
10
+ * bundle 行是结构契约——漂移即真 bug,装配器自有行集校正(profile-cohabitation-assembly)。
11
+ */
12
+ const PACKAGE_NAME = "@tbox.cn/tboxcode-dsh-bundle";
13
+
14
+ //#endregion
15
+ export { DEFAULT_KNOBS, PACKAGE_NAME, TboxcodeRemoteGateway, apply as convergenceApply, name as convergenceName, createConvergenceCore, createLogger, handleCommandsExecute, handleCommandsList, handleDefaultSelection, handleHealth, handleMode, handleReload, handleRetentionRun, handleSessionsFlush, handleSkillsUserInvocable, isOwnedHome, redactTokens, name$1 as remoteName, rowsEqual, startRetentionScheduler, sweepSessions };
@@ -0,0 +1,36 @@
1
+ //#region src/logger.ts
2
+ const LEVEL_WEIGHT = {
3
+ debug: 10,
4
+ info: 20,
5
+ warn: 30,
6
+ error: 40
7
+ };
8
+ /** token redact(深度防御——`token=` 值面打码)。 */
9
+ function redactTokens(text) {
10
+ return text.replace(/(token=)[^&\s"']+/g, "$1[REDACTED]");
11
+ }
12
+ function createLogger(options) {
13
+ const min = LEVEL_WEIGHT[options.level ?? "info"];
14
+ const write = options.write ?? ((line) => process.stderr.write(`${line}\n`));
15
+ const now = options.now ?? (() => Date.now());
16
+ const emit = (level, message, data) => {
17
+ if (LEVEL_WEIGHT[level] < min) return;
18
+ const entry = {
19
+ ts: now(),
20
+ level,
21
+ domain: options.domain,
22
+ message: redactTokens(message)
23
+ };
24
+ if (data !== void 0) entry["data"] = redactTokens(JSON.stringify(data)) === JSON.stringify(data) ? data : JSON.parse(redactTokens(JSON.stringify(data)));
25
+ write(JSON.stringify(entry));
26
+ };
27
+ return {
28
+ debug: (message, data) => emit("debug", message, data),
29
+ info: (message, data) => emit("info", message, data),
30
+ warn: (message, data) => emit("warn", message, data),
31
+ error: (message, data) => emit("error", message, data)
32
+ };
33
+ }
34
+
35
+ //#endregion
36
+ export { redactTokens as n, createLogger as t };
@@ -0,0 +1,33 @@
1
+ //#region src/logger.d.ts
2
+ /**
3
+ * 自有件日志归宿(runtime-operations design):结构化 stderr——strict 档 stdout
4
+ * 协议独占不受影响,quiet 档 console 劫持兼容;lint 禁令的 logger 注入制以
5
+ * stderr 为输送终点(server/web 形态 stderr 由父进程收口;acp 形态零日志
6
+ * 纪律不变——本 logger 仅 server 形态 Remote/retention/网关协调面使用)。
7
+ *
8
+ * 级别与格式(S2a 开放子项定案):单行 JSON `{ts, level, domain, message, data?}`
9
+ * ——机器可解析(Supervisor 环形缓冲 + doctor 消费);级别 debug/info/warn/error。
10
+ * token 纪律:序列化前 redact `token=<值>` 面(防御性——渠道本就禁 token,
11
+ * redact 是深度防御而非授权通道)。
12
+ */
13
+ type LogLevel = 'debug' | 'info' | 'warn' | 'error';
14
+ /** token redact(深度防御——`token=` 值面打码)。 */
15
+ declare function redactTokens(text: string): string;
16
+ interface Logger {
17
+ debug(message: string, data?: Record<string, unknown>): void;
18
+ info(message: string, data?: Record<string, unknown>): void;
19
+ warn(message: string, data?: Record<string, unknown>): void;
20
+ error(message: string, data?: Record<string, unknown>): void;
21
+ }
22
+ interface LoggerOptions {
23
+ domain: string;
24
+ /** 最低输出级别(缺省 info——debug 仅诊断旋钮开启)。 */
25
+ level?: LogLevel;
26
+ /** 输出通道(缺省 process.stderr 单行写)。 */
27
+ write?: (line: string) => void;
28
+ /** 时钟注入(测试确定性)。 */
29
+ now?: () => number;
30
+ }
31
+ declare function createLogger(options: LoggerOptions): Logger;
32
+ //#endregion
33
+ export { redactTokens as a, createLogger as i, Logger as n, LoggerOptions as r, LogLevel as t };
@@ -0,0 +1,2 @@
1
+ import { a as redactTokens, i as createLogger, n as Logger, r as LoggerOptions, t as LogLevel } from "./logger-DcHqQwUI.js";
2
+ export { LogLevel, Logger, LoggerOptions, createLogger, redactTokens };
package/lib/logger.js ADDED
@@ -0,0 +1,3 @@
1
+ import { n as redactTokens, t as createLogger } from "./logger-BGwLHZXY.js";
2
+
3
+ export { createLogger, redactTokens };
@@ -0,0 +1,22 @@
1
+ import { Context } from "@deepseek-ai/cordis";
2
+
3
+ //#region src/prompts.d.ts
4
+ declare const name = "tboxcode-prompts";
5
+ declare const inject: never[];
6
+ interface Config {
7
+ /** `system_prompt` 翻译域:字面文本或 `file://` 路径——在场即 complete 整接管。 */
8
+ systemPrompt?: string;
9
+ /** `rules` 翻译域:用户规则条目(追加用户规则 section)。 */
10
+ rules?: string[];
11
+ }
12
+ /** 白名单二值(reminders-plugin-dissolution 定案):真实用户输入语义。 */
13
+ declare const USER_VOICE_KINDS: ReadonlySet<string>;
14
+ /** plan 档权限说明文案(composition note 引导三层①;build 档空串不渲染)。 */
15
+ declare function renderPermissionContext(mode: string, scratchDir: string): string;
16
+ /** environment 三行(基线 env-static + env-git 精确并集;现算不 memoize)。
17
+ * Working directory 行退役——dsh 0.2.1 原生 working-directory 服务注入
18
+ * `Current working directory: "<path>".`(同信息超集 + 工具联动,subagent-native-adoption)。 */
19
+ declare function renderEnvironmentContext(cwd: string): string;
20
+ declare function apply(ctx: Context, config?: Config): () => void;
21
+ //#endregion
22
+ export { Config, USER_VOICE_KINDS, apply, inject, name, renderEnvironmentContext, renderPermissionContext };