update on the agents and registry side
This commit is contained in:
@@ -166,6 +166,31 @@ export const createAdminTenant = async (data) => {
|
||||
return response.data;
|
||||
};
|
||||
|
||||
/**
|
||||
* Onboard a client: the tenant, its console login (doormile_auth) and its
|
||||
* appusers row, in one server transaction. Only the onboarding owner login
|
||||
* (admin@doormile.com) may call it; anyone else gets 403.
|
||||
* @param {{ companyname: string, contactname: string, email: string, phone: string,
|
||||
* password: string, applocationid: number, requiredeliveryotp?: boolean }} data
|
||||
* @returns {Promise<{ success: boolean, data: { tenant: object, login: object } }>}
|
||||
*/
|
||||
export const onboardClient = async (data) => {
|
||||
const response = await doormileAxios.post('/admin/clients/onboard', data);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
/** Operating cities a new client can be placed in (applocations; owner login only). */
|
||||
export const getOnboardingCities = async () => {
|
||||
const response = await doormileAxios.get('/admin/clients/cities');
|
||||
return response.data.data;
|
||||
};
|
||||
|
||||
/** Clients that have a console login, newest first (owner login only). */
|
||||
export const getOnboardedClients = async () => {
|
||||
const response = await doormileAxios.get('/admin/clients/onboarded');
|
||||
return response.data.data;
|
||||
};
|
||||
|
||||
export const getAdminTenant = async (id) => {
|
||||
const response = await doormileAxios.get(`/admin/tenants/${id}`);
|
||||
return response.data.data;
|
||||
@@ -728,3 +753,80 @@ export const deleteCarrierPricing = async (id) => {
|
||||
const response = await doormileAxios.delete(`/admin/carrier-pricing/${id}`);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
// ==============================|| AI agent registry ||============================== //
|
||||
// /admin/ai/* — Doormile staff only (a partner-tenant login gets 403). Reads
|
||||
// are open to admin/manager/executive; every write is admin-only and audited
|
||||
// server-side. See docs/agent-platform-plan.md.
|
||||
|
||||
export const getAiAgents = async () => {
|
||||
const response = await doormileAxios.get('/admin/ai/agents');
|
||||
return response.data.data;
|
||||
};
|
||||
|
||||
export const getAiSkills = async () => {
|
||||
const response = await doormileAxios.get('/admin/ai/skills');
|
||||
return response.data.data;
|
||||
};
|
||||
|
||||
export const getAiTools = async () => {
|
||||
const response = await doormileAxios.get('/admin/ai/tools');
|
||||
return response.data.data;
|
||||
};
|
||||
|
||||
export const getAiRegistryAudit = async (limit) => {
|
||||
const response = await doormileAxios.get(`/admin/ai/audit${buildQuery({ limit })}`);
|
||||
return response.data.data;
|
||||
};
|
||||
|
||||
/** @param {string} id @param {{ enabled?: boolean, thresholds?: Record<string, number> }} patch */
|
||||
export const updateAiSkill = async (id, patch) => {
|
||||
const response = await doormileAxios.patch(`/admin/ai/skills/${encodeURIComponent(id)}`, patch);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
/** @param {{ agentid: string, title: string, category?: string, description?: string, sampleprompt?: string, tools: string[] }} skill */
|
||||
export const createAiSkill = async (skill) => {
|
||||
const response = await doormileAxios.post('/admin/ai/skills', skill);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
/**
|
||||
* Autonomy ON needs `confirm` set to the agent id — the server refuses it
|
||||
* otherwise, so a stray click cannot let an agent act without a human.
|
||||
* @param {string} id @param {{ autonomous?: boolean, model?: string, confirm?: string }} patch
|
||||
*/
|
||||
export const updateAiAgent = async (id, patch) => {
|
||||
const response = await doormileAxios.patch(`/admin/ai/agents/${encodeURIComponent(id)}`, patch);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
/**
|
||||
* What the agents did over the last `days` (1–30): runs and failures per
|
||||
* AI_engine agent, decisions by type/outcome, live heartbeat. `receiving` is
|
||||
* false when the backend is not subscribed to AI_engine telemetry.
|
||||
* @param {number} days
|
||||
*/
|
||||
export const getAiInsights = async (days = 7) => {
|
||||
const response = await doormileAxios.get(`/admin/ai/insights${buildQuery({ days })}`);
|
||||
return response.data.data;
|
||||
};
|
||||
|
||||
/**
|
||||
* Agent Studio's Test tab: one prompt through Claude with a skill's tools.
|
||||
* Read tools run with personal data redacted; write tools come back as
|
||||
* proposals and are never executed. Admin only. 503 (code
|
||||
* PLAYGROUND_NOT_CONFIGURED) when the server has no Claude client; 429 when
|
||||
* the per-user limit is reached.
|
||||
* @param {{ agentid: string, skillid?: string, prompt: string }} body
|
||||
*/
|
||||
export const runAiPlayground = async (body) => {
|
||||
const response = await doormileAxios.post('/admin/ai/playground/run', body);
|
||||
return response.data.data;
|
||||
};
|
||||
|
||||
/** Recent agent decisions, newest first. `before` is the last id of the previous page. */
|
||||
export const getAiDecisions = async ({ type, before, limit } = {}) => {
|
||||
const response = await doormileAxios.get(`/admin/ai/decisions${buildQuery({ type, before, limit })}`);
|
||||
return response.data.data;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user