mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-24 09:01:28 +01:00
`/sync-gbrain` and `gstack-decision-search --semantic` now find a brain host's artifacts source through `GSTACK_BRAIN_SOURCE_ID`, planning skills read their product and brand digests from current gbrain, and the brain gets each sync's newest artifacts and timeline rows. Why: five outside reports (#4443, #4327, #4265, #4179, #4362), each reproduced on main by a test that fails before this change and passes after it. Nothing to do unless your artifacts source lives outside `~/.gstack-brain-worktree`; then set `GSTACK_BRAIN_SOURCE_ID` to its id. Co-authored-by: Barack-zero-to-one <121355791+Barack-zero-to-one@users.noreply.github.com> Co-authored-by: exGeni <135786749+exGeni@users.noreply.github.com> Co-authored-by: atharva081106 <176514655+atharva081106@users.noreply.github.com> Co-authored-by: extremenelson <2460114+extremenelson@users.noreply.github.com> Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p1/specialist-batched#1 reader=testing Review-Finding: p1v/outside-voice#2 reader=outside-voice
17 lines
831 B
TypeScript
17 lines
831 B
TypeScript
/** Longest artifact page body gstack-memory-ingest writes, in JS characters. */
|
|
export const ARTIFACT_BODY_MAX_CHARS = 200_000;
|
|
|
|
/**
|
|
* An artifact page's body. A file within the cap is kept whole. Past it, a
|
|
* markdown file keeps its start, and an append-only .jsonl log (timeline,
|
|
* learnings, eureka) keeps its newest complete rows, so the page holds the
|
|
* latest events and never ends in a cut row (#4362).
|
|
*/
|
|
export function artifactBody(path: string, raw: string, max = ARTIFACT_BODY_MAX_CHARS): string {
|
|
if (raw.length <= max || !path.endsWith(".jsonl")) return raw.slice(0, max);
|
|
const start = raw.length - max;
|
|
if (raw[start - 1] === "\n") return raw.slice(start);
|
|
const nextRow = raw.indexOf("\n", start);
|
|
return nextRow === -1 || nextRow === raw.length - 1 ? raw.slice(0, max) : raw.slice(nextRow + 1);
|
|
}
|