@te-river/opencode-team-mode 1.7.2 → 1.7.3
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/README.md +1009 -849
- package/README.zh-CN.md +906 -756
- package/dist/host/v2-browser-gate.d.ts +4 -1
- package/dist/host/v2-browser-gate.d.ts.map +1 -1
- package/dist/host/v2-browser-gate.js +1 -1
- package/dist/host/v2-browser-gate.js.map +1 -1
- package/dist/host/v2-capabilities.js +1 -1
- package/dist/host/v2-capabilities.js.map +1 -1
- package/dist/host/v2-guard.d.ts +3 -1
- package/dist/host/v2-guard.d.ts.map +1 -1
- package/dist/host/v2-guard.js +2 -2
- package/dist/host/v2-guard.js.map +1 -1
- package/dist/host/v2-offload.d.ts +12 -2
- package/dist/host/v2-offload.d.ts.map +1 -1
- package/dist/host/v2-offload.js +9 -9
- package/dist/host/v2-offload.js.map +1 -1
- package/dist/host/v2-probe-chain.d.ts +5 -1
- package/dist/host/v2-probe-chain.d.ts.map +1 -1
- package/dist/host/v2-probe-chain.js +4 -6
- package/dist/host/v2-probe-chain.js.map +1 -1
- package/dist/host/v2-probe.d.ts.map +1 -1
- package/dist/host/v2-probe.js +2 -1
- package/dist/host/v2-probe.js.map +1 -1
- package/dist/host/v2-prune.d.ts +5 -1
- package/dist/host/v2-prune.d.ts.map +1 -1
- package/dist/host/v2-prune.js +8 -14
- package/dist/host/v2-prune.js.map +1 -1
- package/dist/host/v2-retry.d.ts +9 -2
- package/dist/host/v2-retry.d.ts.map +1 -1
- package/dist/host/v2-retry.js +13 -15
- package/dist/host/v2-retry.js.map +1 -1
- package/dist/host/v2-session.d.ts +6 -2
- package/dist/host/v2-session.d.ts.map +1 -1
- package/dist/host/v2-session.js +7 -13
- package/dist/host/v2-session.js.map +1 -1
- package/dist/host/v2.d.ts +7 -2
- package/dist/host/v2.d.ts.map +1 -1
- package/dist/host/v2.js +38 -35
- package/dist/host/v2.js.map +1 -1
- package/dist/prompts/lead.d.ts +1 -1
- package/dist/prompts/lead.d.ts.map +1 -1
- package/dist/prompts/lead.js +23 -7
- package/dist/prompts/lead.js.map +1 -1
- package/dist/prompts/specialists.d.ts +1 -1
- package/dist/prompts/specialists.d.ts.map +1 -1
- package/dist/prompts/specialists.js +1 -1
- package/dist/tm/args-schema.d.ts +1 -1
- package/dist/tm/args-schema.js +6 -6
- package/dist/tm/args-schema.js.map +1 -1
- package/dist/tm/board.js +2 -2
- package/dist/tm/board.js.map +1 -1
- package/dist/tm/config-files.d.ts +41 -17
- package/dist/tm/config-files.d.ts.map +1 -1
- package/dist/tm/config-files.js +68 -73
- package/dist/tm/config-files.js.map +1 -1
- package/dist/tm/config-layers.d.ts +65 -33
- package/dist/tm/config-layers.d.ts.map +1 -1
- package/dist/tm/config-layers.js +165 -81
- package/dist/tm/config-layers.js.map +1 -1
- package/dist/tm/config-template.d.ts +32 -0
- package/dist/tm/config-template.d.ts.map +1 -0
- package/dist/tm/config-template.js +74 -0
- package/dist/tm/config-template.js.map +1 -0
- package/dist/tm/config.d.ts +115 -140
- package/dist/tm/config.d.ts.map +1 -1
- package/dist/tm/config.js +100 -200
- package/dist/tm/config.js.map +1 -1
- package/dist/tm/index.d.ts +11 -3
- package/dist/tm/index.d.ts.map +1 -1
- package/dist/tm/index.js +46 -16
- package/dist/tm/index.js.map +1 -1
- package/dist/tm/ledger.d.ts +7 -3
- package/dist/tm/ledger.d.ts.map +1 -1
- package/dist/tm/ledger.js +5 -4
- package/dist/tm/ledger.js.map +1 -1
- package/dist/tm/memory.js +3 -3
- package/dist/tm/pipelines.js +1 -1
- package/dist/tm/search.js +6 -6
- package/dist/tm/search.js.map +1 -1
- package/dist/tm/stats.js +2 -2
- package/dist/tm/stats.js.map +1 -1
- package/dist/tm/tools.js +2 -2
- package/dist/tm/webfetch.d.ts +5 -2
- package/dist/tm/webfetch.d.ts.map +1 -1
- package/dist/tm/webfetch.js +24 -18
- package/dist/tm/webfetch.js.map +1 -1
- package/docs/installation-v2.md +59 -38
- package/docs/installation.md +4 -4
- package/package.json +1 -1
- package/dist/approval-gate.d.ts +0 -205
- package/dist/approval-gate.d.ts.map +0 -1
- package/dist/approval-gate.js +0 -627
- package/dist/approval-gate.js.map +0 -1
- package/dist/host/v1.d.ts +0 -14
- package/dist/host/v1.d.ts.map +0 -1
- package/dist/host/v1.js +0 -340
- package/dist/host/v1.js.map +0 -1
- package/dist/host/v2-client.d.ts +0 -53
- package/dist/host/v2-client.d.ts.map +0 -1
- package/dist/host/v2-client.js +0 -193
- package/dist/host/v2-client.js.map +0 -1
- package/dist/host/v2-transcript.d.ts +0 -73
- package/dist/host/v2-transcript.d.ts.map +0 -1
- package/dist/host/v2-transcript.js +0 -151
- package/dist/host/v2-transcript.js.map +0 -1
- package/dist/host-hooks.d.ts +0 -126
- package/dist/host-hooks.d.ts.map +0 -1
- package/dist/host-hooks.js +0 -284
- package/dist/host-hooks.js.map +0 -1
- package/dist/tm/bash-timeout.d.ts +0 -72
- package/dist/tm/bash-timeout.d.ts.map +0 -1
- package/dist/tm/bash-timeout.js +0 -100
- package/dist/tm/bash-timeout.js.map +0 -1
- package/dist/tm/browser.d.ts +0 -642
- package/dist/tm/browser.d.ts.map +0 -1
- package/dist/tm/browser.js +0 -2836
- package/dist/tm/browser.js.map +0 -1
- package/dist/tm/ptc/budgets.d.ts +0 -59
- package/dist/tm/ptc/budgets.d.ts.map +0 -1
- package/dist/tm/ptc/budgets.js +0 -138
- package/dist/tm/ptc/budgets.js.map +0 -1
- package/dist/tm/ptc/contract.d.ts +0 -171
- package/dist/tm/ptc/contract.d.ts.map +0 -1
- package/dist/tm/ptc/contract.js +0 -85
- package/dist/tm/ptc/contract.js.map +0 -1
- package/dist/tm/ptc/driver.d.ts +0 -40
- package/dist/tm/ptc/driver.d.ts.map +0 -1
- package/dist/tm/ptc/driver.js +0 -213
- package/dist/tm/ptc/driver.js.map +0 -1
- package/dist/tm/ptc/engines.d.ts +0 -43
- package/dist/tm/ptc/engines.d.ts.map +0 -1
- package/dist/tm/ptc/engines.js +0 -454
- package/dist/tm/ptc/engines.js.map +0 -1
- package/dist/tm/ptc/gate.d.ts +0 -28
- package/dist/tm/ptc/gate.d.ts.map +0 -1
- package/dist/tm/ptc/gate.js +0 -130
- package/dist/tm/ptc/gate.js.map +0 -1
- package/dist/tm/ptc/index.d.ts +0 -19
- package/dist/tm/ptc/index.d.ts.map +0 -1
- package/dist/tm/ptc/index.js +0 -15
- package/dist/tm/ptc/index.js.map +0 -1
- package/dist/tm/ptc/pscan.d.ts +0 -30
- package/dist/tm/ptc/pscan.d.ts.map +0 -1
- package/dist/tm/ptc/pscan.js +0 -341
- package/dist/tm/ptc/pscan.js.map +0 -1
- package/dist/tm/ptc/summary.d.ts +0 -17
- package/dist/tm/ptc/summary.d.ts.map +0 -1
- package/dist/tm/ptc/summary.js +0 -134
- package/dist/tm/ptc/summary.js.map +0 -1
- package/dist/tm/ptc/tool.d.ts +0 -66
- package/dist/tm/ptc/tool.d.ts.map +0 -1
- package/dist/tm/ptc/tool.js +0 -231
- package/dist/tm/ptc/tool.js.map +0 -1
- package/dist/tm/ptc.d.ts +0 -298
- package/dist/tm/ptc.d.ts.map +0 -1
- package/dist/tm/ptc.js +0 -865
- package/dist/tm/ptc.js.map +0 -1
- package/dist/tm/pty.d.ts +0 -70
- package/dist/tm/pty.d.ts.map +0 -1
- package/dist/tm/pty.js +0 -245
- package/dist/tm/pty.js.map +0 -1
- package/dist/tool-coerce.d.ts +0 -24
- package/dist/tool-coerce.d.ts.map +0 -1
- package/dist/tool-coerce.js +0 -63
- package/dist/tool-coerce.js.map +0 -1
package/dist/tm/config.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* JIT layer-2 tools (T1.2 + T1.3) — configuration surface.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* `team-mode.jsonc` is the ONLY configuration source. The registry in
|
|
5
|
+
* `config-layers.ts` carries each key's default and doc; `resolveConfig`
|
|
6
|
+
* validates, clamps and fills defaults from it. There is no `TM_*` config
|
|
7
|
+
* env var any more (the three internal/test switches — TM_STORE_RECLAIM,
|
|
8
|
+
* TM_V2_PROBE, TM_CONFIG_AUTOCREATE — are read where they are used, not here).
|
|
9
|
+
*
|
|
10
|
+
* Invalid values never crash plugin startup: a non-numeric number falls back to
|
|
11
|
+
* its default, an out-of-range number is CLAMPED to `min`/`max`, a wrong
|
|
12
|
+
* type falls back to the default (same fail-soft philosophy as
|
|
13
|
+
* blackboard.resolveTtlMs and envprotect.resolveEnvProtectMode).
|
|
8
14
|
*
|
|
9
15
|
* Token 口径 (estimate basis): CJK-range code points ≈ one token each,
|
|
10
16
|
* everything else tokens ≈ chars/4, ceil. Pure chars/4 under-counted CJK
|
|
@@ -14,157 +20,21 @@
|
|
|
14
20
|
* (estimate == threshold still offloads) and the hard preview cap. This
|
|
15
21
|
* 口径 is pinned by test-tm-tools.mjs.
|
|
16
22
|
*
|
|
17
|
-
* Naming note:
|
|
23
|
+
* Naming note: `blackboardDir` (this module, run-payload store, default
|
|
18
24
|
* AUTO = `<repo>/.git/opencode-team/blackboard`) is a DIFFERENT artifact
|
|
19
25
|
* from the team blackboard in blackboard.ts (`.git/opencode-team/`,
|
|
20
26
|
* plugin options). They share a root philosophy (TTL sweeper is the sole
|
|
21
27
|
* cleanup path), not code.
|
|
22
28
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"Measure-Object", "Select-Object", "Where-Object", "Sort-Object",
|
|
29
|
-
"Group-Object", "Test-Path",
|
|
30
|
-
// Process LISTING, read-only and write-free. An agent verifying that a
|
|
31
|
-
// process really exited (a leftover browser, a stray server) had no allowed
|
|
32
|
-
// way to ask the OS, and a claim the user cannot check is worth less than one
|
|
33
|
-
// they can. findstr joins it for the same reason: `tasklist | findstr /i
|
|
34
|
-
// msedge` is the natural Windows spelling of that check, and refusing it only
|
|
35
|
-
// turned one call into two (live evidence: refused, then re-run with
|
|
36
|
-
// Select-String).
|
|
37
|
-
"tasklist", "ps", "findstr",
|
|
38
|
-
];
|
|
39
|
-
/**
|
|
40
|
-
* Seeded tm_webfetch / tm_search domain allowlist — every host the search
|
|
41
|
-
* engines and data sources ride (all reachable from mainland China without
|
|
42
|
-
* API keys): wiki term / bilibili search / bing CN + international / baidu /
|
|
43
|
-
* sogou / 360, the npm registry (JSON search + package metadata) and the
|
|
44
|
-
* GitHub (search API + repo pages + raw/gist content), its ghproxy.net
|
|
45
|
-
* mainland mirror, and PARENT domains for baidu/moegirl so every sibling
|
|
46
|
-
* subdomain (baike./tieba./mzh./mobile.) is covered — real sessions showed
|
|
47
|
-
* agents bouncing off baike.baidu.com and mzh.moegirl.org.cn (the agent-install flow points
|
|
48
|
-
* agents at the installation guide on exactly these hosts). A site's OWN
|
|
49
|
-
* asset CDN on a brand-unrelated domain has to be seeded too — same-site
|
|
50
|
-
* cannot infer it, and blocking it is what makes a page render blank
|
|
51
|
-
* (bdimg.com below is that case, measured). Subdomains of
|
|
52
|
-
* an entry are included;
|
|
53
|
-
* TM_WEBFETCH_ALLOWED_DOMAINS overrides the list (comma/semicolon
|
|
54
|
-
* separated; a lone "*" opens every host — keep the engine hosts or
|
|
55
|
-
* tm_search's engines lose their targets).
|
|
56
|
-
*/
|
|
57
|
-
export const DEFAULT_WEBFETCH_DOMAINS = [
|
|
58
|
-
// CN search engines + content (parent domains cover every sibling subdomain)
|
|
59
|
-
"baidu.com", // www. search / baike. encyclopedia / tieba. — real sessions hit baike.baidu.com
|
|
60
|
-
// Baidu's OWN static + anti-spam CDN. Not a subdomain of baidu.com, so a
|
|
61
|
-
// same-site subresource policy can never infer it, and a page whose own
|
|
62
|
-
// bundle we block is a blank page we then report as "no content" — that is
|
|
63
|
-
// the bug this seed closes (measured 2026-09-23: baike.baidu.com/ rendered 0
|
|
64
|
-
// addressable nodes while the identical client with this host allowed
|
|
65
|
-
// rendered 260).
|
|
66
|
-
"bdimg.com", // bkssl. challenge scripts / resource. / static. asset bundles
|
|
67
|
-
"moegirl.org.cn", // mobile. term / mzh. main site — real sessions hit mzh
|
|
68
|
-
"bilibili.com", // search. / www. video pages / space.
|
|
69
|
-
"www.sogou.com",
|
|
70
|
-
"www.so.com",
|
|
71
|
-
"cn.bing.com",
|
|
72
|
-
"www.bing.com",
|
|
73
|
-
"zhihu.com", // CN Q&A
|
|
74
|
-
"juejin.cn", // CN dev community
|
|
75
|
-
"csdn.net", // CN dev blogs
|
|
76
|
-
"cnblogs.com", // CN dev blogs
|
|
77
|
-
"gitee.com", // CN code hosting
|
|
78
|
-
// international dev sources (reachable from CN, no API keys)
|
|
79
|
-
"github.com",
|
|
80
|
-
"api.github.com",
|
|
81
|
-
"raw.githubusercontent.com",
|
|
82
|
-
"gist.githubusercontent.com",
|
|
83
|
-
"ghproxy.net", // mainland mirror for github raw
|
|
84
|
-
"stackoverflow.com",
|
|
85
|
-
"npmjs.org", // registry. + www. package pages
|
|
86
|
-
"pypi.org",
|
|
87
|
-
"learn.microsoft.com",
|
|
88
|
-
];
|
|
89
|
-
export const TM_CONFIG_DEFAULTS = {
|
|
90
|
-
offloadThreshold: 2000,
|
|
91
|
-
previewLines: 20,
|
|
92
|
-
previewMaxTokens: 80,
|
|
93
|
-
fetchMaxLines: 2000,
|
|
94
|
-
// Empty string = AUTO: resolve git-aware at runtime —
|
|
95
|
-
// <repo>/.git/opencode-team/{blackboard,trajectory} (tmpdir fallback for
|
|
96
|
-
// non-git workspaces). Keeps the payload/trajectory stores out of the
|
|
97
|
-
// user's working tree (user projects never had .blackboard/.trajectory
|
|
98
|
-
// gitignore entries). An explicit TM_BLACKBOARD_DIR / TM_TRAJECTORY_DIR
|
|
99
|
-
// keeps the old semantics: absolute, or relative to the project root.
|
|
100
|
-
blackboardDir: "",
|
|
101
|
-
trajectoryDir: "",
|
|
102
|
-
blackboardTtlDays: 7,
|
|
103
|
-
// ---- P0 upgrade knobs (see TmConfig doc comments for ownership) ----
|
|
104
|
-
memorySessionTtlMin: 240,
|
|
105
|
-
memoryMaxEntries: 200,
|
|
106
|
-
memoryStaleDays: 30,
|
|
107
|
-
memorySessionPersist: "",
|
|
108
|
-
searchDefaultEngine: "auto",
|
|
109
|
-
searchMaxHits: 10,
|
|
110
|
-
searchWeights: {},
|
|
111
|
-
searchDisabledEngines: [],
|
|
112
|
-
// 0.35: a hit with zero query overlap keeps just over a third of its
|
|
113
|
-
// engine weight — demoted, never deleted (see TmConfig.searchRelevanceFloor).
|
|
114
|
-
searchRelevanceFloor: 0.35,
|
|
115
|
-
// Literal fallbacks used ONLY when the global TM_OFFLOAD_THRESHOLD is
|
|
116
|
-
// unset. When the global IS set and a tier env is not, resolveTmConfig
|
|
117
|
-
// derives that tier from the global (inherit — Wave B M1) instead of
|
|
118
|
-
// applying these.
|
|
119
|
-
offloadThresholdText: 4000,
|
|
120
|
-
offloadThresholdData: 2000,
|
|
121
|
-
webCacheTtlSec: 300,
|
|
122
|
-
joinMaxWaitMs: 60_000,
|
|
123
|
-
boardMaxChars: 200_000,
|
|
124
|
-
boardMaxFiles: 200,
|
|
125
|
-
taskOffload: "on",
|
|
126
|
-
storeReclaim: "on",
|
|
127
|
-
// ORPHANED: approval-gate.ts resolveAskTimeoutMs (its only consumer) was
|
|
128
|
-
// deleted with the v1 personality. Kept so an existing config still parses.
|
|
129
|
-
askTimeoutFloorMin: 1,
|
|
130
|
-
// The GENERAL bash cap stays off by default (a real build may legitimately
|
|
131
|
-
// need minutes); the probe cap ships on because a read-only probe never
|
|
132
|
-
// needs the host's 120 s default. Both are ms; 0 = off.
|
|
133
|
-
bashTimeoutMaxMs: 0,
|
|
134
|
-
bashTimeoutProbeMs: 60_000,
|
|
135
|
-
};
|
|
136
|
-
function envInt(env, key, def, min, max) {
|
|
137
|
-
const raw = env[key];
|
|
138
|
-
if (typeof raw !== "string" || raw.trim() === "")
|
|
139
|
-
return def;
|
|
140
|
-
const n = Number(raw.trim());
|
|
141
|
-
if (!Number.isFinite(n))
|
|
142
|
-
return def;
|
|
143
|
-
const i = Math.trunc(n);
|
|
144
|
-
if (i < min || i > max)
|
|
145
|
-
return def;
|
|
146
|
-
return i;
|
|
147
|
-
}
|
|
148
|
-
function envStr(env, key, def) {
|
|
149
|
-
const raw = env[key];
|
|
150
|
-
if (typeof raw !== "string")
|
|
151
|
-
return def;
|
|
152
|
-
const v = raw.trim();
|
|
153
|
-
return v === "" ? def : v;
|
|
154
|
-
}
|
|
155
|
-
/** Float sibling of envInt (fraction knobs like the relevance floor). */
|
|
156
|
-
function envNum(env, key, def, min, max) {
|
|
157
|
-
const raw = env[key];
|
|
158
|
-
if (typeof raw !== "string" || raw.trim() === "")
|
|
159
|
-
return def;
|
|
160
|
-
const n = Number(raw.trim());
|
|
161
|
-
if (!Number.isFinite(n) || n < min || n > max)
|
|
162
|
-
return def;
|
|
163
|
-
return n;
|
|
164
|
-
}
|
|
29
|
+
import { CONFIG_KEYS, DEFAULT_BASH_READONLY_ALLOWED, DEFAULT_WEBFETCH_DOMAINS, isPlainObject, } from "./config-layers.js";
|
|
30
|
+
export { DEFAULT_BASH_READONLY_ALLOWED, DEFAULT_WEBFETCH_DOMAINS };
|
|
31
|
+
/** The registry's defaults, keyed by canonical key. Derived from
|
|
32
|
+
* `CONFIG_KEYS` so a default can never drift from its spec. */
|
|
33
|
+
export const TM_CONFIG_DEFAULTS = Object.fromEntries(CONFIG_KEYS.map((k) => [k.key, k.default]));
|
|
165
34
|
/** TM_SEARCH_WEIGHTS — `bing=0.2,hn=0.3` into a partial weight table. A
|
|
166
35
|
* malformed pair is dropped (not the whole var), so one typo cannot silently
|
|
167
|
-
* flatten every custom weight back to the built-in table.
|
|
36
|
+
* flatten every custom weight back to the built-in table. Kept for the
|
|
37
|
+
* string form; a file value is native JSON and skips this. */
|
|
168
38
|
export function parseWeightsEnv(raw) {
|
|
169
39
|
const out = {};
|
|
170
40
|
if (typeof raw !== "string")
|
|
@@ -180,10 +50,10 @@ export function parseWeightsEnv(raw) {
|
|
|
180
50
|
return out;
|
|
181
51
|
}
|
|
182
52
|
/**
|
|
183
|
-
* Parse a comma/semicolon-separated allowlist
|
|
53
|
+
* Parse a comma/semicolon-separated allowlist string. Unset/absent -> null
|
|
184
54
|
* (caller applies the default). An explicitly EMPTY string parses to []
|
|
185
|
-
* (deny-all) — an explicit user choice is respected.
|
|
186
|
-
*
|
|
55
|
+
* (deny-all) — an explicit user choice is respected. Kept for the string
|
|
56
|
+
* form; a file value is native JSON and skips this.
|
|
187
57
|
*/
|
|
188
58
|
export function parseAllowlistEnv(raw) {
|
|
189
59
|
if (typeof raw !== "string")
|
|
@@ -192,60 +62,90 @@ export function parseAllowlistEnv(raw) {
|
|
|
192
62
|
}
|
|
193
63
|
/** Historical alias — identical grammar to parseAllowlistEnv. */
|
|
194
64
|
export const parseWebfetchAllowlistEnv = parseAllowlistEnv;
|
|
195
|
-
/** Resolve the full tm-tools config from an env-like record (default: process.env). */
|
|
196
|
-
export function resolveTmConfig(env = process.env) {
|
|
197
|
-
const allowlist = parseAllowlistEnv(env.TM_BASH_READONLY_ALLOWED);
|
|
198
|
-
const globalOffload = envInt(env, "TM_OFFLOAD_THRESHOLD", TM_CONFIG_DEFAULTS.offloadThreshold, 0, 10_000_000);
|
|
199
|
-
// Wave B M1 fix — TIER INHERITANCE. The TEXT/DATA classes inherit the
|
|
200
|
-
// global boundary when the user set TM_OFFLOAD_THRESHOLD but left a tier
|
|
201
|
-
// env UNSET: a user who raised the global to 8000 to save tokens must not
|
|
202
|
-
// have prose silently capped back to 4000 (and json to 2000). With the
|
|
203
|
-
// global ALSO unset the documented per-class defaults stand (4000 text /
|
|
204
|
-
// 2000 data — data equals the old baseline so the no-env behavior is the
|
|
205
|
-
// T4 tiering the §6m-t tests pin). An explicit tier env always wins.
|
|
206
|
-
const globalOffloadSet = typeof env.TM_OFFLOAD_THRESHOLD === "string" && env.TM_OFFLOAD_THRESHOLD.trim() !== "";
|
|
207
|
-
const textTierDefault = globalOffloadSet ? globalOffload : TM_CONFIG_DEFAULTS.offloadThresholdText;
|
|
208
|
-
const dataTierDefault = globalOffloadSet ? globalOffload : TM_CONFIG_DEFAULTS.offloadThresholdData;
|
|
209
|
-
return {
|
|
210
|
-
offloadThreshold: globalOffload,
|
|
211
|
-
previewLines: envInt(env, "TM_PREVIEW_LINES", TM_CONFIG_DEFAULTS.previewLines, 1, 1000),
|
|
212
|
-
previewMaxTokens: envInt(env, "TM_PREVIEW_MAX_TOKENS", TM_CONFIG_DEFAULTS.previewMaxTokens, 10, 100_000),
|
|
213
|
-
fetchMaxLines: envInt(env, "TM_FETCH_MAX_LINES", TM_CONFIG_DEFAULTS.fetchMaxLines, 1, 1_000_000),
|
|
214
|
-
blackboardDir: envStr(env, "TM_BLACKBOARD_DIR", TM_CONFIG_DEFAULTS.blackboardDir),
|
|
215
|
-
trajectoryDir: envStr(env, "TM_TRAJECTORY_DIR", TM_CONFIG_DEFAULTS.trajectoryDir),
|
|
216
|
-
blackboardTtlDays: envInt(env, "TM_BLACKBOARD_TTL", TM_CONFIG_DEFAULTS.blackboardTtlDays, 1, 365),
|
|
217
|
-
bashReadonlyAllowed: allowlist ?? [...DEFAULT_BASH_READONLY_ALLOWED],
|
|
218
|
-
webfetchAllowedDomains: parseAllowlistEnv(env.TM_WEBFETCH_ALLOWED_DOMAINS) ?? [...DEFAULT_WEBFETCH_DOMAINS],
|
|
219
|
-
memoryGlobalDir: envStr(env, "TM_MEMORY_GLOBAL_DIR", ""),
|
|
220
|
-
// ---- P0 upgrade knobs (fail-soft like the rest: invalid -> default) ----
|
|
221
|
-
memorySessionTtlMin: envInt(env, "TM_MEMORY_SESSION_TTL_MIN", TM_CONFIG_DEFAULTS.memorySessionTtlMin, 1, 100_000),
|
|
222
|
-
memoryMaxEntries: envInt(env, "TM_MEMORY_MAX_ENTRIES", TM_CONFIG_DEFAULTS.memoryMaxEntries, 1, 100_000),
|
|
223
|
-
memoryStaleDays: envInt(env, "TM_MEMORY_STALE_DAYS", TM_CONFIG_DEFAULTS.memoryStaleDays, 0, 3650),
|
|
224
|
-
memorySessionPersist: envStr(env, "TM_MEMORY_SESSION_PERSIST", TM_CONFIG_DEFAULTS.memorySessionPersist),
|
|
225
|
-
searchDefaultEngine: envStr(env, "TM_SEARCH_DEFAULT_ENGINE", TM_CONFIG_DEFAULTS.searchDefaultEngine),
|
|
226
|
-
searchMaxHits: envInt(env, "TM_SEARCH_MAX_HITS", TM_CONFIG_DEFAULTS.searchMaxHits, 3, 30),
|
|
227
|
-
searchWeights: parseWeightsEnv(env.TM_SEARCH_WEIGHTS),
|
|
228
|
-
searchDisabledEngines: parseAllowlistEnv(env.TM_SEARCH_DISABLED_ENGINES) ?? [],
|
|
229
|
-
searchRelevanceFloor: envNum(env, "TM_SEARCH_RELEVANCE_FLOOR", TM_CONFIG_DEFAULTS.searchRelevanceFloor, 0, 1),
|
|
230
|
-
offloadThresholdText: envInt(env, "TM_OFFLOAD_THRESHOLD_TEXT", textTierDefault, 0, 10_000_000),
|
|
231
|
-
offloadThresholdData: envInt(env, "TM_OFFLOAD_THRESHOLD_DATA", dataTierDefault, 0, 10_000_000),
|
|
232
|
-
webCacheTtlSec: envInt(env, "TM_WEB_CACHE_TTL_SEC", TM_CONFIG_DEFAULTS.webCacheTtlSec, 0, 86_400),
|
|
233
|
-
joinMaxWaitMs: envInt(env, "TM_JOIN_MAX_WAIT_MS", TM_CONFIG_DEFAULTS.joinMaxWaitMs, 0, 600_000),
|
|
234
|
-
boardMaxChars: envInt(env, "TM_BOARD_MAX_CHARS", TM_CONFIG_DEFAULTS.boardMaxChars, 1_000, 2_000_000),
|
|
235
|
-
boardMaxFiles: envInt(env, "TM_BOARD_MAX_FILES", TM_CONFIG_DEFAULTS.boardMaxFiles, 4, 2_000),
|
|
236
|
-
taskOffload: resolveOnOff(env.TM_TASK_OFFLOAD),
|
|
237
|
-
storeReclaim: resolveOnOff(env.TM_STORE_RECLAIM),
|
|
238
|
-
askTimeoutFloorMin: envInt(env, "TM_ASK_TIMEOUT_FLOOR_MIN", TM_CONFIG_DEFAULTS.askTimeoutFloorMin, 1, 1440),
|
|
239
|
-
bashTimeoutMaxMs: envInt(env, "TM_BASH_TIMEOUT_MAX_MS", TM_CONFIG_DEFAULTS.bashTimeoutMaxMs, 0, 3_600_000),
|
|
240
|
-
bashTimeoutProbeMs: envInt(env, "TM_BASH_TIMEOUT_PROBE_MS", TM_CONFIG_DEFAULTS.bashTimeoutProbeMs, 0, 600_000),
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
65
|
/** TM_PTC_WEB_BRIDGE — off only on an explicit off-ish value; unset or
|
|
244
66
|
* invalid keeps the bridge on (fail-soft toward the newer default). */
|
|
245
|
-
function resolveOnOff(raw) {
|
|
67
|
+
export function resolveOnOff(raw) {
|
|
246
68
|
const v = typeof raw === "string" ? raw.trim().toLowerCase() : "";
|
|
247
69
|
return v === "off" || v === "0" || v === "false" ? "off" : "on";
|
|
248
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Coerce ONE raw value against its spec. `undefined`/`null` -> the default.
|
|
73
|
+
* A `number` is truncated when the default is an integer, then clamped to
|
|
74
|
+
* `min`/`max`; a non-numeric value falls back to the default. A `string`
|
|
75
|
+
* with an `enum` must match (case-insensitively; on/off also accept the
|
|
76
|
+
* 0/1/false/true/no/yes spellings); otherwise the default. A `string[]`
|
|
77
|
+
* must be an array of strings; a `record` a plain object of numbers.
|
|
78
|
+
*/
|
|
79
|
+
export function coerceValue(spec, raw) {
|
|
80
|
+
if (raw === undefined || raw === null)
|
|
81
|
+
return spec.default;
|
|
82
|
+
switch (spec.type) {
|
|
83
|
+
case "number": {
|
|
84
|
+
if (typeof raw === "string" && raw.trim() === "")
|
|
85
|
+
return spec.default;
|
|
86
|
+
const n = typeof raw === "number" ? raw : Number(String(raw).trim());
|
|
87
|
+
if (!Number.isFinite(n))
|
|
88
|
+
return spec.default;
|
|
89
|
+
let v = Number.isInteger(spec.default) ? Math.trunc(n) : n;
|
|
90
|
+
if (spec.min !== undefined)
|
|
91
|
+
v = Math.max(spec.min, v);
|
|
92
|
+
if (spec.max !== undefined)
|
|
93
|
+
v = Math.min(spec.max, v);
|
|
94
|
+
return v;
|
|
95
|
+
}
|
|
96
|
+
case "string": {
|
|
97
|
+
// A non-string raw (a number, a boolean) is a wrong TYPE, not a value
|
|
98
|
+
// to stringify: `searchDefaultEngine: 5` must fall back to the default,
|
|
99
|
+
// not become the string "5".
|
|
100
|
+
if (typeof raw !== "string")
|
|
101
|
+
return spec.default;
|
|
102
|
+
const s = raw.trim();
|
|
103
|
+
if (spec.enum) {
|
|
104
|
+
const hit = spec.enum.find((e) => e.toLowerCase() === s.toLowerCase());
|
|
105
|
+
if (hit)
|
|
106
|
+
return hit;
|
|
107
|
+
if (spec.enum.includes("on") && spec.enum.includes("off")) {
|
|
108
|
+
if (/^(0|false|no)$/i.test(s))
|
|
109
|
+
return "off";
|
|
110
|
+
if (/^(1|true|yes)$/i.test(s))
|
|
111
|
+
return "on";
|
|
112
|
+
}
|
|
113
|
+
return spec.default;
|
|
114
|
+
}
|
|
115
|
+
return s === "" ? spec.default : s;
|
|
116
|
+
}
|
|
117
|
+
case "string[]": {
|
|
118
|
+
if (!Array.isArray(raw) || !raw.every((x) => typeof x === "string"))
|
|
119
|
+
return spec.default;
|
|
120
|
+
return raw.map((x) => x);
|
|
121
|
+
}
|
|
122
|
+
case "record": {
|
|
123
|
+
if (!isPlainObject(raw) || !Object.values(raw).every((x) => typeof x === "number"))
|
|
124
|
+
return spec.default;
|
|
125
|
+
return { ...raw };
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Resolve the full tm-tools config from an already-merged JSON value record
|
|
131
|
+
* (the file layers, plus any programmatic `configDefaults`). Registry-driven:
|
|
132
|
+
* every key gets its coerced value or its default. The two offload tiers
|
|
133
|
+
* INHERIT an explicitly-set `offloadThreshold` when they are not set
|
|
134
|
+
* themselves (Wave B M1) — a user who raised the global to save tokens must
|
|
135
|
+
* not have prose silently capped back to 4000.
|
|
136
|
+
*/
|
|
137
|
+
export function resolveConfig(values = {}) {
|
|
138
|
+
const out = {};
|
|
139
|
+
for (const spec of CONFIG_KEYS)
|
|
140
|
+
out[spec.key] = coerceValue(spec, values[spec.key]);
|
|
141
|
+
if (values.offloadThreshold !== undefined) {
|
|
142
|
+
if (values.offloadThresholdText === undefined)
|
|
143
|
+
out.offloadThresholdText = out.offloadThreshold;
|
|
144
|
+
if (values.offloadThresholdData === undefined)
|
|
145
|
+
out.offloadThresholdData = out.offloadThreshold;
|
|
146
|
+
}
|
|
147
|
+
return out;
|
|
148
|
+
}
|
|
249
149
|
/** Token cost of ONE code point — CJK-range ≈ 1 token (kana / Hangul /
|
|
250
150
|
* fullwidth / CJK punctuation all sit above U+2E80), everything else ≈ 0.25
|
|
251
151
|
* (chars/4). Shared by estimateTokens and preview.capTokens so the two
|
package/dist/tm/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/tm/config.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/tm/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EACL,WAAW,EACX,6BAA6B,EAC7B,wBAAwB,EACxB,aAAa,GAEd,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAE,6BAA6B,EAAE,wBAAwB,EAAE,CAAA;AAkIlE;gEACgE;AAChE,MAAM,CAAC,MAAM,kBAAkB,GAA4B,MAAM,CAAC,WAAW,CAC3E,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAC3C,CAAA;AAED;;;+DAG+D;AAC/D,MAAM,UAAU,e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A;AACxB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc,EAAE,SAAiB;IAC7D,OAAO,MAAM,IAAI,SAAS,CAAA;AAC5B,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,OAAO,CAAC,IAAa,EAAE,GAAW;IAChD,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAA;IACxD,OAAO,CAAC,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAA;AACrE,CAAC"}
|
package/dist/tm/index.d.ts
CHANGED
|
@@ -89,6 +89,13 @@ export interface CreateTmToolsOptions {
|
|
|
89
89
|
* opens the domain allowlist, which is a personality decision, not a global
|
|
90
90
|
* one). Anything the user actually set always wins. */
|
|
91
91
|
env?: Record<string, string | undefined>;
|
|
92
|
+
/** Lowest-priority default overrides (BELOW the file layers): v2 uses it to
|
|
93
|
+
* default `webfetchAllowedDomains` to `["*"]` when no file sets it. */
|
|
94
|
+
configDefaults?: Record<string, unknown>;
|
|
95
|
+
/** Test injection: skip the file layers entirely. */
|
|
96
|
+
envOnly?: boolean;
|
|
97
|
+
/** Auto-generate the global config file at boot (default true). */
|
|
98
|
+
autoCreate?: boolean;
|
|
92
99
|
/** Where the lead's LEDGER lives. v2 passes a `ctx.storage` adapter because
|
|
93
100
|
* that host has no `todowrite` for the mandate to attach to; v1 passes nothing
|
|
94
101
|
* and therefore registers no `tm_ledger` at all — its tool surface stays the
|
|
@@ -137,8 +144,9 @@ keep: string | null, ttlMs: number, now?: number): string[];
|
|
|
137
144
|
* touched here. */
|
|
138
145
|
export declare function reclaimLegacyStoreBuckets(base: string, ttlMs: number, now?: number): string[];
|
|
139
146
|
export declare function createTmTools(input: PluginInput, opts?: CreateTmToolsOptions): Promise<TmRuntime>;
|
|
140
|
-
export { DEFAULT_BASH_READONLY_ALLOWED, DEFAULT_WEBFETCH_DOMAINS, estimateTokens, parseAllowlistEnv, parseWebfetchAllowlistEnv,
|
|
141
|
-
export { CONFIG_FILE_NAME, readConfigFiles, resolveLayeredTmConfig, renderConfigSection, type ConfigFileRoots, type ConfigFileRead, type LayeredTmConfig, } from "./config-files.js";
|
|
147
|
+
export { DEFAULT_BASH_READONLY_ALLOWED, DEFAULT_WEBFETCH_DOMAINS, estimateTokens, parseAllowlistEnv, parseWebfetchAllowlistEnv, parseWeightsEnv, resolveConfig, resolveOnOff, coerceValue, shouldOffload, shorten, TM_CONFIG_DEFAULTS, } from "./config.js";
|
|
148
|
+
export { CONFIG_FILE_NAME, readConfigFiles, resolveGlobalDir, resolveLayeredTmConfig, renderConfigSection, type ConfigFileRoots, type ConfigFileRead, type LayeredTmConfig, } from "./config-files.js";
|
|
149
|
+
export { renderConfigTemplate, ensureGlobalConfig, type AutoCreateState } from "./config-template.js";
|
|
142
150
|
export { buildRef, hmacToken, isExpired, loadOrCreateHandleKey, newRunId, parseRef, REF_PATTERN, verifyToken, HANDLE_KEY_FILE, } from "./refs.js";
|
|
143
151
|
export { RunStore, USAGE_JSONL_RELPATH } from "./store.js";
|
|
144
152
|
export { buildPreview, buildStructureSummary, capTokens, contentTypeForPath, detectContentType, sniffContentType, } from "./preview.js";
|
|
@@ -150,7 +158,7 @@ export { buildWebfetchArgsSchema, buildSearchArgsSchema } from "./args-schema.js
|
|
|
150
158
|
export { toToolResult, HANDLE_INVALID_MESSAGE, tmError } from "./result.js";
|
|
151
159
|
export type { TmPhase } from "./result.js";
|
|
152
160
|
export { runShellCommand, spawnShellFallback, cleanShellError } from "./shell-bridge.js";
|
|
153
|
-
export { buildTmWebfetchTool, checkWebUrl, extractWebResponse, extractSearchHits, renderSearchHits, fetchWebText, hitDomainBlacklist, HIT_DOMAIN_BLACKLIST_DEFAULT, hostAllowed, htmlToText, } from "./webfetch.js";
|
|
161
|
+
export { buildTmWebfetchTool, checkWebUrl, extractWebResponse, extractSearchHits, renderSearchHits, fetchWebText, hitDomainBlacklist, setHitBlacklist, setPrivateSpacePolicy, HIT_DOMAIN_BLACKLIST_DEFAULT, hostAllowed, htmlToText, } from "./webfetch.js";
|
|
154
162
|
export type { SearchHit } from "./webfetch.js";
|
|
155
163
|
export { buildTmSearchTool, SEARCH_ENGINES, SEARCH_ENGINE_NAMES, renderNpmResults, renderGithubResults, renderWikiResults, } from "./search.js";
|
|
156
164
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/tm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tm/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAc,MAAM,aAAa,CAAA;AAErF,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,kBAAkB,CAAA;AACzB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tm/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAc,MAAM,aAAa,CAAA;AAErF,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAA+B,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAA;AACxE,OAAO,EAAiE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAGvH,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAQrC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAGvD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,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,EACR,WAAW,EACX,WAAW,EACX,eAAe,GAChB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAC1D,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,SAAS,EACT,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,WAAW,GACZ,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AACjF,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC3E,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACxF,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,4BAA4B,EAC5B,WAAW,EACX,UAAU,GACX,MAAM,eAAe,CAAA;AACtB,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,aAAa,CAAA"}
|
package/dist/tm/index.js
CHANGED
|
@@ -20,7 +20,9 @@ import * as os from "node:os";
|
|
|
20
20
|
import * as path from "node:path";
|
|
21
21
|
import { findRepoRoot } from "../blackboard.js";
|
|
22
22
|
import { parseExtraDeny, resolveEnvProtectMode, } from "../envprotect.js";
|
|
23
|
-
import {
|
|
23
|
+
import { resolveOnOff } from "./config.js";
|
|
24
|
+
import { resolveLayeredTmConfig, renderConfigSection, resolveGlobalDir } from "./config-files.js";
|
|
25
|
+
import { ensureGlobalConfig } from "./config-template.js";
|
|
24
26
|
import { hmacToken, loadOrCreateHandleKey, newRunId } from "./refs.js";
|
|
25
27
|
import { RunStore } from "./store.js";
|
|
26
28
|
import { buildTmTools } from "./tools.js";
|
|
@@ -30,7 +32,7 @@ import { buildStatsTool } from "./stats.js";
|
|
|
30
32
|
import { buildBoardWriteTool } from "./board.js";
|
|
31
33
|
import { buildLedgerTool } from "./ledger.js";
|
|
32
34
|
import { createWebCache } from "./cache.js";
|
|
33
|
-
import { buildTmWebfetchTool } from "./webfetch.js";
|
|
35
|
+
import { buildTmWebfetchTool, setHitBlacklist, setPrivateSpacePolicy } from "./webfetch.js";
|
|
34
36
|
import { buildTmSearchTool } from "./search.js";
|
|
35
37
|
import { rmForceSafe } from "../fs-safe.js";
|
|
36
38
|
export { rmForceSafe };
|
|
@@ -182,12 +184,30 @@ export async function createTmTools(input, opts = {}) {
|
|
|
182
184
|
const directory = typeof input?.directory === "string" && input.directory.length > 0
|
|
183
185
|
? input.directory
|
|
184
186
|
: process.cwd();
|
|
185
|
-
|
|
186
|
-
//
|
|
187
|
-
//
|
|
188
|
-
|
|
187
|
+
const env = opts.env ?? process.env;
|
|
188
|
+
// Auto-create the global config file (idempotent, never overwrites). The
|
|
189
|
+
// plugin option is primary; `TM_CONFIG_AUTOCREATE=off` is the internal/test
|
|
190
|
+
// switch. The file is written BEFORE the read so a fresh install boots with
|
|
191
|
+
// a fully-commented config on disk.
|
|
192
|
+
const autoCreateRaw = env.TM_CONFIG_AUTOCREATE ?? process.env.TM_CONFIG_AUTOCREATE;
|
|
193
|
+
const autoCreate = opts.autoCreate ?? autoCreateRaw !== "off";
|
|
194
|
+
const effectiveRoots = {
|
|
189
195
|
...opts.configRoots,
|
|
190
196
|
projectDir: opts.configRoots?.projectDir ?? directory,
|
|
197
|
+
};
|
|
198
|
+
const globalDir = resolveGlobalDir(effectiveRoots, env);
|
|
199
|
+
const configAutocreate = ensureGlobalConfig(globalDir, { autoCreate });
|
|
200
|
+
// Layered config: global file < project file(s). The project search starts
|
|
201
|
+
// at the workspace root, mirroring the host's own config layering (direct
|
|
202
|
+
// files farthest→closest, then `.opencode/` files, which win). The
|
|
203
|
+
// auto-created global file is INERT (every key commented), so it sets
|
|
204
|
+
// nothing and never shadows a personality's `configDefaults` (v2's
|
|
205
|
+
// `webfetchAllowedDomains: ["*"]`); a user-edited file is a decision and
|
|
206
|
+
// wins.
|
|
207
|
+
const layeredConfig = resolveLayeredTmConfig(effectiveRoots, {
|
|
208
|
+
envOnly: opts.envOnly,
|
|
209
|
+
configDefaults: opts.configDefaults,
|
|
210
|
+
env,
|
|
191
211
|
});
|
|
192
212
|
const cfg = layeredConfig.cfg;
|
|
193
213
|
const runId = newRunId();
|
|
@@ -224,8 +244,11 @@ export async function createTmTools(input, opts = {}) {
|
|
|
224
244
|
// Boot-time reclamation of what an upgrade leaves behind. Both passes are
|
|
225
245
|
// TTL-gated (expired is deletable, fresh is not — a session started before
|
|
226
246
|
// the upgrade may still be writing), and TM_STORE_RECLAIM=off exists so the
|
|
227
|
-
// test runner never reaches into the developer's real Temp.
|
|
228
|
-
|
|
247
|
+
// test runner never reaches into the developer's real Temp. The env switch
|
|
248
|
+
// (an internal/test override) wins over the file value.
|
|
249
|
+
const storeReclaimRaw = env.TM_STORE_RECLAIM ?? process.env.TM_STORE_RECLAIM;
|
|
250
|
+
const storeReclaim = storeReclaimRaw !== undefined ? resolveOnOff(storeReclaimRaw) : cfg.storeReclaim;
|
|
251
|
+
if (storeReclaim !== "off") {
|
|
229
252
|
const ttlMs = cfg.blackboardTtlDays * 24 * 60 * 60 * 1000;
|
|
230
253
|
// Shards live in the TMPDIR bucket and nowhere else — a git workspace's store
|
|
231
254
|
// is inside its own `.git`, which never contains a `w-*`. So the prune has to
|
|
@@ -292,8 +315,9 @@ export async function createTmTools(input, opts = {}) {
|
|
|
292
315
|
layeredConfig.files.projectPaths.length ? "project" : null,
|
|
293
316
|
]
|
|
294
317
|
.filter(Boolean)
|
|
295
|
-
.join(",") || "
|
|
318
|
+
.join(",") || "defaults-only",
|
|
296
319
|
config_global: layeredConfig.files.globalPath ? "present" : "absent",
|
|
320
|
+
config_autocreate: configAutocreate,
|
|
297
321
|
config_project_files: layeredConfig.files.projectPaths.length,
|
|
298
322
|
config_opencode_files: layeredConfig.files.opencodePaths.length,
|
|
299
323
|
config_env_only: layeredConfig.layered.envOnlyActive,
|
|
@@ -320,8 +344,13 @@ export async function createTmTools(input, opts = {}) {
|
|
|
320
344
|
dir: path.join(store.blackboardRoot, "webcache"),
|
|
321
345
|
ttlSec: cfg.webCacheTtlSec,
|
|
322
346
|
});
|
|
323
|
-
const mode = opts.mode ?? resolveEnvProtectMode(
|
|
324
|
-
const extra = opts.extra ?? parseExtraDeny(
|
|
347
|
+
const mode = opts.mode ?? resolveEnvProtectMode(cfg.envProtect);
|
|
348
|
+
const extra = opts.extra ?? parseExtraDeny(cfg.envProtectExtraDeny);
|
|
349
|
+
// The web channel's two config-driven module globals: the private-space policy
|
|
350
|
+
// and the extra hit-domain blacklist. Set from the resolved config so the
|
|
351
|
+
// tools read ONE source (the v2 personality re-sets the policy, harmlessly).
|
|
352
|
+
setPrivateSpacePolicy(cfg.privateSpace);
|
|
353
|
+
setHitBlacklist(cfg.hitBlacklist);
|
|
325
354
|
const expireAt = Date.now() + cfg.blackboardTtlDays * 24 * 60 * 60 * 1000;
|
|
326
355
|
// Bun shell ($): try input.$ first (T0.4② verified), then Bun globals
|
|
327
356
|
// (desktop loader may not pass $ through; Bun exposes it globally).
|
|
@@ -417,7 +446,7 @@ export async function createTmTools(input, opts = {}) {
|
|
|
417
446
|
...tools.tm_stats,
|
|
418
447
|
execute: async (args, ctx) => {
|
|
419
448
|
const res = baseStatsExecute ? await baseStatsExecute(args, ctx) : "";
|
|
420
|
-
const section = renderConfigSection(layeredConfig.layered, layeredConfig.files);
|
|
449
|
+
const section = renderConfigSection(layeredConfig.layered, layeredConfig.files, configAutocreate);
|
|
421
450
|
if (typeof res === "string")
|
|
422
451
|
return `${res}\n${section}`;
|
|
423
452
|
if (res && typeof res === "object" && typeof res.output === "string") {
|
|
@@ -447,7 +476,7 @@ export async function createTmTools(input, opts = {}) {
|
|
|
447
476
|
// personality is frozen: an extra tool in this record would be a v1 tool-
|
|
448
477
|
// surface change smuggled in through a v2 feature.
|
|
449
478
|
if (opts.ledgerStore) {
|
|
450
|
-
tools.tm_ledger = buildLedgerTool({ store: opts.ledgerStore, onlyAgent: "Team",
|
|
479
|
+
tools.tm_ledger = buildLedgerTool({ store: opts.ledgerStore, onlyAgent: "Team", config: cfg });
|
|
451
480
|
}
|
|
452
481
|
return {
|
|
453
482
|
runId,
|
|
@@ -472,8 +501,9 @@ export async function createTmTools(input, opts = {}) {
|
|
|
472
501
|
};
|
|
473
502
|
}
|
|
474
503
|
// ---------- re-exports (stable import surface for tests + plugin entry) ----------
|
|
475
|
-
export { DEFAULT_BASH_READONLY_ALLOWED, DEFAULT_WEBFETCH_DOMAINS, estimateTokens, parseAllowlistEnv, parseWebfetchAllowlistEnv,
|
|
476
|
-
export { CONFIG_FILE_NAME, readConfigFiles, resolveLayeredTmConfig, renderConfigSection, } from "./config-files.js";
|
|
504
|
+
export { DEFAULT_BASH_READONLY_ALLOWED, DEFAULT_WEBFETCH_DOMAINS, estimateTokens, parseAllowlistEnv, parseWebfetchAllowlistEnv, parseWeightsEnv, resolveConfig, resolveOnOff, coerceValue, shouldOffload, shorten, TM_CONFIG_DEFAULTS, } from "./config.js";
|
|
505
|
+
export { CONFIG_FILE_NAME, readConfigFiles, resolveGlobalDir, resolveLayeredTmConfig, renderConfigSection, } from "./config-files.js";
|
|
506
|
+
export { renderConfigTemplate, ensureGlobalConfig } from "./config-template.js";
|
|
477
507
|
export { buildRef, hmacToken, isExpired, loadOrCreateHandleKey, newRunId, parseRef, REF_PATTERN, verifyToken, HANDLE_KEY_FILE, } from "./refs.js";
|
|
478
508
|
export { RunStore, USAGE_JSONL_RELPATH } from "./store.js";
|
|
479
509
|
export { buildPreview, buildStructureSummary, capTokens, contentTypeForPath, detectContentType, sniffContentType, } from "./preview.js";
|
|
@@ -483,7 +513,7 @@ export { buildPipelines } from "./pipelines.js";
|
|
|
483
513
|
export { buildWebfetchArgsSchema, buildSearchArgsSchema } from "./args-schema.js";
|
|
484
514
|
export { toToolResult, HANDLE_INVALID_MESSAGE, tmError } from "./result.js";
|
|
485
515
|
export { runShellCommand, spawnShellFallback, cleanShellError } from "./shell-bridge.js";
|
|
486
|
-
export { buildTmWebfetchTool, checkWebUrl, extractWebResponse, extractSearchHits, renderSearchHits, fetchWebText, hitDomainBlacklist, HIT_DOMAIN_BLACKLIST_DEFAULT, hostAllowed, htmlToText, } from "./webfetch.js";
|
|
516
|
+
export { buildTmWebfetchTool, checkWebUrl, extractWebResponse, extractSearchHits, renderSearchHits, fetchWebText, hitDomainBlacklist, setHitBlacklist, setPrivateSpacePolicy, HIT_DOMAIN_BLACKLIST_DEFAULT, hostAllowed, htmlToText, } from "./webfetch.js";
|
|
487
517
|
export { buildTmSearchTool, SEARCH_ENGINES, SEARCH_ENGINE_NAMES, renderNpmResults, renderGithubResults, renderWikiResults, } from "./search.js";
|
|
488
518
|
// (tm_ptc_run and its engine/bridge/type re-exports lived here; the tool is
|
|
489
519
|
// v1-only and shipped away with the v1 personality, so nothing re-exports
|