@te-river/opencode-team-mode 1.5.15 → 1.6.1
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 +853 -690
- package/README.zh-CN.md +761 -631
- package/dist/agents.d.ts +5 -3
- package/dist/agents.d.ts.map +1 -1
- package/dist/agents.js +19 -8
- package/dist/agents.js.map +1 -1
- package/dist/capabilities.d.ts +1 -1
- package/dist/capabilities.js +2 -2
- package/dist/capabilities.js.map +1 -1
- package/dist/host/note.d.ts +7 -0
- package/dist/host/note.d.ts.map +1 -0
- package/dist/host/note.js +28 -0
- package/dist/host/note.js.map +1 -0
- package/dist/host/v1.d.ts +14 -0
- package/dist/host/v1.d.ts.map +1 -0
- package/dist/host/v1.js +340 -0
- package/dist/host/v1.js.map +1 -0
- package/dist/host/v2-browser-gate.d.ts +45 -0
- package/dist/host/v2-browser-gate.d.ts.map +1 -0
- package/dist/host/v2-browser-gate.js +319 -0
- package/dist/host/v2-browser-gate.js.map +1 -0
- package/dist/host/v2-capabilities.d.ts +68 -0
- package/dist/host/v2-capabilities.d.ts.map +1 -0
- package/dist/host/v2-capabilities.js +146 -0
- package/dist/host/v2-capabilities.js.map +1 -0
- package/dist/host/v2-client.d.ts +53 -0
- package/dist/host/v2-client.d.ts.map +1 -0
- package/dist/host/v2-client.js +193 -0
- package/dist/host/v2-client.js.map +1 -0
- package/dist/host/v2-events.d.ts +56 -0
- package/dist/host/v2-events.d.ts.map +1 -0
- package/dist/host/v2-events.js +158 -0
- package/dist/host/v2-events.js.map +1 -0
- package/dist/host/v2-guard.d.ts +101 -0
- package/dist/host/v2-guard.d.ts.map +1 -0
- package/dist/host/v2-guard.js +199 -0
- package/dist/host/v2-guard.js.map +1 -0
- package/dist/host/v2-offload.d.ts +148 -0
- package/dist/host/v2-offload.d.ts.map +1 -0
- package/dist/host/v2-offload.js +288 -0
- package/dist/host/v2-offload.js.map +1 -0
- package/dist/host/v2-permissions.d.ts +123 -0
- package/dist/host/v2-permissions.d.ts.map +1 -0
- package/dist/host/v2-permissions.js +190 -0
- package/dist/host/v2-permissions.js.map +1 -0
- package/dist/host/v2-probe.d.ts +85 -0
- package/dist/host/v2-probe.d.ts.map +1 -0
- package/dist/host/v2-probe.js +268 -0
- package/dist/host/v2-probe.js.map +1 -0
- package/dist/host/v2-scope.d.ts +51 -0
- package/dist/host/v2-scope.d.ts.map +1 -0
- package/dist/host/v2-scope.js +58 -0
- package/dist/host/v2-scope.js.map +1 -0
- package/dist/host/v2-session-client.d.ts +74 -0
- package/dist/host/v2-session-client.d.ts.map +1 -0
- package/dist/host/v2-session-client.js +171 -0
- package/dist/host/v2-session-client.js.map +1 -0
- package/dist/host/v2-session.d.ts +85 -0
- package/dist/host/v2-session.d.ts.map +1 -0
- package/dist/host/v2-session.js +171 -0
- package/dist/host/v2-session.js.map +1 -0
- package/dist/host/v2-subagent.d.ts +157 -0
- package/dist/host/v2-subagent.d.ts.map +1 -0
- package/dist/host/v2-subagent.js +286 -0
- package/dist/host/v2-subagent.js.map +1 -0
- package/dist/host/v2-tool.d.ts +67 -0
- package/dist/host/v2-tool.d.ts.map +1 -0
- package/dist/host/v2-tool.js +209 -0
- package/dist/host/v2-tool.js.map +1 -0
- package/dist/host/v2-transcript.d.ts +73 -0
- package/dist/host/v2-transcript.d.ts.map +1 -0
- package/dist/host/v2-transcript.js +151 -0
- package/dist/host/v2-transcript.js.map +1 -0
- package/dist/host/v2-types.d.ts +229 -0
- package/dist/host/v2-types.d.ts.map +1 -0
- package/dist/host/v2-types.js +17 -0
- package/dist/host/v2-types.js.map +1 -0
- package/dist/host/v2.d.ts +42 -0
- package/dist/host/v2.d.ts.map +1 -0
- package/dist/host/v2.js +706 -0
- package/dist/host/v2.js.map +1 -0
- package/dist/host-hooks.d.ts +13 -2
- package/dist/host-hooks.d.ts.map +1 -1
- package/dist/host-hooks.js +18 -5
- package/dist/host-hooks.js.map +1 -1
- package/dist/index.d.ts +23 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -326
- package/dist/index.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 +452 -359
- package/dist/prompts/lead.js.map +1 -1
- package/dist/prompts/shared.d.ts +2 -2
- package/dist/prompts/shared.d.ts.map +1 -1
- package/dist/prompts/shared.js +89 -17
- package/dist/prompts/shared.js.map +1 -1
- package/dist/prompts/specialists.d.ts +2 -2
- package/dist/prompts/specialists.d.ts.map +1 -1
- package/dist/prompts/specialists.js +44 -10
- package/dist/prompts/specialists.js.map +1 -1
- package/dist/task-offload.d.ts +83 -0
- package/dist/task-offload.d.ts.map +1 -0
- package/dist/task-offload.js +174 -0
- package/dist/task-offload.js.map +1 -0
- package/dist/tm/args-schema.d.ts +4 -0
- package/dist/tm/args-schema.d.ts.map +1 -1
- package/dist/tm/args-schema.js +36 -3
- package/dist/tm/args-schema.js.map +1 -1
- package/dist/tm/board.d.ts +113 -0
- package/dist/tm/board.d.ts.map +1 -0
- package/dist/tm/board.js +275 -0
- package/dist/tm/board.js.map +1 -0
- package/dist/tm/browser.d.ts +325 -6
- package/dist/tm/browser.d.ts.map +1 -1
- package/dist/tm/browser.js +1360 -135
- package/dist/tm/browser.js.map +1 -1
- package/dist/tm/config.d.ts +36 -25
- package/dist/tm/config.d.ts.map +1 -1
- package/dist/tm/config.js +29 -7
- package/dist/tm/config.js.map +1 -1
- package/dist/tm/dispatch.d.ts +133 -53
- package/dist/tm/dispatch.d.ts.map +1 -1
- package/dist/tm/dispatch.js +481 -279
- package/dist/tm/dispatch.js.map +1 -1
- package/dist/tm/dupe-guard.d.ts +16 -3
- package/dist/tm/dupe-guard.d.ts.map +1 -1
- package/dist/tm/dupe-guard.js +27 -7
- package/dist/tm/dupe-guard.js.map +1 -1
- package/dist/tm/egress.d.ts +44 -0
- package/dist/tm/egress.d.ts.map +1 -0
- package/dist/tm/egress.js +191 -0
- package/dist/tm/egress.js.map +1 -0
- package/dist/tm/guard.js +1 -1
- package/dist/tm/guard.js.map +1 -1
- package/dist/tm/index.d.ts +67 -2
- package/dist/tm/index.d.ts.map +1 -1
- package/dist/tm/index.js +228 -20
- package/dist/tm/index.js.map +1 -1
- package/dist/tm/ledger.d.ts +114 -0
- package/dist/tm/ledger.d.ts.map +1 -0
- package/dist/tm/ledger.js +308 -0
- package/dist/tm/ledger.js.map +1 -0
- package/dist/tm/perm-ask.d.ts +45 -5
- package/dist/tm/perm-ask.d.ts.map +1 -1
- package/dist/tm/perm-ask.js +107 -7
- package/dist/tm/perm-ask.js.map +1 -1
- package/dist/tm/pipelines.d.ts.map +1 -1
- package/dist/tm/pipelines.js +24 -2
- package/dist/tm/pipelines.js.map +1 -1
- package/dist/tm/preview.d.ts +55 -0
- package/dist/tm/preview.d.ts.map +1 -1
- package/dist/tm/preview.js +225 -0
- package/dist/tm/preview.js.map +1 -1
- package/dist/tm/ptc/tool.d.ts.map +1 -1
- package/dist/tm/ptc/tool.js +2 -4
- package/dist/tm/ptc/tool.js.map +1 -1
- package/dist/tm/pty.d.ts.map +1 -1
- package/dist/tm/pty.js +6 -3
- package/dist/tm/pty.js.map +1 -1
- package/dist/tm/search.d.ts +5 -0
- package/dist/tm/search.d.ts.map +1 -1
- package/dist/tm/search.js +40 -8
- package/dist/tm/search.js.map +1 -1
- package/dist/tm/serp-loop.d.ts +45 -0
- package/dist/tm/serp-loop.d.ts.map +1 -0
- package/dist/tm/serp-loop.js +80 -0
- package/dist/tm/serp-loop.js.map +1 -0
- package/dist/tm/stats.d.ts +26 -0
- package/dist/tm/stats.d.ts.map +1 -1
- package/dist/tm/stats.js +194 -4
- package/dist/tm/stats.js.map +1 -1
- package/dist/tm/webfetch.d.ts +56 -0
- package/dist/tm/webfetch.d.ts.map +1 -1
- package/dist/tm/webfetch.js +187 -19
- package/dist/tm/webfetch.js.map +1 -1
- package/dist/tool-coerce.d.ts +24 -0
- package/dist/tool-coerce.d.ts.map +1 -0
- package/dist/tool-coerce.js +63 -0
- package/dist/tool-coerce.js.map +1 -0
- package/dist/types.d.ts +7 -1
- package/dist/types.d.ts.map +1 -1
- package/docs/installation-v2.md +436 -0
- package/docs/installation.md +81 -2
- package/docs/research/agent-data-exchange.md +117 -0
- package/docs/research/browser-pane.md +89 -0
- package/docs/research/host-http-api.md +132 -0
- package/docs/research/host-subagent-injection.md +187 -0
- package/docs/research/plugin-loader-contract.md +261 -0
- package/docs/research/v2-builtin-tools.md +447 -0
- package/docs/v2-port-notes.md +315 -0
- package/index.js +7 -0
- package/package.json +4 -1
- package/scripts/gen-v2-config.mjs +304 -0
- package/scripts/lib/config-surgery.cjs +239 -0
- package/scripts/lib/fake-ctx.mjs +146 -0
package/dist/tm/index.d.ts
CHANGED
|
@@ -19,8 +19,10 @@ import { type EnvProtectMode } from "../envprotect.js";
|
|
|
19
19
|
import { type TmConfig } from "./config.js";
|
|
20
20
|
import { RunStore } from "./store.js";
|
|
21
21
|
import type { CapabilityRow } from "../capabilities.js";
|
|
22
|
-
|
|
22
|
+
import { rmForceSafe } from "../fs-safe.js";
|
|
23
|
+
export { rmForceSafe };
|
|
23
24
|
export { buildTmMemoryTool, MEMORY_CATEGORIES, MEMORY_CONTENT_MAX, MEMORY_TITLE_MAX, projectSlug, scoreMemory, parseMemoryMarkdown, renderMemoryMarkdown, } from "./memory.js";
|
|
25
|
+
export { buildLedgerTool, createStorageLedgerStore, normalizeLedger, emptyLedger, addItem, markItem, openItems, renderLedger, ledgerGoalLine, LEDGER_STATUSES, type Ledger, type LedgerItem, type LedgerStore, } from "./ledger.js";
|
|
24
26
|
export { buildTmBrowserTool, defaultBrowserExecutable, findBrowserExecutable, isChromiumFamily, isPassiveResource, normalizeResourceType, parseDesktopExec, parseProgId, parseRegCommand, playwrightLaunchTarget, rememberSite, resolveHeadless, siteOf, subresourcePass, } from "./browser.js";
|
|
25
27
|
export { ptyCommandLine, ptyCommandBlocked, ptyVerdictLine } from "./pty.js";
|
|
26
28
|
export type { PtyRecord, PtyDeps } from "./pty.js";
|
|
@@ -40,6 +42,19 @@ export interface TmRuntime {
|
|
|
40
42
|
/** Host event bus slice the async dispatcher needs (session.idle /
|
|
41
43
|
* .error / .status settle the lead's children). */
|
|
42
44
|
observeDispatchEvent: (event: HostEvent) => void;
|
|
45
|
+
/** v2: open a tm_join row for a child the HOST's own `subagent` tool created, so a
|
|
46
|
+
* background dispatch is collectable instead of invisible. */
|
|
47
|
+
registerHostChild: (child: {
|
|
48
|
+
sessionID: string;
|
|
49
|
+
parentSessionID: string;
|
|
50
|
+
agent: string;
|
|
51
|
+
label: string;
|
|
52
|
+
}) => boolean;
|
|
53
|
+
/** Settle a registered child from the host's own completion envelope; false when this
|
|
54
|
+
* process does not know the id. See `applyV2CompletionWatch`. */
|
|
55
|
+
settleHostChild: (sessionID: string, state: string) => boolean;
|
|
56
|
+
/** Any child still running? Gates the per-request completion scan. */
|
|
57
|
+
hasOpenHostChild: () => boolean;
|
|
43
58
|
/** Open async dispatches this plugin started (tests + observability). */
|
|
44
59
|
dispatches: () => Array<{
|
|
45
60
|
sessionID: string;
|
|
@@ -56,7 +71,8 @@ export interface CreateTmToolsOptions {
|
|
|
56
71
|
/** Best-effort user notification (the host toast) — tm_browser's idle
|
|
57
72
|
* reaper uses it so an auto-closed window is announced, not silent. */
|
|
58
73
|
notify?: (message: string) => void;
|
|
59
|
-
/** A
|
|
74
|
+
/** A sub-agent child session entered our registry (adopted from the host's
|
|
75
|
+
* session tree, or claimed by an id the lead named) — let the approval gate
|
|
60
76
|
* register it so the sub-agent's own protected read opens the official
|
|
61
77
|
* dialog instead of hard-throwing in an unregistered session. */
|
|
62
78
|
onChildSession?: (sessionID: string, agent: string) => void;
|
|
@@ -64,7 +80,56 @@ export interface CreateTmToolsOptions {
|
|
|
64
80
|
* lives at the plugin entry because that is where the host surfaces are
|
|
65
81
|
* handed to us). */
|
|
66
82
|
capabilities?: () => CapabilityRow[];
|
|
83
|
+
/** Environment to resolve the tool config from. Defaults to `process.env`,
|
|
84
|
+
* and exists so the two personalities can fork a DEFAULT without mutating the
|
|
85
|
+
* host process's env (v1 keeps its shipped behaviour byte-exactly while v2
|
|
86
|
+
* opens the domain allowlist, which is a personality decision, not a global
|
|
87
|
+
* one). Anything the user actually set always wins. */
|
|
88
|
+
env?: Record<string, string | undefined>;
|
|
89
|
+
/** Where the lead's LEDGER lives. v2 passes a `ctx.storage` adapter because
|
|
90
|
+
* that host has no `todowrite` for the mandate to attach to; v1 passes nothing
|
|
91
|
+
* and therefore registers no `tm_ledger` at all — its tool surface stays the
|
|
92
|
+
* one the v1 personality was frozen with. */
|
|
93
|
+
ledgerStore?: import("./ledger.js").LedgerStore;
|
|
94
|
+
/** What the v2 `ctx.session` bridge saw (attempted shapes, last host error), so
|
|
95
|
+
* `tm_join` can report WHY a named id could not be claimed. */
|
|
96
|
+
sessionReaderReport?: () => {
|
|
97
|
+
attempted: number;
|
|
98
|
+
resolved: number;
|
|
99
|
+
usedShape?: string;
|
|
100
|
+
failedShapes: string[];
|
|
101
|
+
lastError?: string;
|
|
102
|
+
};
|
|
67
103
|
}
|
|
104
|
+
/** Collision-free shard key for a workspace path. It is a HASH rather than a
|
|
105
|
+
* sanitized basename because the CJK paths this plugin actually meets strip
|
|
106
|
+
* to nothing useful — `D:\扒取数据` and `D:\文档` both slug to "d", and a store
|
|
107
|
+
* shard that collides is the exact bug this exists to kill. */
|
|
108
|
+
export declare function workspaceStoreKey(directory: string): string;
|
|
109
|
+
/** The shard dir is created lazily, one per non-git workspace — so a machine
|
|
110
|
+
* that runs this plugin's own test suite a hundred times grows a `w-*`
|
|
111
|
+
* directory per throwaway temp dir (64 after a single dev session). Prune
|
|
112
|
+
* the siblings that have produced nothing inside the TTL, never the live
|
|
113
|
+
* one, and never with a bare rmSync (win32 silently no-ops on non-ASCII
|
|
114
|
+
* paths, which would leave the directory in place and the loop lying about
|
|
115
|
+
* what it removed). */
|
|
116
|
+
export declare function pruneStaleStoreShards(base: string,
|
|
117
|
+
/** the live shard to protect; `null` when this workspace has no shard (a git
|
|
118
|
+
* workspace stores at the base itself), which means every stale sibling is fair
|
|
119
|
+
* game — the TTL, not the identity of the current workspace, is what keeps a
|
|
120
|
+
* session's data alive */
|
|
121
|
+
keep: string | null, ttlMs: number, now?: number): string[];
|
|
122
|
+
/** A layout nothing reads is still a layout the user paid disk for. Sharding
|
|
123
|
+
* moved the run/trajectory trees under `w-<hash>/`, which silently orphaned
|
|
124
|
+
* the pre-shard `blackboard/` (runs + webcache) and `trajectory/` at the
|
|
125
|
+
* shared tmpdir base — measured 503 MB and 2654 run dirs on one machine, and
|
|
126
|
+
* no sweeper points there any more, so an upgrade would never reclaim it.
|
|
127
|
+
* Drain them under the SAME TTL rule the live store uses: expired is
|
|
128
|
+
* deletable, fresh is not (a session started before the upgrade may still be
|
|
129
|
+
* writing there), and the empty shells go last. `memories/` and the team
|
|
130
|
+
* blackboard's date-named dirs are still live at that base and are not
|
|
131
|
+
* touched here. */
|
|
132
|
+
export declare function reclaimLegacyStoreBuckets(base: string, ttlMs: number, now?: number): string[];
|
|
68
133
|
export declare function createTmTools(input: PluginInput, opts?: CreateTmToolsOptions): Promise<TmRuntime>;
|
|
69
134
|
export { DEFAULT_BASH_READONLY_ALLOWED, DEFAULT_WEBFETCH_DOMAINS, estimateTokens, parseAllowlistEnv, parseWebfetchAllowlistEnv, resolveTmConfig, shouldOffload, shorten, TM_CONFIG_DEFAULTS, } from "./config.js";
|
|
70
135
|
export { buildRef, hmacToken, isExpired, newRunId, parseRef, REF_PATTERN, verifyToken, } from "./refs.js";
|
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,EAAE,MAAM,aAAa,CAAA;AAEzE,OAAO,EAGL,KAAK,cAAc,E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AAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,aAAa,CAAA;AAOpB,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,cAAc,EACd,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,yBAAyB,EACzB,MAAM,EACN,YAAY,EACZ,WAAW,GACZ,MAAM,gBAAgB,CAAA;AAIvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,YAAY,EACV,SAAS,EACT,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,aAAa,EACb,YAAY,EACZ,aAAa,EACb,aAAa,EACb,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,aAAa,GACd,MAAM,gBAAgB,CAAA"}
|
package/dist/tm/index.js
CHANGED
|
@@ -25,14 +25,18 @@ import { hmacToken, newRunId } from "./refs.js";
|
|
|
25
25
|
import { RunStore } from "./store.js";
|
|
26
26
|
import { buildTmTools } from "./tools.js";
|
|
27
27
|
import { buildPipelines } from "./pipelines.js";
|
|
28
|
-
import { buildPtcArgsSchema, buildWebfetchArgsSchema, buildMemoryArgsSchema, buildBrowserArgsSchema, buildSearchArgsSchema } from "./args-schema.js";
|
|
28
|
+
import { buildPtcArgsSchema, buildWebfetchArgsSchema, buildMemoryArgsSchema, buildBrowserArgsSchema, buildSearchArgsSchema, buildBoardArgsSchema } from "./args-schema.js";
|
|
29
29
|
import { buildPtcRunTool } from "./ptc/index.js";
|
|
30
30
|
import { buildStatsTool } from "./stats.js";
|
|
31
|
+
import { buildBoardWriteTool } from "./board.js";
|
|
32
|
+
import { buildLedgerTool } from "./ledger.js";
|
|
31
33
|
import { createWebCache } from "./cache.js";
|
|
32
34
|
import { buildTmWebfetchTool } from "./webfetch.js";
|
|
33
35
|
import { buildTmSearchTool } from "./search.js";
|
|
34
|
-
|
|
36
|
+
import { rmForceSafe } from "../fs-safe.js";
|
|
37
|
+
export { rmForceSafe };
|
|
35
38
|
export { buildTmMemoryTool, MEMORY_CATEGORIES, MEMORY_CONTENT_MAX, MEMORY_TITLE_MAX, projectSlug, scoreMemory, parseMemoryMarkdown, renderMemoryMarkdown, } from "./memory.js";
|
|
39
|
+
export { buildLedgerTool, createStorageLedgerStore, normalizeLedger, emptyLedger, addItem, markItem, openItems, renderLedger, ledgerGoalLine, LEDGER_STATUSES, } from "./ledger.js";
|
|
36
40
|
export { buildTmBrowserTool, defaultBrowserExecutable, findBrowserExecutable, isChromiumFamily, isPassiveResource, normalizeResourceType, parseDesktopExec, parseProgId, parseRegCommand, playwrightLaunchTarget, rememberSite, resolveHeadless, siteOf, subresourcePass, } from "./browser.js";
|
|
37
41
|
import { buildTmMemoryTool } from "./memory.js";
|
|
38
42
|
import { buildTmBrowserTool } from "./browser.js";
|
|
@@ -40,8 +44,147 @@ import { buildDispatchTools } from "./dispatch.js";
|
|
|
40
44
|
import { buildTmPtyTool } from "./pty.js";
|
|
41
45
|
export { ptyCommandLine, ptyCommandBlocked, ptyVerdictLine } from "./pty.js";
|
|
42
46
|
export { buildDispatchTools, DISPATCH_TARGETS, lastAssistantText, renderChildLine, sessionApiOf, summarizeStates, } from "./dispatch.js";
|
|
47
|
+
/** Collision-free shard key for a workspace path. It is a HASH rather than a
|
|
48
|
+
* sanitized basename because the CJK paths this plugin actually meets strip
|
|
49
|
+
* to nothing useful — `D:\扒取数据` and `D:\文档` both slug to "d", and a store
|
|
50
|
+
* shard that collides is the exact bug this exists to kill. */
|
|
51
|
+
export function workspaceStoreKey(directory) {
|
|
52
|
+
const norm = path
|
|
53
|
+
.resolve(String(directory ?? "").trim() || process.cwd())
|
|
54
|
+
.replace(/[\\/]+$/g, "")
|
|
55
|
+
.toLowerCase();
|
|
56
|
+
return crypto.createHash("sha256").update(path.normalize(norm)).digest("hex").slice(0, 10);
|
|
57
|
+
}
|
|
58
|
+
/** The shard dir is created lazily, one per non-git workspace — so a machine
|
|
59
|
+
* that runs this plugin's own test suite a hundred times grows a `w-*`
|
|
60
|
+
* directory per throwaway temp dir (64 after a single dev session). Prune
|
|
61
|
+
* the siblings that have produced nothing inside the TTL, never the live
|
|
62
|
+
* one, and never with a bare rmSync (win32 silently no-ops on non-ASCII
|
|
63
|
+
* paths, which would leave the directory in place and the loop lying about
|
|
64
|
+
* what it removed). */
|
|
65
|
+
export function pruneStaleStoreShards(base,
|
|
66
|
+
/** the live shard to protect; `null` when this workspace has no shard (a git
|
|
67
|
+
* workspace stores at the base itself), which means every stale sibling is fair
|
|
68
|
+
* game — the TTL, not the identity of the current workspace, is what keeps a
|
|
69
|
+
* session's data alive */
|
|
70
|
+
keep, ttlMs, now = Date.now()) {
|
|
71
|
+
const removed = [];
|
|
72
|
+
let names;
|
|
73
|
+
try {
|
|
74
|
+
names = fs.readdirSync(base);
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return removed;
|
|
78
|
+
}
|
|
79
|
+
const keepName = keep ? path.basename(keep) : "";
|
|
80
|
+
for (const name of names) {
|
|
81
|
+
if (!/^w-[0-9a-f]{10}$/.test(name) || name === keepName)
|
|
82
|
+
continue;
|
|
83
|
+
const dir = path.join(base, name);
|
|
84
|
+
let newest = 0;
|
|
85
|
+
try {
|
|
86
|
+
newest = fs.statSync(dir).mtimeMs;
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
for (const sub of ["trajectory/runs", "blackboard/runs"]) {
|
|
92
|
+
try {
|
|
93
|
+
newest = Math.max(newest, fs.statSync(path.join(dir, sub)).mtimeMs);
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
/* absent — no evidence of life either way */
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (now - newest > ttlMs) {
|
|
100
|
+
rmForceSafe(dir, { recursive: true });
|
|
101
|
+
if (!fs.existsSync(dir))
|
|
102
|
+
removed.push(name);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return removed;
|
|
106
|
+
}
|
|
107
|
+
/** A layout nothing reads is still a layout the user paid disk for. Sharding
|
|
108
|
+
* moved the run/trajectory trees under `w-<hash>/`, which silently orphaned
|
|
109
|
+
* the pre-shard `blackboard/` (runs + webcache) and `trajectory/` at the
|
|
110
|
+
* shared tmpdir base — measured 503 MB and 2654 run dirs on one machine, and
|
|
111
|
+
* no sweeper points there any more, so an upgrade would never reclaim it.
|
|
112
|
+
* Drain them under the SAME TTL rule the live store uses: expired is
|
|
113
|
+
* deletable, fresh is not (a session started before the upgrade may still be
|
|
114
|
+
* writing there), and the empty shells go last. `memories/` and the team
|
|
115
|
+
* blackboard's date-named dirs are still live at that base and are not
|
|
116
|
+
* touched here. */
|
|
117
|
+
export function reclaimLegacyStoreBuckets(base, ttlMs, now = Date.now()) {
|
|
118
|
+
const removed = [];
|
|
119
|
+
const emptyTree = (dir) => {
|
|
120
|
+
// A FILE is not "empty" — it is an entry that exists. Treating the
|
|
121
|
+
// readdir throw as true once deleted a live run dir along with its shell.
|
|
122
|
+
if (!fs.existsSync(dir))
|
|
123
|
+
return true;
|
|
124
|
+
let names;
|
|
125
|
+
try {
|
|
126
|
+
names = fs.readdirSync(dir);
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
return names.every((n) => emptyTree(path.join(dir, n)));
|
|
132
|
+
};
|
|
133
|
+
let top;
|
|
134
|
+
try {
|
|
135
|
+
top = fs.readdirSync(base);
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
return removed;
|
|
139
|
+
}
|
|
140
|
+
if (!top.includes("blackboard") && !top.includes("trajectory"))
|
|
141
|
+
return removed;
|
|
142
|
+
for (const name of ["blackboard", "trajectory"]) {
|
|
143
|
+
const dir = path.join(base, name);
|
|
144
|
+
let containers;
|
|
145
|
+
try {
|
|
146
|
+
containers = fs.readdirSync(dir);
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
for (const container of containers) {
|
|
152
|
+
if (container !== "runs" && container !== "webcache")
|
|
153
|
+
continue;
|
|
154
|
+
const cdir = path.join(dir, container);
|
|
155
|
+
let kids;
|
|
156
|
+
try {
|
|
157
|
+
kids = fs.readdirSync(cdir);
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
for (const kid of kids) {
|
|
163
|
+
const p = path.join(cdir, kid);
|
|
164
|
+
let mtime = 0;
|
|
165
|
+
try {
|
|
166
|
+
mtime = fs.statSync(p).mtimeMs;
|
|
167
|
+
}
|
|
168
|
+
catch {
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
if (now - mtime > ttlMs) {
|
|
172
|
+
rmForceSafe(p, { recursive: true });
|
|
173
|
+
if (!fs.existsSync(p))
|
|
174
|
+
removed.push(`${name}/${container}/${kid}`);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (emptyTree(dir)) {
|
|
179
|
+
rmForceSafe(dir, { recursive: true });
|
|
180
|
+
if (!fs.existsSync(dir))
|
|
181
|
+
removed.push(name);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return removed;
|
|
185
|
+
}
|
|
43
186
|
export async function createTmTools(input, opts = {}) {
|
|
44
|
-
const cfg = resolveTmConfig(process.env);
|
|
187
|
+
const cfg = resolveTmConfig(opts.env ?? process.env);
|
|
45
188
|
const directory = typeof input?.directory === "string" && input.directory.length > 0
|
|
46
189
|
? input.directory
|
|
47
190
|
: process.cwd();
|
|
@@ -66,9 +209,49 @@ export async function createTmTools(input, opts = {}) {
|
|
|
66
209
|
return false;
|
|
67
210
|
}
|
|
68
211
|
})();
|
|
69
|
-
const
|
|
212
|
+
const sharedBase = gitUsable
|
|
70
213
|
? path.join(gitDir, "opencode-team")
|
|
71
214
|
: path.join(os.tmpdir(), "opencode-team");
|
|
215
|
+
// A non-git workspace used to share ONE tmpdir bucket with every other
|
|
216
|
+
// non-git workspace — and with this plugin's own test runs. tm_stats then
|
|
217
|
+
// reported somebody else's session: a user's read-only self-check printed
|
|
218
|
+
// "窗口 10 个 run · 墙钟 81370s" of traffic that belonged to neither their
|
|
219
|
+
// session nor their project. The run/trajectory/blackboard trees are
|
|
220
|
+
// therefore sharded per workspace. `memories/` deliberately stays on the
|
|
221
|
+
// shared base — its project tier is already keyed by project slug, and
|
|
222
|
+
// moving it would strand memories the user already wrote.
|
|
223
|
+
const storeBase = gitUsable ? sharedBase : path.join(sharedBase, `w-${workspaceStoreKey(directory)}`);
|
|
224
|
+
// Boot-time reclamation of what an upgrade leaves behind. Both passes are
|
|
225
|
+
// TTL-gated (expired is deletable, fresh is not — a session started before
|
|
226
|
+
// 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
|
+
if (cfg.storeReclaim !== "off") {
|
|
229
|
+
const ttlMs = cfg.blackboardTtlDays * 24 * 60 * 60 * 1000;
|
|
230
|
+
// Shards live in the TMPDIR bucket and nowhere else — a git workspace's store
|
|
231
|
+
// is inside its own `.git`, which never contains a `w-*`. So the prune has to
|
|
232
|
+
// name that bucket explicitly rather than reuse `sharedBase`: passing sharedBase
|
|
233
|
+
// meant a git boot swept a directory that can only ever be empty of shards, and
|
|
234
|
+
// the pass was additionally gated on `!gitUsable`. Two independent reasons why
|
|
235
|
+
// one machine accumulated 2,067 orphaned shards while its owner worked mostly
|
|
236
|
+
// inside repositories. A git workspace therefore protects no live shard
|
|
237
|
+
// (`keep: null`), and the TTL — not the current workspace's identity — is what
|
|
238
|
+
// spares a session running in another window.
|
|
239
|
+
const shardBucket = path.join(os.tmpdir(), "opencode-team");
|
|
240
|
+
try {
|
|
241
|
+
pruneStaleStoreShards(shardBucket, gitUsable ? null : storeBase, ttlMs);
|
|
242
|
+
}
|
|
243
|
+
catch {
|
|
244
|
+
/* cleanup only — a failed prune must never cost the session its tools */
|
|
245
|
+
}
|
|
246
|
+
// The pre-shard layout lives at the TMPDIR base and nowhere else: inside a
|
|
247
|
+
// repo, `blackboard/`+`trajectory/` ARE the live store.
|
|
248
|
+
try {
|
|
249
|
+
reclaimLegacyStoreBuckets(shardBucket, ttlMs);
|
|
250
|
+
}
|
|
251
|
+
catch {
|
|
252
|
+
/* same: reclamation is never worth failing a session over */
|
|
253
|
+
}
|
|
254
|
+
}
|
|
72
255
|
// User-level global memory root — OUTSIDE any repo, so "global" scope
|
|
73
256
|
// really follows the user across projects (repo scope stays in .git).
|
|
74
257
|
const globalMemoriesDir = cfg.memoryGlobalDir || path.join(os.homedir(), ".opencode-team", "memories", "global");
|
|
@@ -138,7 +321,7 @@ export async function createTmTools(input, opts = {}) {
|
|
|
138
321
|
// a network channel, it is shared project knowledge.
|
|
139
322
|
const memoryArgs = await buildMemoryArgsSchema();
|
|
140
323
|
tools.tm_memory = buildTmMemoryTool({
|
|
141
|
-
storeBase,
|
|
324
|
+
storeBase: sharedBase,
|
|
142
325
|
globalRoot: globalMemoriesDir,
|
|
143
326
|
directory,
|
|
144
327
|
cfg,
|
|
@@ -213,26 +396,27 @@ export async function createTmTools(input, opts = {}) {
|
|
|
213
396
|
webTools: ptcWebTools,
|
|
214
397
|
});
|
|
215
398
|
tools.tm_ptc_run = ptcTool;
|
|
216
|
-
//
|
|
217
|
-
// the
|
|
218
|
-
//
|
|
219
|
-
//
|
|
220
|
-
//
|
|
399
|
+
// tm_join — the collect side of sub-agent work (see src/tm/dispatch.ts for
|
|
400
|
+
// the whole story). tm_dispatch is NOT registered: a plugin-spawned child is
|
|
401
|
+
// a session the user can neither open from a card nor stop from the UI, so
|
|
402
|
+
// delegation has exactly one route left — the host's own `task` (governed,
|
|
403
|
+
// visible, killable). The dispatcher object stays because tm_join needs its
|
|
404
|
+
// registry: children dispatched before the removal are still adopted,
|
|
405
|
+
// collected and cancelled through it, and it self-gates to the lead agent.
|
|
221
406
|
const dispatch = buildDispatchTools({
|
|
222
407
|
client: input?.client,
|
|
223
408
|
pipelines,
|
|
224
409
|
onChildSession: opts.onChildSession,
|
|
225
|
-
|
|
226
|
-
//
|
|
227
|
-
//
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
//
|
|
232
|
-
|
|
233
|
-
|
|
410
|
+
maxWaitMs: cfg.joinMaxWaitMs,
|
|
411
|
+
// #80: tm_join reports a child that settled while still holding a browser
|
|
412
|
+
// window. One shared instance already owns the lease table, so this is a
|
|
413
|
+
// read of a fact, not a second source of truth.
|
|
414
|
+
browserLeases: () => browserTool.leases(),
|
|
415
|
+
// The goal tripwire prefers the HOST's todo list; when there is none (v2),
|
|
416
|
+
// the plugin's own LEDGER is the list that can actually be checked.
|
|
417
|
+
ledgerStore: opts.ledgerStore,
|
|
418
|
+
sessionReaderReport: opts.sessionReaderReport,
|
|
234
419
|
});
|
|
235
|
-
tools.tm_dispatch = dispatch.tm_dispatch;
|
|
236
420
|
tools.tm_join = dispatch.tm_join;
|
|
237
421
|
// tm_pty — non-blocking command execution on the host's own terminal
|
|
238
422
|
// sessions (issue #6: three serial 120 s test suites are minutes of dead
|
|
@@ -244,6 +428,27 @@ export async function createTmTools(input, opts = {}) {
|
|
|
244
428
|
// with a number behind it instead of a vibe, and what names the surface an
|
|
245
429
|
// OpenCode upgrade removed.
|
|
246
430
|
tools.tm_stats = buildStatsTool({ store, capabilities: opts.capabilities });
|
|
431
|
+
// tm_board_write — the blackboard's write side. The board layout the
|
|
432
|
+
// workspace note publishes is <root>/<session-key>/<task>/NN-<role>-<topic>,
|
|
433
|
+
// and reaching it used to require a file tool: architect and researcher carry
|
|
434
|
+
// none (no write, no edit, not even bash to stamp the session folder), so
|
|
435
|
+
// every oversized deliverable from those roles came back as
|
|
436
|
+
// BLACKBOARD WRITE FAILED + the whole document pasted inline. This writer is
|
|
437
|
+
// scoped to that one path shape under the SAME root the note advertises —
|
|
438
|
+
// sharedBase, which is teamRootFor(directory) in every mode.
|
|
439
|
+
tools.tm_board_write = buildBoardWriteTool({
|
|
440
|
+
pipelines,
|
|
441
|
+
boardRoot: sharedBase,
|
|
442
|
+
cfg: { boardMaxChars: cfg.boardMaxChars, boardMaxFiles: cfg.boardMaxFiles },
|
|
443
|
+
args: await buildBoardArgsSchema(),
|
|
444
|
+
});
|
|
445
|
+
// tm_ledger — registered ONLY when a store was handed in, which today means
|
|
446
|
+
// v2. v1 has the host's own `todowrite` for the LEDGER mandate, and the v1
|
|
447
|
+
// personality is frozen: an extra tool in this record would be a v1 tool-
|
|
448
|
+
// surface change smuggled in through a v2 feature.
|
|
449
|
+
if (opts.ledgerStore) {
|
|
450
|
+
tools.tm_ledger = buildLedgerTool({ store: opts.ledgerStore, onlyAgent: "team", env: opts.env ?? process.env });
|
|
451
|
+
}
|
|
247
452
|
return {
|
|
248
453
|
runId,
|
|
249
454
|
config: cfg,
|
|
@@ -252,6 +457,9 @@ export async function createTmTools(input, opts = {}) {
|
|
|
252
457
|
tools,
|
|
253
458
|
dispose: () => browserTool.dispose(),
|
|
254
459
|
observeDispatchEvent: dispatch.observeEvent,
|
|
460
|
+
registerHostChild: dispatch.register,
|
|
461
|
+
settleHostChild: dispatch.settle,
|
|
462
|
+
hasOpenHostChild: dispatch.hasOpen,
|
|
255
463
|
dispatches: () => dispatch.children().map((c) => ({ sessionID: c.sessionID, agent: c.agent, label: c.label, state: c.state })),
|
|
256
464
|
};
|
|
257
465
|
}
|
package/dist/tm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,kBAAkB,CAAA;AACrG,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE3E,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,4BAA4B,EAC5B,WAAW,EACX,UAAU,GACX,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,aAAa,CAAA;AAEpB,mCAAmC;AACnC,yEAAyE;AACzE,sEAAsE;AACtE,uEAAuE;AACvE,uDAAuD;AACvD,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,cAAc,EACd,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,yBAAyB,EACzB,MAAM,EACN,YAAY,EACZ,WAAW,GACZ,MAAM,gBAAgB,CAAA;AACvB,wEAAwE;AACxE,sEAAsE;AACtE,uEAAuE;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `tm_ledger` — the LEDGER rule's landing spot on a host that has no `todowrite`.
|
|
3
|
+
*
|
|
4
|
+
* The lead's prompt mandates it: every new ask becomes a list item BEFORE the
|
|
5
|
+
* work, an interruption is an insertion rather than a replacement, `blocked` is a
|
|
6
|
+
* state and not an exit, and after a compaction the list is re-read before
|
|
7
|
+
* anything else. On v1 that list is the host's own `todowrite`. On v2 a plugin
|
|
8
|
+
* cannot create that tool (`V2_ONLY_ACTIONS` names `todowrite` as a key with no
|
|
9
|
+
* v2 counterpart), so the mandate had no落点 — and the goal tripwire in `tm_join`
|
|
10
|
+
* had nothing to check, which it now says out loud (`goal_unchecked reason=no_seam`).
|
|
11
|
+
*
|
|
12
|
+
* This module is the other answer. Storage is `ctx.storage` — the host's own
|
|
13
|
+
* key/value domain, proven by a boot self-check that writes a marker and reads it
|
|
14
|
+
* back. That choice beats the alternative (a file under the run store), which is
|
|
15
|
+
* the user's work-in-progress sitting in a temp directory with no owner. Two facts
|
|
16
|
+
* from a live 2.0.16 probe (`docs/research/agent-data-exchange.md`) shape this file:
|
|
17
|
+
* · the domain is shared across sessions, agents AND projects — the only namespace
|
|
18
|
+
* is the plugin id — so the session id is part of the key and nothing may be
|
|
19
|
+
* written without one;
|
|
20
|
+
* · there is no TTL and no quota, so a list that only ever grows is a leak with a
|
|
21
|
+
* friendly name. That is why `LEDGER_MAX_ITEMS` refuses instead of promising a
|
|
22
|
+
* cleanup mechanism this host does not offer.
|
|
23
|
+
*
|
|
24
|
+
* The honesty rule this module exists to obey (product goal #6): a reply about
|
|
25
|
+
* the list says whether the list REACHED storage. An in-memory-only "已记录"
|
|
26
|
+
* would be exactly the unverified "done" the rest of this plugin treats as a bug.
|
|
27
|
+
*/
|
|
28
|
+
import type { ToolDefinition } from "../types.js";
|
|
29
|
+
export declare const LEDGER_STATUSES: readonly ["open", "doing", "done", "blocked"];
|
|
30
|
+
export type LedgerStatus = (typeof LEDGER_STATUSES)[number];
|
|
31
|
+
export interface LedgerItem {
|
|
32
|
+
id: number;
|
|
33
|
+
text: string;
|
|
34
|
+
status: LedgerStatus;
|
|
35
|
+
/** epoch ms of the last change to THIS item */
|
|
36
|
+
at: number;
|
|
37
|
+
/** why it is blocked / how it was closed — the part a later round cannot infer */
|
|
38
|
+
note?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface Ledger {
|
|
41
|
+
sessionID: string;
|
|
42
|
+
items: LedgerItem[];
|
|
43
|
+
updated: number;
|
|
44
|
+
}
|
|
45
|
+
/** The persistence seam. v2 supplies the `ctx.storage` adapter; a test supplies
|
|
46
|
+
* a Map. Nothing here may assume a shape the host did not answer with, so
|
|
47
|
+
* `load` returns null for "nothing stored yet" and throws only for a real
|
|
48
|
+
* failure — which the tool reports as a failure. */
|
|
49
|
+
export interface LedgerStore {
|
|
50
|
+
readonly kind: string;
|
|
51
|
+
available(): boolean;
|
|
52
|
+
load(sessionID: string): Promise<Ledger | null>;
|
|
53
|
+
save(ledger: Ledger): Promise<void>;
|
|
54
|
+
/** the last transport problem, in words — never a value the user stored */
|
|
55
|
+
detail?(): string;
|
|
56
|
+
}
|
|
57
|
+
export declare function createStorageLedgerStore(storage: unknown): LedgerStore;
|
|
58
|
+
/** Defensive read: a value that is not a ledger is treated as absent rather than
|
|
59
|
+
* half-trusted, because a silently-mangled list is worse than an empty one —
|
|
60
|
+
* the lead would wrap up believing the work was accounted for. */
|
|
61
|
+
export declare function normalizeLedger(raw: unknown): Ledger | null;
|
|
62
|
+
/** The dedup key. The LEDGER rule says an interruption INSERTS, and the same ask
|
|
63
|
+
* arriving twice (a re-stated instruction, a screenshot of the same question)
|
|
64
|
+
* must not grow a second line the lead then has to close twice — so the key is
|
|
65
|
+
* the text with case/whitespace/trailing punctuation removed, which is the same
|
|
66
|
+
* "same question" notion tm_memory's dedupKey uses. */
|
|
67
|
+
export declare function ledgerDedupKey(text: string): string;
|
|
68
|
+
export declare function emptyLedger(sessionID: string): Ledger;
|
|
69
|
+
/** `ctx.storage` never expires anything (measured), so the list needs a ceiling or
|
|
70
|
+
* it grows for the life of the install. Refusing is honest; silently truncating
|
|
71
|
+
* would be the overstated claim — the lead would believe its oldest asks were gone
|
|
72
|
+
* when they were only hidden. */
|
|
73
|
+
export declare const LEDGER_MAX_ITEMS_DEFAULT = 200;
|
|
74
|
+
export declare function ledgerMaxItems(env?: Record<string, string | undefined>): number;
|
|
75
|
+
/** A merge is reported, not hidden: the reply says "这条已经在清单上(#2)" so the
|
|
76
|
+
* lead learns the insertion was a repeat instead of wondering why the count did
|
|
77
|
+
* not move. */
|
|
78
|
+
export declare function addItem(ledger: Ledger, text: string, now?: number): {
|
|
79
|
+
ledger: Ledger;
|
|
80
|
+
item: LedgerItem;
|
|
81
|
+
merged: boolean;
|
|
82
|
+
};
|
|
83
|
+
export declare function openItems(ledger: Ledger | null | undefined): LedgerItem[];
|
|
84
|
+
/** Resolve `#4` / `4` / a substring, and refuse an ambiguous match by NAMING the
|
|
85
|
+
* candidates — a list tool that silently marks the wrong line destroys the one
|
|
86
|
+
* thing it is for. */
|
|
87
|
+
export declare function findItem(ledger: Ledger, ref: string | number): {
|
|
88
|
+
item?: LedgerItem;
|
|
89
|
+
candidates: LedgerItem[];
|
|
90
|
+
};
|
|
91
|
+
export declare function markItem(ledger: Ledger, ref: string | number, status: LedgerStatus, note?: string, now?: number): {
|
|
92
|
+
ledger: Ledger;
|
|
93
|
+
item: LedgerItem;
|
|
94
|
+
} | {
|
|
95
|
+
error: string;
|
|
96
|
+
};
|
|
97
|
+
export declare function renderLedger(ledger: Ledger): string;
|
|
98
|
+
/** The line `tm_join` appends when the round settled but the LEDGER did not —
|
|
99
|
+
* the goal tripwire's shape applied to a list the plugin actually owns. */
|
|
100
|
+
export declare function ledgerGoalLine(ledger: Ledger | null | undefined, max?: number): string | null;
|
|
101
|
+
export interface LedgerToolDeps {
|
|
102
|
+
store: LedgerStore;
|
|
103
|
+
/** The LEDGER is the lead's instrument (a specialist reports STATUS and answers
|
|
104
|
+
* to the lead), and on v2 the matrix grants every `tm_*` to every role, so the
|
|
105
|
+
* gate lives here rather than in the frozen permission table. */
|
|
106
|
+
onlyAgent?: string;
|
|
107
|
+
/** Resolved from the personality's own env copy, so v1 and v2 can differ. */
|
|
108
|
+
env?: Record<string, string | undefined>;
|
|
109
|
+
/** Called after a successful write so the host (index.ts) can log the trajectory. */
|
|
110
|
+
onWrite?: (sessionID: string, event: string) => void;
|
|
111
|
+
now?: () => number;
|
|
112
|
+
}
|
|
113
|
+
export declare function buildLedgerTool(deps: LedgerToolDeps): ToolDefinition;
|
|
114
|
+
//# sourceMappingURL=ledger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger.d.ts","sourceRoot":"","sources":["../../src/tm/ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,aAAa,CAAA;AAG7D,eAAO,MAAM,eAAe,+CAAgD,CAAA;AAC5E,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAA;AAE3D,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,YAAY,CAAA;IACpB,+CAA+C;IAC/C,EAAE,EAAE,MAAM,CAAA;IACV,kFAAkF;IAClF,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,MAAM;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,UAAU,EAAE,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;;qDAGqD;AACrD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,SAAS,IAAI,OAAO,CAAA;IACpB,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IAC/C,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACnC,2EAA2E;IAC3E,MAAM,CAAC,IAAI,MAAM,CAAA;CAClB;AAcD,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