@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.
Files changed (165) hide show
  1. package/README.md +1009 -849
  2. package/README.zh-CN.md +906 -756
  3. package/dist/host/v2-browser-gate.d.ts +4 -1
  4. package/dist/host/v2-browser-gate.d.ts.map +1 -1
  5. package/dist/host/v2-browser-gate.js +1 -1
  6. package/dist/host/v2-browser-gate.js.map +1 -1
  7. package/dist/host/v2-capabilities.js +1 -1
  8. package/dist/host/v2-capabilities.js.map +1 -1
  9. package/dist/host/v2-guard.d.ts +3 -1
  10. package/dist/host/v2-guard.d.ts.map +1 -1
  11. package/dist/host/v2-guard.js +2 -2
  12. package/dist/host/v2-guard.js.map +1 -1
  13. package/dist/host/v2-offload.d.ts +12 -2
  14. package/dist/host/v2-offload.d.ts.map +1 -1
  15. package/dist/host/v2-offload.js +9 -9
  16. package/dist/host/v2-offload.js.map +1 -1
  17. package/dist/host/v2-probe-chain.d.ts +5 -1
  18. package/dist/host/v2-probe-chain.d.ts.map +1 -1
  19. package/dist/host/v2-probe-chain.js +4 -6
  20. package/dist/host/v2-probe-chain.js.map +1 -1
  21. package/dist/host/v2-probe.d.ts.map +1 -1
  22. package/dist/host/v2-probe.js +2 -1
  23. package/dist/host/v2-probe.js.map +1 -1
  24. package/dist/host/v2-prune.d.ts +5 -1
  25. package/dist/host/v2-prune.d.ts.map +1 -1
  26. package/dist/host/v2-prune.js +8 -14
  27. package/dist/host/v2-prune.js.map +1 -1
  28. package/dist/host/v2-retry.d.ts +9 -2
  29. package/dist/host/v2-retry.d.ts.map +1 -1
  30. package/dist/host/v2-retry.js +13 -15
  31. package/dist/host/v2-retry.js.map +1 -1
  32. package/dist/host/v2-session.d.ts +6 -2
  33. package/dist/host/v2-session.d.ts.map +1 -1
  34. package/dist/host/v2-session.js +7 -13
  35. package/dist/host/v2-session.js.map +1 -1
  36. package/dist/host/v2.d.ts +7 -2
  37. package/dist/host/v2.d.ts.map +1 -1
  38. package/dist/host/v2.js +38 -35
  39. package/dist/host/v2.js.map +1 -1
  40. package/dist/prompts/lead.d.ts +1 -1
  41. package/dist/prompts/lead.d.ts.map +1 -1
  42. package/dist/prompts/lead.js +23 -7
  43. package/dist/prompts/lead.js.map +1 -1
  44. package/dist/prompts/specialists.d.ts +1 -1
  45. package/dist/prompts/specialists.d.ts.map +1 -1
  46. package/dist/prompts/specialists.js +1 -1
  47. package/dist/tm/args-schema.d.ts +1 -1
  48. package/dist/tm/args-schema.js +6 -6
  49. package/dist/tm/args-schema.js.map +1 -1
  50. package/dist/tm/board.js +2 -2
  51. package/dist/tm/board.js.map +1 -1
  52. package/dist/tm/config-files.d.ts +41 -17
  53. package/dist/tm/config-files.d.ts.map +1 -1
  54. package/dist/tm/config-files.js +68 -73
  55. package/dist/tm/config-files.js.map +1 -1
  56. package/dist/tm/config-layers.d.ts +65 -33
  57. package/dist/tm/config-layers.d.ts.map +1 -1
  58. package/dist/tm/config-layers.js +165 -81
  59. package/dist/tm/config-layers.js.map +1 -1
  60. package/dist/tm/config-template.d.ts +32 -0
  61. package/dist/tm/config-template.d.ts.map +1 -0
  62. package/dist/tm/config-template.js +74 -0
  63. package/dist/tm/config-template.js.map +1 -0
  64. package/dist/tm/config.d.ts +115 -140
  65. package/dist/tm/config.d.ts.map +1 -1
  66. package/dist/tm/config.js +100 -200
  67. package/dist/tm/config.js.map +1 -1
  68. package/dist/tm/index.d.ts +11 -3
  69. package/dist/tm/index.d.ts.map +1 -1
  70. package/dist/tm/index.js +46 -16
  71. package/dist/tm/index.js.map +1 -1
  72. package/dist/tm/ledger.d.ts +7 -3
  73. package/dist/tm/ledger.d.ts.map +1 -1
  74. package/dist/tm/ledger.js +5 -4
  75. package/dist/tm/ledger.js.map +1 -1
  76. package/dist/tm/memory.js +3 -3
  77. package/dist/tm/pipelines.js +1 -1
  78. package/dist/tm/search.js +6 -6
  79. package/dist/tm/search.js.map +1 -1
  80. package/dist/tm/stats.js +2 -2
  81. package/dist/tm/stats.js.map +1 -1
  82. package/dist/tm/tools.js +2 -2
  83. package/dist/tm/webfetch.d.ts +5 -2
  84. package/dist/tm/webfetch.d.ts.map +1 -1
  85. package/dist/tm/webfetch.js +24 -18
  86. package/dist/tm/webfetch.js.map +1 -1
  87. package/docs/installation-v2.md +59 -38
  88. package/docs/installation.md +4 -4
  89. package/package.json +1 -1
  90. package/dist/approval-gate.d.ts +0 -205
  91. package/dist/approval-gate.d.ts.map +0 -1
  92. package/dist/approval-gate.js +0 -627
  93. package/dist/approval-gate.js.map +0 -1
  94. package/dist/host/v1.d.ts +0 -14
  95. package/dist/host/v1.d.ts.map +0 -1
  96. package/dist/host/v1.js +0 -340
  97. package/dist/host/v1.js.map +0 -1
  98. package/dist/host/v2-client.d.ts +0 -53
  99. package/dist/host/v2-client.d.ts.map +0 -1
  100. package/dist/host/v2-client.js +0 -193
  101. package/dist/host/v2-client.js.map +0 -1
  102. package/dist/host/v2-transcript.d.ts +0 -73
  103. package/dist/host/v2-transcript.d.ts.map +0 -1
  104. package/dist/host/v2-transcript.js +0 -151
  105. package/dist/host/v2-transcript.js.map +0 -1
  106. package/dist/host-hooks.d.ts +0 -126
  107. package/dist/host-hooks.d.ts.map +0 -1
  108. package/dist/host-hooks.js +0 -284
  109. package/dist/host-hooks.js.map +0 -1
  110. package/dist/tm/bash-timeout.d.ts +0 -72
  111. package/dist/tm/bash-timeout.d.ts.map +0 -1
  112. package/dist/tm/bash-timeout.js +0 -100
  113. package/dist/tm/bash-timeout.js.map +0 -1
  114. package/dist/tm/browser.d.ts +0 -642
  115. package/dist/tm/browser.d.ts.map +0 -1
  116. package/dist/tm/browser.js +0 -2836
  117. package/dist/tm/browser.js.map +0 -1
  118. package/dist/tm/ptc/budgets.d.ts +0 -59
  119. package/dist/tm/ptc/budgets.d.ts.map +0 -1
  120. package/dist/tm/ptc/budgets.js +0 -138
  121. package/dist/tm/ptc/budgets.js.map +0 -1
  122. package/dist/tm/ptc/contract.d.ts +0 -171
  123. package/dist/tm/ptc/contract.d.ts.map +0 -1
  124. package/dist/tm/ptc/contract.js +0 -85
  125. package/dist/tm/ptc/contract.js.map +0 -1
  126. package/dist/tm/ptc/driver.d.ts +0 -40
  127. package/dist/tm/ptc/driver.d.ts.map +0 -1
  128. package/dist/tm/ptc/driver.js +0 -213
  129. package/dist/tm/ptc/driver.js.map +0 -1
  130. package/dist/tm/ptc/engines.d.ts +0 -43
  131. package/dist/tm/ptc/engines.d.ts.map +0 -1
  132. package/dist/tm/ptc/engines.js +0 -454
  133. package/dist/tm/ptc/engines.js.map +0 -1
  134. package/dist/tm/ptc/gate.d.ts +0 -28
  135. package/dist/tm/ptc/gate.d.ts.map +0 -1
  136. package/dist/tm/ptc/gate.js +0 -130
  137. package/dist/tm/ptc/gate.js.map +0 -1
  138. package/dist/tm/ptc/index.d.ts +0 -19
  139. package/dist/tm/ptc/index.d.ts.map +0 -1
  140. package/dist/tm/ptc/index.js +0 -15
  141. package/dist/tm/ptc/index.js.map +0 -1
  142. package/dist/tm/ptc/pscan.d.ts +0 -30
  143. package/dist/tm/ptc/pscan.d.ts.map +0 -1
  144. package/dist/tm/ptc/pscan.js +0 -341
  145. package/dist/tm/ptc/pscan.js.map +0 -1
  146. package/dist/tm/ptc/summary.d.ts +0 -17
  147. package/dist/tm/ptc/summary.d.ts.map +0 -1
  148. package/dist/tm/ptc/summary.js +0 -134
  149. package/dist/tm/ptc/summary.js.map +0 -1
  150. package/dist/tm/ptc/tool.d.ts +0 -66
  151. package/dist/tm/ptc/tool.d.ts.map +0 -1
  152. package/dist/tm/ptc/tool.js +0 -231
  153. package/dist/tm/ptc/tool.js.map +0 -1
  154. package/dist/tm/ptc.d.ts +0 -298
  155. package/dist/tm/ptc.d.ts.map +0 -1
  156. package/dist/tm/ptc.js +0 -865
  157. package/dist/tm/ptc.js.map +0 -1
  158. package/dist/tm/pty.d.ts +0 -70
  159. package/dist/tm/pty.d.ts.map +0 -1
  160. package/dist/tm/pty.js +0 -245
  161. package/dist/tm/pty.js.map +0 -1
  162. package/dist/tool-coerce.d.ts +0 -24
  163. package/dist/tool-coerce.d.ts.map +0 -1
  164. package/dist/tool-coerce.js +0 -63
  165. package/dist/tool-coerce.js.map +0 -1
