feat(saas): industry agent template assignment system
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Phase 1-8 of industry-agent-delivery plan: - DB migration: accounts.assigned_template_id (ON DELETE SET NULL) - SaaS API: 4 new endpoints (assign/get/unassign/create-agent) - Service layer: assign_template_to_account, get_assigned_template, unassign_template, create_agent_from_template) - Types: AssignTemplateRequest, AgentConfigFromTemplate (capabilities merged into tools) - Frontend SaaS Client: assignTemplate, getAssignedTemplate, unassignTemplate, createAgentFromTemplate - saasStore: assignedTemplate state + login auto-fetch + actions - saas-relay-client: fix unused import and saasUrl reference error - connectionStore: fix relayModel undefined error - capabilities default to glm-4-flash - Route registration: new template assignment routes Cospec and handlers consolidated Build: cargo check --workspace PASS, tsc --noEmit Pass
This commit is contained in:
@@ -66,6 +66,7 @@ export type {
|
||||
CreateTemplateRequest,
|
||||
AgentTemplateAvailable,
|
||||
AgentTemplateFull,
|
||||
AgentConfigFromTemplate,
|
||||
} from './saas-types';
|
||||
|
||||
export { SaaSApiError } from './saas-errors';
|
||||
@@ -101,6 +102,7 @@ import type {
|
||||
PaginatedResponse,
|
||||
AgentTemplateAvailable,
|
||||
AgentTemplateFull,
|
||||
AgentConfigFromTemplate,
|
||||
} from './saas-types';
|
||||
import { SaaSApiError } from './saas-errors';
|
||||
import { clearSaaSSession } from './saas-session';
|
||||
@@ -403,6 +405,41 @@ export class SaaSClient {
|
||||
async fetchTemplateFull(id: string): Promise<AgentTemplateFull> {
|
||||
return this.request<AgentTemplateFull>('GET', `/api/v1/agent-templates/${id}/full`);
|
||||
}
|
||||
|
||||
// --- Template Assignment ---
|
||||
|
||||
/**
|
||||
* Assign a template to the current account.
|
||||
* Records the user's industry choice for onboarding flow control.
|
||||
*/
|
||||
async assignTemplate(templateId: string): Promise<AgentTemplateFull> {
|
||||
return this.request<AgentTemplateFull>('POST', '/api/v1/accounts/me/assign-template', {
|
||||
template_id: templateId,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the template currently assigned to the account.
|
||||
* Returns null if no template is assigned.
|
||||
*/
|
||||
async getAssignedTemplate(): Promise<AgentTemplateFull | null> {
|
||||
return this.request<AgentTemplateFull | null>('GET', '/api/v1/accounts/me/assigned-template');
|
||||
}
|
||||
|
||||
/**
|
||||
* Unassign the current template from the account.
|
||||
*/
|
||||
async unassignTemplate(): Promise<void> {
|
||||
await this.request<unknown>('DELETE', '/api/v1/accounts/me/assigned-template');
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an agent configuration from a template.
|
||||
* Merges capabilities into tools, applies default model fallback.
|
||||
*/
|
||||
async createAgentFromTemplate(templateId: string): Promise<AgentConfigFromTemplate> {
|
||||
return this.request<AgentConfigFromTemplate>('POST', `/api/v1/agent-templates/${templateId}/create-agent`);
|
||||
}
|
||||
}
|
||||
|
||||
// === Install mixin methods ===
|
||||
|
||||
Reference in New Issue
Block a user