@burdenoff/microfe-healthybowl 2026.919.4 → 2026.924.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistantUsecases.js","names":[],"sources":["../../src/config/assistantUsecases.ts"],"sourcesContent":["/**\n * HealthyBowl AI Assistant usecases.\n *\n * `AssistantUsecaseId` is the full set of modes the transport/runtime\n * understands — it drives the image/resource switches in `services/assistantApi`.\n * `ASSISTANT_USECASE_CONFIG` is the set of modes the panel KNOWS about; the mode\n * selector further filters them at runtime by the user's role (see\n * `useAssistantApiAccess`) so a write-capable mode only appears for org admins.\n * - `general` — docs Q&A (proxy-token auth, available to everyone).\n * - `api-calls` — WRITE-CAPABLE: the agent executes GraphQL on the user's\n * behalf (app-client-credentials auth). Minting its per-sandbox OAuth app\n * requires a global Owner/Admin actor, so it is gated to admins, guarded by a\n * confirm-before-mutate dialog + a soft agent preamble, and master-flagged.\n * - `vibe-plugins` — a VibeControls-only concept HealthyBowl never exposes.\n */\n\n// Full set of runtime-understood modes. Keep in sync with the image/resource\n// switches in `services/assistantApi.ts`.\nexport type AssistantUsecaseId = 'general' | 'assistant' | 'api-calls' | 'vibe-plugins';\n\nexport interface AssistantUsecase {\n id: AssistantUsecaseId;\n label: string;\n description: string;\n suggestions: readonly string[];\n /** Only offered to a global Owner/Admin (minting the OAuth app needs admin). */\n requiresAdmin?: boolean;\n /** Executes mutations on live data → triggers the confirm-before-mutate guard. */\n writeCapable?: boolean;\n}\n\n/**\n * Master switch for the write-capable `api-calls` (\"Actions\") mode. Enabled on\n * ALL environments (alpha + production) as of 2026-06-30, by explicit product\n * decision. The mode remains gated by: (1) the admin check — only org\n * Owners/Admins ever see it (useAssistantApiAccess), (2) a one-time consent\n * dialog, (3) the user's approval of each write — since 2026-09-07 the sandbox\n * refuses a mutation and holds it until the user presses Approve on the\n * pending-write card (ai-assistant #41/#42, fe-libs #194), and the model holds\n * no token that could send it — and (4) a describe-and-confirm instruction\n * prepended to the prompt, which is advisory. The approval is recorded inside\n * the sandbox, so it stops an accidental or misread write; it is not a wall\n * against a model set on getting round it.\n *\n * `typeof window` keeps it false during any non-browser evaluation; in the\n * browser it's always on (the admin gate is the real boundary).\n */\nexport const API_CALLS_MODE_ENABLED = typeof window !== 'undefined';\n\n// Default \"Ask\" for EVERY user: docs Q&A + READ-ONLY live data. Unlike\n// `api-calls` it authenticates with the user's OWN forwarded token (no\n// admin-gated OAuth-app mint), and the in-sandbox helper rejects mutations\n// (AI_ASSISTANT_READONLY) — so it needs no admin and answers questions like\n// \"list my livestock\" against real data. Writes live in `api-calls` below.\nconst ASSISTANT: AssistantUsecase = {\n id: 'assistant',\n label: 'Ask',\n description:\n 'Ask about HealthyBowl and your own farm data — crops, livestock, weather, finances. Reads your live records; use \"Take action\" to make changes.',\n suggestions: [\n 'List all my livestock',\n 'How many crops do I have?',\n 'Explain the livestock health tracker',\n 'What government schemes can I apply for?',\n ],\n};\n\nconst API_CALLS: AssistantUsecase = {\n id: 'api-calls',\n // Display label only — the mode ID stays 'api-calls' (see services/assistantApi).\n label: 'Take action',\n description:\n 'Let the assistant take actions for you — add crops, log harvests, update records. It describes what it will do and asks before changing anything.',\n suggestions: [\n 'Add a new crop',\n 'Log a harvest for one of my fields',\n 'List all my livestock',\n \"Update a crop's status\",\n ],\n
|
|
1
|
+
{"version":3,"file":"assistantUsecases.js","names":[],"sources":["../../src/config/assistantUsecases.ts"],"sourcesContent":["/**\n * HealthyBowl AI Assistant usecases.\n *\n * `AssistantUsecaseId` is the full set of modes the transport/runtime\n * understands — it drives the image/resource switches in `services/assistantApi`.\n * `ASSISTANT_USECASE_CONFIG` is the set of modes the panel KNOWS about; the mode\n * selector further filters them at runtime by the user's role (see\n * `useAssistantApiAccess`) so a write-capable mode only appears for org admins.\n * - `general` — docs Q&A (proxy-token auth, available to everyone).\n * - `api-calls` — WRITE-CAPABLE: the agent executes GraphQL on the user's\n * behalf (app-client-credentials auth). Minting its per-sandbox OAuth app\n * requires a global Owner/Admin actor, so it is gated to admins, guarded by a\n * confirm-before-mutate dialog + a soft agent preamble, and master-flagged.\n * - `vibe-plugins` — a VibeControls-only concept HealthyBowl never exposes.\n */\n\n// Full set of runtime-understood modes. Keep in sync with the image/resource\n// switches in `services/assistantApi.ts`.\nexport type AssistantUsecaseId = 'general' | 'assistant' | 'api-calls' | 'vibe-plugins';\n\nexport interface AssistantUsecase {\n id: AssistantUsecaseId;\n label: string;\n description: string;\n suggestions: readonly string[];\n /** Only offered to a global Owner/Admin (minting the OAuth app needs admin). */\n requiresAdmin?: boolean;\n /** Executes mutations on live data → triggers the confirm-before-mutate guard. */\n writeCapable?: boolean;\n}\n\n/**\n * Master switch for the write-capable `api-calls` (\"Actions\") mode. Enabled on\n * ALL environments (alpha + production) as of 2026-06-30, by explicit product\n * decision. The mode remains gated by: (1) the admin check — only org\n * Owners/Admins ever see it (useAssistantApiAccess), (2) a one-time consent\n * dialog, (3) the user's approval of each write — since 2026-09-07 the sandbox\n * refuses a mutation and holds it until the user presses Approve on the\n * pending-write card (ai-assistant #41/#42, fe-libs #194), and the model holds\n * no token that could send it — and (4) a describe-and-confirm instruction\n * prepended to the prompt, which is advisory. The approval is recorded inside\n * the sandbox, so it stops an accidental or misread write; it is not a wall\n * against a model set on getting round it.\n *\n * `typeof window` keeps it false during any non-browser evaluation; in the\n * browser it's always on (the admin gate is the real boundary).\n */\nexport const API_CALLS_MODE_ENABLED = typeof window !== 'undefined';\n\n// Default \"Ask\" for EVERY user: docs Q&A + READ-ONLY live data. Unlike\n// `api-calls` it authenticates with the user's OWN forwarded token (no\n// admin-gated OAuth-app mint), and the in-sandbox helper rejects mutations\n// (AI_ASSISTANT_READONLY) — so it needs no admin and answers questions like\n// \"list my livestock\" against real data. Writes live in `api-calls` below.\nconst ASSISTANT: AssistantUsecase = {\n id: 'assistant',\n label: 'Ask',\n description:\n 'Ask about HealthyBowl and your own farm data — crops, livestock, weather, finances. Reads your live records; use \"Take action\" to make changes.',\n suggestions: [\n 'List all my livestock',\n 'How many crops do I have?',\n 'Explain the livestock health tracker',\n 'What government schemes can I apply for?',\n ],\n};\n\nconst API_CALLS: AssistantUsecase = {\n id: 'api-calls',\n // Display label only — the mode ID stays 'api-calls' (see services/assistantApi).\n label: 'Take action',\n description:\n 'Let the assistant take actions for you — add crops, log harvests, update records. It describes what it will do and asks before changing anything.',\n suggestions: [\n 'Add a new crop',\n 'Log a harvest for one of my fields',\n 'List all my livestock',\n \"Update a crop's status\",\n ],\n writeCapable: true,\n};\n\n// Modes the panel knows about. The default \"Ask\" is now the read-only\n// `assistant` mode (docs + live data, available to everyone). `api-calls`\n// (\"Take action\", write) is added when enabled and further filtered to admins\n// at runtime by the mode selector. `general` (docs-only) is retained in the\n// type for back-compat with persisted conversations but no longer surfaced.\nexport const ASSISTANT_USECASE_CONFIG: readonly AssistantUsecase[] = API_CALLS_MODE_ENABLED\n ? [ASSISTANT, API_CALLS]\n : [ASSISTANT];\n"],"mappings":";AA+CA,IAAa,IAAyB,OAAO,SAAW,KAOlD,IAA8B;CAClC,IAAI;CACJ,OAAO;CACP,aACE;CACF,aAAa;EACX;EACA;EACA;EACA;CACF;AACF,GAsBa,IAAwD,IACjE,CAAC,GAAW;CApBd,IAAI;CAEJ,OAAO;CACP,aACE;CACF,aAAa;EACX;EACA;EACA;EACA;CACF;CACA,cAAc;AASA,CAAS,IACrB,CAAC,CAAS"}
|
package/package.json
CHANGED