@code-yeongyu/senpi 2026.8.9-2 → 2026.8.10
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/CHANGELOG.md +16 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +9 -2
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +7 -0
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +2 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +4 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +34 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/omo-native-detect.d.ts +1 -1
- package/dist/core/omo-native-detect.d.ts.map +1 -1
- package/dist/core/omo-native-detect.js +7 -1
- package/dist/core/omo-native-detect.js.map +1 -1
- package/dist/core/omo-native-detect.test.d.ts +2 -0
- package/dist/core/omo-native-detect.test.d.ts.map +1 -0
- package/dist/core/omo-native-detect.test.js +47 -0
- package/dist/core/omo-native-detect.test.js.map +1 -0
- package/dist/core/tools/edit.d.ts +3 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +12 -0
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/filesystem-policy.d.ts +10 -0
- package/dist/core/tools/filesystem-policy.d.ts.map +1 -0
- package/dist/core/tools/filesystem-policy.js +59 -0
- package/dist/core/tools/filesystem-policy.js.map +1 -0
- package/dist/core/tools/find.d.ts +3 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +15 -0
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts +3 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +16 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/ls.d.ts +3 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +11 -0
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/read.d.ts +3 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +13 -0
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/write.d.ts +3 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +12 -0
- package/dist/core/tools/write.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/footer-omo-native-badge.test.d.ts +2 -0
- package/dist/modes/interactive/components/footer-omo-native-badge.test.d.ts.map +1 -0
- package/dist/modes/interactive/components/footer-omo-native-badge.test.js +52 -0
- package/dist/modes/interactive/components/footer-omo-native-badge.test.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +3 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/docs/extensions.md +76 -0
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +12 -0
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
- package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +1 -1
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"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AC","sourcesContent":["import type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport { Container, Text } from \"@earendil-works/pi-tui\";\nimport { mkdir as fsMkdir, writeFile as fsWriteFile } from \"fs/promises\";\nimport { dirname } from \"path\";\nimport { type Static, Type } from \"typebox\";\nimport { keyHint } from \"../../modes/interactive/components/keybinding-hints.ts\";\nimport { getLanguageFromPath, highlightCode, type Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport type { ToolDefinition, ToolRenderResultOptions } from \"../extensions/types.ts\";\nimport { renderToolDiff } from \"./diff-render.ts\";\nimport { withFileMutationQueue } from \"./file-mutation-queue.ts\";\nimport { resolveToCwd } from \"./path-utils.ts\";\nimport { normalizeDisplayText, renderToolPath, replaceTabs, str } from \"./render-utils.ts\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.ts\";\nimport {\n\tcreateWriteDetails,\n\tformatWriteResult,\n\treadLocalWriteBaseline,\n\ttype WriteToolDetails,\n} from \"./write-result.ts\";\n\nconst writeSchema = Type.Object({\n\tpath: Type.String({ description: \"Path to the file to write (relative or absolute)\" }),\n\tcontent: Type.String({ description: \"Content to write to the file\" }),\n});\n\nexport type WriteToolInput = Static<typeof writeSchema>;\n\n/**\n * Pluggable operations for the write tool.\n * Override these to delegate file writing to remote systems (for example SSH).\n */\nexport interface WriteOperations {\n\t/** Write content to a file */\n\twriteFile: (absolutePath: string, content: string) => Promise<void>;\n\t/** Create directory recursively */\n\tmkdir: (dir: string) => Promise<void>;\n}\n\nconst defaultWriteOperations: WriteOperations = {\n\twriteFile: (path, content) => fsWriteFile(path, content, \"utf-8\"),\n\tmkdir: (dir) => fsMkdir(dir, { recursive: true }).then(() => {}),\n};\n\nexport interface WriteToolOptions {\n\t/** Custom operations for file writing. Default: local filesystem */\n\toperations?: WriteOperations;\n}\n\ntype WriteHighlightCache = {\n\trawPath: string | null;\n\tlang: string;\n\trawContent: string;\n\tnormalizedLines: string[];\n\thighlightedLines: string[];\n};\n\nclass WriteCallRenderComponent extends Text {\n\tcache?: WriteHighlightCache;\n\n\tconstructor() {\n\t\tsuper(\"\", 0, 0);\n\t}\n}\n\nconst WRITE_PARTIAL_FULL_HIGHLIGHT_LINES = 50;\n\ntype WriteCallRenderOptions = ToolRenderResultOptions & {\n\targsComplete: boolean;\n};\n\nfunction highlightSingleLine(line: string, lang: string): string {\n\tconst highlighted = highlightCode(line, lang);\n\treturn highlighted[0] ?? \"\";\n}\n\nfunction refreshWriteHighlightPrefix(cache: WriteHighlightCache): void {\n\tconst prefixCount = Math.min(WRITE_PARTIAL_FULL_HIGHLIGHT_LINES, cache.normalizedLines.length);\n\tif (prefixCount === 0) return;\n\tconst prefixSource = cache.normalizedLines.slice(0, prefixCount).join(\"\\n\");\n\tconst prefixHighlighted = highlightCode(prefixSource, cache.lang);\n\tfor (let i = 0; i < prefixCount; i++) {\n\t\tcache.highlightedLines[i] =\n\t\t\tprefixHighlighted[i] ?? highlightSingleLine(cache.normalizedLines[i] ?? \"\", cache.lang);\n\t}\n}\n\nfunction rebuildWriteHighlightCacheFull(rawPath: string | null, fileContent: string): WriteHighlightCache | undefined {\n\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\tif (!lang) return undefined;\n\tconst displayContent = normalizeDisplayText(fileContent);\n\tconst normalized = replaceTabs(displayContent);\n\treturn {\n\t\trawPath,\n\t\tlang,\n\t\trawContent: fileContent,\n\t\tnormalizedLines: normalized.split(\"\\n\"),\n\t\thighlightedLines: highlightCode(normalized, lang),\n\t};\n}\n\nfunction updateWriteHighlightCacheIncremental(\n\tcache: WriteHighlightCache | undefined,\n\trawPath: string | null,\n\tfileContent: string,\n): WriteHighlightCache | undefined {\n\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\tif (!lang) return undefined;\n\tif (!cache) return rebuildWriteHighlightCacheFull(rawPath, fileContent);\n\tif (cache.lang !== lang || cache.rawPath !== rawPath) return rebuildWriteHighlightCacheFull(rawPath, fileContent);\n\tif (!fileContent.startsWith(cache.rawContent)) return rebuildWriteHighlightCacheFull(rawPath, fileContent);\n\tif (fileContent.length === cache.rawContent.length) return cache;\n\n\tconst deltaRaw = fileContent.slice(cache.rawContent.length);\n\tconst deltaDisplay = normalizeDisplayText(deltaRaw);\n\tconst deltaNormalized = replaceTabs(deltaDisplay);\n\tcache.rawContent = fileContent;\n\tif (cache.normalizedLines.length === 0) {\n\t\tcache.normalizedLines.push(\"\");\n\t\tcache.highlightedLines.push(\"\");\n\t}\n\n\tconst segments = deltaNormalized.split(\"\\n\");\n\tconst lastIndex = cache.normalizedLines.length - 1;\n\tcache.normalizedLines[lastIndex] += segments[0];\n\tcache.highlightedLines[lastIndex] = highlightSingleLine(cache.normalizedLines[lastIndex], cache.lang);\n\tfor (let i = 1; i < segments.length; i++) {\n\t\tcache.normalizedLines.push(segments[i]);\n\t\tcache.highlightedLines.push(highlightSingleLine(segments[i], cache.lang));\n\t}\n\trefreshWriteHighlightPrefix(cache);\n\treturn cache;\n}\n\nfunction trimTrailingEmptyLines(lines: string[]): string[] {\n\tlet end = lines.length;\n\twhile (end > 0 && lines[end - 1] === \"\") {\n\t\tend--;\n\t}\n\treturn lines.slice(0, end);\n}\n\nfunction generateAddedContentDiff(content: string, visibleLineCount: number): string {\n\tconst visibleLines = trimTrailingEmptyLines(content.split(\"\\n\"));\n\tconst lineNumWidth = String(Math.max(1, visibleLines.length)).length;\n\tconst output: string[] = [];\n\tfor (let index = 0; index < Math.min(visibleLineCount, visibleLines.length); index++) {\n\t\toutput.push(`+${String(index + 1).padStart(lineNumWidth, \" \")} ${visibleLines[index] ?? \"\"}`);\n\t}\n\tif (visibleLines.length > visibleLineCount) output.push(` ${\"\".padStart(lineNumWidth, \" \")} ...`);\n\treturn output.join(\"\\n\");\n}\n\nfunction formatWriteCall(\n\targs: { path?: string; file_path?: string; content?: string } | undefined,\n\toptions: WriteCallRenderOptions,\n\ttheme: Theme,\n\tcache: WriteHighlightCache | undefined,\n\tcwd: string,\n): string {\n\tconst rawPath = str(args?.file_path ?? args?.path);\n\tconst fileContent = str(args?.content);\n\tconst pathDisplay = renderToolPath(rawPath, theme, cwd);\n\tlet text = `${theme.fg(\"toolTitle\", theme.bold(\"write\"))} ${pathDisplay}`;\n\n\tif (fileContent === null) {\n\t\ttext += `\\n\\n${theme.fg(\"error\", \"[invalid content arg - expected string]\")}`;\n\t} else if (fileContent) {\n\t\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\t\tconst normalizedContent = replaceTabs(normalizeDisplayText(fileContent));\n\t\tconst lines = trimTrailingEmptyLines(normalizedContent.split(\"\\n\"));\n\t\tconst totalLines = lines.length;\n\t\tconst maxLines = options.expanded ? lines.length : 10;\n\t\tconst remaining = lines.length - maxLines;\n\t\tif (options.argsComplete) {\n\t\t\ttext += `\\n\\n${renderToolDiff(generateAddedContentDiff(normalizedContent, maxLines), {\n\t\t\t\tfilePath: rawPath ?? undefined,\n\t\t\t\ttheme,\n\t\t\t})}`;\n\t\t} else {\n\t\t\tconst renderedLines = lang ? (cache?.highlightedLines ?? highlightCode(normalizedContent, lang)) : lines;\n\t\t\ttext += `\\n\\n${renderedLines\n\t\t\t\t.slice(0, maxLines)\n\t\t\t\t.map((line) => (lang ? line : theme.fg(\"toolOutput\", line)))\n\t\t\t\t.join(\"\\n\")}`;\n\t\t}\n\t\tif (remaining > 0) {\n\t\t\ttext += `${theme.fg(\"muted\", `\\n... (${remaining} more lines, ${totalLines} total,`)} ${keyHint(\"app.tools.expand\", \"to expand\")}${theme.fg(\"muted\", \")\")}`;\n\t\t}\n\t}\n\n\treturn text;\n}\n\nexport function createWriteToolDefinition(\n\tcwd: string,\n\toptions?: WriteToolOptions,\n): ToolDefinition<typeof writeSchema, WriteToolDetails | undefined> {\n\tconst ops = options?.operations ?? defaultWriteOperations;\n\tconst readBaseline = options?.operations ? undefined : readLocalWriteBaseline;\n\treturn {\n\t\tname: \"write\",\n\t\tlabel: \"write\",\n\t\tdescription:\n\t\t\t\"Write content to a file. Creates the file if it doesn't exist, overwrites if it does. Automatically creates parent directories.\",\n\t\tpromptSnippet: \"Create or overwrite files\",\n\t\tpromptGuidelines: [\"Use write only for new files or complete rewrites.\"],\n\t\tparameters: writeSchema,\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\t{ path, content }: { path: string; content: string },\n\t\t\tsignal?: AbortSignal,\n\t\t\t_onUpdate?,\n\t\t\t_ctx?,\n\t\t) {\n\t\t\tconst absolutePath = resolveToCwd(path, cwd);\n\t\t\tconst dir = dirname(absolutePath);\n\t\t\treturn withFileMutationQueue(absolutePath, async () => {\n\t\t\t\t// Do not reject from an abort event listener here: that would release the\n\t\t\t\t// mutation queue while an in-flight filesystem operation may still finish.\n\t\t\t\t// Checking signal.aborted after each await observes the same aborts while\n\t\t\t\t// keeping the queue locked until the current operation has settled.\n\t\t\t\tconst throwIfAborted = (): void => {\n\t\t\t\t\tif (signal?.aborted) throw new Error(\"Operation aborted\");\n\t\t\t\t};\n\n\t\t\t\tthrowIfAborted();\n\t\t\t\tconst baseline = readBaseline ? await readBaseline(absolutePath) : ({ kind: \"unavailable\" } as const);\n\t\t\t\tthrowIfAborted();\n\t\t\t\t// Create parent directories if needed.\n\t\t\t\tawait ops.mkdir(dir);\n\t\t\t\tthrowIfAborted();\n\n\t\t\t\t// Write the file contents.\n\t\t\t\tawait ops.writeFile(absolutePath, content);\n\t\t\t\tthrowIfAborted();\n\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: `Successfully wrote ${content.length} bytes to ${path}` }],\n\t\t\t\t\tdetails: createWriteDetails(path, content, baseline),\n\t\t\t\t};\n\t\t\t});\n\t\t},\n\t\trenderCall(args, theme, context) {\n\t\t\tconst renderArgs = args as { path?: string; file_path?: string; content?: string } | undefined;\n\t\t\tconst rawPath = str(renderArgs?.file_path ?? renderArgs?.path);\n\t\t\tconst fileContent = str(renderArgs?.content);\n\t\t\tconst component =\n\t\t\t\t(context.lastComponent as WriteCallRenderComponent | undefined) ?? new WriteCallRenderComponent();\n\t\t\tif (fileContent !== null) {\n\t\t\t\tcomponent.cache = context.argsComplete\n\t\t\t\t\t? rebuildWriteHighlightCacheFull(rawPath, fileContent)\n\t\t\t\t\t: updateWriteHighlightCacheIncremental(component.cache, rawPath, fileContent);\n\t\t\t} else {\n\t\t\t\tcomponent.cache = undefined;\n\t\t\t}\n\t\t\tcomponent.setText(\n\t\t\t\tformatWriteCall(\n\t\t\t\t\trenderArgs,\n\t\t\t\t\t{ argsComplete: context.argsComplete, expanded: context.expanded, isPartial: context.isPartial },\n\t\t\t\t\ttheme,\n\t\t\t\t\tcomponent.cache,\n\t\t\t\t\tcontext.cwd,\n\t\t\t\t),\n\t\t\t);\n\t\t\treturn component;\n\t\t},\n\t\trenderResult(result, _options, theme, context) {\n\t\t\tconst output = formatWriteResult({ ...result, isError: context.isError }, theme);\n\t\t\tif (!output) {\n\t\t\t\tconst component = (context.lastComponent as Container | undefined) ?? new Container();\n\t\t\t\tcomponent.detachAll();\n\t\t\t\treturn component;\n\t\t\t}\n\t\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\t\ttext.setText(output);\n\t\t\treturn text;\n\t\t},\n\t};\n}\n\nexport function createWriteTool(cwd: string, options?: WriteToolOptions): AgentTool<typeof writeSchema> {\n\treturn wrapToolDefinition(createWriteToolDefinition(cwd, options));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"write.js","sourceRoot":"","sources":["../../../src/core/tools/write.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,wDAAwD,CAAC;AACjF,OAAO,E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B;IACtE,OAAO,kBAAkB,CAAC,yBAAyB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;AACpE,CAAC","sourcesContent":["import type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport { Container, Text } from \"@earendil-works/pi-tui\";\nimport { mkdir as fsMkdir, writeFile as fsWriteFile } from \"fs/promises\";\nimport { dirname } from \"path\";\nimport { type Static, Type } from \"typebox\";\nimport { keyHint } from \"../../modes/interactive/components/keybinding-hints.ts\";\nimport { getLanguageFromPath, highlightCode, type Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport type { FilesystemPolicyChecker, ToolDefinition, ToolRenderResultOptions } from \"../extensions/types.ts\";\nimport { renderToolDiff } from \"./diff-render.ts\";\nimport { withFileMutationQueue } from \"./file-mutation-queue.ts\";\nimport { canonicalizeFilesystemPath } from \"./filesystem-policy.ts\";\nimport { resolveToCwd } from \"./path-utils.ts\";\nimport { normalizeDisplayText, renderToolPath, replaceTabs, str } from \"./render-utils.ts\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.ts\";\nimport {\n\tcreateWriteDetails,\n\tformatWriteResult,\n\treadLocalWriteBaseline,\n\ttype WriteToolDetails,\n} from \"./write-result.ts\";\n\nconst writeSchema = Type.Object({\n\tpath: Type.String({ description: \"Path to the file to write (relative or absolute)\" }),\n\tcontent: Type.String({ description: \"Content to write to the file\" }),\n});\n\nexport type WriteToolInput = Static<typeof writeSchema>;\n\n/**\n * Pluggable operations for the write tool.\n * Override these to delegate file writing to remote systems (for example SSH).\n */\nexport interface WriteOperations {\n\t/** Write content to a file */\n\twriteFile: (absolutePath: string, content: string) => Promise<void>;\n\t/** Create directory recursively */\n\tmkdir: (dir: string) => Promise<void>;\n}\n\nconst defaultWriteOperations: WriteOperations = {\n\twriteFile: (path, content) => fsWriteFile(path, content, \"utf-8\"),\n\tmkdir: (dir) => fsMkdir(dir, { recursive: true }).then(() => {}),\n};\n\nexport interface WriteToolOptions {\n\t/** Custom operations for file writing. Default: local filesystem */\n\toperations?: WriteOperations;\n\t/** Extension-registered filesystem policy checker. */\n\tfilesystemPolicy?: FilesystemPolicyChecker;\n}\n\ntype WriteHighlightCache = {\n\trawPath: string | null;\n\tlang: string;\n\trawContent: string;\n\tnormalizedLines: string[];\n\thighlightedLines: string[];\n};\n\nclass WriteCallRenderComponent extends Text {\n\tcache?: WriteHighlightCache;\n\n\tconstructor() {\n\t\tsuper(\"\", 0, 0);\n\t}\n}\n\nconst WRITE_PARTIAL_FULL_HIGHLIGHT_LINES = 50;\n\ntype WriteCallRenderOptions = ToolRenderResultOptions & {\n\targsComplete: boolean;\n};\n\nfunction highlightSingleLine(line: string, lang: string): string {\n\tconst highlighted = highlightCode(line, lang);\n\treturn highlighted[0] ?? \"\";\n}\n\nfunction refreshWriteHighlightPrefix(cache: WriteHighlightCache): void {\n\tconst prefixCount = Math.min(WRITE_PARTIAL_FULL_HIGHLIGHT_LINES, cache.normalizedLines.length);\n\tif (prefixCount === 0) return;\n\tconst prefixSource = cache.normalizedLines.slice(0, prefixCount).join(\"\\n\");\n\tconst prefixHighlighted = highlightCode(prefixSource, cache.lang);\n\tfor (let i = 0; i < prefixCount; i++) {\n\t\tcache.highlightedLines[i] =\n\t\t\tprefixHighlighted[i] ?? highlightSingleLine(cache.normalizedLines[i] ?? \"\", cache.lang);\n\t}\n}\n\nfunction rebuildWriteHighlightCacheFull(rawPath: string | null, fileContent: string): WriteHighlightCache | undefined {\n\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\tif (!lang) return undefined;\n\tconst displayContent = normalizeDisplayText(fileContent);\n\tconst normalized = replaceTabs(displayContent);\n\treturn {\n\t\trawPath,\n\t\tlang,\n\t\trawContent: fileContent,\n\t\tnormalizedLines: normalized.split(\"\\n\"),\n\t\thighlightedLines: highlightCode(normalized, lang),\n\t};\n}\n\nfunction updateWriteHighlightCacheIncremental(\n\tcache: WriteHighlightCache | undefined,\n\trawPath: string | null,\n\tfileContent: string,\n): WriteHighlightCache | undefined {\n\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\tif (!lang) return undefined;\n\tif (!cache) return rebuildWriteHighlightCacheFull(rawPath, fileContent);\n\tif (cache.lang !== lang || cache.rawPath !== rawPath) return rebuildWriteHighlightCacheFull(rawPath, fileContent);\n\tif (!fileContent.startsWith(cache.rawContent)) return rebuildWriteHighlightCacheFull(rawPath, fileContent);\n\tif (fileContent.length === cache.rawContent.length) return cache;\n\n\tconst deltaRaw = fileContent.slice(cache.rawContent.length);\n\tconst deltaDisplay = normalizeDisplayText(deltaRaw);\n\tconst deltaNormalized = replaceTabs(deltaDisplay);\n\tcache.rawContent = fileContent;\n\tif (cache.normalizedLines.length === 0) {\n\t\tcache.normalizedLines.push(\"\");\n\t\tcache.highlightedLines.push(\"\");\n\t}\n\n\tconst segments = deltaNormalized.split(\"\\n\");\n\tconst lastIndex = cache.normalizedLines.length - 1;\n\tcache.normalizedLines[lastIndex] += segments[0];\n\tcache.highlightedLines[lastIndex] = highlightSingleLine(cache.normalizedLines[lastIndex], cache.lang);\n\tfor (let i = 1; i < segments.length; i++) {\n\t\tcache.normalizedLines.push(segments[i]);\n\t\tcache.highlightedLines.push(highlightSingleLine(segments[i], cache.lang));\n\t}\n\trefreshWriteHighlightPrefix(cache);\n\treturn cache;\n}\n\nfunction trimTrailingEmptyLines(lines: string[]): string[] {\n\tlet end = lines.length;\n\twhile (end > 0 && lines[end - 1] === \"\") {\n\t\tend--;\n\t}\n\treturn lines.slice(0, end);\n}\n\nfunction generateAddedContentDiff(content: string, visibleLineCount: number): string {\n\tconst visibleLines = trimTrailingEmptyLines(content.split(\"\\n\"));\n\tconst lineNumWidth = String(Math.max(1, visibleLines.length)).length;\n\tconst output: string[] = [];\n\tfor (let index = 0; index < Math.min(visibleLineCount, visibleLines.length); index++) {\n\t\toutput.push(`+${String(index + 1).padStart(lineNumWidth, \" \")} ${visibleLines[index] ?? \"\"}`);\n\t}\n\tif (visibleLines.length > visibleLineCount) output.push(` ${\"\".padStart(lineNumWidth, \" \")} ...`);\n\treturn output.join(\"\\n\");\n}\n\nfunction formatWriteCall(\n\targs: { path?: string; file_path?: string; content?: string } | undefined,\n\toptions: WriteCallRenderOptions,\n\ttheme: Theme,\n\tcache: WriteHighlightCache | undefined,\n\tcwd: string,\n): string {\n\tconst rawPath = str(args?.file_path ?? args?.path);\n\tconst fileContent = str(args?.content);\n\tconst pathDisplay = renderToolPath(rawPath, theme, cwd);\n\tlet text = `${theme.fg(\"toolTitle\", theme.bold(\"write\"))} ${pathDisplay}`;\n\n\tif (fileContent === null) {\n\t\ttext += `\\n\\n${theme.fg(\"error\", \"[invalid content arg - expected string]\")}`;\n\t} else if (fileContent) {\n\t\tconst lang = rawPath ? getLanguageFromPath(rawPath) : undefined;\n\t\tconst normalizedContent = replaceTabs(normalizeDisplayText(fileContent));\n\t\tconst lines = trimTrailingEmptyLines(normalizedContent.split(\"\\n\"));\n\t\tconst totalLines = lines.length;\n\t\tconst maxLines = options.expanded ? lines.length : 10;\n\t\tconst remaining = lines.length - maxLines;\n\t\tif (options.argsComplete) {\n\t\t\ttext += `\\n\\n${renderToolDiff(generateAddedContentDiff(normalizedContent, maxLines), {\n\t\t\t\tfilePath: rawPath ?? undefined,\n\t\t\t\ttheme,\n\t\t\t})}`;\n\t\t} else {\n\t\t\tconst renderedLines = lang ? (cache?.highlightedLines ?? highlightCode(normalizedContent, lang)) : lines;\n\t\t\ttext += `\\n\\n${renderedLines\n\t\t\t\t.slice(0, maxLines)\n\t\t\t\t.map((line) => (lang ? line : theme.fg(\"toolOutput\", line)))\n\t\t\t\t.join(\"\\n\")}`;\n\t\t}\n\t\tif (remaining > 0) {\n\t\t\ttext += `${theme.fg(\"muted\", `\\n... (${remaining} more lines, ${totalLines} total,`)} ${keyHint(\"app.tools.expand\", \"to expand\")}${theme.fg(\"muted\", \")\")}`;\n\t\t}\n\t}\n\n\treturn text;\n}\n\nexport function createWriteToolDefinition(\n\tcwd: string,\n\toptions?: WriteToolOptions,\n): ToolDefinition<typeof writeSchema, WriteToolDetails | undefined> {\n\tconst ops = options?.operations ?? defaultWriteOperations;\n\tconst readBaseline = options?.operations ? undefined : readLocalWriteBaseline;\n\tconst filesystemPolicy = options?.filesystemPolicy;\n\treturn {\n\t\tname: \"write\",\n\t\tlabel: \"write\",\n\t\tdescription:\n\t\t\t\"Write content to a file. Creates the file if it doesn't exist, overwrites if it does. Automatically creates parent directories.\",\n\t\tpromptSnippet: \"Create or overwrite files\",\n\t\tpromptGuidelines: [\"Use write only for new files or complete rewrites.\"],\n\t\tparameters: writeSchema,\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\t{ path, content }: { path: string; content: string },\n\t\t\tsignal?: AbortSignal,\n\t\t\t_onUpdate?,\n\t\t\t_ctx?,\n\t\t) {\n\t\t\tconst absolutePath = resolveToCwd(path, cwd);\n\t\t\tconst dir = dirname(absolutePath);\n\t\t\treturn withFileMutationQueue(absolutePath, async () => {\n\t\t\t\t// Do not reject from an abort event listener here: that would release the\n\t\t\t\t// mutation queue while an in-flight filesystem operation may still finish.\n\t\t\t\t// Checking signal.aborted after each await observes the same aborts while\n\t\t\t\t// keeping the queue locked until the current operation has settled.\n\t\t\t\tconst throwIfAborted = (): void => {\n\t\t\t\t\tif (signal?.aborted) throw new Error(\"Operation aborted\");\n\t\t\t\t};\n\n\t\t\t\tthrowIfAborted();\n\t\t\t\tif (filesystemPolicy) {\n\t\t\t\t\tconst decision = await filesystemPolicy({\n\t\t\t\t\t\toperation: \"write\",\n\t\t\t\t\t\tcanonicalPath: await canonicalizeFilesystemPath(absolutePath),\n\t\t\t\t\t\ttoolName: \"write\",\n\t\t\t\t\t});\n\t\t\t\t\tif (!decision.allow) throw new Error(decision.reason);\n\t\t\t\t\tthrowIfAborted();\n\t\t\t\t}\n\t\t\t\tconst baseline = readBaseline ? await readBaseline(absolutePath) : ({ kind: \"unavailable\" } as const);\n\t\t\t\tthrowIfAborted();\n\t\t\t\t// Create parent directories if needed.\n\t\t\t\tawait ops.mkdir(dir);\n\t\t\t\tthrowIfAborted();\n\n\t\t\t\t// Write the file contents.\n\t\t\t\tawait ops.writeFile(absolutePath, content);\n\t\t\t\tthrowIfAborted();\n\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: `Successfully wrote ${content.length} bytes to ${path}` }],\n\t\t\t\t\tdetails: createWriteDetails(path, content, baseline),\n\t\t\t\t};\n\t\t\t});\n\t\t},\n\t\trenderCall(args, theme, context) {\n\t\t\tconst renderArgs = args as { path?: string; file_path?: string; content?: string } | undefined;\n\t\t\tconst rawPath = str(renderArgs?.file_path ?? renderArgs?.path);\n\t\t\tconst fileContent = str(renderArgs?.content);\n\t\t\tconst component =\n\t\t\t\t(context.lastComponent as WriteCallRenderComponent | undefined) ?? new WriteCallRenderComponent();\n\t\t\tif (fileContent !== null) {\n\t\t\t\tcomponent.cache = context.argsComplete\n\t\t\t\t\t? rebuildWriteHighlightCacheFull(rawPath, fileContent)\n\t\t\t\t\t: updateWriteHighlightCacheIncremental(component.cache, rawPath, fileContent);\n\t\t\t} else {\n\t\t\t\tcomponent.cache = undefined;\n\t\t\t}\n\t\t\tcomponent.setText(\n\t\t\t\tformatWriteCall(\n\t\t\t\t\trenderArgs,\n\t\t\t\t\t{ argsComplete: context.argsComplete, expanded: context.expanded, isPartial: context.isPartial },\n\t\t\t\t\ttheme,\n\t\t\t\t\tcomponent.cache,\n\t\t\t\t\tcontext.cwd,\n\t\t\t\t),\n\t\t\t);\n\t\t\treturn component;\n\t\t},\n\t\trenderResult(result, _options, theme, context) {\n\t\t\tconst output = formatWriteResult({ ...result, isError: context.isError }, theme);\n\t\t\tif (!output) {\n\t\t\t\tconst component = (context.lastComponent as Container | undefined) ?? new Container();\n\t\t\t\tcomponent.detachAll();\n\t\t\t\treturn component;\n\t\t\t}\n\t\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0);\n\t\t\ttext.setText(output);\n\t\t\treturn text;\n\t\t},\n\t};\n}\n\nexport function createWriteTool(cwd: string, options?: WriteToolOptions): AgentTool<typeof writeSchema> {\n\treturn wrapToolDefinition(createWriteToolDefinition(cwd, options));\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { AgentSession, type AgentSessionConfig, type AgentSessionEvent, type Age
|
|
|
5
5
|
export { type OAuthCredential, readStoredCredential } from "./core/auth-storage.ts";
|
|
6
6
|
export { type BranchPreparation, type BranchSummaryResult, type CollectEntriesResult, type CompactionResult, type CutPointResult, calculateContextTokens, collectEntriesForBranchSummary, compact, DEFAULT_COMPACTION_SETTINGS, estimateTokens, type FileOperations, findCutPoint, findTurnStartIndex, type GenerateBranchSummaryOptions, generateBranchSummary, generateSummary, generateSummaryWithUsage, getLastAssistantUsage, prepareBranchEntries, serializeConversation, shouldCompact, } from "./core/compaction/index.ts";
|
|
7
7
|
export { createEventBus, type EventBus, type EventBusController } from "./core/event-bus.ts";
|
|
8
|
-
export type { AgentEndEvent, AgentSettledEvent, AgentStartEvent, AgentToolResult, AgentToolUpdateCallback, AppKeybinding, AutocompleteProviderFactory, BashToolCallEvent, BeforeAgentStartEvent, BeforeAgentStartEventResult, BeforeProviderHeadersEvent, BeforeProviderRequestEvent, BeforeProviderRequestEventResult, BuildSystemPromptOptions, CompactOptions, ContextEvent, ContextUsage, CustomToolCallEvent, EditToolCallEvent, EntryRenderer, EntryRenderOptions, ExecOptions, ExecResult, Extension, ExtensionActions, ExtensionAPI, ExtensionCommandContext, ExtensionCommandContextActions, ExtensionContext, ExtensionContextActions, ExtensionError, ExtensionEvent, ExtensionFactory, ExtensionFlag, ExtensionHandler, ExtensionRuntime, ExtensionShortcut, ExtensionUIContext, ExtensionUIDialogOptions, ExtensionWidgetOptions, FindToolCallEvent, GrepToolCallEvent, InlineExtension, InputDispositionEvent, InputEvent, InputEventResult, InputSource, KeybindingsManager, LoadExtensionsResult, LsToolCallEvent, MarkdownTransformContext, MarkdownTransformer, McpServerDeclaration, MessageEndEvent, MessageRenderer, MessageRenderOptions, MessageStartEvent, MessageUpdateEvent, ProjectTrustContext, ProjectTrustEvent, ProjectTrustEventDecision, ProjectTrustEventResult, ProjectTrustHandler, ProviderConfig, ProviderModelConfig, ReadToolCallEvent, RegisteredCommand, RegisteredTool, ResolvedCommand, SessionBeforeCompactEvent, SessionBeforeForkEvent, SessionBeforeSwitchEvent, SessionBeforeTreeEvent, SessionCompactEvent, SessionInfoChangedEvent, SessionShutdownEvent, SessionStartEvent, SessionTreeEvent, SlashCommandInfo, SlashCommandSource, SourceInfo, TerminalInputHandler, ToolCallEvent, ToolCallEventResult, ToolDefinition, ToolExecutionEndEvent, ToolExecutionMode, ToolExecutionStartEvent, ToolExecutionUpdateEvent, ToolInfo, ToolRenderResultOptions, ToolResultEvent, TurnEndEvent, TurnStartEvent, UserBashEvent, UserBashEventResult, WidgetPlacement, WorkingIndicatorOptions, WriteToolCallEvent, } from "./core/extensions/index.ts";
|
|
8
|
+
export type { AgentEndEvent, AgentSettledEvent, AgentStartEvent, AgentToolResult, AgentToolUpdateCallback, AppKeybinding, AutocompleteProviderFactory, BashToolCallEvent, BeforeAgentStartEvent, BeforeAgentStartEventResult, BeforeProviderHeadersEvent, BeforeProviderRequestEvent, BeforeProviderRequestEventResult, BuildSystemPromptOptions, CompactOptions, ContextEvent, ContextUsage, CustomToolCallEvent, EditToolCallEvent, EntryRenderer, EntryRenderOptions, ExecOptions, ExecResult, Extension, ExtensionActions, ExtensionAPI, ExtensionCommandContext, ExtensionCommandContextActions, ExtensionContext, ExtensionContextActions, ExtensionError, ExtensionEvent, ExtensionFactory, ExtensionFlag, ExtensionHandler, ExtensionRuntime, ExtensionShortcut, ExtensionUIContext, ExtensionUIDialogOptions, ExtensionWidgetOptions, FilesystemOperation, FilesystemPolicy, FilesystemPolicyChecker, FilesystemPolicyDecision, FilesystemPolicyRequest, FindToolCallEvent, GrepToolCallEvent, InlineExtension, InputDispositionEvent, InputEvent, InputEventResult, InputSource, KeybindingsManager, LoadExtensionsResult, LsToolCallEvent, MarkdownTransformContext, MarkdownTransformer, McpServerDeclaration, MessageEndEvent, MessageRenderer, MessageRenderOptions, MessageStartEvent, MessageUpdateEvent, ProjectTrustContext, ProjectTrustEvent, ProjectTrustEventDecision, ProjectTrustEventResult, ProjectTrustHandler, ProviderConfig, ProviderModelConfig, ReadToolCallEvent, RegisteredCommand, RegisteredTool, ResolvedCommand, SessionBeforeCompactEvent, SessionBeforeForkEvent, SessionBeforeSwitchEvent, SessionBeforeTreeEvent, SessionCompactEvent, SessionInfoChangedEvent, SessionShutdownEvent, SessionStartEvent, SessionTreeEvent, SlashCommandInfo, SlashCommandSource, SourceInfo, TerminalInputHandler, ToolCallEvent, ToolCallEventResult, ToolDefinition, ToolExecutionEndEvent, ToolExecutionMode, ToolExecutionStartEvent, ToolExecutionUpdateEvent, ToolInfo, ToolRenderResultOptions, ToolResultEvent, TurnEndEvent, TurnStartEvent, UserBashEvent, UserBashEventResult, WidgetPlacement, WorkingIndicatorOptions, WriteToolCallEvent, } from "./core/extensions/index.ts";
|
|
9
9
|
export { createExtensionRuntime, defineTool, discoverAndLoadExtensions, ExtensionRunner, isBashToolResult, isEditToolResult, isFindToolResult, isGrepToolResult, isLsToolResult, isReadToolResult, isToolCallEventType, isWriteToolResult, wrapRegisteredTool, wrapRegisteredTools, } from "./core/extensions/index.ts";
|
|
10
10
|
export type { ReadonlyFooterDataProvider } from "./core/footer-data-provider.ts";
|
|
11
11
|
export { convertToLlm } from "./core/messages.ts";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,KAAK,IAAI,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EACN,eAAe,EACf,WAAW,EACX,WAAW,EACX,eAAe,EACf,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gB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE9F,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAa,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,eAAe;AACf,OAAO,EACN,eAAe,EACf,WAAW,EACX,WAAW,EACX,eAAe,EACf,aAAa,EACb,aAAa,EACb,OAAO,GACP,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,YAAY,EAOZ,eAAe,GAEf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAwB,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACpF,aAAa;AACb,OAAO,EAMN,sBAAsB,EACtB,8BAA8B,EAC9B,OAAO,EACP,2BAA2B,EAC3B,cAAc,EAEd,YAAY,EACZ,kBAAkB,EAElB,qBAAqB,EACrB,eAAe,EACf,wBAAwB,EACxB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,GACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAA0C,MAAM,qBAAqB,CAAC;AAuG7F,OAAO,EACN,sBAAsB,EACtB,UAAU,EACV,yBAAyB,EACzB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,GACnB,MAAM,4BAA4B,CAAC;AAGpC,OAA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sanitizeTerminalLabel } from \"@earendil-works/pi-tui\";\nexport { type Args, parseArgs } from \"./cli/args.ts\";\n// Config paths\nexport {\n\tCONFIG_DIR_NAME,\n\tgetAgentDir,\n\tgetDocsPath,\n\tgetExamplesPath,\n\tgetPackageDir,\n\tgetReadmePath,\n\tVERSION,\n} from \"./config.ts\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.ts\";\nexport { type OAuthCredential, readStoredCredential } from \"./core/auth-storage.ts\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactionResult,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgenerateSummaryWithUsage,\n\tgetLastAssistantUsage,\n\tprepareBranchEntries,\n\tserializeConversation,\n\tshouldCompact,\n} from \"./core/compaction/index.ts\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.ts\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentSettledEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppKeybinding,\n\tAutocompleteProviderFactory,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tBeforeAgentStartEventResult,\n\tBeforeProviderHeadersEvent,\n\tBeforeProviderRequestEvent,\n\tBeforeProviderRequestEventResult,\n\tBuildSystemPromptOptions,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tEntryRenderer,\n\tEntryRenderOptions,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInlineExtension,\n\tInputDispositionEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMarkdownTransformContext,\n\tMarkdownTransformer,\n\tMcpServerDeclaration,\n\tMessageEndEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tMessageStartEvent,\n\tMessageUpdateEvent,\n\tProjectTrustContext,\n\tProjectTrustEvent,\n\tProjectTrustEventDecision,\n\tProjectTrustEventResult,\n\tProjectTrustHandler,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tResolvedCommand,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionInfoChangedEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tSourceInfo,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolDefinition,\n\tToolExecutionEndEvent,\n\tToolExecutionMode,\n\tToolExecutionStartEvent,\n\tToolExecutionUpdateEvent,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWorkingIndicatorOptions,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.ts\";\nexport {\n\tcreateExtensionRuntime,\n\tdefineTool,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n} from \"./core/extensions/index.ts\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.ts\";\nexport { convertToLlm } from \"./core/messages.ts\";\nexport { ModelRegistry } from \"./core/model-registry.ts\";\nexport {\n\ttype ModelScopeDiagnostic,\n\ttype ResolveCliModelResult,\n\ttype ResolveModelScopeResult,\n\tresolveCliModel,\n\tresolveModelScopeWithDiagnostics,\n\ttype ScopedModel,\n} from \"./core/model-resolver.ts\";\nexport {\n\ttype CreateModelRuntimeOptions,\n\tModelRuntime,\n\ttype ModelRuntimeAuthOverrides,\n} from \"./core/model-runtime.ts\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.ts\";\nexport { DefaultPackageManager } from \"./core/package-manager.ts\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.ts\";\nexport { DefaultResourceLoader, loadProjectContextFiles } from \"./core/resource-loader.ts\";\n// SDK for programmatic usage\nexport {\n\tAgentSessionRuntime,\n\ttype AgentSessionRuntimeDiagnostic,\n\ttype AgentSessionServices,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\ttype CreateAgentSessionRuntimeFactory,\n\ttype CreateAgentSessionRuntimeResult,\n\ttype CreateAgentSessionServicesOptions,\n\t// Factory\n\tcreateAgentSession,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n} from \"./core/sdk.ts\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildContextEntries,\n\tbuildSessionContext,\n\ttype CompactionEntry,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype SessionTreeNode,\n\tsessionEntryToContextMessages,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.ts\";\nexport {\n\ttype CompactionSettings,\n\ttype DefaultProjectTrust,\n\ttype ImageSettings,\n\ttype PackageSource,\n\ttype RetrySettings,\n\tSettingsManager,\n\ttype SettingsManagerCreateOptions,\n\ttype UiMode,\n} from \"./core/settings-manager.ts\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.ts\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.ts\";\nexport { type EditDiffResult, generateDiffString, generateUnifiedPatch } from \"./core/tools/edit-diff.ts\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateGrepToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLsToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n} from \"./core/tools/index.ts\";\nexport {\n\thasTrustRequiringProjectResources,\n\ttype ProjectTrustDecision,\n\tProjectTrustStore,\n\ttype ProjectTrustStoreEntry,\n\ttype ProjectTrustUpdate,\n} from \"./core/trust-manager.ts\";\n// Main entry point\nexport { type MainOptions, main } from \"./main.ts\";\n// Run modes for programmatic SDK usage\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype ModelInfo,\n\ttype PrintModeOptions,\n\tRpcClient,\n\ttype RpcClientOptions,\n\ttype RpcCommand,\n\ttype RpcEventListener,\n\ttype RpcExtensionUIRequest,\n\ttype RpcExtensionUIResponse,\n\ttype RpcResponse,\n\ttype RpcSessionState,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.ts\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tkeyHint,\n\tkeyText,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tTreeSelectorComponent,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.ts\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.ts\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.ts\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.ts\";\nexport { convertToPng } from \"./utils/image-convert.ts\";\nexport { formatDimensionNote, type ResizedImage, resizeImage } from \"./utils/image-resize.ts\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAa,SAAS,EAAE,MAAM,eAAe,CA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C1B,eAAe,EACf,OAAO,EACP,OAAO,EACP,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EAEtB,UAAU,EACV,UAAU,EACV,wBAAwB,EAGxB,yBAAyB,EACzB,2BAA2B,EAC3B,+BAA+B,EAC/B,sBAAsB,EACtB,yBAAyB,EACzB,sBAAsB,EAEtB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,GAE5B,MAAM,yCAAyC,CAAC;AACjD,kDAAkD;AAClD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,GAEL,MAAM,oCAAoC,CAAC;AAC5C,sBAAsB;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAqB,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC9F,kBAAkB;AAClB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["// Core session management\n\nexport { sanitizeTerminalLabel } from \"@earendil-works/pi-tui\";\nexport { type Args, parseArgs } from \"./cli/args.ts\";\n// Config paths\nexport {\n\tCONFIG_DIR_NAME,\n\tgetAgentDir,\n\tgetDocsPath,\n\tgetExamplesPath,\n\tgetPackageDir,\n\tgetReadmePath,\n\tVERSION,\n} from \"./config.ts\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.ts\";\nexport { type OAuthCredential, readStoredCredential } from \"./core/auth-storage.ts\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactionResult,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgenerateSummaryWithUsage,\n\tgetLastAssistantUsage,\n\tprepareBranchEntries,\n\tserializeConversation,\n\tshouldCompact,\n} from \"./core/compaction/index.ts\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.ts\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentSettledEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppKeybinding,\n\tAutocompleteProviderFactory,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tBeforeAgentStartEventResult,\n\tBeforeProviderHeadersEvent,\n\tBeforeProviderRequestEvent,\n\tBeforeProviderRequestEventResult,\n\tBuildSystemPromptOptions,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tEntryRenderer,\n\tEntryRenderOptions,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tFilesystemOperation,\n\tFilesystemPolicy,\n\tFilesystemPolicyChecker,\n\tFilesystemPolicyDecision,\n\tFilesystemPolicyRequest,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInlineExtension,\n\tInputDispositionEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMarkdownTransformContext,\n\tMarkdownTransformer,\n\tMcpServerDeclaration,\n\tMessageEndEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tMessageStartEvent,\n\tMessageUpdateEvent,\n\tProjectTrustContext,\n\tProjectTrustEvent,\n\tProjectTrustEventDecision,\n\tProjectTrustEventResult,\n\tProjectTrustHandler,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tResolvedCommand,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionInfoChangedEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tSourceInfo,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolDefinition,\n\tToolExecutionEndEvent,\n\tToolExecutionMode,\n\tToolExecutionStartEvent,\n\tToolExecutionUpdateEvent,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWorkingIndicatorOptions,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.ts\";\nexport {\n\tcreateExtensionRuntime,\n\tdefineTool,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n} from \"./core/extensions/index.ts\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.ts\";\nexport { convertToLlm } from \"./core/messages.ts\";\nexport { ModelRegistry } from \"./core/model-registry.ts\";\nexport {\n\ttype ModelScopeDiagnostic,\n\ttype ResolveCliModelResult,\n\ttype ResolveModelScopeResult,\n\tresolveCliModel,\n\tresolveModelScopeWithDiagnostics,\n\ttype ScopedModel,\n} from \"./core/model-resolver.ts\";\nexport {\n\ttype CreateModelRuntimeOptions,\n\tModelRuntime,\n\ttype ModelRuntimeAuthOverrides,\n} from \"./core/model-runtime.ts\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.ts\";\nexport { DefaultPackageManager } from \"./core/package-manager.ts\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.ts\";\nexport { DefaultResourceLoader, loadProjectContextFiles } from \"./core/resource-loader.ts\";\n// SDK for programmatic usage\nexport {\n\tAgentSessionRuntime,\n\ttype AgentSessionRuntimeDiagnostic,\n\ttype AgentSessionServices,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\ttype CreateAgentSessionRuntimeFactory,\n\ttype CreateAgentSessionRuntimeResult,\n\ttype CreateAgentSessionServicesOptions,\n\t// Factory\n\tcreateAgentSession,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n} from \"./core/sdk.ts\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildContextEntries,\n\tbuildSessionContext,\n\ttype CompactionEntry,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype SessionTreeNode,\n\tsessionEntryToContextMessages,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.ts\";\nexport {\n\ttype CompactionSettings,\n\ttype DefaultProjectTrust,\n\ttype ImageSettings,\n\ttype PackageSource,\n\ttype RetrySettings,\n\tSettingsManager,\n\ttype SettingsManagerCreateOptions,\n\ttype UiMode,\n} from \"./core/settings-manager.ts\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.ts\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.ts\";\nexport { type EditDiffResult, generateDiffString, generateUnifiedPatch } from \"./core/tools/edit-diff.ts\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateGrepToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLsToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n} from \"./core/tools/index.ts\";\nexport {\n\thasTrustRequiringProjectResources,\n\ttype ProjectTrustDecision,\n\tProjectTrustStore,\n\ttype ProjectTrustStoreEntry,\n\ttype ProjectTrustUpdate,\n} from \"./core/trust-manager.ts\";\n// Main entry point\nexport { type MainOptions, main } from \"./main.ts\";\n// Run modes for programmatic SDK usage\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype ModelInfo,\n\ttype PrintModeOptions,\n\tRpcClient,\n\ttype RpcClientOptions,\n\ttype RpcCommand,\n\ttype RpcEventListener,\n\ttype RpcExtensionUIRequest,\n\ttype RpcExtensionUIResponse,\n\ttype RpcResponse,\n\ttype RpcSessionState,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.ts\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tkeyHint,\n\tkeyText,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tTreeSelectorComponent,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.ts\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.ts\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.ts\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.ts\";\nexport { convertToPng } from \"./utils/image-convert.ts\";\nexport { formatDimensionNote, type ResizedImage, resizeImage } from \"./utils/image-resize.ts\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.ts\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"footer-omo-native-badge.test.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/footer-omo-native-badge.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { beforeAll, describe, expect, it } from "vitest";
|
|
2
|
+
import { initTheme } from "../theme/theme.js";
|
|
3
|
+
import { FooterComponent } from "./footer.js";
|
|
4
|
+
// The badge is the only visible marker that a session is running the omo native distribution, so it is
|
|
5
|
+
// pinned here at the render() boundary: emoji, wording, and bottom-left anchoring all matter to users.
|
|
6
|
+
const OMO_NATIVE_BADGE = "(😺 OmO Native)";
|
|
7
|
+
function footerData(isOmoNative) {
|
|
8
|
+
return {
|
|
9
|
+
getGitBranch: () => undefined,
|
|
10
|
+
getExtensionStatuses: () => [],
|
|
11
|
+
getAvailableProviderCount: () => 1,
|
|
12
|
+
onBranchChange: () => () => { },
|
|
13
|
+
isOmoNative: () => isOmoNative,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function session() {
|
|
17
|
+
return {
|
|
18
|
+
state: { model: undefined, thinkingLevel: "off" },
|
|
19
|
+
sessionManager: {
|
|
20
|
+
getCwd: () => "/tmp/omo-footer-fixture",
|
|
21
|
+
getSessionName: () => undefined,
|
|
22
|
+
getUsageTotals: () => ({ cacheRead: 0, cacheWrite: 0, cost: 0, latestCacheHitRate: undefined }),
|
|
23
|
+
},
|
|
24
|
+
getContextUsage: () => undefined,
|
|
25
|
+
isFastModeActive: () => false,
|
|
26
|
+
modelRuntime: { isUsingOAuth: () => false },
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function renderFooter(isOmoNative) {
|
|
30
|
+
return new FooterComponent(session(), footerData(isOmoNative)).render(200).join("\n");
|
|
31
|
+
}
|
|
32
|
+
describe("footer omo native badge", () => {
|
|
33
|
+
beforeAll(() => initTheme("dark"));
|
|
34
|
+
describe("#given a session running the omo native distribution", () => {
|
|
35
|
+
it("#when the footer renders #then the cat badge appears", () => {
|
|
36
|
+
expect(renderFooter(true)).toContain(OMO_NATIVE_BADGE);
|
|
37
|
+
});
|
|
38
|
+
it("#when the footer renders #then the badge leads the left anchor row", () => {
|
|
39
|
+
const line = renderFooter(true);
|
|
40
|
+
const badgeAt = line.indexOf(OMO_NATIVE_BADGE);
|
|
41
|
+
const cwdAt = line.indexOf("omo-footer-fixture");
|
|
42
|
+
expect(badgeAt).toBeGreaterThanOrEqual(0);
|
|
43
|
+
expect(badgeAt).toBeLessThan(cwdAt);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
describe("#given a session that is not omo native", () => {
|
|
47
|
+
it("#when the footer renders #then no badge appears", () => {
|
|
48
|
+
expect(renderFooter(false)).not.toContain("OmO Native");
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=footer-omo-native-badge.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"footer-omo-native-badge.test.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/footer-omo-native-badge.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAGzD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,uGAAuG;AACvG,uGAAuG;AACvG,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAE3C,SAAS,UAAU,CAAC,WAAoB;IACvC,OAAO;QACN,YAAY,EAAE,GAAG,EAAE,CAAC,SAAS;QAC7B,oBAAoB,EAAE,GAAG,EAAE,CAAC,EAAE;QAC9B,yBAAyB,EAAE,GAAG,EAAE,CAAC,CAAC;QAClC,cAAc,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAE,CAAC;QAC9B,WAAW,EAAE,GAAG,EAAE,CAAC,WAAW;KACW,CAAC;AAC5C,CAAC;AAED,SAAS,OAAO;IACf,OAAO;QACN,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,KAAK,EAAE;QACjD,cAAc,EAAE;YACf,MAAM,EAAE,GAAG,EAAE,CAAC,yBAAyB;YACvC,cAAc,EAAE,GAAG,EAAE,CAAC,SAAS;YAC/B,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,kBAAkB,EAAE,SAAS,EAAE,CAAC;SAC/F;QACD,eAAe,EAAE,GAAG,EAAE,CAAC,SAAS;QAChC,gBAAgB,EAAE,GAAG,EAAE,CAAC,KAAK;QAC7B,YAAY,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,KA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["import { beforeAll, describe, expect, it } from \"vitest\";\nimport type { AgentSession } from \"../../../core/agent-session.ts\";\nimport type { ReadonlyFooterDataProvider } from \"../../../core/footer-data-provider.ts\";\nimport { initTheme } from \"../theme/theme.ts\";\nimport { FooterComponent } from \"./footer.ts\";\n\n// The badge is the only visible marker that a session is running the omo native distribution, so it is\n// pinned here at the render() boundary: emoji, wording, and bottom-left anchoring all matter to users.\nconst OMO_NATIVE_BADGE = \"(😺 OmO Native)\";\n\nfunction footerData(isOmoNative: boolean): ReadonlyFooterDataProvider {\n\treturn {\n\t\tgetGitBranch: () => undefined,\n\t\tgetExtensionStatuses: () => [],\n\t\tgetAvailableProviderCount: () => 1,\n\t\tonBranchChange: () => () => {},\n\t\tisOmoNative: () => isOmoNative,\n\t} as unknown as ReadonlyFooterDataProvider;\n}\n\nfunction session(): AgentSession {\n\treturn {\n\t\tstate: { model: undefined, thinkingLevel: \"off\" },\n\t\tsessionManager: {\n\t\t\tgetCwd: () => \"/tmp/omo-footer-fixture\",\n\t\t\tgetSessionName: () => undefined,\n\t\t\tgetUsageTotals: () => ({ cacheRead: 0, cacheWrite: 0, cost: 0, latestCacheHitRate: undefined }),\n\t\t},\n\t\tgetContextUsage: () => undefined,\n\t\tisFastModeActive: () => false,\n\t\tmodelRuntime: { isUsingOAuth: () => false },\n\t} as unknown as AgentSession;\n}\n\nfunction renderFooter(isOmoNative: boolean): string {\n\treturn new FooterComponent(session(), footerData(isOmoNative)).render(200).join(\"\\n\");\n}\n\ndescribe(\"footer omo native badge\", () => {\n\tbeforeAll(() => initTheme(\"dark\"));\n\n\tdescribe(\"#given a session running the omo native distribution\", () => {\n\t\tit(\"#when the footer renders #then the cat badge appears\", () => {\n\t\t\texpect(renderFooter(true)).toContain(OMO_NATIVE_BADGE);\n\t\t});\n\n\t\tit(\"#when the footer renders #then the badge leads the left anchor row\", () => {\n\t\t\tconst line = renderFooter(true);\n\t\t\tconst badgeAt = line.indexOf(OMO_NATIVE_BADGE);\n\t\t\tconst cwdAt = line.indexOf(\"omo-footer-fixture\");\n\t\t\texpect(badgeAt).toBeGreaterThanOrEqual(0);\n\t\t\texpect(badgeAt).toBeLessThan(cwdAt);\n\t\t});\n\t});\n\n\tdescribe(\"#given a session that is not omo native\", () => {\n\t\tit(\"#when the footer renders #then no badge appears\", () => {\n\t\t\texpect(renderFooter(false)).not.toContain(\"OmO Native\");\n\t\t});\n\t});\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/footer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAiC,MAAM,wBAAwB,CAAC;AACvF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/footer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAiC,MAAM,wBAAwB,CAAC;AACvF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAoBxF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CASlD;AAQD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAYhF;AAkBD;;;GAGG;AACH,qBAAa,eAAgB,YAAW,SAAS;IAChD,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,UAAU,CAA6B;IAC/C,OAAO,CAAC,kBAAkB,CAAQ;IAElC,YAAY,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,0BAA0B,EAGxE;IAED,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAEtC;IAED,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAE5C;IAED;;;OAGG;IACH,UAAU,IAAI,IAAI,CAEjB;IAED;;;OAGG;IACH,OAAO,IAAI,IAAI,CAEd;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CA0J9B;CACD"}
|
|
@@ -3,6 +3,8 @@ import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
|
3
3
|
import { theme } from "../theme/theme.js";
|
|
4
4
|
import { planFooterLayout } from "./footer-layout.js";
|
|
5
5
|
const FAST_MODE_INDICATOR = "\u26a1 ";
|
|
6
|
+
/** Bottom-left marker identifying a session running the omo native distribution. */
|
|
7
|
+
const OMO_NATIVE_BADGE = "(😺 OmO Native)";
|
|
6
8
|
/**
|
|
7
9
|
* Sanitize text for display in a single-line status.
|
|
8
10
|
* Removes newlines, tabs, carriage returns, and other control characters.
|
|
@@ -127,7 +129,7 @@ export class FooterComponent {
|
|
|
127
129
|
const branch = this.footerData.getGitBranch();
|
|
128
130
|
const sessionName = this.session.sessionManager.getSessionName();
|
|
129
131
|
const omoNativeBadge = this.footerData.isOmoNative()
|
|
130
|
-
? { plain:
|
|
132
|
+
? { plain: OMO_NATIVE_BADGE, colored: theme.fg("success", OMO_NATIVE_BADGE) }
|
|
131
133
|
: undefined;
|
|
132
134
|
const anchor = [{ plain: pwdRaw, colored: theme.fg("accent", pwdRaw) }];
|
|
133
135
|
if (omoNativeBadge)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/footer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAkB,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGvF,OAAO,EAAE,KAAK,EAAE,MAAM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,CAAC,eAAe,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;QACxE,CAAC;QAED,OAAO,KAAK,CAAC;IACd,CAAC;CACD","sourcesContent":["import { isAbsolute, relative, resolve, sep } from \"node:path\";\nimport { type Component, truncateToWidth, visibleWidth } from \"@earendil-works/pi-tui\";\nimport type { AgentSession } from \"../../../core/agent-session.ts\";\nimport type { ReadonlyFooterDataProvider } from \"../../../core/footer-data-provider.ts\";\nimport { theme } from \"../theme/theme.ts\";\nimport { type FooterSegment, planFooterLayout } from \"./footer-layout.ts\";\n\nconst FAST_MODE_INDICATOR = \"\\u26a1 \";\n\n/**\n * Sanitize text for display in a single-line status.\n * Removes newlines, tabs, carriage returns, and other control characters.\n */\nfunction sanitizeStatusText(text: string): string {\n\t// Replace newlines, tabs, carriage returns with space, then collapse multiple spaces\n\treturn text\n\t\t.replace(/[\\r\\n\\t]/g, \" \")\n\t\t.replace(/ +/g, \" \")\n\t\t.trim();\n}\n\n/**\n * Format token counts for footer display using oh-my-pi-style K/M/B abbreviation.\n * Examples: \"999\", \"6.8K\", \"546K\", \"1M\", \"1.5M\", \"2B\".\n */\nexport function formatTokens(count: number): string {\n\tconst n = Math.round(count);\n\tif (n < 1_000) return n.toString();\n\tif (n < 10_000) return `${trim1(n / 1_000)}K`;\n\tif (n < 1_000_000) return `${Math.round(n / 1_000)}K`;\n\tif (n < 10_000_000) return `${trim1(n / 1_000_000)}M`;\n\tif (n < 1_000_000_000) return `${Math.round(n / 1_000_000)}M`;\n\tif (n < 10_000_000_000) return `${trim1(n / 1_000_000_000)}B`;\n\treturn `${Math.round(n / 1_000_000_000)}B`;\n}\n\n/** Format with up to 1 decimal place, dropping trailing `.0`. */\nfunction trim1(n: number): string {\n\tconst s = n.toFixed(1);\n\treturn s.endsWith(\".0\") ? s.slice(0, -2) : s;\n}\n\nexport function formatCwdForFooter(cwd: string, home: string | undefined): string {\n\tif (!home) return cwd;\n\n\tconst resolvedCwd = resolve(cwd);\n\tconst resolvedHome = resolve(home);\n\tconst relativeToHome = relative(resolvedHome, resolvedCwd);\n\tconst isInsideHome =\n\t\trelativeToHome === \"\" ||\n\t\t(relativeToHome !== \"..\" && !relativeToHome.startsWith(`..${sep}`) && !isAbsolute(relativeToHome));\n\n\tif (!isInsideHome) return cwd;\n\treturn relativeToHome === \"\" ? \"~\" : `~${sep}${relativeToHome}`;\n}\n\n/**\n * Color the right side of the footer: (provider) muted, model accent, :thinking dim.\n * The text is the plain (uncolored) right-aligned segment from the layout pass.\n */\nfunction colorRightSide(text: string): string {\n\tif (!text) return \"\";\n\tconst providerMatch = text.match(/^\\(([^)]+)\\) (.*)$/);\n\tconst afterProvider = providerMatch ? providerMatch[2] : text;\n\tconst providerPrefix = providerMatch ? theme.fg(\"muted\", `(${providerMatch[1]}) `) : \"\";\n\tconst fastPrefix = afterProvider.startsWith(FAST_MODE_INDICATOR) ? theme.fg(\"warning\", FAST_MODE_INDICATOR) : \"\";\n\tconst body = fastPrefix ? afterProvider.slice(FAST_MODE_INDICATOR.length) : afterProvider;\n\tconst thinkingMatch = body.match(/^(.+):([^:]+)$/);\n\tif (!thinkingMatch) return providerPrefix + fastPrefix + theme.fg(\"accent\", body);\n\treturn `${providerPrefix}${fastPrefix}${theme.fg(\"accent\", thinkingMatch[1])}${theme.fg(\"dim\", `:${thinkingMatch[2]}`)}`;\n}\n\n/**\n * Footer component that shows pwd, token stats, and context usage.\n * Computes token/context stats from session, gets git branch and extension statuses from provider.\n */\nexport class FooterComponent implements Component {\n\tprivate session: AgentSession;\n\tprivate footerData: ReadonlyFooterDataProvider;\n\tprivate autoCompactEnabled = true;\n\n\tconstructor(session: AgentSession, footerData: ReadonlyFooterDataProvider) {\n\t\tthis.session = session;\n\t\tthis.footerData = footerData;\n\t}\n\n\tsetSession(session: AgentSession): void {\n\t\tthis.session = session;\n\t}\n\n\tsetAutoCompactEnabled(enabled: boolean): void {\n\t\tthis.autoCompactEnabled = enabled;\n\t}\n\n\t/**\n\t * No-op: git branch caching now handled by provider.\n\t * Kept for compatibility with existing call sites in interactive-mode.\n\t */\n\tinvalidate(): void {\n\t\t// No-op: git branch is cached/invalidated by provider\n\t}\n\n\t/**\n\t * Clean up resources.\n\t * Git watcher cleanup now handled by provider.\n\t */\n\tdispose(): void {\n\t\t// Git watcher cleanup handled by provider\n\t}\n\n\trender(width: number): string[] {\n\t\tconst state = this.session.state;\n\n\t\t// O(1) running totals maintained by SessionManager (identical to summing\n\t\t// usage over all entries; totals are not branch-scoped).\n\t\tconst usageTotals = this.session.sessionManager.getUsageTotals();\n\t\tconst totalCacheRead = usageTotals.cacheRead;\n\t\tconst totalCacheWrite = usageTotals.cacheWrite;\n\t\tconst totalCost = usageTotals.cost;\n\t\tconst latestCacheHitRate = usageTotals.latestCacheHitRate;\n\n\t\t// Calculate context usage from session (handles compaction correctly).\n\t\t// After compaction, tokens are unknown until the next LLM response.\n\t\tconst contextUsage = this.session.getContextUsage();\n\t\tconst contextWindow = contextUsage?.contextWindow ?? state.model?.contextWindow ?? 0;\n\t\tconst contextPercentValue = contextUsage?.percent ?? 0;\n\t\tconst contextPercent = contextUsage?.percent !== null ? contextPercentValue.toFixed(1) : \"?\";\n\t\tconst contextTokens =\n\t\t\ttypeof contextUsage?.tokens === \"number\"\n\t\t\t\t? formatTokens(contextUsage.tokens)\n\t\t\t\t: typeof contextUsage?.percent === \"number\"\n\t\t\t\t\t? formatTokens(Math.round((contextWindow * contextUsage.percent) / 100))\n\t\t\t\t\t: \"?\";\n\n\t\t// Segments in priority order: anchors (pwd, branch, context) and the model\n\t\t// label always stay; middle stats elide from the right when space runs out.\n\t\t// The width ladder itself lives in ./footer-layout.ts.\n\t\tconst separator = \" • \";\n\t\tconst sepColored = theme.fg(\"borderMuted\", separator);\n\t\tconst pwdRaw = formatCwdForFooter(\n\t\t\tthis.session.sessionManager.getCwd(),\n\t\t\tprocess.env.HOME || process.env.USERPROFILE,\n\t\t);\n\t\tconst branch = this.footerData.getGitBranch();\n\t\tconst sessionName = this.session.sessionManager.getSessionName();\n\n\t\tconst omoNativeBadge: FooterSegment | undefined = this.footerData.isOmoNative()\n\t\t\t? { plain: \"(🏴☠️ OmO Native)\", colored: theme.fg(\"success\", \"(🏴☠️ OmO Native)\") }\n\t\t\t: undefined;\n\n\t\tconst anchor: [FooterSegment, ...FooterSegment[]] = [{ plain: pwdRaw, colored: theme.fg(\"accent\", pwdRaw) }];\n\t\tif (omoNativeBadge) anchor.unshift(omoNativeBadge);\n\t\tif (branch) anchor.push({ plain: branch, colored: theme.fg(\"warning\", branch) });\n\t\tconst pwdIndex = omoNativeBadge ? 1 : 0;\n\n\t\tconst dim = (plain: string): FooterSegment => ({ plain, colored: theme.fg(\"dim\", plain) });\n\t\tconst middle: FooterSegment[] = [];\n\t\tif (sessionName) middle.push({ plain: sessionName, colored: theme.fg(\"muted\", sessionName) });\n\t\tif ((totalCacheRead > 0 || totalCacheWrite > 0) && latestCacheHitRate !== undefined && latestCacheHitRate >= 10) {\n\t\t\tmiddle.push(dim(`CH${latestCacheHitRate.toFixed(1)}%`));\n\t\t}\n\n\t\t// Kimi Coding is subscription-backed despite using API-key authentication.\n\t\tconst usingSubscription = state.model\n\t\t\t? state.model.provider === \"kimi-coding\" || this.session.modelRuntime.isUsingOAuth(state.model.provider)\n\t\t\t: false;\n\t\tif (totalCost || usingSubscription) {\n\t\t\tconst costStr = `$${totalCost.toFixed(3)}${usingSubscription ? \" (sub)\" : \"\"}`;\n\t\t\tmiddle.push({ plain: costStr, colored: theme.fg(\"success\", costStr) });\n\t\t}\n\n\t\tconst autoIndicator = this.autoCompactEnabled ? \" (auto)\" : \"\";\n\t\tconst ctxDisplay =\n\t\t\tcontextPercent === \"?\"\n\t\t\t\t? `${contextTokens}/${formatTokens(contextWindow)} (?)${autoIndicator}`\n\t\t\t\t: `${contextTokens}/${formatTokens(contextWindow)} (${contextPercent}%)${autoIndicator}`;\n\t\tconst ctxColored =\n\t\t\tcontextPercentValue > 90\n\t\t\t\t? theme.fg(\"error\", ctxDisplay)\n\t\t\t\t: contextPercentValue > 70\n\t\t\t\t\t? theme.fg(\"warning\", ctxDisplay)\n\t\t\t\t\t: theme.fg(\"muted\", ctxDisplay);\n\t\tconst tail: FooterSegment = { plain: ctxDisplay, colored: ctxColored };\n\n\t\t// Model label pinned to the right edge; the provider prefix stays only when\n\t\t// the full line fits.\n\t\tconst modelName = state.model?.id || \"no-model\";\n\t\tconst fastIndicator = this.session.isFastModeActive() ? FAST_MODE_INDICATOR : \"\";\n\t\tlet minimalRight = `${fastIndicator}${modelName}`;\n\t\tif (state.model?.reasoning) {\n\t\t\tconst thinkingLevel = state.thinkingLevel || \"off\";\n\t\t\tminimalRight = thinkingLevel === \"off\" ? `${minimalRight}:off` : `${minimalRight}:${thinkingLevel}`;\n\t\t}\n\t\tconst minimal: FooterSegment = { plain: minimalRight, colored: colorRightSide(minimalRight) };\n\t\tconst providerPrefix =\n\t\t\tthis.footerData.getAvailableProviderCount() > 1 && state.model ? `(${state.model.provider}) ` : \"\";\n\t\tconst full: FooterSegment | undefined = providerPrefix\n\t\t\t? { plain: `${providerPrefix}${minimalRight}`, colored: colorRightSide(`${providerPrefix}${minimalRight}`) }\n\t\t\t: undefined;\n\n\t\tconst marker: FooterSegment = { plain: \"…\", colored: theme.fg(\"dim\", \"…\") };\n\t\tconst plan = planFooterLayout({\n\t\t\twidth,\n\t\t\tanchor,\n\t\t\tpwdIndex,\n\t\t\tmiddle,\n\t\t\ttail,\n\t\t\tright: { minimal, full },\n\t\t\tseparator,\n\t\t\tminPadding: 2,\n\t\t\tellipsisMarker: marker,\n\t\t});\n\n\t\tconst joinSegments = (segments: readonly FooterSegment[]): { colored: string; width: number } => ({\n\t\t\tcolored: segments.map((segment) => segment.colored).join(sepColored),\n\t\t\twidth: visibleWidth(segments.map((segment) => segment.plain).join(separator)),\n\t\t});\n\n\t\tlet left: { colored: string; width: number };\n\t\tlet right: FooterSegment;\n\t\tif (plan.kind === \"full\") {\n\t\t\tright = plan.useFullRight && full ? full : minimal;\n\t\t\tleft = joinSegments([...anchor, ...middle, tail]);\n\t\t} else if (plan.kind === \"middle-elided\") {\n\t\t\tright = plan.useFullRight && full ? full : minimal;\n\t\t\tconst segments = [...anchor, ...middle.slice(0, plan.keptMiddleCount)];\n\t\t\tif (plan.showMarker) segments.push(marker);\n\t\t\tsegments.push(tail);\n\t\t\tleft = joinSegments(segments);\n\t\t} else if (plan.kind === \"pwd-elided\") {\n\t\t\tright = plan.useFullRight && full ? full : minimal;\n\t\t\tconst segments: FooterSegment[] = [\n\t\t\t\t...anchor.map((segment, index) =>\n\t\t\t\t\tindex === pwdIndex ? { plain: plan.pwdPlain, colored: theme.fg(\"accent\", plan.pwdPlain) } : segment,\n\t\t\t\t),\n\t\t\t\t...middle.slice(0, plan.keptMiddleCount),\n\t\t\t];\n\t\t\tif (plan.showMarker) segments.push(marker);\n\t\t\tsegments.push(tail);\n\t\t\tleft = joinSegments(segments);\n\t\t} else if (plan.kind === \"left-elided\") {\n\t\t\tright = minimal;\n\t\t\tleft = { colored: theme.fg(\"muted\", plan.leftPlain), width: visibleWidth(plan.leftPlain) };\n\t\t} else {\n\t\t\tleft = { colored: \"\", width: 0 };\n\t\t\tright = { plain: plan.rightPlain, colored: colorRightSide(plan.rightPlain) };\n\t\t}\n\n\t\tconst rightWidth = visibleWidth(right.plain);\n\t\tconst padding = \" \".repeat(Math.max(0, width - left.width - rightWidth));\n\t\tconst lines = [left.colored + padding + right.colored];\n\n\t\t// Add extension statuses on a single line, sorted by key alphabetically\n\t\tconst extensionStatuses = this.footerData.getExtensionStatuses();\n\t\tif (extensionStatuses.size > 0) {\n\t\t\tconst sortedStatuses = Array.from(extensionStatuses.entries())\n\t\t\t\t.sort(([a], [b]) => a.localeCompare(b))\n\t\t\t\t.map(([, text]) => sanitizeStatusText(text));\n\t\t\tconst statusLine = sortedStatuses.join(\" \");\n\t\t\t// Truncate to terminal width with dim ellipsis for consistency with footer style\n\t\t\tlines.push(truncateToWidth(statusLine, width, theme.fg(\"dim\", \"...\")));\n\t\t}\n\n\t\treturn lines;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"footer.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/footer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAkB,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGvF,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAsB,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE1E,MAAM,mBAAmB,GAAG,SAAS,CAAC;AACtC,oFAAoF;AACpF,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAE3C;;;GAGG;AACH,SAAS,kBAAkB,CAAC,IAAY;IACvC,qFAAqF;IACrF,OAAO,IAAI;SACT,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC;SACzB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,IAAI,EAAE,CAAC;AACV,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACzC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC5B,IAAI,CAAC,GAAG,KAAK;QAAE,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;IACnC,IAAI,CAAC,GAAG,MAAM;QAAE,OAAO,GAAG,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC;IAC9C,IAAI,CAAC,GAAG,SAAS;QAAE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC;IACtD,IAAI,CAAC,GAAG,UAAU;QAAE,OAAO,GAAG,KAAK,CAAC,CAAC,GAAG,SAAS,CAAC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I,GAAG,CAAC,EAAE,CAAC;YAChC,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC;iBAC5D,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;iBACtC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;YAC9C,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC5C,iFAAiF;YACjF,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;QACxE,CAAC;QAED,OAAO,KAAK,CAAC;IACd,CAAC;CACD","sourcesContent":["import { isAbsolute, relative, resolve, sep } from \"node:path\";\nimport { type Component, truncateToWidth, visibleWidth } from \"@earendil-works/pi-tui\";\nimport type { AgentSession } from \"../../../core/agent-session.ts\";\nimport type { ReadonlyFooterDataProvider } from \"../../../core/footer-data-provider.ts\";\nimport { theme } from \"../theme/theme.ts\";\nimport { type FooterSegment, planFooterLayout } from \"./footer-layout.ts\";\n\nconst FAST_MODE_INDICATOR = \"\\u26a1 \";\n/** Bottom-left marker identifying a session running the omo native distribution. */\nconst OMO_NATIVE_BADGE = \"(😺 OmO Native)\";\n\n/**\n * Sanitize text for display in a single-line status.\n * Removes newlines, tabs, carriage returns, and other control characters.\n */\nfunction sanitizeStatusText(text: string): string {\n\t// Replace newlines, tabs, carriage returns with space, then collapse multiple spaces\n\treturn text\n\t\t.replace(/[\\r\\n\\t]/g, \" \")\n\t\t.replace(/ +/g, \" \")\n\t\t.trim();\n}\n\n/**\n * Format token counts for footer display using oh-my-pi-style K/M/B abbreviation.\n * Examples: \"999\", \"6.8K\", \"546K\", \"1M\", \"1.5M\", \"2B\".\n */\nexport function formatTokens(count: number): string {\n\tconst n = Math.round(count);\n\tif (n < 1_000) return n.toString();\n\tif (n < 10_000) return `${trim1(n / 1_000)}K`;\n\tif (n < 1_000_000) return `${Math.round(n / 1_000)}K`;\n\tif (n < 10_000_000) return `${trim1(n / 1_000_000)}M`;\n\tif (n < 1_000_000_000) return `${Math.round(n / 1_000_000)}M`;\n\tif (n < 10_000_000_000) return `${trim1(n / 1_000_000_000)}B`;\n\treturn `${Math.round(n / 1_000_000_000)}B`;\n}\n\n/** Format with up to 1 decimal place, dropping trailing `.0`. */\nfunction trim1(n: number): string {\n\tconst s = n.toFixed(1);\n\treturn s.endsWith(\".0\") ? s.slice(0, -2) : s;\n}\n\nexport function formatCwdForFooter(cwd: string, home: string | undefined): string {\n\tif (!home) return cwd;\n\n\tconst resolvedCwd = resolve(cwd);\n\tconst resolvedHome = resolve(home);\n\tconst relativeToHome = relative(resolvedHome, resolvedCwd);\n\tconst isInsideHome =\n\t\trelativeToHome === \"\" ||\n\t\t(relativeToHome !== \"..\" && !relativeToHome.startsWith(`..${sep}`) && !isAbsolute(relativeToHome));\n\n\tif (!isInsideHome) return cwd;\n\treturn relativeToHome === \"\" ? \"~\" : `~${sep}${relativeToHome}`;\n}\n\n/**\n * Color the right side of the footer: (provider) muted, model accent, :thinking dim.\n * The text is the plain (uncolored) right-aligned segment from the layout pass.\n */\nfunction colorRightSide(text: string): string {\n\tif (!text) return \"\";\n\tconst providerMatch = text.match(/^\\(([^)]+)\\) (.*)$/);\n\tconst afterProvider = providerMatch ? providerMatch[2] : text;\n\tconst providerPrefix = providerMatch ? theme.fg(\"muted\", `(${providerMatch[1]}) `) : \"\";\n\tconst fastPrefix = afterProvider.startsWith(FAST_MODE_INDICATOR) ? theme.fg(\"warning\", FAST_MODE_INDICATOR) : \"\";\n\tconst body = fastPrefix ? afterProvider.slice(FAST_MODE_INDICATOR.length) : afterProvider;\n\tconst thinkingMatch = body.match(/^(.+):([^:]+)$/);\n\tif (!thinkingMatch) return providerPrefix + fastPrefix + theme.fg(\"accent\", body);\n\treturn `${providerPrefix}${fastPrefix}${theme.fg(\"accent\", thinkingMatch[1])}${theme.fg(\"dim\", `:${thinkingMatch[2]}`)}`;\n}\n\n/**\n * Footer component that shows pwd, token stats, and context usage.\n * Computes token/context stats from session, gets git branch and extension statuses from provider.\n */\nexport class FooterComponent implements Component {\n\tprivate session: AgentSession;\n\tprivate footerData: ReadonlyFooterDataProvider;\n\tprivate autoCompactEnabled = true;\n\n\tconstructor(session: AgentSession, footerData: ReadonlyFooterDataProvider) {\n\t\tthis.session = session;\n\t\tthis.footerData = footerData;\n\t}\n\n\tsetSession(session: AgentSession): void {\n\t\tthis.session = session;\n\t}\n\n\tsetAutoCompactEnabled(enabled: boolean): void {\n\t\tthis.autoCompactEnabled = enabled;\n\t}\n\n\t/**\n\t * No-op: git branch caching now handled by provider.\n\t * Kept for compatibility with existing call sites in interactive-mode.\n\t */\n\tinvalidate(): void {\n\t\t// No-op: git branch is cached/invalidated by provider\n\t}\n\n\t/**\n\t * Clean up resources.\n\t * Git watcher cleanup now handled by provider.\n\t */\n\tdispose(): void {\n\t\t// Git watcher cleanup handled by provider\n\t}\n\n\trender(width: number): string[] {\n\t\tconst state = this.session.state;\n\n\t\t// O(1) running totals maintained by SessionManager (identical to summing\n\t\t// usage over all entries; totals are not branch-scoped).\n\t\tconst usageTotals = this.session.sessionManager.getUsageTotals();\n\t\tconst totalCacheRead = usageTotals.cacheRead;\n\t\tconst totalCacheWrite = usageTotals.cacheWrite;\n\t\tconst totalCost = usageTotals.cost;\n\t\tconst latestCacheHitRate = usageTotals.latestCacheHitRate;\n\n\t\t// Calculate context usage from session (handles compaction correctly).\n\t\t// After compaction, tokens are unknown until the next LLM response.\n\t\tconst contextUsage = this.session.getContextUsage();\n\t\tconst contextWindow = contextUsage?.contextWindow ?? state.model?.contextWindow ?? 0;\n\t\tconst contextPercentValue = contextUsage?.percent ?? 0;\n\t\tconst contextPercent = contextUsage?.percent !== null ? contextPercentValue.toFixed(1) : \"?\";\n\t\tconst contextTokens =\n\t\t\ttypeof contextUsage?.tokens === \"number\"\n\t\t\t\t? formatTokens(contextUsage.tokens)\n\t\t\t\t: typeof contextUsage?.percent === \"number\"\n\t\t\t\t\t? formatTokens(Math.round((contextWindow * contextUsage.percent) / 100))\n\t\t\t\t\t: \"?\";\n\n\t\t// Segments in priority order: anchors (pwd, branch, context) and the model\n\t\t// label always stay; middle stats elide from the right when space runs out.\n\t\t// The width ladder itself lives in ./footer-layout.ts.\n\t\tconst separator = \" • \";\n\t\tconst sepColored = theme.fg(\"borderMuted\", separator);\n\t\tconst pwdRaw = formatCwdForFooter(\n\t\t\tthis.session.sessionManager.getCwd(),\n\t\t\tprocess.env.HOME || process.env.USERPROFILE,\n\t\t);\n\t\tconst branch = this.footerData.getGitBranch();\n\t\tconst sessionName = this.session.sessionManager.getSessionName();\n\n\t\tconst omoNativeBadge: FooterSegment | undefined = this.footerData.isOmoNative()\n\t\t\t? { plain: OMO_NATIVE_BADGE, colored: theme.fg(\"success\", OMO_NATIVE_BADGE) }\n\t\t\t: undefined;\n\n\t\tconst anchor: [FooterSegment, ...FooterSegment[]] = [{ plain: pwdRaw, colored: theme.fg(\"accent\", pwdRaw) }];\n\t\tif (omoNativeBadge) anchor.unshift(omoNativeBadge);\n\t\tif (branch) anchor.push({ plain: branch, colored: theme.fg(\"warning\", branch) });\n\t\tconst pwdIndex = omoNativeBadge ? 1 : 0;\n\n\t\tconst dim = (plain: string): FooterSegment => ({ plain, colored: theme.fg(\"dim\", plain) });\n\t\tconst middle: FooterSegment[] = [];\n\t\tif (sessionName) middle.push({ plain: sessionName, colored: theme.fg(\"muted\", sessionName) });\n\t\tif ((totalCacheRead > 0 || totalCacheWrite > 0) && latestCacheHitRate !== undefined && latestCacheHitRate >= 10) {\n\t\t\tmiddle.push(dim(`CH${latestCacheHitRate.toFixed(1)}%`));\n\t\t}\n\n\t\t// Kimi Coding is subscription-backed despite using API-key authentication.\n\t\tconst usingSubscription = state.model\n\t\t\t? state.model.provider === \"kimi-coding\" || this.session.modelRuntime.isUsingOAuth(state.model.provider)\n\t\t\t: false;\n\t\tif (totalCost || usingSubscription) {\n\t\t\tconst costStr = `$${totalCost.toFixed(3)}${usingSubscription ? \" (sub)\" : \"\"}`;\n\t\t\tmiddle.push({ plain: costStr, colored: theme.fg(\"success\", costStr) });\n\t\t}\n\n\t\tconst autoIndicator = this.autoCompactEnabled ? \" (auto)\" : \"\";\n\t\tconst ctxDisplay =\n\t\t\tcontextPercent === \"?\"\n\t\t\t\t? `${contextTokens}/${formatTokens(contextWindow)} (?)${autoIndicator}`\n\t\t\t\t: `${contextTokens}/${formatTokens(contextWindow)} (${contextPercent}%)${autoIndicator}`;\n\t\tconst ctxColored =\n\t\t\tcontextPercentValue > 90\n\t\t\t\t? theme.fg(\"error\", ctxDisplay)\n\t\t\t\t: contextPercentValue > 70\n\t\t\t\t\t? theme.fg(\"warning\", ctxDisplay)\n\t\t\t\t\t: theme.fg(\"muted\", ctxDisplay);\n\t\tconst tail: FooterSegment = { plain: ctxDisplay, colored: ctxColored };\n\n\t\t// Model label pinned to the right edge; the provider prefix stays only when\n\t\t// the full line fits.\n\t\tconst modelName = state.model?.id || \"no-model\";\n\t\tconst fastIndicator = this.session.isFastModeActive() ? FAST_MODE_INDICATOR : \"\";\n\t\tlet minimalRight = `${fastIndicator}${modelName}`;\n\t\tif (state.model?.reasoning) {\n\t\t\tconst thinkingLevel = state.thinkingLevel || \"off\";\n\t\t\tminimalRight = thinkingLevel === \"off\" ? `${minimalRight}:off` : `${minimalRight}:${thinkingLevel}`;\n\t\t}\n\t\tconst minimal: FooterSegment = { plain: minimalRight, colored: colorRightSide(minimalRight) };\n\t\tconst providerPrefix =\n\t\t\tthis.footerData.getAvailableProviderCount() > 1 && state.model ? `(${state.model.provider}) ` : \"\";\n\t\tconst full: FooterSegment | undefined = providerPrefix\n\t\t\t? { plain: `${providerPrefix}${minimalRight}`, colored: colorRightSide(`${providerPrefix}${minimalRight}`) }\n\t\t\t: undefined;\n\n\t\tconst marker: FooterSegment = { plain: \"…\", colored: theme.fg(\"dim\", \"…\") };\n\t\tconst plan = planFooterLayout({\n\t\t\twidth,\n\t\t\tanchor,\n\t\t\tpwdIndex,\n\t\t\tmiddle,\n\t\t\ttail,\n\t\t\tright: { minimal, full },\n\t\t\tseparator,\n\t\t\tminPadding: 2,\n\t\t\tellipsisMarker: marker,\n\t\t});\n\n\t\tconst joinSegments = (segments: readonly FooterSegment[]): { colored: string; width: number } => ({\n\t\t\tcolored: segments.map((segment) => segment.colored).join(sepColored),\n\t\t\twidth: visibleWidth(segments.map((segment) => segment.plain).join(separator)),\n\t\t});\n\n\t\tlet left: { colored: string; width: number };\n\t\tlet right: FooterSegment;\n\t\tif (plan.kind === \"full\") {\n\t\t\tright = plan.useFullRight && full ? full : minimal;\n\t\t\tleft = joinSegments([...anchor, ...middle, tail]);\n\t\t} else if (plan.kind === \"middle-elided\") {\n\t\t\tright = plan.useFullRight && full ? full : minimal;\n\t\t\tconst segments = [...anchor, ...middle.slice(0, plan.keptMiddleCount)];\n\t\t\tif (plan.showMarker) segments.push(marker);\n\t\t\tsegments.push(tail);\n\t\t\tleft = joinSegments(segments);\n\t\t} else if (plan.kind === \"pwd-elided\") {\n\t\t\tright = plan.useFullRight && full ? full : minimal;\n\t\t\tconst segments: FooterSegment[] = [\n\t\t\t\t...anchor.map((segment, index) =>\n\t\t\t\t\tindex === pwdIndex ? { plain: plan.pwdPlain, colored: theme.fg(\"accent\", plan.pwdPlain) } : segment,\n\t\t\t\t),\n\t\t\t\t...middle.slice(0, plan.keptMiddleCount),\n\t\t\t];\n\t\t\tif (plan.showMarker) segments.push(marker);\n\t\t\tsegments.push(tail);\n\t\t\tleft = joinSegments(segments);\n\t\t} else if (plan.kind === \"left-elided\") {\n\t\t\tright = minimal;\n\t\t\tleft = { colored: theme.fg(\"muted\", plan.leftPlain), width: visibleWidth(plan.leftPlain) };\n\t\t} else {\n\t\t\tleft = { colored: \"\", width: 0 };\n\t\t\tright = { plain: plan.rightPlain, colored: colorRightSide(plan.rightPlain) };\n\t\t}\n\n\t\tconst rightWidth = visibleWidth(right.plain);\n\t\tconst padding = \" \".repeat(Math.max(0, width - left.width - rightWidth));\n\t\tconst lines = [left.colored + padding + right.colored];\n\n\t\t// Add extension statuses on a single line, sorted by key alphabetically\n\t\tconst extensionStatuses = this.footerData.getExtensionStatuses();\n\t\tif (extensionStatuses.size > 0) {\n\t\t\tconst sortedStatuses = Array.from(extensionStatuses.entries())\n\t\t\t\t.sort(([a], [b]) => a.localeCompare(b))\n\t\t\t\t.map(([, text]) => sanitizeStatusText(text));\n\t\t\tconst statusLine = sortedStatuses.join(\" \");\n\t\t\t// Truncate to terminal width with dim ellipsis for consistency with footer style\n\t\t\tlines.push(truncateToWidth(statusLine, width, theme.fg(\"dim\", \"...\")));\n\t\t}\n\n\t\treturn lines;\n\t}\n}\n"]}
|
package/docs/extensions.md
CHANGED
|
@@ -1437,6 +1437,82 @@ pi.registerTool({
|
|
|
1437
1437
|
});
|
|
1438
1438
|
```
|
|
1439
1439
|
|
|
1440
|
+
### pi.registerFilesystemPolicy(policy)
|
|
1441
|
+
|
|
1442
|
+
Register a filesystem access policy for Senpi's built-in `read`, `write`,
|
|
1443
|
+
`edit`, `ls`, `find`, and `grep` tools. This is a **factory-time only** API: call
|
|
1444
|
+
it directly from the extension factory so the checker is compiled before the
|
|
1445
|
+
built-in tools are constructed.
|
|
1446
|
+
|
|
1447
|
+
The policy receives a canonical absolute target:
|
|
1448
|
+
|
|
1449
|
+
```typescript
|
|
1450
|
+
interface FilesystemPolicyRequest {
|
|
1451
|
+
operation: "read" | "enumerate" | "write";
|
|
1452
|
+
canonicalPath: string;
|
|
1453
|
+
toolName: string;
|
|
1454
|
+
}
|
|
1455
|
+
```
|
|
1456
|
+
|
|
1457
|
+
Operation mapping:
|
|
1458
|
+
|
|
1459
|
+
| Operation | Built-in tools |
|
|
1460
|
+
|---|---|
|
|
1461
|
+
| `read` | `read` |
|
|
1462
|
+
| `write` | `write`, `edit` |
|
|
1463
|
+
| `enumerate` | `ls`, `find`, `grep` |
|
|
1464
|
+
|
|
1465
|
+
Existing targets are resolved through filesystem symlinks. A missing write
|
|
1466
|
+
target is resolved through its nearest existing real parent, then its missing
|
|
1467
|
+
suffix is reattached. The policy runs after that resolution and immediately
|
|
1468
|
+
before the tool's target I/O. A denial is returned as a normal tool error with
|
|
1469
|
+
the policy's reason.
|
|
1470
|
+
|
|
1471
|
+
```typescript
|
|
1472
|
+
import { isAbsolute, relative, resolve, sep } from "node:path";
|
|
1473
|
+
import type { ExtensionAPI } from "@code-yeongyu/senpi";
|
|
1474
|
+
|
|
1475
|
+
function isContained(root: string, candidate: string): boolean {
|
|
1476
|
+
const pathFromRoot = relative(root, candidate);
|
|
1477
|
+
return pathFromRoot === "" || (
|
|
1478
|
+
pathFromRoot !== ".." &&
|
|
1479
|
+
!pathFromRoot.startsWith(`..${sep}`) &&
|
|
1480
|
+
!isAbsolute(pathFromRoot)
|
|
1481
|
+
);
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
export default function (pi: ExtensionAPI) {
|
|
1485
|
+
const writableRoot = resolve(process.cwd());
|
|
1486
|
+
|
|
1487
|
+
pi.registerFilesystemPolicy({
|
|
1488
|
+
check({ operation, canonicalPath }) {
|
|
1489
|
+
if (operation !== "write" || isContained(writableRoot, canonicalPath)) {
|
|
1490
|
+
return { allow: true };
|
|
1491
|
+
}
|
|
1492
|
+
return {
|
|
1493
|
+
allow: false,
|
|
1494
|
+
reason: `Writes are limited to ${writableRoot}`,
|
|
1495
|
+
};
|
|
1496
|
+
},
|
|
1497
|
+
});
|
|
1498
|
+
}
|
|
1499
|
+
```
|
|
1500
|
+
|
|
1501
|
+
Policies run in extension load and registration order. Every policy must allow a
|
|
1502
|
+
request; the first denial wins. A thrown policy error also stops the tool before
|
|
1503
|
+
its target I/O.
|
|
1504
|
+
|
|
1505
|
+
An optional `deniedRoots: readonly string[]` field exposes metadata for future
|
|
1506
|
+
inherited process sandbox support. Use canonical absolute roots. The current
|
|
1507
|
+
runtime does not interpret this metadata and does not apply filesystem policies
|
|
1508
|
+
to `bash` or descendants; command-string rewriting is not a filesystem security
|
|
1509
|
+
boundary.
|
|
1510
|
+
|
|
1511
|
+
This enforcement is separate from `tool_call` permission and approval hooks.
|
|
1512
|
+
An unrestricted approval mode, or a hook that returns `{ block: false }`, cannot
|
|
1513
|
+
bypass the built-in executor check. Custom extension tools are not covered
|
|
1514
|
+
automatically and must call their own policy if they access the filesystem.
|
|
1515
|
+
|
|
1440
1516
|
### pi.registerMcpServer(name, config)
|
|
1441
1517
|
|
|
1442
1518
|
Register an MCP server that the agent can use. This is a **factory-time only**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code-yeongyu/senpi-codemode",
|
|
3
|
-
"version": "2026.8.
|
|
3
|
+
"version": "2026.8.10",
|
|
4
4
|
"description": "Source-only senpi extension package for codemode evaluation tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@babel/parser": "8.0.4",
|
|
33
|
-
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.8.
|
|
33
|
+
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.8.10",
|
|
34
34
|
"typebox": "1.3.8"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@code-yeongyu/senpi": "2026.8.
|
|
37
|
+
"@code-yeongyu/senpi": "2026.8.10"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@code-yeongyu/senpi": "2026.8.
|
|
40
|
+
"@code-yeongyu/senpi": "2026.8.10"
|
|
41
41
|
},
|
|
42
42
|
"keywords": [
|
|
43
43
|
"senpi",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@earendil-works/pi-agent-core",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "2026.8.
|
|
4
|
+
"version": "2026.8.10",
|
|
5
5
|
"description": "General-purpose agent with transport abstraction, state management, and attachment support",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"prepublishOnly": "npm run build"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.8.
|
|
33
|
+
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.8.10",
|
|
34
34
|
"diff": "9.0.0",
|
|
35
35
|
"ignore": "7.0.6",
|
|
36
36
|
"typebox": "1.3.8",
|