From 153f87b5779345fd0655f46840f8e0f2e9ef00fc Mon Sep 17 00:00:00 2001 From: abhishek Date: Mon, 28 Sep 2026 11:25:32 +0530 Subject: [PATCH] nearle admin agent fix --- src/components/shell/assistantContext.test.ts | 2 +- src/components/shell/assistantContext.ts | 57 ++++++++++++++----- 2 files changed, 44 insertions(+), 15 deletions(-) diff --git a/src/components/shell/assistantContext.test.ts b/src/components/shell/assistantContext.test.ts index 17321f6..533a06e 100644 --- a/src/components/shell/assistantContext.test.ts +++ b/src/components/shell/assistantContext.test.ts @@ -82,7 +82,7 @@ test('every agent named here exists on the backend', () => { // The agents are YAML in backend_fiesta/services/agents. A name that does not // match one is refused at the door, and the person sees a failed question // rather than a disabled composer — worse, because it looks like a fault. - const shipped = new Set(['console', 'orders', 'inventory', 'shopfloor']); + const shipped = new Set(['console', 'orders', 'inventory', 'shopfloor', 'platform']); for (const [route, context] of Object.entries(CONTEXT)) { if (!context.agent) continue; diff --git a/src/components/shell/assistantContext.ts b/src/components/shell/assistantContext.ts index dfe1f63..3a8e9cf 100644 --- a/src/components/shell/assistantContext.ts +++ b/src/components/shell/assistantContext.ts @@ -34,35 +34,64 @@ export const CONTEXT: Record< agent?: string; } > = { + /* ── Nearle Admin ───────────────────────────────────────────────────────── + * + * The `platform` agent, which holds ONE tool: `help`. + * + * Not a reduced version of the merchant agents — the only one a platform + * account can use. `issuperadmin` reads across every merchant and belongs to + * none, so it carries no tenant, and all eight tools that read a shop's data + * declare `RequiresTenant` or `RequiresBranch` and refuse it. Giving this + * workspace those tools would produce a composer that accepts every question + * and answers "pick a shop first" to all of them. + * + * The chips changed with it, and had to. They used to ask "Which tenants have + * no branches?" and "Summarise platform growth" — questions no tool here can + * answer. The rule above holds: a chip that comes back "I cannot look that + * up" reads as a broken assistant rather than an unbuilt feature. + * + * The corpus now carries platform passages as well as the merchant ones — + * what creating a branch produces, what assigning a delivery partner does, + * what a district is, and why a shop's own figures are not reachable from + * here. The chips ask those. + */ + '/nearle/stores': { + agent: 'platform', page: 'Stores', title: 'Nearle Buddy', - greeting: 'Every tenant on the platform, and which of them have branches sitting idle.', - reading: 'Would cover the tenant directory — branch counts, status and per-tenant performance.', + greeting: 'Answers about how Nearle works — not about any one shop’s numbers.', + reading: 'Reads the help material. A shop’s own data is reachable only from inside its console.', prompts: [ - 'Which tenants have no branches?', - 'Who onboarded most recently?', - 'What needs attention?', - 'Summarise platform growth', + 'What does creating a branch actually create?', + 'Why can I not see a shop’s orders from here?', + 'How does a shop get riders?', + 'What is the difference between a till account and a console login?', ], }, '/nearle/onboard/tenant': { + agent: 'platform', page: 'Onboard tenant', title: 'Provisioning a tenant', - greeting: 'Registering the enterprise also creates its primary Administrator account.', - reading: 'Would cover the onboarding form — required fields, category and head-office address.', - prompts: ['What does provisioning create?', 'Which fields are required?', 'What happens next?'], + greeting: 'A branch is never created alone — it arrives with somebody who can run it.', + reading: 'Reads the help material on onboarding, accounts and delivery regions.', + prompts: [ + 'What does creating a branch actually create?', + 'New outlet cannot sign in', + 'What is a district?', + 'How does a shop get riders?', + ], }, '/nearle/catalogue': { + agent: 'platform', page: 'Global catalogue', title: 'Stocking a store', greeting: 'The catalogue carries a price range, not a price — the store sets the real one.', - reading: 'Would cover the global catalogue and what this tenant has already imported.', + reading: 'Reads the help material on how the catalogue reaches a shop’s shelf.', prompts: [ - 'Which products are already imported?', - 'Catalogue or spreadsheet?', - 'What does re-importing do?', - 'Which columns does the sheet need?', + 'What does re-importing a product do?', + 'Why is a product in my catalogue but not on the shelf?', + 'Why can I not see a shop’s stock from here?', ], },