Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/0xSero/pi-brain
/ functions
Functions
123 in github.com/0xSero/pi-brain
⨍
Functions
123
◇
Types & classes
37
↓ 13 callers
Function
detectAll
( text: string, categories: ReadonlyArray<RedactionCategory>, customPatterns?: Readonly<Record<string, stri
core/privacy/detectors.ts:97
↓ 11 callers
Function
anonymize
( sessions: ReadonlyArray<SanitizedSession>, config?: AnonymizeConfig, )
core/privacy/anonymizer.ts:44
↓ 11 callers
Function
sanitize
( session: CanonicalSession, config?: PrivacyConfig, )
core/privacy/redactor.ts:50
↓ 10 callers
Function
makeSession
()
tests/core/anonymizer.test.ts:22
↓ 9 callers
Function
createBundle
( sessions: ReadonlyArray<SanitizedSession>, config: Required<ExportConfig>, )
core/data-processing/bundle.ts:29
↓ 9 callers
Function
home
()
plugins/helpers.ts:28
↓ 8 callers
Function
chunk
(text: string, maxTokens = 1000)
core/data-processing/chunker.ts:27
↓ 7 callers
Function
canonicalize
(raw: unknown)
core/data-processing/canonicalize.ts:20
↓ 7 callers
Function
findFiles
(dir: string, match: (name: string) => boolean)
plugins/helpers.ts:62
↓ 7 callers
Function
showCommandResult
(ctx: ExtensionCommandContext, message: string, success: boolean)
plugins/pi/index.ts:849
↓ 6 callers
Function
parseJsonlString
(content: string)
plugins/helpers.ts:95
↓ 5 callers
Method
listSessions
List available session references.
core/index.ts:84
↓ 5 callers
Function
makeSession
(messages: Array<{ role: string; content: string }>)
tests/core/redactor.test.ts:99
↓ 5 callers
Function
sessionIdFromPath
(filePath: string)
plugins/helpers.ts:113
↓ 4 callers
Function
createUiContext
(notifications: Notification[])
tests/plugins/pi-extension.test.ts:26
↓ 4 callers
Function
dirExists
(path: string)
plugins/helpers.ts:33
↓ 4 callers
Function
fileExists
(path: string)
plugins/helpers.ts:42
↓ 4 callers
Function
format
( sessions: ReadonlyArray<SanitizedSession>, formatType: ExportFormat, )
core/data-processing/formatters.ts:27
↓ 4 callers
Method
loadSession
Load a session by reference (file path, session ID, "current", etc.).
core/index.ts:82
↓ 4 callers
Function
maybeFallbackToAllSessions
( ctx: ExtensionCommandContext, message: string, prompt: string, )
plugins/pi/index.ts:674
↓ 4 callers
Function
parseFormats
Parse export format list from user input.
plugins/pi/index.ts:798
↓ 4 callers
Function
queryDb
* Run a sqlite3 query and return parsed JSON rows. * Uses `-json` output mode so each row is a JSON object.
plugins/opencode/index.ts:32
↓ 4 callers
Function
runLocalExport
( args: string, currentSessionFile?: string, scopeOverride?: ExportScope, )
plugins/pi/index.ts:480
↓ 4 callers
Function
runPublicExport
( args: string, currentSessionFile?: string, scopeOverride?: ExportScope, )
plugins/pi/index.ts:532
↓ 4 callers
Function
tokenize
(raw: string)
plugins/pi/index.ts:828
↓ 4 callers
Function
upload
(bundle: ExportBundle, config: UploadConfig)
core/uploads/uploader.ts:34
↓ 3 callers
Function
escapeSql
Escape a string for safe inclusion in a SQL literal.
plugins/opencode/index.ts:228
↓ 3 callers
Function
findExistingDirs
(candidates: string[])
plugins/helpers.ts:54
↓ 3 callers
Function
loadFixtureSession
* Manually parse the Pi fixture since we can't import the plugin in tests * without the full module resolution chain.
tests/integration/pi.test.ts:13
↓ 3 callers
Function
makeSessions
()
tests/core/formatters.test.ts:5
↓ 3 callers
Function
parseScopeFlag
(raw: string)
plugins/pi/index.ts:686
↓ 3 callers
Function
postJson
( url: string, data: unknown, headers?: Record<string, string>, )
core/uploads/http-client.ts:23
↓ 3 callers
Function
queryDb
(dbPath: string, sql: string)
plugins/hermes/index.ts:71
↓ 3 callers
Function
resolveExportScope
( rawArgs: string, ctx: ExtensionCommandContext, )
plugins/pi/index.ts:619
↓ 3 callers
Function
writeBundle
(bundle: ExportBundle, outputDir: string)
core/data-processing/bundle.ts:60
↓ 2 callers
Function
collectSanitizedPiSessions
( config: RuntimeConfig, scope: ExportScope, currentSessionFile?: string, )
plugins/pi/index.ts:591
↓ 2 callers
Function
commit
()
core/uploads/uploader.ts:124
↓ 2 callers
Function
escapeSql
(value: string)
plugins/hermes/index.ts:243
↓ 2 callers
Function
formatExportMessage
( title: string, scope: ExportScope, sessions: ReadonlyArray<{ messages: ReadonlyArray<unknown> }>, sessio
plugins/pi/index.ts:775
↓ 2 callers
Function
fuzzTimestamp
* Fuzz a timestamp by a deterministic but unpredictable offset. * Uses a seed to ensure the same timestamp in the same session * gets the same fuzz
core/privacy/anonymizer.ts:215
↓ 2 callers
Function
getDbPath
Path to the OpenCode SQLite database.
plugins/opencode/index.ts:23
↓ 2 callers
Function
getDbPath
()
plugins/hermes/index.ts:66
↓ 2 callers
Function
nowTimestamp
()
plugins/pi/index.ts:845
↓ 2 callers
Function
printHelp
()
cli.ts:189
↓ 2 callers
Function
replaceAll
(text: string, search: string, replacement: string)
core/privacy/anonymizer.ts:229
↓ 2 callers
Function
resolveConfig
(partial?: PiBrainConfig)
core/configs/defaults.ts:72
↓ 2 callers
Function
resolveRuntimeConfig
()
plugins/pi/index.ts:744
↓ 2 callers
Function
runDetector
Execute a single regex detector and collect all matches.
core/privacy/detectors.ts:127
↓ 2 callers
Function
safeParse
Safely parse a JSON string, returning undefined on failure.
plugins/opencode/index.ts:233
↓ 2 callers
Function
toIsoTimestamp
(value: number | null | undefined)
plugins/hermes/index.ts:237
↓ 1 callers
Function
anonymizePath
* Replace an absolute path with an anonymized version. * Strips home directory, username, and hostname components. * Preserves the last 2 path segme
core/privacy/anonymizer.ts:192
↓ 1 callers
Function
buildStripList
* Build the list of strings to strip from all text fields. * Includes OS username, hostname, home directory, and any custom additions.
core/privacy/anonymizer.ts:149
↓ 1 callers
Function
claudeEntriesToCanonical
(entries: unknown[], filePath: string)
plugins/claude/index.ts:103
↓ 1 callers
Function
codexEntriesToCanonical
(entries: unknown[], filePath: string)
plugins/codex/index.ts:72
↓ 1 callers
Function
convertAssistantMessage
* Convert an assistant message, extracting text from content blocks.
plugins/factory/index.ts:244
↓ 1 callers
Function
convertUserMessage
* Convert a user message, splitting out any tool_result content blocks * into separate CanonicalMessages.
plugins/factory/index.ts:191
↓ 1 callers
Function
createPiApi
()
tests/plugins/pi-extension.test.ts:7
↓ 1 callers
Function
deduplicateAndSort
* Remove overlapping spans (keep the earlier/longer one) and sort by start.
core/privacy/detectors.ts:152
↓ 1 callers
Function
estimateTokens
Estimate token count for a text (whitespace-split heuristic).
core/data-processing/chunker.ts:98
↓ 1 callers
Function
extractTextFromContent
* Extract text from a response_item content array. * Content blocks use {type: "input_text" | "output_text", text: string}.
plugins/codex/index.ts:60
↓ 1 callers
Function
factoryEntriesToCanonical
* Convert Factory JSONL entries into a CanonicalSession. * Walks the entry tree from the leaf to the root to reconstruct * the active conversation b
plugins/factory/index.ts:83
↓ 1 callers
Function
factoryMessageToCanonical
* Convert a single Factory message entry to one or more CanonicalMessages. * * Factory embeds tool results as content blocks inside user messages ra
plugins/factory/index.ts:172
↓ 1 callers
Function
fileNameToFormat
(fileName: string)
cli.ts:300
↓ 1 callers
Function
findSplitPoint
* Find a good split point near `target` that doesn't break placeholders * or words when possible. Prefers paragraph > line > word boundaries.
core/data-processing/chunker.ts:63
↓ 1 callers
Function
formatChatMl
* ChatML format: tagged messages in a single text block per conversation. * Output is JSONL where each line has a "text" field with ChatML markup.
core/data-processing/formatters.ts:82
↓ 1 callers
Function
formatSessions
Sessions format: one full session object per JSONL line.
core/data-processing/formatters.ts:44
↓ 1 callers
Function
formatSftJsonl
* SFT-JSONL format: one conversation per line with a flat messages array. * Compatible with most fine-tuning frameworks (Unsloth, Axolotl, etc.)
core/data-processing/formatters.ts:57
↓ 1 callers
Function
getClaudeProjectsDirs
()
plugins/claude/index.ts:47
↓ 1 callers
Function
getCodexDirs
()
plugins/codex/index.ts:29
↓ 1 callers
Function
getCursorExtractedDirs
()
plugins/cursor/index.ts:26
↓ 1 callers
Function
getOS
()
plugins/helpers.ts:16
↓ 1 callers
Function
getOrCreatePlaceholder
* Get an existing placeholder for a repeated value, or create a new one. * This ensures the same raw value always maps to the same placeholder * wit
core/privacy/redactor.ts:136
↓ 1 callers
Function
hashWithSalt
* Hash a value with a salt to produce a deterministic but unlinkable ID. * Output is 16 hex chars (64 bits) — enough uniqueness, not reversible.
core/privacy/anonymizer.ts:183
↓ 1 callers
Function
isSupportedFormat
(value: string)
plugins/pi/index.ts:824
↓ 1 callers
Function
loadSessionFromDb
(dbPath: string, sessionId: string)
plugins/opencode/index.ts:115
↓ 1 callers
Function
loadSessionFromDb
(dbPath: string, sessionId: string)
plugins/hermes/index.ts:109
↓ 1 callers
Function
main
()
cli.ts:48
↓ 1 callers
Function
main
()
scripts/run-harness.ts:20
↓ 1 callers
Function
normalizeToolContent
(raw: string | null)
plugins/hermes/index.ts:225
↓ 1 callers
Function
parseExportAliasArgs
(raw: string)
plugins/pi/index.ts:700
↓ 1 callers
Function
parseExportArgs
Format and validate command arguments for `/dataset-export`.
plugins/pi/index.ts:225
↓ 1 callers
Function
parsePublicExportArgs
( raw: string, runtimeConfig: RuntimeConfig, )
plugins/pi/index.ts:329
↓ 1 callers
Function
parseToolCalls
(raw: string | null)
plugins/hermes/index.ts:215
↓ 1 callers
Function
parseUploadArgs
(args: string[])
cli.ts:207
↓ 1 callers
Function
piEntriesToCanonical
* Convert Pi JSONL entries into a CanonicalSession. * Walks the entry tree from the leaf to the root to reconstruct * the active conversation branch
plugins/pi/index.ts:865
↓ 1 callers
Function
piMessageToCanonical
Convert a single Pi message to CanonicalMessage.
plugins/pi/index.ts:928
↓ 1 callers
Function
promptForExportMode
(ctx: ExtensionCommandContext)
plugins/pi/index.ts:658
↓ 1 callers
Function
readBundle
(bundleDir: string)
cli.ts:261
↓ 1 callers
Function
registerPiCommands
(pi: ExtensionAPI)
plugins/pi/index.ts:64
↓ 1 callers
Function
replaceSpans
* Replace detected spans in text with stable placeholders. * Builds replacements right-to-left to preserve offsets.
core/privacy/redactor.ts:97
↓ 1 callers
Function
resolveExportAlias
( rawArgs: string, ctx: ExtensionCommandContext, )
plugins/pi/index.ts:640
↓ 1 callers
Function
resolveSessionId
* Resolve a bare session ID (UUID) to its JSONL file path. * First checks the sessions-index.json for a quick lookup, then falls * back to scanning
plugins/factory/index.ts:68
↓ 1 callers
Function
review
( chunks: ReadonlyArray<TextChunk>, config: Required<ReviewerConfig>, )
core/privacy/reviewer.ts:45
↓ 1 callers
Function
reviewSingleChunk
Send a single chunk for review and parse the JSON response.
core/privacy/reviewer.ts:70
↓ 1 callers
Function
runExport
(args: string[])
cli.ts:74
↓ 1 callers
Function
runList
(args: string[])
cli.ts:165
↓ 1 callers
Function
runUpload
(args: string[])
cli.ts:142
↓ 1 callers
Function
uploadMultipart
( url: string, fileName: string, content: string, fields?: Record<string, string>, headers?: Record<strin
core/uploads/http-client.ts:45
↓ 1 callers
Function
uploadToHttp
Upload to a generic HTTP endpoint.
core/uploads/uploader.ts:279
↓ 1 callers
Function
uploadToHuggingFace
Upload to a Hugging Face dataset repository.
core/uploads/uploader.ts:62
next →
1–100 of 123, ranked by callers