@vectorize-io/hindsight-coding-agents 0.8.2 → 0.8.4
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 +13 -3
- package/dist/antigravity-hook.js +95 -42
- package/dist/antigravity-statusline.js +6 -6
- package/dist/antigravity-stop-hook.js +132 -51
- package/dist/claude-hook.js +95 -42
- package/dist/claude-sessionstart-hook.js +385 -100
- package/dist/claude-stop-hook.js +132 -51
- package/dist/cline.js +403 -92
- package/dist/codebuddy-hook.js +95 -42
- package/dist/codebuddy-sessionstart-hook.js +385 -100
- package/dist/codebuddy-stop-hook.js +132 -51
- package/dist/codex-hook.js +95 -42
- package/dist/codex-sessionstart-hook.js +385 -100
- package/dist/codex-stop-hook.js +132 -51
- package/dist/copilot-hook.js +95 -42
- package/dist/copilot-sessionstart-hook.js +385 -100
- package/dist/copilot-stop-hook.js +132 -51
- package/dist/cursor-hook.js +95 -42
- package/dist/cursor-sessionstart-hook.js +385 -100
- package/dist/cursor-stop-hook.js +132 -51
- package/dist/daemon-start.js +10 -10
- package/dist/dcode-hook.js +95 -42
- package/dist/dcode-sessionstart-hook.js +385 -100
- package/dist/dcode-stop-hook.js +132 -51
- package/dist/deepen.js +82 -23
- package/dist/devin-hook.js +95 -42
- package/dist/devin-sessionstart-hook.js +385 -100
- package/dist/devin-stop-hook.js +132 -51
- package/dist/droid-hook.js +95 -42
- package/dist/droid-sessionstart-hook.js +385 -100
- package/dist/droid-stop-hook.js +132 -51
- package/dist/dsh.js +422 -99
- package/dist/grok-hook.js +95 -42
- package/dist/grok-sessionstart-hook.js +385 -100
- package/dist/grok-stop-hook.js +132 -51
- package/dist/hindsight-seed.js +6 -6
- package/dist/index.js +427 -111
- package/dist/installer.js +89 -80
- package/dist/kilo.js +427 -111
- package/dist/kimi-hook.js +95 -42
- package/dist/kimi-sessionstart-hook.js +385 -100
- package/dist/kimi-stop-hook.js +132 -51
- package/dist/mcp-server.js +169 -62
- package/dist/opencode2.js +583 -105
- package/dist/pi.js +403 -99
- package/dist/prime-agent.js +403 -99
- package/dist/qwen-hook.js +95 -42
- package/dist/qwen-sessionstart-hook.js +385 -100
- package/dist/qwen-stop-hook.js +132 -51
- package/dist/status.js +67 -17
- package/dist/survey-supervisor.js +73 -9
- package/dist/traecode-hook.js +95 -42
- package/dist/traecode-sessionstart-hook.js +385 -100
- package/dist/traecode-stop-hook.js +132 -51
- package/dist/workbuddy-hook.js +95 -42
- package/dist/workbuddy-sessionstart-hook.js +385 -100
- package/dist/workbuddy-stop-hook.js +132 -51
- package/dist/zcode-hook.js +95 -42
- package/dist/zcode-sessionstart-hook.js +385 -100
- package/dist/zcode-stop-hook.js +132 -51
- package/index.js +4 -1
- package/package.json +7 -4
- package/plugin.json +1 -1
- package/skill/SKILL.md +10 -2
package/README.md
CHANGED
|
@@ -356,7 +356,9 @@ A Cordis plugin row in `$DSH_HOME/cordis.patch.yml` (`~/.dsh` by default), which
|
|
|
356
356
|
composes — native tools, no MCP needed. Two dsh-specific notes: one dsh process serves **several
|
|
357
357
|
repositories** (its Web UI opens each session in whatever directory you pick), so the bank is
|
|
358
358
|
resolved per session workspace rather than once per process; and dsh has no plugin-facing notice
|
|
359
|
-
channel, so the seed line goes to the plugin log rather than the UI.
|
|
359
|
+
channel, so the seed line goes to the plugin log rather than the UI. A **forked** session saves only
|
|
360
|
+
the turns it adds after the fork — the part it inherited is already in the parent's conversation.
|
|
361
|
+
Everything model-facing —
|
|
360
362
|
recalled memory, the knowledge preamble, the `hindsight_*` tools — is unaffected. If you prefer the
|
|
361
363
|
published-package route, `dsh plugin --profile web add @vectorize-io/hindsight-coding-agents` works
|
|
362
364
|
too: the package ships the profile patch layer, so nothing else needs editing. Either route gets the
|
|
@@ -675,7 +677,7 @@ hook by Codex...), so one shared config serves several agents side by side:
|
|
|
675
677
|
| `pages` | every page | per-page configuration for the seeded knowledge pages, keyed by page name (case-insensitive): `false` skips a page entirely, `{"source_query": "..."}` seeds it with your question instead of the built-in one. Omitted, all five pages are seeded with their built-in queries. This is the supported way to own a page's wording — the plugin re-syncs a page whose live query differs from the one it is configured to have, so a query edited through the API or the control plane is replaced on the next session. A skipped page is **not deleted**: one already seeded keeps its content and stops being re-synced. The scoping clause is appended to your query too, so a reworded page cannot start reporting a dependency's decisions as this project's. File-only, like `recallOptions`; in a `banks.<id>` section it replaces the global map rather than merging into it |
|
|
676
678
|
| `customPages` | — | knowledge pages of your own, seeded alongside the five above and keyed by the name they get: `{"Security posture": {"source_query": "...", "tags": ["knowledge:decision"]}}`. `source_query` is required; `tags` picks which facts feed the page and is optional — omitted, the page draws on everything the bank holds. A separate setting from `pages` on purpose, so that an unknown name there stays a typo warning rather than quietly creating a page. File-only, and replaced (not merged) by a `banks.<id>` section |
|
|
677
679
|
| `autoSeed` | `true` | SessionStart: auto-seed a cold repo's bank from git history |
|
|
678
|
-
| `seedLimit` | `300` |
|
|
680
|
+
| `seedLimit` | `300` | git-log document size: a full write keeps the newest commits, between half of this and this many (the window moves in steps of half), and logs how many older ones it drops |
|
|
679
681
|
| `codebaseSurvey` | `true` | SessionStart: headless survey of a cold repo's structure, run under the current harness's own CLI (claude/codex/antigravity/opencode), falling back to any available agent |
|
|
680
682
|
| `surveyModel` | `haiku` | model for the survey — Claude recipe only (`claude -p --model`); other agents use their configured default |
|
|
681
683
|
| `surveyBudgetUsd` | `2` | survey spend cap — Claude recipe only (`claude -p --max-budget-usd`); other agents rely on their read-only sandbox |
|
|
@@ -1010,6 +1012,12 @@ Coding memory is **per repository**. Resolution order for the working directory:
|
|
|
1010
1012
|
The default `"coding-agent::{gitProject}"` is **harness-neutral**, so opencode, Claude Code, and Codex
|
|
1011
1013
|
all share one memory per repo — use `"{harness}-{gitProject}"` to split per agent instead.
|
|
1012
1014
|
|
|
1015
|
+
The bank is resolved on every turn from where the agent is working. A session that moves into a
|
|
1016
|
+
directory with a different bank (say, `cd` across a `mapPathToBank` prefix) **follows the folder from
|
|
1017
|
+
that turn on**: the new bank gets the turns from the move onward, never the ones already saved
|
|
1018
|
+
elsewhere, and going back appends to the conversation the first bank already holds. Each move is
|
|
1019
|
+
logged as a warning in `plugin.log`.
|
|
1020
|
+
|
|
1013
1021
|
### Recording where a memory came from
|
|
1014
1022
|
|
|
1015
1023
|
With a bank per repo, the bank _is_ the answer to "where did this come from". On a deliberately
|
|
@@ -1195,7 +1203,9 @@ npx @vectorize-io/hindsight-coding-agents stats
|
|
|
1195
1203
|
that: `"synced": true` means the seeded memory is queryable. It also reports gitlog freshness, how
|
|
1196
1204
|
far per-commit deepening has got, the codebase survey's state (`surveyBaseline` is the HEAD the last
|
|
1197
1205
|
survey started from, `surveyDocs` counts the findings documents that have landed, 0–4 — a baseline
|
|
1198
|
-
with no findings retries automatically), and the extraction
|
|
1206
|
+
with no findings retries automatically, at most three times per commit), and the extraction
|
|
1207
|
+
operations still in flight. Each survey agent that could not be found, failed to launch or exited
|
|
1208
|
+
with an error leaves one `[survey]` line in the plugin log.
|
|
1199
1209
|
|
|
1200
1210
|
### Resetting a repo's memory
|
|
1201
1211
|
|
package/dist/antigravity-hook.js
CHANGED
|
@@ -207,14 +207,14 @@ function probeGitLayout(directory) {
|
|
|
207
207
|
var PLACEHOLDER = /\{([a-zA-Z_]+)\}/g;
|
|
208
208
|
function applyTemplate(template, resolvers, what) {
|
|
209
209
|
return template.replace(PLACEHOLDER, (_, name) => {
|
|
210
|
-
const
|
|
211
|
-
if (!
|
|
210
|
+
const resolve4 = resolvers[name];
|
|
211
|
+
if (!resolve4) {
|
|
212
212
|
console.error(
|
|
213
213
|
`hindsight: unknown ${what} placeholder "{${name}}" \u2014 valid: ` + Object.keys(resolvers).sort().map((k) => `{${k}}`).join(", ")
|
|
214
214
|
);
|
|
215
215
|
return "unknown";
|
|
216
216
|
}
|
|
217
|
-
return
|
|
217
|
+
return resolve4();
|
|
218
218
|
});
|
|
219
219
|
}
|
|
220
220
|
|
|
@@ -657,11 +657,11 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
|
|
|
657
657
|
}
|
|
658
658
|
|
|
659
659
|
// package.json
|
|
660
|
-
var version = "0.8.
|
|
660
|
+
var version = "0.8.4";
|
|
661
661
|
|
|
662
662
|
// src/core/util.ts
|
|
663
|
-
import { accessSync, constants } from "fs";
|
|
664
|
-
import { delimiter, join as join6 } from "path";
|
|
663
|
+
import { accessSync, constants, statSync as statSync2 } from "fs";
|
|
664
|
+
import { delimiter, extname, isAbsolute as isAbsolute2, join as join6, resolve as resolve2 } from "path";
|
|
665
665
|
var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
666
666
|
function semverGte(version2, min) {
|
|
667
667
|
const parts = (v) => {
|
|
@@ -939,15 +939,19 @@ var HindsightClient = class {
|
|
|
939
939
|
}
|
|
940
940
|
/**
|
|
941
941
|
* Whether this server honours `operation_id` on an async retain, and can therefore be appended to
|
|
942
|
-
* safely (see MIN_IDEMPOTENT_RETAIN_VERSION). Probed
|
|
942
|
+
* safely (see MIN_IDEMPOTENT_RETAIN_VERSION). Probed via the version endpoint; anything
|
|
943
943
|
* unreachable, unparseable or older answers "no", which costs efficiency, never correctness.
|
|
944
|
+
* Only a "yes" is cached: a long-lived plugin client would otherwise keep replacing for the rest
|
|
945
|
+
* of the process after one probe that hit a restarting server (#5735).
|
|
944
946
|
*/
|
|
945
947
|
async supportsIdempotentRetain() {
|
|
946
|
-
if (this.idempotentRetain
|
|
947
|
-
|
|
948
|
-
|
|
948
|
+
if (this.idempotentRetain) return true;
|
|
949
|
+
const supported = await this.probeIdempotentRetain();
|
|
950
|
+
if (supported || this.idempotentRetain === void 0) {
|
|
951
|
+
this.log(`server retain idempotency: ${supported ? "supported" : "unavailable"}`);
|
|
949
952
|
}
|
|
950
|
-
|
|
953
|
+
this.idempotentRetain = supported;
|
|
954
|
+
return supported;
|
|
951
955
|
}
|
|
952
956
|
/** `/v1/version` first: an ingress that routes only `/v1` to the API (the Helm chart's default)
|
|
953
957
|
* hands a bare `/version` to the control plane, whose HTML 404 or login redirect read as "no",
|
|
@@ -2082,7 +2086,7 @@ function sessionRootDir(harness, sessionId, cwd) {
|
|
|
2082
2086
|
}
|
|
2083
2087
|
|
|
2084
2088
|
// src/core/turn-journal.ts
|
|
2085
|
-
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync3, readFileSync as readFileSync5, statSync as
|
|
2089
|
+
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync3, readFileSync as readFileSync5, statSync as statSync3 } from "fs";
|
|
2086
2090
|
import { tmpdir as tmpdir2 } from "os";
|
|
2087
2091
|
import { dirname as dirname6, join as join9 } from "path";
|
|
2088
2092
|
|
|
@@ -2130,7 +2134,7 @@ function appendJournalTurn(path, turn) {
|
|
|
2130
2134
|
const content = stripInjectedMemory(turn.content ?? "").trim();
|
|
2131
2135
|
if (!content) return;
|
|
2132
2136
|
try {
|
|
2133
|
-
if (
|
|
2137
|
+
if (statSync3(path).size >= JOURNAL_MAX_BYTES) return;
|
|
2134
2138
|
} catch {
|
|
2135
2139
|
}
|
|
2136
2140
|
const last = readJournalTranscript(path).at(-1);
|
|
@@ -2471,7 +2475,7 @@ import { join as join11 } from "path";
|
|
|
2471
2475
|
|
|
2472
2476
|
// src/core/git.ts
|
|
2473
2477
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
2474
|
-
import { resolve as
|
|
2478
|
+
import { resolve as resolve3 } from "path";
|
|
2475
2479
|
var US = "";
|
|
2476
2480
|
var RS = "";
|
|
2477
2481
|
var GITLOG_FORMAT = `--format=%h${US}%ad${US}%an${US}%s${US}%b${RS}`;
|
|
@@ -2482,11 +2486,14 @@ import { execFileSync as execFileSync4 } from "child_process";
|
|
|
2482
2486
|
// src/core/survey.ts
|
|
2483
2487
|
import { execFileSync as execFileSync3, spawn as realSpawn4 } from "child_process";
|
|
2484
2488
|
import { createHash as createHash4 } from "crypto";
|
|
2485
|
-
import { existsSync as existsSync3 } from "fs";
|
|
2489
|
+
import { existsSync as existsSync3, readFileSync as readFileSync7, writeFileSync as writeFileSync3 } from "fs";
|
|
2486
2490
|
import { homedir as homedir4, tmpdir as tmpdir3 } from "os";
|
|
2487
2491
|
import { dirname as dirname8, join as join13 } from "path";
|
|
2488
2492
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
2489
2493
|
|
|
2494
|
+
// node_modules/smol-toml/dist/stringify.js
|
|
2495
|
+
var HAS_WELLFORMED = !!"".isWellFormed;
|
|
2496
|
+
|
|
2490
2497
|
// src/core/survey-lease.ts
|
|
2491
2498
|
import { spawn as realSpawn3 } from "child_process";
|
|
2492
2499
|
import { randomUUID } from "crypto";
|
|
@@ -2497,7 +2504,7 @@ import {
|
|
|
2497
2504
|
renameSync as renameSync3,
|
|
2498
2505
|
rmdirSync,
|
|
2499
2506
|
rmSync as rmSync2,
|
|
2500
|
-
statSync as
|
|
2507
|
+
statSync as statSync4,
|
|
2501
2508
|
unlinkSync,
|
|
2502
2509
|
utimesSync,
|
|
2503
2510
|
writeFileSync as writeFileSync2
|
|
@@ -2509,10 +2516,10 @@ import { spawn as realSpawn5 } from "child_process";
|
|
|
2509
2516
|
import {
|
|
2510
2517
|
existsSync as existsSync4,
|
|
2511
2518
|
mkdirSync as mkdirSync5,
|
|
2512
|
-
readFileSync as
|
|
2519
|
+
readFileSync as readFileSync8,
|
|
2513
2520
|
realpathSync as realpathSync2,
|
|
2514
2521
|
unlinkSync as unlinkSync2,
|
|
2515
|
-
writeFileSync as
|
|
2522
|
+
writeFileSync as writeFileSync4
|
|
2516
2523
|
} from "fs";
|
|
2517
2524
|
import { homedir as homedir5, tmpdir as tmpdir4 } from "os";
|
|
2518
2525
|
import { dirname as dirname9, join as join14 } from "path";
|
|
@@ -2523,7 +2530,7 @@ var NPM_VIEW_HARD_DEADLINE_MS = NPM_VIEW_TIMEOUT_MS + 1e3;
|
|
|
2523
2530
|
var LOCK_STALE_MS = 10 * 60 * 1e3;
|
|
2524
2531
|
|
|
2525
2532
|
// src/core/skill-sync.ts
|
|
2526
|
-
import { cpSync, existsSync as existsSync6, readFileSync as
|
|
2533
|
+
import { cpSync, existsSync as existsSync6, readFileSync as readFileSync9 } from "fs";
|
|
2527
2534
|
import { homedir as homedir6 } from "os";
|
|
2528
2535
|
import { dirname as dirname10, join as join16 } from "path";
|
|
2529
2536
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
@@ -2533,15 +2540,15 @@ import { existsSync as existsSync5 } from "fs";
|
|
|
2533
2540
|
import { join as join15 } from "path";
|
|
2534
2541
|
|
|
2535
2542
|
// src/core/legacy.ts
|
|
2536
|
-
import { existsSync as existsSync7, readFileSync as
|
|
2543
|
+
import { existsSync as existsSync7, readFileSync as readFileSync10 } from "fs";
|
|
2537
2544
|
import { homedir as homedir7 } from "os";
|
|
2538
|
-
import { join as join17, relative, isAbsolute as
|
|
2545
|
+
import { join as join17, relative, isAbsolute as isAbsolute3 } from "path";
|
|
2539
2546
|
|
|
2540
2547
|
// src/core/traecode-mcp.ts
|
|
2541
2548
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
2542
|
-
import { existsSync as existsSync8, mkdirSync as mkdirSync6, readFileSync as
|
|
2549
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync6, readFileSync as readFileSync11, readdirSync as readdirSync2, rmSync as rmSync3, writeFileSync as writeFileSync5 } from "fs";
|
|
2543
2550
|
import { homedir as homedir8 } from "os";
|
|
2544
|
-
import { dirname as dirname11, isAbsolute as
|
|
2551
|
+
import { dirname as dirname11, isAbsolute as isAbsolute4, join as join18 } from "path";
|
|
2545
2552
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
2546
2553
|
var MCP_SERVER_NAME = "hindsight";
|
|
2547
2554
|
var MCP_FILE_REL = join18(".trae", "mcp.json");
|
|
@@ -2576,7 +2583,7 @@ function gateStateFile() {
|
|
|
2576
2583
|
}
|
|
2577
2584
|
function readGateState(opts = {}) {
|
|
2578
2585
|
try {
|
|
2579
|
-
return JSON.parse(
|
|
2586
|
+
return JSON.parse(readFileSync11(opts.stateFile ?? gateStateFile(), "utf8"));
|
|
2580
2587
|
} catch {
|
|
2581
2588
|
return {};
|
|
2582
2589
|
}
|
|
@@ -2584,7 +2591,7 @@ function readGateState(opts = {}) {
|
|
|
2584
2591
|
function workspaceMcpGateState(settingsPath) {
|
|
2585
2592
|
let raw;
|
|
2586
2593
|
try {
|
|
2587
|
-
raw =
|
|
2594
|
+
raw = readFileSync11(settingsPath, "utf8");
|
|
2588
2595
|
} catch {
|
|
2589
2596
|
return "unknown";
|
|
2590
2597
|
}
|
|
@@ -2606,7 +2613,7 @@ function workspaceMcpHint(opts = {}) {
|
|
|
2606
2613
|
if (typeof state.lastHint === "number" && now - state.lastHint < HINT_MIN_INTERVAL_MS) {
|
|
2607
2614
|
return void 0;
|
|
2608
2615
|
}
|
|
2609
|
-
|
|
2616
|
+
writeFileSync5(
|
|
2610
2617
|
opts.stateFile ?? gateStateFile(),
|
|
2611
2618
|
JSON.stringify({ ...state, lastHint: now }, null, 2) + "\n"
|
|
2612
2619
|
);
|
|
@@ -2624,10 +2631,10 @@ function gitignoreCovers(lines) {
|
|
|
2624
2631
|
function ensureGitignored(repo) {
|
|
2625
2632
|
const gitignore = join18(repo, ".gitignore");
|
|
2626
2633
|
if (!existsSync8(gitignore)) return;
|
|
2627
|
-
const current2 =
|
|
2634
|
+
const current2 = readFileSync11(gitignore, "utf8");
|
|
2628
2635
|
if (gitignoreCovers(current2.split("\n"))) return;
|
|
2629
2636
|
const addition = (current2.endsWith("\n") || current2 === "" ? "" : "\n") + "# hindsight MCP registration (machine-specific)\n.trae/mcp.json\n";
|
|
2630
|
-
|
|
2637
|
+
writeFileSync5(gitignore, current2 + addition);
|
|
2631
2638
|
}
|
|
2632
2639
|
function ensureTraecodeWorkspaceMcp(cwd, opts = {}) {
|
|
2633
2640
|
registerTraecodeWorkspaceMcp(cwd, opts);
|
|
@@ -2637,7 +2644,7 @@ function ensureTraecodeWorkspaceMcp(cwd, opts = {}) {
|
|
|
2637
2644
|
function registerTraecodeWorkspaceMcp(cwd, opts = {}) {
|
|
2638
2645
|
try {
|
|
2639
2646
|
const home = opts.home ?? homedir8();
|
|
2640
|
-
if (!cwd || !
|
|
2647
|
+
if (!cwd || !isAbsolute4(cwd) || dirname11(cwd) === cwd || cwd === home) return "skipped";
|
|
2641
2648
|
const dist = opts.dist ?? bundledDistDir();
|
|
2642
2649
|
const script = join18(dist, "mcp-server.js");
|
|
2643
2650
|
if (!existsSync8(script)) return "skipped";
|
|
@@ -2645,7 +2652,7 @@ function registerTraecodeWorkspaceMcp(cwd, opts = {}) {
|
|
|
2645
2652
|
let doc = {};
|
|
2646
2653
|
let exists = false;
|
|
2647
2654
|
try {
|
|
2648
|
-
doc = JSON.parse(
|
|
2655
|
+
doc = JSON.parse(readFileSync11(file, "utf8"));
|
|
2649
2656
|
exists = true;
|
|
2650
2657
|
} catch {
|
|
2651
2658
|
if (existsSync8(file)) return "skipped";
|
|
@@ -2675,7 +2682,7 @@ function registerTraecodeWorkspaceMcp(cwd, opts = {}) {
|
|
|
2675
2682
|
if (existing !== void 0 && canon(merged) === canon(existing)) return "current";
|
|
2676
2683
|
servers[MCP_SERVER_NAME] = merged;
|
|
2677
2684
|
mkdirSync6(dirname11(file), { recursive: true });
|
|
2678
|
-
|
|
2685
|
+
writeFileSync5(file, JSON.stringify(doc, null, 2) + "\n");
|
|
2679
2686
|
if (!exists) ensureGitignored(cwd);
|
|
2680
2687
|
diag("traecode", "workspace_mcp_registered", { cwd, file });
|
|
2681
2688
|
return "registered";
|
|
@@ -2701,7 +2708,7 @@ function findWorkspaceStorageDir(storage, repo) {
|
|
|
2701
2708
|
}
|
|
2702
2709
|
for (const name of entries) {
|
|
2703
2710
|
try {
|
|
2704
|
-
const doc = JSON.parse(
|
|
2711
|
+
const doc = JSON.parse(readFileSync11(join18(storage, name, "workspace.json"), "utf8"));
|
|
2705
2712
|
if (typeof doc.folder !== "string") continue;
|
|
2706
2713
|
let folder;
|
|
2707
2714
|
try {
|
|
@@ -2719,7 +2726,7 @@ function findWorkspaceStorageDir(storage, repo) {
|
|
|
2719
2726
|
function ensureWorkspaceMcpEnabled(cwd, opts = {}) {
|
|
2720
2727
|
try {
|
|
2721
2728
|
const home = opts.home ?? homedir8();
|
|
2722
|
-
if (!cwd || !
|
|
2729
|
+
if (!cwd || !isAbsolute4(cwd) || dirname11(cwd) === cwd || cwd === home) return "failed";
|
|
2723
2730
|
const dir = findWorkspaceStorageDir(traecodeWorkspaceStorageDir(home), cwd);
|
|
2724
2731
|
if (!dir) return "failed";
|
|
2725
2732
|
const db = join18(dir, "state.vscdb");
|
|
@@ -2754,7 +2761,7 @@ function workspaceEnableHint(opts = {}) {
|
|
|
2754
2761
|
if (typeof state.lastEnableHint === "number" && now - state.lastEnableHint < HINT_MIN_INTERVAL_MS) {
|
|
2755
2762
|
return void 0;
|
|
2756
2763
|
}
|
|
2757
|
-
|
|
2764
|
+
writeFileSync5(
|
|
2758
2765
|
opts.stateFile ?? gateStateFile(),
|
|
2759
2766
|
JSON.stringify({ ...state, lastEnableHint: now }, null, 2) + "\n"
|
|
2760
2767
|
);
|
|
@@ -2936,6 +2943,10 @@ function readCursorTranscript(path) {
|
|
|
2936
2943
|
}
|
|
2937
2944
|
|
|
2938
2945
|
// src/core/transcript-antigravity.ts
|
|
2946
|
+
function unwrapUserRequest(text) {
|
|
2947
|
+
const request = /<USER_REQUEST>([\s\S]*?)<\/USER_REQUEST>/.exec(text);
|
|
2948
|
+
return request ? request[1] : text.replace(/<ADDITIONAL_METADATA>[\s\S]*?<\/ADDITIONAL_METADATA>/g, "");
|
|
2949
|
+
}
|
|
2939
2950
|
function readAntigravityTranscript(path) {
|
|
2940
2951
|
if (!path) return [];
|
|
2941
2952
|
const turns = [];
|
|
@@ -2945,7 +2956,8 @@ function readAntigravityTranscript(path) {
|
|
|
2945
2956
|
const role = event.role ?? event.message?.role ?? event.type;
|
|
2946
2957
|
const normalizedRole = role === "user" || role === "USER_INPUT" ? "user" : role === "assistant" || role === "model" || role === "PLANNER_RESPONSE" ? "assistant" : void 0;
|
|
2947
2958
|
const content = event.content ?? event.text ?? event.message?.content ?? event.message?.text;
|
|
2948
|
-
const
|
|
2959
|
+
const text = typeof content === "string" ? stripInjectedMemory(content) : "";
|
|
2960
|
+
const clean = (normalizedRole === "user" ? unwrapUserRequest(text) : text).trim();
|
|
2949
2961
|
if (normalizedRole && clean) {
|
|
2950
2962
|
turns.push({
|
|
2951
2963
|
role: normalizedRole,
|
|
@@ -2976,7 +2988,7 @@ function readCopilotTranscript(path) {
|
|
|
2976
2988
|
}
|
|
2977
2989
|
|
|
2978
2990
|
// src/core/transcript-grok.ts
|
|
2979
|
-
import { existsSync as existsSync9, readFileSync as
|
|
2991
|
+
import { existsSync as existsSync9, readFileSync as readFileSync12, readdirSync as readdirSync3 } from "fs";
|
|
2980
2992
|
import { homedir as homedir9 } from "os";
|
|
2981
2993
|
import { join as join19 } from "path";
|
|
2982
2994
|
var CHAT_HISTORY = "chat_history.jsonl";
|
|
@@ -2987,7 +2999,7 @@ function grokTranscriptPath(cwd, sessionId, grokHome = process.env.GROK_HOME ||
|
|
|
2987
2999
|
try {
|
|
2988
3000
|
for (const candidate of readdirSync3(sessionsDir)) {
|
|
2989
3001
|
const directory = join19(sessionsDir, candidate);
|
|
2990
|
-
if (
|
|
3002
|
+
if (readFileSync12(join19(directory, ".cwd"), "utf8").trim() === cwd) {
|
|
2991
3003
|
return join19(directory, sessionId, CHAT_HISTORY);
|
|
2992
3004
|
}
|
|
2993
3005
|
}
|
|
@@ -3338,7 +3350,7 @@ function readDroidTranscript(path) {
|
|
|
3338
3350
|
}
|
|
3339
3351
|
|
|
3340
3352
|
// src/core/transcript-zcode.ts
|
|
3341
|
-
import { readFileSync as
|
|
3353
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
3342
3354
|
function messageText(content) {
|
|
3343
3355
|
if (typeof content === "string") return content.trim();
|
|
3344
3356
|
if (!Array.isArray(content)) return "";
|
|
@@ -3348,7 +3360,7 @@ function readZcodeTranscript(path) {
|
|
|
3348
3360
|
if (!path) return [];
|
|
3349
3361
|
let body;
|
|
3350
3362
|
try {
|
|
3351
|
-
body =
|
|
3363
|
+
body = readFileSync13(path, "utf8");
|
|
3352
3364
|
} catch {
|
|
3353
3365
|
return [];
|
|
3354
3366
|
}
|
|
@@ -3569,12 +3581,12 @@ function readWorkbuddyTranscript(path) {
|
|
|
3569
3581
|
}
|
|
3570
3582
|
|
|
3571
3583
|
// src/core/transcript-codebuddy-ide.ts
|
|
3572
|
-
import { readFileSync as
|
|
3584
|
+
import { readFileSync as readFileSync14 } from "fs";
|
|
3573
3585
|
import { basename as basename3, dirname as dirname12, join as join22 } from "path";
|
|
3574
3586
|
var IDE_CONTEXT_RE = /<(user_info|git_status|additional_data|system_reminder)\b[\s\S]*?<\/\1>/g;
|
|
3575
3587
|
function readJson(path) {
|
|
3576
3588
|
try {
|
|
3577
|
-
return JSON.parse(
|
|
3589
|
+
return JSON.parse(readFileSync14(path, "utf8"));
|
|
3578
3590
|
} catch {
|
|
3579
3591
|
return void 0;
|
|
3580
3592
|
}
|
|
@@ -3788,7 +3800,9 @@ var HOOK_HARNESSES = {
|
|
|
3788
3800
|
parse: (ev) => ({
|
|
3789
3801
|
sessionId: ev.session_id,
|
|
3790
3802
|
transcriptPath: ev.transcript_path,
|
|
3791
|
-
cwd: ev.cwd
|
|
3803
|
+
cwd: ev.cwd,
|
|
3804
|
+
// The transcript may not hold the final reply yet when Stop fires after a tool call (#5790).
|
|
3805
|
+
lastAssistantMessage: ev.last_assistant_message
|
|
3792
3806
|
})
|
|
3793
3807
|
}
|
|
3794
3808
|
},
|
|
@@ -4271,3 +4285,42 @@ var runHarnessPrompt = (harness) => runHook(HOOK_HARNESSES[harness].prompt);
|
|
|
4271
4285
|
|
|
4272
4286
|
// src/antigravity-hook.ts
|
|
4273
4287
|
void runHarnessPrompt("antigravity-cli");
|
|
4288
|
+
/*! Bundled license information:
|
|
4289
|
+
|
|
4290
|
+
smol-toml/dist/error.js:
|
|
4291
|
+
smol-toml/dist/primitive.js:
|
|
4292
|
+
smol-toml/dist/date.js:
|
|
4293
|
+
smol-toml/dist/extract.js:
|
|
4294
|
+
smol-toml/dist/util.js:
|
|
4295
|
+
smol-toml/dist/struct.js:
|
|
4296
|
+
smol-toml/dist/parse.js:
|
|
4297
|
+
smol-toml/dist/stringify.js:
|
|
4298
|
+
smol-toml/dist/index.js:
|
|
4299
|
+
(*!
|
|
4300
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
4301
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
4302
|
+
*
|
|
4303
|
+
* Redistribution and use in source and binary forms, with or without
|
|
4304
|
+
* modification, are permitted provided that the following conditions are met:
|
|
4305
|
+
*
|
|
4306
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
4307
|
+
* list of conditions and the following disclaimer.
|
|
4308
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
4309
|
+
* this list of conditions and the following disclaimer in the
|
|
4310
|
+
* documentation and/or other materials provided with the distribution.
|
|
4311
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
4312
|
+
* may be used to endorse or promote products derived from this software without
|
|
4313
|
+
* specific prior written permission.
|
|
4314
|
+
*
|
|
4315
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
4316
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
4317
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
4318
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
4319
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
4320
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
4321
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
4322
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
4323
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
4324
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
4325
|
+
*)
|
|
4326
|
+
*/
|
|
@@ -177,14 +177,14 @@ function probeGitLayout(directory) {
|
|
|
177
177
|
var PLACEHOLDER = /\{([a-zA-Z_]+)\}/g;
|
|
178
178
|
function applyTemplate(template, resolvers, what) {
|
|
179
179
|
return template.replace(PLACEHOLDER, (_, name) => {
|
|
180
|
-
const
|
|
181
|
-
if (!
|
|
180
|
+
const resolve3 = resolvers[name];
|
|
181
|
+
if (!resolve3) {
|
|
182
182
|
console.error(
|
|
183
183
|
`hindsight: unknown ${what} placeholder "{${name}}" \u2014 valid: ` + Object.keys(resolvers).sort().map((k) => `{${k}}`).join(", ")
|
|
184
184
|
);
|
|
185
185
|
return "unknown";
|
|
186
186
|
}
|
|
187
|
-
return
|
|
187
|
+
return resolve3();
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
190
|
|
|
@@ -396,11 +396,11 @@ var PLUGIN_GOVERNED_BANK_FIELDS = [
|
|
|
396
396
|
];
|
|
397
397
|
|
|
398
398
|
// package.json
|
|
399
|
-
var version = "0.8.
|
|
399
|
+
var version = "0.8.4";
|
|
400
400
|
|
|
401
401
|
// src/core/util.ts
|
|
402
|
-
import { accessSync, constants } from "fs";
|
|
403
|
-
import { delimiter, join as join6 } from "path";
|
|
402
|
+
import { accessSync, constants, statSync as statSync2 } from "fs";
|
|
403
|
+
import { delimiter, extname, isAbsolute as isAbsolute2, join as join6, resolve as resolve2 } from "path";
|
|
404
404
|
|
|
405
405
|
// src/core/hindsight.ts
|
|
406
406
|
var USER_AGENT = `hindsight-coding-agents/${version}`;
|