{"id":19300470,"url":"https://github.com/rubriclab/actions","last_synced_at":"2026-05-16T15:31:24.873Z","repository":{"id":259497043,"uuid":"866840509","full_name":"RubricLab/actions","owner":"RubricLab","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-04T14:08:39.000Z","size":77,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-04T15:22:46.803Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RubricLab.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-03T00:56:54.000Z","updated_at":"2025-02-04T14:08:42.000Z","dependencies_parsed_at":"2024-10-26T01:47:21.155Z","dependency_job_id":"36ac1f8a-46f8-4fe0-8695-c54b89dcdae2","html_url":"https://github.com/RubricLab/actions","commit_stats":null,"previous_names":["rubriclab/actions"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubricLab%2Factions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubricLab%2Factions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubricLab%2Factions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubricLab%2Factions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RubricLab","download_url":"https://codeload.github.com/RubricLab/actions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240402167,"owners_count":19795682,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T23:14:51.890Z","updated_at":"2026-05-16T15:31:24.868Z","avatar_url":"https://github.com/RubricLab.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @rubriclab/actions\nThe Actions package aims to provide a powerful and simple way to define actions (which are essentially API primitives) and execute them safely with JSON serializable payloads.\n\nIt is part of Rubric's architecture for Generative UI when used with:\n- [@rubriclab/actions](https://github.com/rubriclab/actions)\n- [@rubriclab/blocks](https://github.com/rubriclab/blocks)\n- [@rubriclab/chains](https://github.com/rubriclab/chains)\n- [@rubriclab/agents](https://github.com/rubriclab/agents)\n- [@rubriclab/events](https://github.com/rubriclab/events)\n\n[Demo](https://chat.rubric.sh)\n\n## Get Started\n### Installation\n`bun add @rubriclab/actions`\n\n\u003e @rubriclab scope packages are not built, they are all raw typescript. If using in a next.js app, make sure to transpile.\n\n```ts\n// next.config.ts\nimport type { NextConfig } from  'next' \nexport default {\n\ttranspilePackages: ['@rubriclab/actions'],\n\treactStrictMode: true\n} satisfies  NextConfig\n```\n\n\u003e If using inside the monorepo (@rubric), simply add `{\"@rubriclab/actions\": \"*\"}` to dependencies and then run `bun i`\n\n### Define Actions\nTo get started, define a few actions.\n\n```ts\nimport { createAction } from '@rubriclab/actions'\nimport { z } from 'zod'\n\nconst convertStringToNumber = createAction({\n\tschema: {\n\t\tinput: z.object({\n\t\t\tstr: z.string()\n\t\t}),\n\t\toutput: z.number()\n\t},\n\texecute: ({ str }) =\u003e Number(str)\n})\n\nexport const actions = { convertStringToNumber }\n```\n\n### Create an Executor\nPass all your actions into an executor to get a function to execute it.\n\n```ts\n'use server'\n\nimport { createActionExecutor } from '@rubriclab/actions'\nimport { actions } from './actions'\n\nexport const { execute } = createActionExecutor({ actions })\n```\n\n### Execute an Action\n\n```ts\nconst number = await execute({ action: 'convertStringToNumber' params: { str: '2' } })\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubriclab%2Factions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frubriclab%2Factions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubriclab%2Factions/lists"}