import { WorkspaceScopedResource, extractData } from './base.js';
/**
 * Manage actions — reusable AI capabilities that agents can call.
 * Actions define structured input/output schemas and execution settings.
 *
 * Note: The underlying API paths use `/skills/` for backward compatibility.
 */
export class ActionsResource extends WorkspaceScopedResource {
    /** Create a new action */
    async create(body) {
        return extractData(await this.client.POST('/v1/{workspace_id}/skills', {
            params: { path: { workspace_id: this.workspaceId } },
            body,
        }));
    }
    /** List actions in the workspace */
    async list(params) {
        return extractData(await this.client.GET('/v1/{workspace_id}/skills', {
            params: { path: { workspace_id: this.workspaceId }, query: params },
        }));
    }
    listAutoPaging(params) {
        return this.iteratePaginatedList((pageParams) => this.list(pageParams), params);
    }
    /** Get a single action */
    async get(actionId) {
        return extractData(await this.client.GET('/v1/{workspace_id}/skills/{skill_id}', {
            params: { path: { workspace_id: this.workspaceId, skill_id: actionId } },
        }));
    }
    /** Update an action */
    async update(actionId, body) {
        return extractData(await this.client.PUT('/v1/{workspace_id}/skills/{skill_id}', {
            params: { path: { workspace_id: this.workspaceId, skill_id: actionId } },
            body,
        }));
    }
    /** Delete an action */
    async delete(actionId) {
        await this.client.DELETE('/v1/{workspace_id}/skills/{skill_id}', {
            params: { path: { workspace_id: this.workspaceId, skill_id: actionId } },
        });
    }
    /** Get all context graphs and services that reference this action */
    async getReferences(actionId) {
        return extractData(await this.client.GET('/v1/{workspace_id}/skills/{skill_id}/references', {
            params: { path: { workspace_id: this.workspaceId, skill_id: actionId } },
        }));
    }
    /**
     * Test an action with a sample input.
     * Executes the action in a sandbox and returns the result.
     */
    async test(actionId, body) {
        return extractData(await this.client.POST('/v1/{workspace_id}/skills/{skill_id}/test', {
            params: { path: { workspace_id: this.workspaceId, skill_id: actionId } },
            body,
        }));
    }
}
//# sourceMappingURL=actions.js.map