fix(config): קריאת config מותאמת ל-scope של חברה (Paperclip 2026.722.0)
מיגרציה 0164_plugin_config_company_scope הפכה את config של פלאגינים ל-company-scoped, ו-`ctx.config.get()` בלי companyId זורק "company context is required" כשה-host לא יכול לגזור חברה מההקשר. ב-setup() אין חברה בהגדרה, ולכן הקריאה שם הפילה את הפעלת הפלאגין כולו בשדרוג מ-2026.609.0 (status=error, 0 כלים רשומים). - setup() כבר לא קורא config; LegalApi מקבל resolver עצל במקום URL קבוע (baseUrl שימש במקום אחד בלבד, ולכן 17 ה-tool handlers לא נגעו) - resolveApiBase() פותר לפי הסדר: companyId מפורש → גזירת ה-host מההקשר → סריקת החברות ב-CEO_AGENT_IDS → ברירת מחדל - data handlers מעבירים params.companyId; jobs מתוזמנים חסרי חברה (PluginJobContext לא כולל companyId) ולכן נשענים על הסריקה - שדרוג @paperclipai/plugin-sdk ל-2026.722.0 מאומת: הפלאגין עולה עם אותה חתימת רישום כמו לפני השדרוג — eventSubscriptions:2, jobs:4, webhooks:1, tools:9, בלי warnings. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,11 +2,23 @@
|
||||
* HTTP client for Ezer Mishpati legal-ai REST API.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Where the client gets its base URL. A plain string still works; a resolver is
|
||||
* used when the URL comes from company-scoped plugin config, which cannot be
|
||||
* read at worker startup (see worker.ts — `ctx.config.get` needs a company).
|
||||
*/
|
||||
export type BaseUrlSource = string | (() => string | Promise<string>);
|
||||
|
||||
export class LegalApi {
|
||||
constructor(private baseUrl: string) {}
|
||||
constructor(private baseUrl: BaseUrlSource) {}
|
||||
|
||||
private async resolveBaseUrl(): Promise<string> {
|
||||
return typeof this.baseUrl === "string" ? this.baseUrl : this.baseUrl();
|
||||
}
|
||||
|
||||
private async request<T>(path: string, init?: RequestInit): Promise<T> {
|
||||
const res = await fetch(`${this.baseUrl}${path}`, {
|
||||
const base = await this.resolveBaseUrl();
|
||||
const res = await fetch(`${base}${path}`, {
|
||||
...init,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
|
||||
Reference in New Issue
Block a user