nearle admin agent fix

This commit is contained in:
2026-09-28 11:25:32 +05:30
parent 21818320a0
commit 153f87b577
2 changed files with 44 additions and 15 deletions

View File

@@ -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;

View File

@@ -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?',
],
},