Hashline editing: content-hash anchors for edit_file stale-patch detection.
Pure-JS xxHash32, line hash computation, validation with HashlineMismatchError,
256-entry hash dictionary. 6 files in apps/coder/src/services/hashline/.
Audit hooks: emitHook('tool.execute.after') wired in frame-emitter.ts for
completed/failed tool results. emitHook('turn.end') wired at terminal points
in dispatcher.ts (all 5 run functions: native, external, opencode, warm ACP,
claude SDK). Fire-and-forget, non-blocking.
11 lines
369 B
TypeScript
11 lines
369 B
TypeScript
export const NIBBLE_STR = "ZPMQVRWSNKTXJBYH"
|
|
|
|
export const HASHLINE_DICT = Array.from({ length: 256 }, (_, i) => {
|
|
const high = i >>> 4
|
|
const low = i & 0x0f
|
|
return `${NIBBLE_STR[high]}${NIBBLE_STR[low]}`
|
|
})
|
|
|
|
export const HASHLINE_REF_PATTERN = /^([0-9]+)#([ZPMQVRWSNKTXJBYH]{2})$/
|
|
export const HASHLINE_OUTPUT_PATTERN = /^([0-9]+)#([ZPMQVRWSNKTXJBYH]{2})\|(.*)$/
|