{"_id":"@baguette-studios/kernl-react-native","name":"@baguette-studios/kernl-react-native","dist-tags":{"latest":"0.2.0"},"versions":{"0.2.0":{"name":"@baguette-studios/kernl-react-native","version":"0.2.0","type":"module","private":false,"description":"Headless React Native bindings for the Kernl embedded-agent runtime.","license":"ISC","repository":{"type":"git","url":"git+https://github.com/Jules-Astier/agent-context.git","directory":"packages/react-native"},"homepage":"https://github.com/Jules-Astier/agent-context#readme","bugs":{"url":"https://github.com/Jules-Astier/agent-context/issues"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"sideEffects":false,"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./lifecycle":{"types":"./dist/lifecycle.d.ts","import":"./dist/lifecycle.js","default":"./dist/lifecycle.js"},"./navigation":{"types":"./dist/navigation.d.ts","import":"./dist/navigation.js","default":"./dist/navigation.js"},"./persistence":{"types":"./dist/persistence.d.ts","import":"./dist/persistence.js","default":"./dist/persistence.js"}},"scripts":{"build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.json --noEmit","test":"vitest run --root ../.. --config packages/react-native/vitest.config.ts"},"dependencies":{"@baguette-studios/kernl-client":"0.2.0","@baguette-studios/kernl-core":"0.2.0"},"peerDependencies":{"react":"^18.2.0 || ^19.0.0","react-native":">=0.76.0 <0.87.0"},"devDependencies":{"@types/react":"^19.2.17","@types/react-test-renderer":"^19.1.0","react":"19.2.3","react-test-renderer":"19.2.3","typescript":"^5.8.3","vitest":"^4.1.9"},"_id":"@baguette-studios/kernl-react-native@0.2.0","gitHead":"9af8d0156c9d7ee9a8038da7bc30000db9ce3871","_nodeVersion":"22.23.1","_npmVersion":"10.9.8","dist":{"integrity":"sha512-FeULxpZBMNBIazO+S2vPIenVrte/wbl6LpoyUoEB5bmaacmL16A53DR/AcqC1IBneVCyzjI3Fn+khCqu8y3jrQ==","shasum":"3addae3abf6220054c3c6b5554aa64ee7f86b985","tarball":"https://registry.npmjs.org/@baguette-studios/kernl-react-native/-/kernl-react-native-0.2.0.tgz","fileCount":15,"unpackedSize":88868,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDY+dBM/ftTiF69ZA34ukvP1qPye3Xx+sH9rMH8IyVFwAiADO30WxjanlQ4hwUx7Ai1XwMH/rnuaR+9c07Rk7UCMhQ=="}]},"_npmUser":{"name":"baguette-studios","email":"astier.jules@gmail.com"},"directories":{},"maintainers":[{"name":"baguette-studios","email":"astier.jules@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/kernl-react-native_0.2.0_1784802662448_0.7590618830551081"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-23T10:31:02.236Z","0.2.0":"2026-07-23T10:31:02.602Z","modified":"2026-07-23T10:31:02.906Z"},"maintainers":[{"name":"baguette-studios","email":"astier.jules@gmail.com"}],"description":"Headless React Native bindings for the Kernl embedded-agent runtime.","homepage":"https://github.com/Jules-Astier/agent-context#readme","repository":{"type":"git","url":"git+https://github.com/Jules-Astier/agent-context.git","directory":"packages/react-native"},"bugs":{"url":"https://github.com/Jules-Astier/agent-context/issues"},"license":"ISC","readme":"# @baguette-studios/kernl-react-native\n\nHeadless React Native bindings for Kernl. The package provides React lifecycle registration, sessions, approvals, forms, asynchronous native persistence, app lifecycle state, and router-neutral navigation without importing the web React or DOM UI packages.\n\n```tsx\nimport { AppState } from \"react-native\";\nimport AsyncStorage from \"@react-native-async-storage/async-storage\";\nimport {\n  AgentBoundary,\n  AgentProvider,\n  createAsyncStorageDriver,\n  createNativeAgentSessionStore,\n  createReactNativeAppStateAdapter,\n  useAgentMessages,\n  useAgentSendMessage,\n  useAgentTool,\n} from \"@baguette-studios/kernl-react-native\";\n\nconst sessionStore = createNativeAgentSessionStore(\n  createAsyncStorageDriver(AsyncStorage),\n);\nconst lifecycle = createReactNativeAppStateAdapter(AppState);\n\nexport function InvoiceScreen() {\n  return (\n    <AgentProvider\n      adapter={testingAdapter}\n      appLifecycle={lifecycle}\n      user={{ id: \"user_1\" }}\n      sessionPersistence={{\n        namespace: \"billing\",\n        sessionId: \"invoice-thread\",\n        store: sessionStore,\n      }}\n    >\n      <AgentBoundary id=\"invoice\" title=\"Invoice\" type=\"page\">\n        <InvoiceAgent />\n      </AgentBoundary>\n    </AgentProvider>\n  );\n}\n\nfunction InvoiceAgent() {\n  const messages = useAgentMessages();\n  const sendMessage = useAgentSendMessage();\n  useAgentTool({\n    name: \"readInvoice\",\n    description: \"Read the mounted invoice\",\n    risk: \"read\",\n    run: async () => ({ id: \"inv_1\", status: \"overdue\" }),\n  });\n  // Render any native UI. Kernl UI is optional.\n  return null;\n}\n```\n\n## Persistence and security\n\n`createNativeAgentSessionStore` accepts a small asynchronous key/value driver. `createAsyncStorageDriver` and `createSecureStoreDriver` adapt the common community driver shapes without hard dependencies on either package.\n\nPersistence activates only when `sessionPersistence` is configured and a stable user id is available from `sessionPersistence.userId`, `user.id`, or `context.id`. Keys include namespace, user, and session. Records contain visible messages and thread metadata only. Hosted client configuration, authorization callbacks, headers, and session JWTs remain in `@baguette-studios/kernl-client` memory and are never part of a persistence record. Credential-shaped keys and JWT-like text are removed or redacted before a record is written.\n\nSecureStore is appropriate for small preferences or metadata. Conversation transcripts may exceed platform SecureStore value limits; AsyncStorage-compatible storage is the normal transcript adapter.\n\nServer-backed history remains available with `client={{ url, serverSessionHistory: true }}`. Application authorization remains the responsibility of the host backend issuing short-lived Kernl session credentials.\n\n## App lifecycle\n\nPass `createReactNativeAppStateAdapter(AppState)` to `appLifecycle`. The provider owns one change listener and removes it on unmount. Background/foreground transitions update `useAgentSession().lifecycleState` and flush configured persistence; they do not replay sends or recreate subscriptions. `cancelSend()` aborts the active Kernl tool signal where supported.\n\n## Navigation\n\n`createNativeNavigationTarget` turns a `NativeNavigationAdapter` into a normal Kernl navigation target. `createReactNavigationAdapter` and `createExpoRouterAdapter` accept router-shaped objects supplied by the host, so neither router is a dependency.\n\n## Public API\n\n- Runtime: `AgentProvider`, `AgentBoundary`, `useAgentRuntime`, `useAgentSnapshot`, `useAgentEventLog`\n- Contributions: `useAgentScope`, `useKernl`, `useAgentInstruction`, `useAgentTool`, `useAgentPrompt`, `useAgentNavigation`\n- Invocation: `useAgentInvokeTool`, `useAgentInvokeNavigation`\n- Sessions: `useAgentSession`, `useAgentMessages`, `useAgentSendMessage`, `useAgentLifecycleState`\n- Human input: `useAgentApprovals`, `useAgentForms`\n- Personas: `useAgentUser`, `useAgentPersonas`, `useActiveAgent`, `useAgentHandoffTargets`, `useAgentHandoffToolName`\n- Persistence: `createNativeAgentSessionStore`, `createAsyncStorageDriver`, `createSecureStoreDriver`\n- Lifecycle: `createReactNativeAppStateAdapter`\n- Navigation: `createNativeNavigationTarget`, `createReactNavigationAdapter`, `createExpoRouterAdapter`\n\nThe package requires React 18.2+ or 19 and React Native 0.76 through 0.86. It contains no UI dependency; pair it with `@baguette-studios/kernl-react-native-ui` or build a fully custom native interface.\n","readmeFilename":"README.md","_rev":"1-966e41ae3ab45c61e0f539300ab0d9cc"}