{"_id":"@adam2go/tilo-react","_rev":"2-22ffb5a0855668a8edaa4c6a2cd2f326","name":"@adam2go/tilo-react","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@adam2go/tilo-react","version":"0.1.0","keywords":["ai","agent","react","tilo","aip","llm","artifact","surface"],"author":{"name":"adam2go"},"license":"MIT","_id":"@adam2go/tilo-react@0.1.0","maintainers":[{"name":"adam2go","email":"hxlee418@gmail.com"}],"homepage":"https://github.com/adam2go/tilo-framework#readme","bugs":{"url":"https://github.com/adam2go/tilo-framework/issues"},"dist":{"shasum":"2973f2933982f6dff67a151172b0dff8bf4734ea","tarball":"https://registry.npmjs.org/@adam2go/tilo-react/-/tilo-react-0.1.0.tgz","fileCount":8,"integrity":"sha512-uq/zf+jMPts7xT8RR615he3IRv81rLdOQuAwwOLcUWjlWeamCa5wzHpIpmZM4IJ2yl9vFWVaxD0BaUtmTABNjw==","signatures":[{"sig":"MEQCIF8Nce+cIXitNRcPAuY5gYkLop8fZqkuqZHX94IIQBDIAiA11HGkoy6TTrffKUrYmlqIZYfR8n60Tio9dI7pODfp6A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":226776},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"1d43cd1ea78b65c1455201a298939170b05902dc","scripts":{"dev":"tsup --watch","build":"tsup","typecheck":"tsc --noEmit"},"_npmUser":{"name":"adam2go","email":"hxlee418@gmail.com"},"repository":{"url":"git+https://github.com/adam2go/tilo-framework.git","type":"git","directory":"packages/react"},"_npmVersion":"10.8.2","description":"React renderer SDK for Tilo Agent Interaction Protocol (AIP) — render agent-authored surfaces, artifact blocks, and the two-way action loop.","directories":{},"sideEffects":false,"_nodeVersion":"20.20.2","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","typescript":"^5.9.3","@types/react":"^18.3.30","@types/react-dom":"^18.3.7"},"peerDependencies":{"react":">=18","recharts":">=2","react-dom":">=18","lucide-react":">=0.400"},"_npmOperationalInternal":{"tmp":"tmp/tilo-react_0.1.0_1780535884884_0.9864845828060003","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@adam2go/tilo-react","version":"0.2.0","description":"React renderer SDK for Tilo Agent Interaction Protocol (AIP) — render agent-authored surfaces, artifact blocks, and the two-way action loop.","keywords":["ai","agent","react","tilo","aip","llm","artifact","surface"],"license":"MIT","author":{"name":"adam2go"},"repository":{"type":"git","url":"git+https://github.com/adam2go/tilo-framework.git","directory":"packages/react"},"homepage":"https://github.com/adam2go/tilo-framework#readme","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"sideEffects":false,"scripts":{"build":"tsup","dev":"tsup --watch","typecheck":"tsc --noEmit"},"peerDependencies":{"lucide-react":">=0.400","react":">=18","react-dom":">=18","recharts":">=2"},"devDependencies":{"@types/react":"^18.3.30","@types/react-dom":"^18.3.7","tsup":"^8.5.1","typescript":"^5.9.3"},"_id":"@adam2go/tilo-react@0.2.0","gitHead":"0e5d0910a53a2caeab685b52b6dbec7e3f9b4836","bugs":{"url":"https://github.com/adam2go/tilo-framework/issues"},"_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-RmbtQ+2Q8coW0CL9bZRQ7YC/+/6HsDhsT5fUAA2yuNTre0zKl3vw0xuMaEKR/rXfRy8+G8famWS+DKddqUTIFg==","shasum":"b52c3ca148165c7014aaf78c25bce37e4232bb55","tarball":"https://registry.npmjs.org/@adam2go/tilo-react/-/tilo-react-0.2.0.tgz","fileCount":8,"unpackedSize":277612,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIByTt6NVzXP73Ah9b4BTJl+AyqSyV6+/cweAhJ8ixskjAiEAqU3f6PjxeIoBP0w+Eb5waHSXtYyHZnLbTrbaeKpceQU="}]},"_npmUser":{"name":"adam2go","email":"hxlee418@gmail.com"},"directories":{},"maintainers":[{"name":"adam2go","email":"hxlee418@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/tilo-react_0.2.0_1780623036178_0.1662956865549996"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-04T01:18:04.777Z","modified":"2026-06-05T01:30:36.447Z","0.1.0":"2026-06-04T01:18:05.035Z","0.2.0":"2026-06-05T01:30:36.331Z"},"bugs":{"url":"https://github.com/adam2go/tilo-framework/issues"},"author":{"name":"adam2go"},"license":"MIT","homepage":"https://github.com/adam2go/tilo-framework#readme","keywords":["ai","agent","react","tilo","aip","llm","artifact","surface"],"repository":{"type":"git","url":"git+https://github.com/adam2go/tilo-framework.git","directory":"packages/react"},"description":"React renderer SDK for Tilo Agent Interaction Protocol (AIP) — render agent-authored surfaces, artifact blocks, and the two-way action loop.","maintainers":[{"name":"adam2go","email":"hxlee418@gmail.com"}],"readme":"# @adam2go/tilo-react\n\nReact renderer SDK for [Tilo](https://github.com/adam2go/tilo-framework) — render agent-authored surfaces, artifact blocks, and the two-way AIP action loop in any React app.\n\n```bash\nnpm install @adam2go/tilo-react recharts lucide-react\n# or\npnpm add @adam2go/tilo-react recharts lucide-react\n```\n\n## Quick start\n\n### Render a surface spec\n\n```tsx\nimport { TiloRenderer, createTiloClient, useTiloSurface } from \"@adam2go/tilo-react\";\n\nconst client = createTiloClient({ baseUrl: \"http://localhost:8000\" });\n\nfunction MyApp({ runId }: { runId: string }) {\n  const { turns, loading } = useTiloSurface({ client, runId });\n\n  return (\n    <div>\n      {turns.map((turn) => (\n        <TiloRenderer\n          key={turn.id}\n          surface={turn.spec}\n          onAction={async (event) => {\n            await client.executeSurfaceAction({\n              surface: turn.spec,\n              actionId: event.action.id,\n              workspaceId: \"my-workspace-id\",\n              runId,\n            });\n          }}\n        />\n      ))}\n    </div>\n  );\n}\n```\n\n### Render an artifact block\n\n```tsx\nimport { renderArtifactBlock } from \"@adam2go/tilo-react\";\n\n// Works with any AIP v1 block (chart, diff, code, timeline, kanban, …)\nconst block = {\n  id: \"chart-1\",\n  type: \"chart\",\n  props: {\n    chart_type: \"bar\",\n    labels: [\"Q1\", \"Q2\", \"Q3\", \"Q4\"],\n    datasets: [{ label: \"Revenue\", data: [120, 180, 150, 220] }],\n  },\n};\n\n<div>{renderArtifactBlock(block)}</div>\n```\n\n### Override a block renderer\n\n```tsx\nimport { TiloRenderer } from \"@adam2go/tilo-react\";\nimport type { BlockProps } from \"@adam2go/tilo-react\";\n\nfunction MyDecision({ block, fire }: BlockProps<\"decision\">) {\n  return (\n    <div>\n      {block.data.options.map((opt) => (\n        <button key={opt.id} onClick={() => fire(opt.action_id)}>\n          {opt.label}\n        </button>\n      ))}\n    </div>\n  );\n}\n\n<TiloRenderer surface={spec} components={{ decision: MyDecision }} />\n```\n\n## Block types\n\n### Surface blocks (`TiloRenderer`)\n\n| Type | Description |\n|---|---|\n| `heading` | Section header with severity badge |\n| `text` | Plain text paragraph |\n| `evidence` | Quoted excerpt with source reference |\n| `comparison` | Side-by-side or table comparison |\n| `decision` | Choice buttons (single / multi) |\n| `form` | Input fields + submit |\n| `progress` | Steps, percent bar, or status |\n| `list` | Ordered / unordered list with severity |\n| `link` | Link with external indicator |\n| `editable` | Editable textarea with save action |\n| `artifact_link` | Clickable card that opens a rich artifact |\n| `fallback` | Graceful fallback for unknown types |\n\n### Artifact blocks (`renderArtifactBlock`)\n\nThese match the block types produced by `tilo.generate()` and the\nzero-setup Python viewer (`tilo.view`), so React rendering looks identical.\n\n| Type | Description |\n|---|---|\n| `heading` | Section header with severity color |\n| `markdown` | Plain text / markdown |\n| `card` | Titled card with severity |\n| `metric` | Single KPI value (label + value + delta) |\n| `table` | Data table with header row |\n| `list` | Bullet list with severity |\n| `code` | Monospace code block with language label |\n| `chart` | Bar, line, pie, or radar chart via Recharts |\n| `diff` | Unified diff (color-coded) or before/after |\n| `timeline` | Vertical dot-and-line timeline |\n| `kanban` | Horizontal column board |\n| `progress` | Progress bar |\n| `checklist` | Interactive checkboxes |\n| `rating` | Interactive star rating |\n| `button_group` | Action buttons (primary / default) |\n| `form` | Input fields + submit |\n| `confirmation` | Human-approval gate with risk badge |\n| `tool_preview` | Tool call result with status badge |\n| `memory_card` | Memory candidate with confidence % |\n| + custom | Unknown types fall back gracefully |\n\n## Tailwind CSS\n\n`@adam2go/tilo-react` components use Tailwind CSS utility classes. Add the package to your `tailwind.config.js` content scan:\n\n```js\n// tailwind.config.js\nmodule.exports = {\n  content: [\n    \"./src/**/*.{js,ts,jsx,tsx}\",\n    \"./node_modules/@adam2go/tilo-react/dist/**/*.{js,mjs}\",\n  ],\n};\n```\n\n## Peer dependencies\n\n| Package | Version |\n|---|---|\n| `react` | ≥ 18 |\n| `react-dom` | ≥ 18 |\n| `recharts` | ≥ 2 (for chart blocks) |\n| `lucide-react` | ≥ 0.400 (for icons) |\n\n## API\n\n### `<TiloRenderer>`\n\n| Prop | Type | Description |\n|---|---|---|\n| `surface` | `SurfaceSpec` | The surface spec to render |\n| `onAction` | `(event: TiloAction) => void \\| Promise<void>` | Action callback |\n| `components` | `BlockOverrides` | Per-type visual overrides |\n| `blockWrapper` | `(block, child) => ReactNode` | Wrapper around each block |\n\n### `createTiloClient(options)`\n\nReturns a `TiloClient` with:\n- `fetchRunSurfaceTurns(runId)` → `SurfaceTurn[]`\n- `fetchSessionSurfaceTurns(sessionId, limit?)` → `SurfaceTurn[]`\n- `executeSurfaceAction(params)` → `SurfaceActionResult`\n\n### `useTiloSurface(options)`\n\n| Option | Type | Description |\n|---|---|---|\n| `client` | `TiloClient` | Client from `createTiloClient` |\n| `runId` | `string \\| null` | Fetch turns for a specific run |\n| `sessionId` | `string \\| null` | Fetch turns for a conversation |\n| `pollingMs` | `number` | Auto-refresh interval (0 = off) |\n| `enabled` | `boolean` | Enable/disable fetching |\n\nReturns `{ turns, loading, error, refresh }`.\n\n## License\n\nMIT — part of [Tilo Framework](https://github.com/adam2go/tilo-framework)\n","readmeFilename":"README.md"}