mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-21 16:27:18 +02:00
Preserve LLM Wiki event ingestion sources
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
6de996489d
commit
e6ec96cef7
2 files changed
+63
-12
No files matched your search
@@ -337,21 +337,37 @@ const plugin = definePlugin({
|
||||
});
|
||||
|
||||
ctx.actions.register("update-event-ingestion-settings", async (params) => {
|
||||
const sources = typeof params.sources === "object" && params.sources != null && !Array.isArray(params.sources)
|
||||
const requestedSources = typeof params.sources === "object" && params.sources != null && !Array.isArray(params.sources)
|
||||
? params.sources as Record<string, unknown>
|
||||
: {};
|
||||
: null;
|
||||
const sources: { issues?: boolean; comments?: boolean; documents?: boolean } = {};
|
||||
if (requestedSources && Object.prototype.hasOwnProperty.call(requestedSources, "issues")) {
|
||||
sources.issues = requestedSources.issues === true;
|
||||
}
|
||||
if (requestedSources && Object.prototype.hasOwnProperty.call(requestedSources, "comments")) {
|
||||
sources.comments = requestedSources.comments === true;
|
||||
}
|
||||
if (requestedSources && Object.prototype.hasOwnProperty.call(requestedSources, "documents")) {
|
||||
sources.documents = requestedSources.documents === true;
|
||||
}
|
||||
const settings: {
|
||||
enabled?: boolean;
|
||||
wikiId?: string;
|
||||
maxCharacters?: number;
|
||||
sources?: typeof sources;
|
||||
} = {
|
||||
wikiId: stringField(params.wikiId) ?? undefined,
|
||||
maxCharacters: typeof params.maxCharacters === "number" ? params.maxCharacters : undefined,
|
||||
};
|
||||
if (typeof params.enabled === "boolean") {
|
||||
settings.enabled = params.enabled;
|
||||
}
|
||||
if (Object.keys(sources).length > 0) {
|
||||
settings.sources = sources;
|
||||
}
|
||||
return updateEventIngestionSettings(ctx, {
|
||||
companyId: readCompanyIdFromParams(params),
|
||||
settings: {
|
||||
enabled: params.enabled === true,
|
||||
wikiId: stringField(params.wikiId) ?? undefined,
|
||||
maxCharacters: typeof params.maxCharacters === "number" ? params.maxCharacters : undefined,
|
||||
sources: {
|
||||
issues: sources.issues === true,
|
||||
comments: sources.comments === true,
|
||||
documents: sources.documents === true,
|
||||
},
|
||||
},
|
||||
settings,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1713,6 +1713,41 @@ Duplicate headings receive stable suffixes.
|
||||
]));
|
||||
});
|
||||
|
||||
it("preserves Paperclip event ingestion sources when only enabled changes", async () => {
|
||||
const harness = createTestHarness({ manifest });
|
||||
|
||||
await plugin.definition.setup(harness.ctx);
|
||||
await harness.performAction("update-event-ingestion-settings", {
|
||||
companyId: COMPANY_ID,
|
||||
enabled: true,
|
||||
sources: { issues: true, comments: true, documents: true },
|
||||
});
|
||||
|
||||
const disabled = await harness.performAction<{
|
||||
enabled: boolean;
|
||||
sources: { issues: boolean; comments: boolean; documents: boolean };
|
||||
}>("update-event-ingestion-settings", {
|
||||
companyId: COMPANY_ID,
|
||||
enabled: false,
|
||||
});
|
||||
expect(disabled).toMatchObject({
|
||||
enabled: false,
|
||||
sources: { issues: true, comments: true, documents: true },
|
||||
});
|
||||
|
||||
const reenabled = await harness.performAction<{
|
||||
enabled: boolean;
|
||||
sources: { issues: boolean; comments: boolean; documents: boolean };
|
||||
}>("update-event-ingestion-settings", {
|
||||
companyId: COMPANY_ID,
|
||||
enabled: true,
|
||||
});
|
||||
expect(reenabled).toMatchObject({
|
||||
enabled: true,
|
||||
sources: { issues: true, comments: true, documents: true },
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps Paperclip event cursor observations company scoped and ignores plugin-operation issues", async () => {
|
||||
const harness = createTestHarness({ manifest });
|
||||
const visibleIssue = paperclipIssue({ projectId: "77777777-7777-4777-8777-777777777777" });
|
||||
|
||||
Reference in new issue
Block a user