@@ -1,10 +1,16 @@
1
1
  /**
2
2
  * JIT layer-2 tools (T1.2 + T1.3) — configuration surface.
3
3
  *
4
- * Every knob resolves from the process environment with a typed default;
5
- * invalid values never crash plugin startup, they fall back to the default
6
- * (same fail-soft philosophy as blackboard.resolveTtlMs and
7
- * envprotect.resolveEnvProtectMode).
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,34 +20,14 @@
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: TM_BLACKBOARD_DIR (this module, run-payload store, default
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
- /** Default tm_bash read-only allowlist (P3, command-level). The PS
24
- * -Object entries are pure pipeline formatters — no write capability. */
25
- export declare const DEFAULT_BASH_READONLY_ALLOWED: readonly string[];
26
- /**
27
- * Seeded tm_webfetch / tm_search domain allowlist — every host the search
28
- * engines and data sources ride (all reachable from mainland China without
29
- * API keys): wiki term / bilibili search / bing CN + international / baidu /
30
- * sogou / 360, the npm registry (JSON search + package metadata) and the
31
- * GitHub (search API + repo pages + raw/gist content), its ghproxy.net
32
- * mainland mirror, and PARENT domains for baidu/moegirl so every sibling
33
- * subdomain (baike./tieba./mzh./mobile.) is covered — real sessions showed
34
- * agents bouncing off baike.baidu.com and mzh.moegirl.org.cn (the agent-install flow points
35
- * agents at the installation guide on exactly these hosts). A site's OWN
36
- * asset CDN on a brand-unrelated domain has to be seeded too — same-site
37
- * cannot infer it, and blocking it is what makes a page render blank
38
- * (bdimg.com below is that case, measured). Subdomains of
39
- * an entry are included;
40
- * TM_WEBFETCH_ALLOWED_DOMAINS overrides the list (comma/semicolon
41
- * separated; a lone "*" opens every host — keep the engine hosts or
42
- * tm_search's engines lose their targets).
43
- */
44
- export declare const DEFAULT_WEBFETCH_DOMAINS: readonly string[];
29
+ import { DEFAULT_BASH_READONLY_ALLOWED, DEFAULT_WEBFETCH_DOMAINS, type ConfigKeySpec } from "./config-layers.js";
30
+ export { DEFAULT_BASH_READONLY_ALLOWED, DEFAULT_WEBFETCH_DOMAINS };
45
31
  export interface TmConfig {
46
32
  /** Offload boundary in estimated tokens (estimate == threshold offloads). */
47
33
  offloadThreshold: number;
@@ -66,151 +52,141 @@ export interface TmConfig {
66
52
  /** tm_memory GLOBAL scope dir. Empty = auto (~/.opencode-team/memories/global
67
53
  * — user-level, follows the user across projects). */
68
54
  memoryGlobalDir: string;
69
- /** tm_memory session-scope entry TTL in minutes (lazy + boot sweep).
70
- * Consumed by memory.ts (T1). */
55
+ /** tm_memory session-scope entry TTL in minutes (lazy + boot sweep). */
71
56
  memorySessionTtlMin: number;
72
57
  /** tm_memory max entries per scope (project / global); over the cap,
73
- * add fails with a compact/forget hint. Consumed by memory.ts (T1). */
58
+ * add fails with a compact/forget hint. */
74
59
  memoryMaxEntries: number;
75
- /** tm_memory staleness marker age in days; 0 disables `[stale Nd]`
76
- * tagging on search hits. Consumed by memory.ts (T1). */
60
+ /** tm_memory staleness marker age in days; 0 disables `[stale Nd]`. */
77
61
  memoryStaleDays: number;
78
62
  /** tm_memory session persistence: "" (default) = ephemeral in-process
79
- * Map only; "1" = also write under <storeBase>/memories/sessions/<sid>/.
80
- * Consumed by memory.ts (T1). */
63
+ * Map only; "1" = also write under <storeBase>/memories/sessions/<sid>/. */
81
64
  memorySessionPersist: string;
82
- /** tm_search default engine when no explicit `engine` arg is given
83
- * ("auto" = current first-engine behavior). Consumed by search.ts (T4). */
65
+ /** tm_search default engine when no explicit `engine` arg is given. */
84
66
  searchDefaultEngine: string;
85
- /** Hits kept per engine leg AND in the final fused list. Consumed by
86
- * search.ts. */
67
+ /** Hits kept per engine leg AND in the final fused list. */
87
68
  searchMaxHits: number;
88
- /** Per-engine fusion weight overrides (`bing=0.2,hn=0.3`). Anything not
89
- * listed keeps the built-in table. Consumed by search.ts. */
69
+ /** Per-engine fusion weight overrides (`bing=0.2,hn=0.3`). */
90
70
  searchWeights: Record<string, number>;
91
- /** Engines removed from the roster AND from every auto route
92
- * (comma/semicolon separated). Consumed by search.ts. */
71
+ /** Engines removed from the roster AND from every auto route. */
93
72
  searchDisabledEngines: string[];
94
- /** Weight multiplier applied to a ZERO-overlap hit (no query token in the
95
- * title/snippet/host). bing used to own ranks 1-10 purely on its 0.4
96
- * trust weight, so its junk outranked every engine's best hit; the floor
97
- * keeps such a hit in play at a fraction of the weight instead of
98
- * deleting an engine the user cannot afford to lose. Consumed by
99
- * search.ts. */
73
+ /** Weight multiplier applied to a ZERO-overlap hit. */
100
74
  searchRelevanceFloor: number;
101
75
  /** Offload boundary (estimated tokens) for the markdown/text/log prose
102
- * class. Defaults to 4000 when NOTHING is set; but if the user only set
103
- * the global `TM_OFFLOAD_THRESHOLD` (no `TM_OFFLOAD_THRESHOLD_TEXT`),
104
- * this tier INHERITS the global so a prose-heavy session that raised the
105
- * boundary is not silently capped back to 4000. An explicit
106
- * `TM_OFFLOAD_THRESHOLD_TEXT` always wins. Consumed by pipelines.ts
107
- * `offloadThresholdFor` (T4 tiering — now live). */
76
+ * class. Inherits an explicitly-set `offloadThreshold` when this key is
77
+ * not set; an explicit value always wins. */
108
78
  offloadThresholdText: number;
109
- /** Offload boundary for the json/csv/code/binary data class. Defaults to
110
- * 2000 (= the historical global baseline) when NOTHING is set; inherits
111
- * an explicitly-set `TM_OFFLOAD_THRESHOLD` exactly like the text tier; an
112
- * explicit `TM_OFFLOAD_THRESHOLD_DATA` always wins. Consumed by
113
- * pipelines.ts `offloadThresholdFor` (T4 tiering — now live). */
79
+ /** Offload boundary for the json/csv/code/binary data class. Inherits the
80
+ * global exactly like the text tier. */
114
81
  offloadThresholdData: number;
115
- /** TM_WEB_CACHE_TTL_SEC (default 300; 0 disables) — how long a governed
116
- * fetch body may be re-served for the SAME URL. The web channel is the
117
- * slowest thing the team does and the most duplicated (lead + researcher
118
- * issuing overlapping queries, `auto` re-fanning engine legs), so this is
119
- * a throughput knob, not a convenience one. Freshness is the price, which
120
- * is why a hit is announced in the reply and counted by tm_stats. A cache
121
- * entry is only ever consulted after the STATIC allowlist admits the hop
122
- * (see cache.ts) — dialog consent is per-request and is never cached. */
82
+ /** URL-level cache TTL in seconds (0 disables). */
123
83
  webCacheTtlSec: number;
124
- /** TM_JOIN_MAX_WAIT_MS (default 60 000) — the ceiling on tm_join's bounded
125
- * wait. It was 300 000, and a live session used exactly that twice in a
126
- * row: ten minutes of a lead sitting inside a tool call while six
127
- * researchers worked. A wait is not parallelism — the lead's turn is
128
- * blocked either way — so the default now says "check, then go do lead
129
- * work" instead of "park here". Raise it only deliberately. */
84
+ /** The ceiling on tm_join's bounded wait (ms). */
130
85
  joinMaxWaitMs: number;
131
- /** tm_board_write: one board file's character cap and one session folder's file cap.
132
- * The board is the ONLY oversized-deliverable channel, and the roles that
133
- * need it most (architect / researcher) own no write-capable file tool, so the caps
134
- * are what keeps a governed writer from becoming a disk leak. */
86
+ /** tm_board_write: one board file's character cap and one session folder's file cap. */
135
87
  boardMaxChars: number;
136
88
  boardMaxFiles: number;
137
- /** TM_TASK_OFFLOAD (default on) — keep the HOST's own background sub-agent
138
- * (`task {background:true}`, needs OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS)
139
- * inside our context budget: when the host injects the finished child's full
140
- * reply into the parent session, swap the oversized body for a preview plus a
141
- * `tm_join` pointer (see src/task-offload.ts). Synthetic parts carrying the
142
- * host's own task envelope ONLY — never a message the user typed, and no
143
- * disk copy. `off` restores the host's verbatim injection. */
89
+ /** Keep the HOST's own background sub-agent reply inside our context budget. */
144
90
  taskOffload: "on" | "off";
145
- /** Reclaim the store layout an upgrade left behind: a sibling `w-*` shard
146
- * idle past the TTL, and the pre-shard `blackboard/`+`trajectory/` at the
147
- * shared tmpdir base (which no sweeper points at any more). Only ever
148
- * TTL-expired entries — never a live run. `off` keeps the disk as is; the
149
- * test runner sets it so a suite cannot mutate the developer's real Temp. */
91
+ /** Reclaim the store layout an upgrade left behind. */
150
92
  storeReclaim: "on" | "off";
151
- /** Floor (minutes) for the (v1) approval-gate ask timeout. ORPHANED: its
152
- * only consumer, approval-gate.ts `resolveAskTimeoutMs`, was deleted with
153
- * the v1 personality (v2 raises no plugin dialog, so there is no timer to
154
- * floor). The knob is still parsed so an existing config keeps resolving;
155
- * nothing reads it. DEFAULTED TO 1. */
93
+ /** Floor (minutes) for the (v1) approval-gate ask timeout. ORPHANED. */
156
94
  askTimeoutFloorMin: number;
157
- /** Ceiling (ms) forced onto the built-in bash tool's `timeout` ARG through
158
- * the official `tool.execute.before` hook. 0 (default) = no cap: a build
159
- * or test run stays whatever the model asked for. Consumed by
160
- * src/host/v2-guard.ts (applyV2ShellTimeoutClamp). */
95
+ /** Ceiling (ms) forced onto the built-in bash tool's `timeout` ARG. */
161
96
  bashTimeoutMaxMs: number;
162
- /** Ceiling (ms) for a bash command that the P3 read-only allowlist already
163
- * classifies as a pure probe (ls/grep/rg/cat/Get-ChildItem …). Those
164
- * never legitimately need the host's 120 s default, and models routinely
165
- * set 120000+ on them, so this one ships ENABLED. 0 disables.
166
- * Consumed by src/host/v2-guard.ts (applyV2ShellTimeoutClamp). */
97
+ /** Ceiling (ms) for a bash command the P3 read-only allowlist accepts. */
167
98
  bashTimeoutProbeMs: number;
99
+ /** JIT governance over the HOST's own tools (read/grep/shell…). */
100
+ nativeOffload: "on" | "off";
101
+ /** (v1-only) tm_ptc_run's web bridge. */
102
+ ptcWebBridge: "on" | "off";
103
+ /** Extra hit-domain blacklist entries (merged with the built-in default). */
104
+ hitBlacklist: string[];
105
+ /** R6 extra deny rules (raw `K=V;K2=V2`-style string). */
106
+ envProtectExtraDeny: string;
107
+ /** (v1-only) shell env passthrough. */
108
+ shellEnv: string;
109
+ /** (v1-only) per-agent temperature overrides. */
110
+ agentTemperature: string;
111
+ /** (v1-only) compaction survival list. */
112
+ compactionContext: "on" | "off";
113
+ /** R6 mode (strict/standard/off). */
114
+ envProtect: string;
115
+ /** R6 fine-grained ask policy; "off" = every shell command asks. */
116
+ r6FineAsk: string;
117
+ /** Private-space policy (allow/deny/ask). */
118
+ privateSpace: string;
119
+ /** Concurrency cap on `subagent`; 0 disables. */
120
+ maxConcurrentSubagents: number;
121
+ /** v2 tool delivery: "direct" sends options.codemode=false; "" = catalog. */
122
+ v2CodeMode: string;
123
+ /** Context pruning (settled messages → pointers). */
124
+ prune: "on" | "off";
125
+ /** Percent of the window at which pruning starts. */
126
+ pruneAtPercent: number;
127
+ /** Percent of the window kept verbatim at the tail. */
128
+ pruneKeepTailPercent: number;
129
+ /** Retry governor (recognise throttle + inject wait + cooldown). */
130
+ retry: "on" | "off";
131
+ retryBaseMs: number;
132
+ retryMaxMs: number;
133
+ retryJitter: number;
134
+ retryBreakAfter: number;
135
+ retryCooldownMs: number;
136
+ /** Split advice when a dispatch brief is oversized. */
137
+ splitAdvice: "on" | "off";
138
+ splitBriefTokens: number;
139
+ splitMaxCriteria: number;
140
+ /** Code Mode adoption hint after a run of native calls. */
141
+ probeChain: "on" | "off";
142
+ probeChainAfter: number;
143
+ /** Token budget a native browser snapshot keeps (addressing lines). */
144
+ nativeSnapshotMaxTokens: number;
145
+ /** Token budget a native report keeps (tables). */
146
+ nativeReportMaxTokens: number;
147
+ /** The native `browser_*` catalog gate. */
148
+ v2BrowserGate: "on" | "off";
149
+ /** tm_ledger per-session item cap. */
150
+ ledgerMaxItems: number;
168
151
  }
169
- export declare const TM_CONFIG_DEFAULTS: {
170
- readonly offloadThreshold: 2000;
171
- readonly previewLines: 20;
172
- readonly previewMaxTokens: 80;
173
- readonly fetchMaxLines: 2000;
174
- readonly blackboardDir: "";
175
- readonly trajectoryDir: "";
176
- readonly blackboardTtlDays: 7;
177
- readonly memorySessionTtlMin: 240;
178
- readonly memoryMaxEntries: 200;
179
- readonly memoryStaleDays: 30;
180
- readonly memorySessionPersist: "";
181
- readonly searchDefaultEngine: "auto";
182
- readonly searchMaxHits: 10;
183
- readonly searchWeights: {};
184
- readonly searchDisabledEngines: readonly [];
185
- readonly searchRelevanceFloor: 0.35;
186
- readonly offloadThresholdText: 4000;
187
- readonly offloadThresholdData: 2000;
188
- readonly webCacheTtlSec: 300;
189
- readonly joinMaxWaitMs: 60000;
190
- readonly boardMaxChars: 200000;
191
- readonly boardMaxFiles: 200;
192
- readonly taskOffload: "on";
193
- readonly storeReclaim: "on";
194
- readonly askTimeoutFloorMin: 1;
195
- readonly bashTimeoutMaxMs: 0;
196
- readonly bashTimeoutProbeMs: 60000;
197
- };
198
- type EnvLike = Record<string, string | undefined>;
152
+ /** The registry's defaults, keyed by canonical key. Derived from
153
+ * `CONFIG_KEYS` so a default can never drift from its spec. */
154
+ export declare const TM_CONFIG_DEFAULTS: Record<string, unknown>;
199
155
  /** TM_SEARCH_WEIGHTS — `bing=0.2,hn=0.3` into a partial weight table. A
200
156
  * malformed pair is dropped (not the whole var), so one typo cannot silently
201
- * flatten every custom weight back to the built-in table. */
157
+ * flatten every custom weight back to the built-in table. Kept for the
158
+ * string form; a file value is native JSON and skips this. */
202
159
  export declare function parseWeightsEnv(raw: unknown): Record<string, number>;
203
160
  /**
204
- * Parse a comma/semicolon-separated allowlist env var. Unset/absent -> null
161
+ * Parse a comma/semicolon-separated allowlist string. Unset/absent -> null
205
162
  * (caller applies the default). An explicitly EMPTY string parses to []
206
- * (deny-all) — an explicit user choice is respected. Shared by
207
- * TM_BASH_READONLY_ALLOWED and TM_WEBFETCH_ALLOWED_DOMAINS.
163
+ * (deny-all) — an explicit user choice is respected. Kept for the string
164
+ * form; a file value is native JSON and skips this.
208
165
  */
209
166
  export declare function parseAllowlistEnv(raw: unknown): string[] | null;
210
167
  /** Historical alias — identical grammar to parseAllowlistEnv. */
211
168
  export declare const parseWebfetchAllowlistEnv: typeof parseAllowlistEnv;
212
- /** Resolve the full tm-tools config from an env-like record (default: process.env). */
213
- export declare function resolveTmConfig(env?: EnvLike): TmConfig;
169
+ /** TM_PTC_WEB_BRIDGE — off only on an explicit off-ish value; unset or
170
+ * invalid keeps the bridge on (fail-soft toward the newer default). */
171
+ export declare function resolveOnOff(raw: unknown): "on" | "off";
172
+ /**
173
+ * Coerce ONE raw value against its spec. `undefined`/`null` -> the default.
174
+ * A `number` is truncated when the default is an integer, then clamped to
175
+ * `min`/`max`; a non-numeric value falls back to the default. A `string`
176
+ * with an `enum` must match (case-insensitively; on/off also accept the
177
+ * 0/1/false/true/no/yes spellings); otherwise the default. A `string[]`
178
+ * must be an array of strings; a `record` a plain object of numbers.
179
+ */
180
+ export declare function coerceValue(spec: ConfigKeySpec, raw: unknown): unknown;
181
+ /**
182
+ * Resolve the full tm-tools config from an already-merged JSON value record
183
+ * (the file layers, plus any programmatic `configDefaults`). Registry-driven:
184
+ * every key gets its coerced value or its default. The two offload tiers
185
+ * INHERIT an explicitly-set `offloadThreshold` when they are not set
186
+ * themselves (Wave B M1) — a user who raised the global to save tokens must
187
+ * not have prose silently capped back to 4000.
188
+ */
189
+ export declare function resolveConfig(values?: Record<string, unknown>): TmConfig;
214
190
  /** Token cost of ONE code point — CJK-range ≈ 1 token (kana / Hangul /
215
191
  * fullwidth / CJK punctuation all sit above U+2E80), everything else ≈ 0.25
216
192
  * (chars/4). Shared by estimateTokens and preview.capTokens so the two
@@ -234,5 +210,4 @@ export declare function estimateTokens(text: string): number;
234
210
  export declare function shouldOffload(tokens: number, threshold: number): boolean;
235
211
  /** Collapse whitespace and hard-cap a string for messages / clue lines. */
236
212
  export declare function shorten(text: unknown, max: number): string;
237
- export {};
238
213
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/tm/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;0EAC0E;AAC1E,eAAO,MAAM,6BAA6B,EAAE,SAAS,MAAM,EAa1D,CAAA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EA+BrD,CAAA;AAED,MAAM,WAAW,QAAQ;IACvB,6EAA6E;IAC7E,gBAAgB,EAAE,MAAM,CAAA;IACxB,+DAA+D;IAC/D,YAAY,EAAE,MAAM,CAAA;IACpB,gFAAgF;IAChF,gBAAgB,EAAE,MAAM,CAAA;IACxB,4CAA4C;IAC5C,aAAa,EAAE,MAAM,CAAA;IACrB;oFACgF;IAChF,aAAa,EAAE,MAAM,CAAA;IACrB;oFACgF;IAChF,aAAa,EAAE,MAAM,CAAA;IACrB,2EAA2E;IAC3E,iBAAiB,EAAE,MAAM,CAAA;IACzB,kDAAkD;IAClD,mBAAmB,EAAE,MAAM,EAAE,CAAA;IAC7B,0EAA0E;IAC1E,sBAAsB,EAAE,MAAM,EAAE,CAAA;IAChC;2DACuD;IACvD,eAAe,EAAE,MAAM,CAA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