mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-28 20:21:50 +01:00
Resolve LLM wiki manifest review gaps
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
fc42373f70
commit
b8097eaf83
4 files changed
+14
-84
No files matched your search
@@ -132,6 +132,7 @@ const manifest: PaperclipPluginManifestV1 = {
|
||||
"wiki",
|
||||
"wiki/sources",
|
||||
"wiki/projects",
|
||||
"wiki/areas",
|
||||
"wiki/entities",
|
||||
"wiki/concepts",
|
||||
"wiki/synthesis"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createHash, randomUUID } from "node:crypto";
|
||||
import type { Agent, AgentSessionEvent, Issue, IssueComment, PluginContext, PluginEvent, PluginLocalFolderEntry, Project, ToolResult } from "@paperclipai/plugin-sdk";
|
||||
import type { IssueDocument, PluginIssueOriginKind, PluginManagedRoutineResolution } from "@paperclipai/plugin-sdk/types";
|
||||
import type { Agent, AgentSessionEvent, Issue, PluginContext, PluginEvent, PluginLocalFolderEntry, Project, ToolResult } from "@paperclipai/plugin-sdk";
|
||||
import type { PluginIssueOriginKind, PluginManagedRoutineResolution } from "@paperclipai/plugin-sdk/types";
|
||||
import {
|
||||
DEFAULT_MAX_SOURCE_BYTES,
|
||||
DEFAULT_MAX_PAPERCLIP_CURSOR_WINDOW_CHARS,
|
||||
@@ -2355,11 +2355,6 @@ export async function distillPaperclipProjectPage(ctx: PluginContext, input: Pap
|
||||
};
|
||||
}
|
||||
|
||||
function truncateEventSource(contents: string, maxCharacters: number): string {
|
||||
if (contents.length <= maxCharacters) return contents;
|
||||
return `${contents.slice(0, maxCharacters)}\n\n[Truncated by LLM Wiki event ingestion policy at ${maxCharacters} characters.]\n`;
|
||||
}
|
||||
|
||||
function eventPayload(event: PluginEvent): Record<string, unknown> {
|
||||
return event.payload && typeof event.payload === "object" && !Array.isArray(event.payload)
|
||||
? event.payload as Record<string, unknown>
|
||||
@@ -2370,82 +2365,6 @@ function sourceTitleForIssue(issue: Issue): string {
|
||||
return issue.identifier ? `${issue.identifier} ${issue.title}` : issue.title;
|
||||
}
|
||||
|
||||
function rawPathForPaperclipEvent(input: {
|
||||
sourceKind: WikiEventIngestionSource;
|
||||
issue: Issue;
|
||||
label: string;
|
||||
contents: string;
|
||||
event: PluginEvent;
|
||||
}): string {
|
||||
const identifier = input.issue.identifier ?? input.issue.id.slice(0, 8);
|
||||
const eventDate = input.event.occurredAt.slice(0, 10);
|
||||
return assertRawPath(`raw/paperclip/${input.sourceKind}/${eventDate}-${slugify(identifier)}-${slugify(input.label)}-${contentHash(input.contents).slice(0, 8)}.md`);
|
||||
}
|
||||
|
||||
function formatIssueEventSource(issue: Issue, event: PluginEvent, maxCharacters: number): string {
|
||||
return truncateEventSource([
|
||||
`# Paperclip issue: ${sourceTitleForIssue(issue)}`,
|
||||
"",
|
||||
"## Provenance",
|
||||
"",
|
||||
`- Company ID: ${issue.companyId}`,
|
||||
`- Issue ID: ${issue.id}`,
|
||||
issue.identifier ? `- Issue identifier: ${issue.identifier}` : null,
|
||||
`- Event type: ${event.eventType}`,
|
||||
`- Event ID: ${event.eventId}`,
|
||||
`- Event occurred at: ${event.occurredAt}`,
|
||||
`- Status: ${issue.status}`,
|
||||
`- Priority: ${issue.priority}`,
|
||||
"",
|
||||
"## Issue",
|
||||
"",
|
||||
issue.description?.trim() ? issue.description.trim() : "_No issue description._",
|
||||
].filter((line): line is string => line !== null).join("\n"), maxCharacters);
|
||||
}
|
||||
|
||||
function formatCommentEventSource(issue: Issue, comment: IssueComment, event: PluginEvent, maxCharacters: number): string {
|
||||
return truncateEventSource([
|
||||
`# Paperclip comment on ${sourceTitleForIssue(issue)}`,
|
||||
"",
|
||||
"## Provenance",
|
||||
"",
|
||||
`- Company ID: ${issue.companyId}`,
|
||||
`- Issue ID: ${issue.id}`,
|
||||
issue.identifier ? `- Issue identifier: ${issue.identifier}` : null,
|
||||
`- Comment ID: ${comment.id}`,
|
||||
`- Event type: ${event.eventType}`,
|
||||
`- Event ID: ${event.eventId}`,
|
||||
`- Event occurred at: ${event.occurredAt}`,
|
||||
"",
|
||||
"## Comment",
|
||||
"",
|
||||
comment.body,
|
||||
].filter((line): line is string => line !== null).join("\n"), maxCharacters);
|
||||
}
|
||||
|
||||
function formatDocumentEventSource(issue: Issue, document: IssueDocument, event: PluginEvent, maxCharacters: number): string {
|
||||
return truncateEventSource([
|
||||
`# Paperclip document: ${document.title ?? document.key}`,
|
||||
"",
|
||||
"## Provenance",
|
||||
"",
|
||||
`- Company ID: ${issue.companyId}`,
|
||||
`- Issue ID: ${issue.id}`,
|
||||
issue.identifier ? `- Issue identifier: ${issue.identifier}` : null,
|
||||
`- Document ID: ${document.id}`,
|
||||
`- Document key: ${document.key}`,
|
||||
`- Event type: ${event.eventType}`,
|
||||
`- Event ID: ${event.eventId}`,
|
||||
`- Event occurred at: ${event.occurredAt}`,
|
||||
`- Format: ${document.format}`,
|
||||
`- Revision: ${document.latestRevisionNumber}`,
|
||||
"",
|
||||
"## Document",
|
||||
"",
|
||||
document.body,
|
||||
].filter((line): line is string => line !== null).join("\n"), maxCharacters);
|
||||
}
|
||||
|
||||
async function recordPaperclipCursorObservation(ctx: PluginContext, input: {
|
||||
companyId: string;
|
||||
wikiId: string;
|
||||
|
||||
@@ -511,6 +511,16 @@ describe("LLM Wiki plugin scaffold", () => {
|
||||
exportName: "WikiRouteSidebar",
|
||||
routePath: "wiki",
|
||||
});
|
||||
expect(manifest.localFolders?.[0]?.requiredDirectories).toEqual([
|
||||
"raw",
|
||||
"wiki",
|
||||
"wiki/sources",
|
||||
"wiki/projects",
|
||||
"wiki/areas",
|
||||
"wiki/entities",
|
||||
"wiki/concepts",
|
||||
"wiki/synthesis",
|
||||
]);
|
||||
expect(packageJson.dependencies).toBeUndefined();
|
||||
expect(packageJson.devDependencies?.react).toBeUndefined();
|
||||
expect(packageJson.devDependencies?.["react-dom"]).toBeDefined();
|
||||
|
||||
@@ -23,7 +23,7 @@ const FOLDER_HEALTHY = {
|
||||
access: "readWrite" as const,
|
||||
readable: true,
|
||||
writable: true,
|
||||
requiredDirectories: ["raw", "wiki", "wiki/sources", "wiki/projects", "wiki/entities", "wiki/concepts", "wiki/synthesis"],
|
||||
requiredDirectories: ["raw", "wiki", "wiki/sources", "wiki/projects", "wiki/areas", "wiki/entities", "wiki/concepts", "wiki/synthesis"],
|
||||
requiredFiles: ["AGENTS.md", "IDEA.md", "wiki/index.md", "wiki/log.md"],
|
||||
missingDirectories: [],
|
||||
missingFiles: [],
|
||||
|
||||
Reference in new issue
Block a user