jaz-clio 5.20.1 → 5.20.2
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.
- package/assets/skills/api/SKILL.md +1 -1
- package/assets/skills/cli/SKILL.md +1 -1
- package/assets/skills/conversion/SKILL.md +1 -1
- package/assets/skills/jaz-pseudo-sql/SKILL.md +1 -1
- package/assets/skills/jobs/SKILL.md +1 -1
- package/assets/skills/transaction-recipes/SKILL.md +1 -1
- package/cli.mjs +1 -1
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -868,7 +868,7 @@ btType enum: SALE = invoice, PURCHASE = bill, SALE_CREDIT_NOTE = customer CN, PU
|
|
|
868
868
|
|
|
869
869
|
Each result carries contactSignals (Mid-7: cadence, outliers, severity, divergences from contact's modal pattern; null if no contact / no history) and breakdown (Balance-panel payload: line items + subtotal/tax/total/balance/exchange rate). Top-level contactSignalsMeta.unavailable=true \u2192 freshness layer offline for whole batch.
|
|
870
870
|
|
|
871
|
-
USE THIS to score a specific draft against contact history. For stand-alone "what does this contact normally look like?" without a draft \u2192 use get_contact_signals.`,params:{items:{type:"array",description:"Draft business transaction references (max 500). Mix any btType freely.",items:{type:"object",properties:{btResourceId:{type:"string",description:"Draft BT resource ID (UUID) \u2014 required"},btType:{type:"string",enum:["SALE","PURCHASE","SALE_CREDIT_NOTE","PURCHASE_CREDIT_NOTE"],description:"Required"}}}}},required:["items"],group:"drafts",readOnly:!0,isConcurrencySafe:!0,searchHint:"validate drafts eligibility check before convert promote",execute:async(t,e)=>(iv(e.items),RY(t.client,e.items))},{name:"convert_drafts_to_active",description:`BULK promote \u2014 finalize up to 500 draft business transactions to ACTIVE in ONE call, mixing any combination of invoices, bills, and credit notes (no per-type tools needed). ${Tu} NOT idempotent: a second call on already-promoted drafts returns 422. Filter the draft list by status: DRAFT before submitting. Pair with validate_drafts for a pre-flight check on large batches.`,params:{items:{type:"array",description:"Draft BT references (max 500). Mix any btType.",items:{type:"object",properties:{btResourceId:{type:"string",description:"Draft BT resource ID (UUID) \u2014 required"},btType:{type:"string",enum:["SALE","PURCHASE","SALE_CREDIT_NOTE","PURCHASE_CREDIT_NOTE"],description:"Required"}}}}},required:["items"],group:"drafts",readOnly:!1,searchHint:"convert drafts to active promote finalize bulk",execute:async(t,e)=>(iv(e.items),xY(t.client,e.items))},{name:"submit_drafts_for_approval",description:`BULK submit \u2014 route up to 500 draft business transactions into the approval workflow in ONE call, mixing any combination of invoices, bills, and credit notes. ${Tu} NOT idempotent on drafts that already have an in-flight approval request.`,params:{items:{type:"array",description:"Draft BT references (max 500). Mix any btType.",items:{type:"object",properties:{btResourceId:{type:"string",description:"Draft BT resource ID (UUID) \u2014 required"},btType:{type:"string",enum:["SALE","PURCHASE","SALE_CREDIT_NOTE","PURCHASE_CREDIT_NOTE"],description:"Required"}}}}},required:["items"],group:"drafts",readOnly:!1,searchHint:"submit drafts for approval workflow review bulk",execute:async(t,e)=>(iv(e.items),TY(t.client,e.items))},{name:"search_help_center",description:'Search the Jaz help center for how-to articles, feature guides, and accounting concepts. Use this for "how do I..." or "what is..." questions about Jaz: bank reconciliation, GST/VAT filing, multi-currency, fixed assets, custom fields, integrations, and so on. Returns top matching articles with title, section, content, and source URL.',params:{query:{type:"string",description:'Natural-language question or keywords (e.g. "how do I reconcile a bank statement", "set up GST", "multi-currency invoice").'},limit:{type:"number",description:"Maximum number of articles to return (default 3, max 10)."},section:{type:"string",description:'Optional: restrict to a single help-center section slug (e.g. "bank-reconciliations", "invoices").'}},required:["query"],group:"help_center",readOnly:!0,searchHint:"help center docs how to guide article search question",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async(t,e)=>{let r=String(e.query??"").trim();if(!r)return{error:"Query is required.",hint:"Pass a natural-language question or keywords."};let n=typeof e.limit=="number"&&!Number.isNaN(e.limit)?e.limit:3,i=Math.max(1,Math.min(10,Math.floor(n))),s=typeof e.section=="string"?e.section:void 0;try{let o=VR();if(s&&!o.sections.some(u=>u.slug===s))return{error:`Unknown section: "${s}".`,available:o.sections.map(u=>u.slug),hint:"Omit the section parameter to search every section, or pick a slug from the available list."};let a=JR(),c=await WR(o,a,r,{mode:"hybrid",limit:i,section:s});return c.length===0?{results:[],hint:"No matching articles. Try broader keywords or rephrase the question."}:{results:c.map(u=>{let f=(Hae(u.article)??u.article.snippet).slice(0,1500);return{title:u.article.title,section:u.section.name,sectionSlug:u.section.slug,content:f,url:u.article.sourceUrl,score:Math.round(u.score*1e3)/1e3,scoreKind:u.scoreKind,matchedTerms:u.matchedTerms}}),totalArticles:o.articleCount,searchedSections:s?[s]:void 0}}catch(o){return{error:"Help center search failed.",detail:o instanceof Error?o.message:String(o),hint:"The bundled help-center index may be missing or corrupt."}}}},{name:"present_questions",description:`Present the user with a bounded multiple-choice question as an interactive pick-list, instead of asking in prose. Use as your FINAL action when you need the user to choose among a KNOWN, finite set of options to continue (e.g. "which bank account?", "which of these duplicate bills?"). List the options and stop \u2014 the user's pick arrives as their next message and starts a new turn. Do NOT use for open-ended input (names, amounts, free text \u2014 ask in plain prose) or for confirming destructive actions (confirm in prose). This is terminal: do not call further tools or re-list the options in text afterward.`,params:{questions:{type:"array",description:"Questions to ask. Currently the first is rendered (single question, single-select) \u2014 provide one unless you genuinely have several to ask in sequence.",items:{type:"object",properties:{header:{type:"string",description:'Optional short eyebrow label categorizing the question (1-2 words, e.g. "Account", "Period").'},question:{type:"string",description:'The question, shown as the card title (e.g. "Which bank account should I inspect?").'},options:{type:"array",description:"2-8 concrete choices.",items:{type:"object",properties:{label:{type:"string",description:"The choice shown on the row and relayed verbatim as the user's answer when picked \u2014 keep it self-contained and unambiguous."},description:{type:"string",description:'Optional one-line detail under the label (e.g. "554 unreconciled records").'}},required:["label"]}},multiSelect:{type:"boolean",description:"Reserved for future multi-select; single-select only today. Omit or set false."}},required:["question","options"]}}},required:["questions"],group:"interaction",alwaysLoaded:!0,disabled:!0,readOnly:!0,isConcurrencySafe:!0,searchHint:"present questions options choices pick select ask user interactive widget",maxResultSizeChars:2e4,execute:async(t,e)=>{let n=(Array.isArray(e?.questions)?e.questions:[]).filter(i=>typeof i=="object"&&i!==null).map(i=>{let s=(Array.isArray(i.options)?i.options:[]).filter(a=>typeof a=="object"&&a!==null).map(a=>{let c=String(a.label??"").trim();return a.description?{label:c,description:String(a.description)}:{label:c}}).filter(a=>a.label),o=String(i.question??"").trim();return{...i.header?{header:String(i.header)}:{},question:o,options:s,multiSelect:!!i.multiSelect}}).filter(i=>i.question&&i.options.length>=2);return n.length===0?{error:"present_questions needs at least one question with non-empty question text and \u22652 labeled options (a single-option pick-list is not a choice).",hint:"Provide questions: [{ question, options: [{ label }, { label }] }]. For open-ended input, ask in prose instead."}:{questions:n}}},{name:"find_dashboard_destinations",description:'Discover valid destinations for get_dashboard_url. Returns dashboard screens and record/modal types as { key, label, kind }. Filter with `query` (substring over key + label, e.g. "invoice", "report", "settings"), `resource` (e.g. "sales", "purchases"), or `kind` ("screen" | "modal"). Results are capped; narrow the filter if `truncated` is true. Call this first when you are unsure of the exact destination key.',params:{query:{type:"string",description:'Case-insensitive substring to match against destination keys and labels (e.g. "invoice", "p&l", "bank").'},resource:{type:"string",description:'Restrict to one resource namespace, e.g. "sales", "purchases", "reports", "settings".'},kind:{type:"string",description:'Restrict to "screen" (list/report pages) or "modal" (record view/create/edit).',enum:["screen","modal"]}},required:[],group:"navigation",readOnly:!0,isConcurrencySafe:!0,searchHint:"list dashboard destinations find screens modals navigation keys catalog",maxResultSizeChars:16e3,execute:async(t,e)=>{let r=e.kind==="screen"||e.kind==="modal"?e.kind:void 0,n=UFe({query:typeof e.query=="string"?e.query:void 0,resource:typeof e.resource=="string"?e.resource:void 0,kind:r});return n.truncated?{...n,hint:`Showing ${n.results.length} of ${n.total} matches. Narrow with a more specific query, resource, or kind.`}:n}},{name:"get_dashboard_url",description:'Build a deep link to a dashboard screen or record so you can hand the user a URL ("here is the page: <url>"). `destination` is a key from find_dashboard_destinations \u2014 a screen (e.g. "sales.transactions.active-sales", "reports.profit-and-loss") or a record modal (e.g. "sales.modal.view-sale", "sales.modal.new-sale", "settings.modal.user_management"). For a record-specific modal (view/edit/duplicate a particular record) pass `resourceId` (the Jaz resourceId of that record); omit it for screens and for create/"new" modals. The link opens in the user\'s current org. Returns { url, kind, label }.',params:{destination:{type:"string",description:'Destination key from find_dashboard_destinations, e.g. "reports.profit-and-loss" or "sales.modal.view-sale".'},resourceId:{type:"string",description:"Jaz resourceId of the record to focus \u2014 only for record modals (view/edit a specific record). Omit for screens and create modals."}},required:["destination"],group:"navigation",readOnly:!0,isConcurrencySafe:!0,searchHint:"dashboard url deep link navigate go to open screen record modal page",execute:async(t,e)=>{let{dashboardUrl:r}=OFe(t.platform??"jaz");try{return $Fe(typeof e.destination=="string"?e.destination:"",typeof e.resourceId=="string"&&e.resourceId?e.resourceId:void 0,{dashboardUrl:r,orgResourceId:t.org?.resourceId})}catch(n){return{error:n instanceof Error?n.message:String(n)}}}}]});function Zit(t,e=5){let r=t.trim().toLowerCase();if(!r)return[];let n=r.split(/[\s_-]+/).filter(s=>s.length>=2);return n.length===0?[]:Qc.map(s=>{let o=0,a=s.name.toLowerCase(),c=s.description.toLowerCase();(a===r||a===r.replace(/\s+/g,"_"))&&(o+=5),a.includes(r)&&(o+=3),c.includes(r)&&(o+=1);for(let u of n)a.includes(u)&&(o+=2),c.includes(u)&&(o+=1);return{ns:s,score:o}}).filter(s=>s.score>0).sort((s,o)=>o.score-s.score).slice(0,e).map(s=>s.ns)}var Qc,$x=re(()=>{"use strict";Qc=[{name:"invoices",description:"Sales invoices (INV/SI). Create, search, get, update, delete, pay, finalize, apply credits, download PDF. Also: receivables, AR, AR aging, billing, overdue invoices, dunning, recurring invoices.",groups:["invoices"]},{name:"customer_credit_notes",description:"Customer credit notes (CN). Create, search, update, delete, finalize, refund, download PDF. Also: sales returns, customer CN.",groups:["customer_credit_notes"]},{name:"bills",description:"Purchase bills (PO/PI). Create, search, get, update, delete, pay, finalize, apply credits. Also: payables, AP, vendor invoices, supplier bills.",groups:["bills"]},{name:"supplier_credit_notes",description:"Supplier credit notes. Create, search, update, delete, finalize, refund. Also: purchase returns, debit notes, supplier CN.",groups:["supplier_credit_notes"]},{name:"sale_orders",description:"Sales order documents: Sale Quotes (estimates/quotations) and Sale Orders. Create, get, search, update, and transition (accept a quote, confirm an order, void, delete). A Sale Order links to its quote via saleQuoteResourceId; the quote must be accepted first. Tracks fulfillment via orderState. Pipeline: quote \u2192 order \u2192 invoice (raise the invoice separately).",groups:["sale_orders"]},{name:"purchase_orders",description:"Purchase order documents: Purchase Requests (requisitions) and Purchase Orders (POs). Create, get, search, update, and transition (accept a request, confirm an order, void, delete). A Purchase Order links to its request via purchaseRequestResourceId; the request must be accepted first. Tracks fulfillment via orderState. Pipeline: request \u2192 order \u2192 bill (raise the bill separately).",groups:["purchase_orders"]},{name:"journals",description:"Journal entries (JE). Create, search, update, delete manual journals. Also: adjusting entries, accruals, reclassifications, corrections.",groups:["journals"]},{name:"cash_entries",description:"Cash-in receipts and cash-out disbursements for external cash movements. WHEN TO USE: money received from customers/external \u2192 cash-in. Money paid to suppliers/external \u2192 cash-out. For internal account-to-account transfers, use cash_transfers namespace.",groups:["cash_entries"]},{name:"cash_transfers",description:"Cash transfers between your own bank/cash accounts and cashflow transaction search. WHEN TO USE: moving funds between own accounts (main bank \u2192 petty cash, USD \u2192 SGD). For external receipts/payments, use cash_entries namespace.",groups:["cash_transfers"]},{name:"bank_accounts",description:"Bank accounts, bank statement imports (CSV/OFX), bank records search, auto-reconciliation. For unreconciled queries: ALWAYS search bank records with status UNRECONCILED after listing accounts. Also: bank feeds, bank balance.",groups:["bank"]},{name:"bank_rules",description:"Bank reconciliation rules (action shortcuts). Create, search, update, delete bank rules. Configure auto-matching rules for bank records.",groups:["bank_rules"]},{name:"reconciliations",description:"Apply a reconciliation decision to a bank statement entry \u2014 write side. Match bank records to EXISTING open bills/invoices/payments (reconcile_with_payments \u2014 the primary path, creates the payment for you), or to journals, cash entries, or transfers, or CREATE new bills/invoices (invoice_receipt/bill_receipt). Distinct from bank_accounts/bank_rules (which configure auto-reconciliation) and view_auto_reconciliation (which queries suggestions). Eleven endpoints: quick_reconcile + apply_bank_rule + magic_match (bulk), and direct_cash_entry / cash_journal / manual_journal / cash_transfer / invoice_receipt / bill_receipt / with_payments / learned_prediction (per-entry). Match-to-existing is preferred over create-new to avoid duplicates. Most fields prefill from the bank entry when omitted; FX is resolved server-side.",groups:["reconciliations"]},{name:"financial_reports",description:"Core financial statements: trial balance (TB), balance sheet (BS/B/S), profit & loss (PnL/P&L/income statement), cash flow, general ledger (GL), cash balance/position, equity movement, VAT/GST ledger. Also: how profitable, what is the balance. XLSX/PDF file exports of any of these statements are produced via download_export (lives in operational_reports namespace \u2014 switch there or call by name).",groups:["financial_reports"]},{name:"operational_reports",description:"Aging and operational reports: aged receivables (AR aging), aged payables (AP aging), AR report, bank balance summary, bank reconciliation reports, fixed asset (FA) summary, FA reconciliation. Data exports (CSV/Excel/XLSX). Anomaly detection and audit analysis: anomalous invoices, anomalous bills, cashflow anomalies, GL journal audit, exchange rate audit, receivables customer risk, cash expense health. Also: overdue analysis, how much owed, suspicious transactions, audit trail.",groups:["operational_reports","exports"]},{name:"pseudo_sql",description:"Pseudo-SQL ad-hoc read-only queries against the curated reporting schema (custom select, custom report, query data, run sql). Includes live schema introspection (get_pseudo_sql_schema) + sync preview (\u2264100 rows) + async CSV export. Use when search_* / download_export canonical reports don't cover the question.",groups:["pseudo_sql"]},{name:"contacts",description:"Contacts (customers/suppliers/vendors), contact groups, customer segmentation. Create, search, get, update, delete contacts. Bulk upsert contacts from CSV / spreadsheet imports \u2014 async, returns jobId, poll background_jobs. List/create contact groups.",groups:["contacts","contact_groups"]},{name:"items_and_inventory",description:"Products, services, inventory items. Create, search, get, update, delete items. Check inventory balance. Also: SKU, catalog, stock.",groups:["items","inventory"]},{name:"tags_and_custom_fields",description:"Tags for categorizing transactions. Custom fields for adding metadata (text, date, dropdown). Create, search, delete tags and custom fields.",groups:["tags","custom_fields"]},{name:"nano_classifiers",description:"Nano classifiers (tracking categories/dimensions). List, search, create, update, delete classifiers and their classes. Used for line-item tagging and dimensional reporting. Also: tracking categories, cost centers, departments, projects.",groups:["nano_classifiers"]},{name:"chart_of_accounts",description:"Chart of accounts (COA/GL accounts). Create, search, update accounts \u2014 including setting or removing an account's period lock date (lock / unlock a period, lock date: block recording or editing transactions on the account dated on or before a date). Bookmarks (favorites/shortcuts). Also: ledger codes, account types.",groups:["accounts","bookmarks"]},{name:"currencies",description:"Currencies, exchange rates (FX/forex). List/add org currencies. Set, update, import currency rates. Also: multi-currency, FX rates.",groups:["currencies"]},{name:"tax_profiles",description:"Tax profiles (GST/VAT/sales tax), withholding tax codes (WHT/ATC). Search, create, update tax profiles. List WHT codes.",groups:["tax_profiles"]},{name:"capsules_and_recipes",description:"Capsules (transaction groupings/capsule types). Financial recipes: amortization, depreciation, deferred revenue, IFRS 16 leases, hire purchase, fixed deposits, FX revaluation, loan schedules, ECL/expected credit loss, IAS 37 provisions, asset disposal. Two recipe execution paths: offline (plan_recipe + execute_recipe \u2014 client-side calculators, no API key) and server-side (list/get/preview/resume/rollback_capsule_recipe \u2014 produce real capsule entities via Jaz API). Plus capsuleRecipe payload on trigger mutations (create_bill, create_journal, create_cash_in, etc.) to create and trigger a recipe in one shot, with optional templateOverrides to customize the generated text (Customize Recipe). Keywords: calculate, provision, schedule, expected credit loss, revaluation, amortize, rollback recipe, customize template overrides slots.",groups:["capsules","recipes","capsule_recipes"]},{name:"scheduled_transactions",description:"Scheduled/recurring invoices, bills, journals. Create scheduled invoices/bills/journals, search scheduled transactions. Also: recurring, auto-generate.",groups:["schedulers"]},{name:"subscriptions",description:"Subscriptions (recurring billing/payment plans). Create, update, cancel, search subscriptions. Also: recurring charges, subscription schedules.",groups:["subscriptions"]},{name:"organization",description:"Organization info (name, currency, country, fiscal year). User management: invite, update, remove, search org users. Bulk invite.",groups:["organization","org_users"]},{name:"document_ai",description:"File attachments, spreadsheets, and document AI. Read and parse rows from attached spreadsheets \u2014 CSV, Excel, XLSX. Extract data from PDFs and images via AI/OCR: invoice, receipt, and bill scanning. Upload and list attachments; track extraction workflows.",groups:["attachments","magic"]},{name:"fixed_assets",description:"Fixed assets (PP&E/property, plant, equipment). Search, create, update, discard, sell, transfer, undo disposal. Also: depreciation, asset register.",groups:["fixed_assets"]},{name:"payments_and_search",description:"Payment records: get, update, delete individual payments. List payments/credits on invoices and bills. Reverse credit applications. Cashflow transaction search. Universal cross-entity search. Also: payment run, batch payment, payment matching, void payment, payment history, credit note applications.",groups:["payments","cashflow","search"]},{name:"quick_fix",description:"Quick Fix: bulk-update multiple transactions or line items in one call. Change dates, contacts, tags, accounts, tax profiles, custom fields across many invoices/bills/journals/credit-notes/cash-entries/schedulers at once. Also: batch update, mass edit.",groups:["quick_fix"]},{name:"export_records",description:"Export records to XLSX. List available columns, preview export scope (row count + sample), generate export file with pre-signed download URL. Supports any entity type: invoices, bills, contacts, items, journals, bank records, cashflow, fixed assets, etc. Pass query (structured search syntax) or filter (JSON), never both.",groups:["export_records"]},{name:"background_jobs",description:"Background job tracking. Poll any async operation by jobId (contacts bulk-upsert, items bulk-upsert, bank import, magic file processing, etc.). Filter by resourceId field to look up a specific job. Poll until status is SUCCESS, FAILED, or PARTIAL_SUCCESS.",groups:["background_jobs"]},{name:"drafts",description:"Draft business transactions \u2014 both local payload validation (invoices, bills, journals, credit notes) AND BULK-FRIENDLY server-side lifecycle: validate_drafts (sync eligibility check), convert_drafts_to_active (async promote to ACTIVE), submit_drafts_for_approval (async route to approval). The lifecycle tools are GENERIC and BULK \u2014 one call accepts up to 500 items mixing any combination of {btResourceId, btType: SALE|PURCHASE|SALE_CREDIT_NOTE|PURCHASE_CREDIT_NOTE}. No need for per-entity tools when promoting/submitting drafts at scale. NOT idempotent on already-promoted drafts.",groups:["drafts"]},{name:"help_center",description:"Search the Jaz help center for how-to articles, feature guides, accounting concepts, and troubleshooting. Returns top matches with title, section, snippet, and source URL. Works without an API key.",groups:["help_center"]},{name:"navigation",description:"Dashboard navigation deep links. Build a URL to any dashboard screen or record for the user. Also: open, go to, take me to, link, deep link, navigate, show me the page/screen for invoices, bills, reports, settings, or a specific transaction.",groups:["navigation"]}]});function r0r(){if(!R8){R8=new Map;for(let t of kc)R8.set(t.name,t)}return R8}function sy(t){return r0r().get(t)}function Ux(){return Zue||(Zue=kc.filter(t=>!t.disabled)),Zue}function $h(t){return Ux().filter(e=>e.group===t)}var R8,Zue,hv=re(()=>{"use strict";ov();R8=null,Zue=null});function x8(t){let e={type:t.type};if(t.description&&(e.description=t.description),t.enum&&(e.enum=t.enum),t.type==="array"&&t.items&&(e.items=x8(t.items)),t.type==="object"&&t.properties){let r={};for(let[n,i]of Object.entries(t.properties))r[n]=x8(i);e.properties=r,t.required?.length&&(e.required=t.required)}return e}function id(t,e){let r={};for(let[n,i]of Object.entries(t))r[n]=x8(i);return{type:"object",properties:r,...e.length>0?{required:e}:{}}}function oy(t){return{name:t.name,description:t.description,input_schema:id(t.params,t.required),...t.searchHint?{searchHint:t.searchHint}:{}}}var qx=re(()=>{"use strict"});function jx(t){if(typeof t!="string")return t.isDestructive??!1;let e=t;return e.startsWith("delete_")||e.startsWith("pay_")||e.startsWith("finalize_")||e.includes("refund")||e==="remove_org_user"}function T8(t){return{readOnlyHint:t.readOnly,destructiveHint:!t.readOnly&&jx(t),idempotentHint:t.readOnly,openWorldHint:t.openWorld??!1}}function Kit(t){if(!t.trim())return{namespaces:Qc.map(i=>{let s=i.groups.flatMap(o=>$h(o));return{name:i.name,description:i.description,toolCount:s.length,tools:s.map(o=>o.name)}}),hint:"Call describe_tools with specific tool names to get full schemas before executing."};let e=Zit(t,5);if(e.length===0)return{matches:[],hint:`No tools match "${t}". Try broader terms or call search_tools with empty query to see all namespaces.`};let n=t.toLowerCase().split(/\s+/).filter(Boolean);return{matches:e.map(i=>{let s=i.groups.flatMap(u=>$h(u)),o=s.map(u=>`${u.name} ${u.searchHint??""} ${u.description}`.toLowerCase()),a=new Map(n.map(u=>{let f=o.filter(d=>d.includes(u)).length;return[u,Math.log((s.length+1)/(f+1))]})),c=s.map((u,f)=>{let d=o[f],p=n.reduce((h,A)=>d.includes(A)?h+(a.get(A)??0):h,0);return{tool:u,score:p}}).sort((u,f)=>f.score-u.score);return{namespace:i.name,description:i.description,tools:c.map(u=>({name:u.tool.name,description:u.tool.description.split(`
|
|
871
|
+
USE THIS to score a specific draft against contact history. For stand-alone "what does this contact normally look like?" without a draft \u2192 use get_contact_signals.`,params:{items:{type:"array",description:"Draft business transaction references (max 500). Mix any btType freely.",items:{type:"object",properties:{btResourceId:{type:"string",description:"Draft BT resource ID (UUID) \u2014 required"},btType:{type:"string",enum:["SALE","PURCHASE","SALE_CREDIT_NOTE","PURCHASE_CREDIT_NOTE"],description:"Required"}}}}},required:["items"],group:"drafts",readOnly:!0,isConcurrencySafe:!0,searchHint:"validate drafts eligibility check before convert promote",execute:async(t,e)=>(iv(e.items),RY(t.client,e.items))},{name:"convert_drafts_to_active",description:`BULK promote \u2014 finalize up to 500 draft business transactions to ACTIVE in ONE call, mixing any combination of invoices, bills, and credit notes (no per-type tools needed). ${Tu} NOT idempotent: a second call on already-promoted drafts returns 422. Filter the draft list by status: DRAFT before submitting. Pair with validate_drafts for a pre-flight check on large batches.`,params:{items:{type:"array",description:"Draft BT references (max 500). Mix any btType.",items:{type:"object",properties:{btResourceId:{type:"string",description:"Draft BT resource ID (UUID) \u2014 required"},btType:{type:"string",enum:["SALE","PURCHASE","SALE_CREDIT_NOTE","PURCHASE_CREDIT_NOTE"],description:"Required"}}}}},required:["items"],group:"drafts",readOnly:!1,searchHint:"convert drafts to active promote finalize bulk",execute:async(t,e)=>(iv(e.items),xY(t.client,e.items))},{name:"submit_drafts_for_approval",description:`BULK submit \u2014 route up to 500 draft business transactions into the approval workflow in ONE call, mixing any combination of invoices, bills, and credit notes. ${Tu} NOT idempotent on drafts that already have an in-flight approval request.`,params:{items:{type:"array",description:"Draft BT references (max 500). Mix any btType.",items:{type:"object",properties:{btResourceId:{type:"string",description:"Draft BT resource ID (UUID) \u2014 required"},btType:{type:"string",enum:["SALE","PURCHASE","SALE_CREDIT_NOTE","PURCHASE_CREDIT_NOTE"],description:"Required"}}}}},required:["items"],group:"drafts",readOnly:!1,searchHint:"submit drafts for approval workflow review bulk",execute:async(t,e)=>(iv(e.items),TY(t.client,e.items))},{name:"search_help_center",description:'Search the Jaz help center for how-to articles, feature guides, and accounting concepts. Use this for "how do I..." or "what is..." questions about Jaz: bank reconciliation, GST/VAT filing, multi-currency, fixed assets, custom fields, integrations, and so on. Returns top matching articles with title, section, content, and source URL.',params:{query:{type:"string",description:'Natural-language question or keywords (e.g. "how do I reconcile a bank statement", "set up GST", "multi-currency invoice").'},limit:{type:"number",description:"Maximum number of articles to return (default 3, max 10)."},section:{type:"string",description:'Optional: restrict to a single help-center section slug (e.g. "bank-reconciliations", "invoices").'}},required:["query"],group:"help_center",readOnly:!0,searchHint:"help center docs how to guide article search question",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async(t,e)=>{let r=String(e.query??"").trim();if(!r)return{error:"Query is required.",hint:"Pass a natural-language question or keywords."};let n=typeof e.limit=="number"&&!Number.isNaN(e.limit)?e.limit:3,i=Math.max(1,Math.min(10,Math.floor(n))),s=typeof e.section=="string"?e.section:void 0;try{let o=VR();if(s&&!o.sections.some(u=>u.slug===s))return{error:`Unknown section: "${s}".`,available:o.sections.map(u=>u.slug),hint:"Omit the section parameter to search every section, or pick a slug from the available list."};let a=JR(),c=await WR(o,a,r,{mode:"hybrid",limit:i,section:s});return c.length===0?{results:[],hint:"No matching articles. Try broader keywords or rephrase the question."}:{results:c.map(u=>{let f=(Hae(u.article)??u.article.snippet).slice(0,1500);return{title:u.article.title,section:u.section.name,sectionSlug:u.section.slug,content:f,url:u.article.sourceUrl,score:Math.round(u.score*1e3)/1e3,scoreKind:u.scoreKind,matchedTerms:u.matchedTerms}}),totalArticles:o.articleCount,searchedSections:s?[s]:void 0}}catch(o){return{error:"Help center search failed.",detail:o instanceof Error?o.message:String(o),hint:"The bundled help-center index may be missing or corrupt."}}}},{name:"present_questions",description:`Present the user with a bounded multiple-choice question as an interactive pick-list, instead of asking in prose. Use as your FINAL action when you need the user to choose among a KNOWN, finite set of options to continue (e.g. "which bank account?", "which of these duplicate bills?"). List the options and stop \u2014 the user's pick arrives as their next message and starts a new turn. Do NOT use for open-ended input (names, amounts, free text \u2014 ask in plain prose) or for confirming destructive actions (confirm in prose). This is terminal: do not call further tools or re-list the options in text afterward.`,params:{questions:{type:"array",description:"Questions to ask. Currently the first is rendered (single question, single-select) \u2014 provide one unless you genuinely have several to ask in sequence.",items:{type:"object",properties:{header:{type:"string",description:'Optional short eyebrow label categorizing the question (1-2 words, e.g. "Account", "Period").'},question:{type:"string",description:'The question, shown as the card title (e.g. "Which bank account should I inspect?").'},options:{type:"array",description:"2-8 concrete choices.",items:{type:"object",properties:{label:{type:"string",description:"The choice shown on the row and relayed verbatim as the user's answer when picked \u2014 keep it self-contained and unambiguous."},description:{type:"string",description:'Optional one-line detail under the label (e.g. "554 unreconciled records").'}},required:["label"]}},multiSelect:{type:"boolean",description:"Reserved for future multi-select; single-select only today. Omit or set false."}},required:["question","options"]}}},required:["questions"],group:"interaction",alwaysLoaded:!0,disabled:!0,readOnly:!0,isConcurrencySafe:!0,searchHint:"present questions options choices pick select ask user interactive widget",maxResultSizeChars:2e4,execute:async(t,e)=>{let n=(Array.isArray(e?.questions)?e.questions:[]).filter(i=>typeof i=="object"&&i!==null).map(i=>{let s=(Array.isArray(i.options)?i.options:[]).filter(a=>typeof a=="object"&&a!==null).map(a=>{let c=String(a.label??"").trim();return a.description?{label:c,description:String(a.description)}:{label:c}}).filter(a=>a.label),o=String(i.question??"").trim();return{...i.header?{header:String(i.header)}:{},question:o,options:s,multiSelect:!!i.multiSelect}}).filter(i=>i.question&&i.options.length>=2);return n.length===0?{error:"present_questions needs at least one question with non-empty question text and \u22652 labeled options (a single-option pick-list is not a choice).",hint:"Provide questions: [{ question, options: [{ label }, { label }] }]. For open-ended input, ask in prose instead."}:{questions:n}}},{name:"find_dashboard_destinations",description:'Discover valid destinations for get_dashboard_url. Returns dashboard screens and record/modal types as { key, label, kind }. Filter with `query` (substring over key + label, e.g. "invoice", "report", "settings"), `resource` (e.g. "sales", "purchases"), or `kind` ("screen" | "modal"). Results are capped; narrow the filter if `truncated` is true. Call this first when you are unsure of the exact destination key.',params:{query:{type:"string",description:'Case-insensitive substring to match against destination keys and labels (e.g. "invoice", "p&l", "bank").'},resource:{type:"string",description:'Restrict to one resource namespace, e.g. "sales", "purchases", "reports", "settings".'},kind:{type:"string",description:'Restrict to "screen" (list/report pages) or "modal" (record view/create/edit).',enum:["screen","modal"]}},required:[],group:"navigation",readOnly:!0,isConcurrencySafe:!0,searchHint:"list dashboard destinations find screens modals navigation keys catalog",maxResultSizeChars:16e3,execute:async(t,e)=>{let r=e.kind==="screen"||e.kind==="modal"?e.kind:void 0,n=UFe({query:typeof e.query=="string"?e.query:void 0,resource:typeof e.resource=="string"?e.resource:void 0,kind:r});return n.truncated?{...n,hint:`Showing ${n.results.length} of ${n.total} matches. Narrow with a more specific query, resource, or kind.`}:n.results.length===0?{...n,hint:'No matches. Destinations are named by product area, not task wording \u2014 retry with a broader or synonym term (e.g. "billing" not "card", "sales" not "invoice payment", "settings", "reports", "bank") before concluding the destination does not exist.'}:n}},{name:"get_dashboard_url",description:'Build a deep link to a dashboard screen or record so you can hand the user a URL ("here is the page: <url>"). `destination` is a key from find_dashboard_destinations \u2014 a screen (e.g. "sales.transactions.active-sales", "reports.profit-and-loss") or a record modal (e.g. "sales.modal.view-sale", "sales.modal.new-sale", "settings.modal.user_management"). For a record-specific modal (view/edit/duplicate a particular record) pass `resourceId` (the Jaz resourceId of that record); omit it for screens and for create/"new" modals. The link opens in the user\'s current org. Returns { url, kind, label }.',params:{destination:{type:"string",description:'Destination key from find_dashboard_destinations, e.g. "reports.profit-and-loss" or "sales.modal.view-sale".'},resourceId:{type:"string",description:"Jaz resourceId of the record to focus \u2014 only for record modals (view/edit a specific record). Omit for screens and create modals."}},required:["destination"],group:"navigation",readOnly:!0,isConcurrencySafe:!0,searchHint:"dashboard url deep link navigate go to open screen record modal page",execute:async(t,e)=>{let{dashboardUrl:r}=OFe(t.platform??"jaz");try{return $Fe(typeof e.destination=="string"?e.destination:"",typeof e.resourceId=="string"&&e.resourceId?e.resourceId:void 0,{dashboardUrl:r,orgResourceId:t.org?.resourceId})}catch(n){return{error:n instanceof Error?n.message:String(n)}}}}]});function Zit(t,e=5){let r=t.trim().toLowerCase();if(!r)return[];let n=r.split(/[\s_-]+/).filter(s=>s.length>=2);return n.length===0?[]:Qc.map(s=>{let o=0,a=s.name.toLowerCase(),c=s.description.toLowerCase();(a===r||a===r.replace(/\s+/g,"_"))&&(o+=5),a.includes(r)&&(o+=3),c.includes(r)&&(o+=1);for(let u of n)a.includes(u)&&(o+=2),c.includes(u)&&(o+=1);return{ns:s,score:o}}).filter(s=>s.score>0).sort((s,o)=>o.score-s.score).slice(0,e).map(s=>s.ns)}var Qc,$x=re(()=>{"use strict";Qc=[{name:"invoices",description:"Sales invoices (INV/SI). Create, search, get, update, delete, pay, finalize, apply credits, download PDF. Also: receivables, AR, AR aging, billing, overdue invoices, dunning, recurring invoices.",groups:["invoices"]},{name:"customer_credit_notes",description:"Customer credit notes (CN). Create, search, update, delete, finalize, refund, download PDF. Also: sales returns, customer CN.",groups:["customer_credit_notes"]},{name:"bills",description:"Purchase bills (PO/PI). Create, search, get, update, delete, pay, finalize, apply credits. Also: payables, AP, vendor invoices, supplier bills.",groups:["bills"]},{name:"supplier_credit_notes",description:"Supplier credit notes. Create, search, update, delete, finalize, refund. Also: purchase returns, debit notes, supplier CN.",groups:["supplier_credit_notes"]},{name:"sale_orders",description:"Sales order documents: Sale Quotes (estimates/quotations) and Sale Orders. Create, get, search, update, and transition (accept a quote, confirm an order, void, delete). A Sale Order links to its quote via saleQuoteResourceId; the quote must be accepted first. Tracks fulfillment via orderState. Pipeline: quote \u2192 order \u2192 invoice (raise the invoice separately).",groups:["sale_orders"]},{name:"purchase_orders",description:"Purchase order documents: Purchase Requests (requisitions) and Purchase Orders (POs). Create, get, search, update, and transition (accept a request, confirm an order, void, delete). A Purchase Order links to its request via purchaseRequestResourceId; the request must be accepted first. Tracks fulfillment via orderState. Pipeline: request \u2192 order \u2192 bill (raise the bill separately).",groups:["purchase_orders"]},{name:"journals",description:"Journal entries (JE). Create, search, update, delete manual journals. Also: adjusting entries, accruals, reclassifications, corrections.",groups:["journals"]},{name:"cash_entries",description:"Cash-in receipts and cash-out disbursements for external cash movements. WHEN TO USE: money received from customers/external \u2192 cash-in. Money paid to suppliers/external \u2192 cash-out. For internal account-to-account transfers, use cash_transfers namespace.",groups:["cash_entries"]},{name:"cash_transfers",description:"Cash transfers between your own bank/cash accounts and cashflow transaction search. WHEN TO USE: moving funds between own accounts (main bank \u2192 petty cash, USD \u2192 SGD). For external receipts/payments, use cash_entries namespace.",groups:["cash_transfers"]},{name:"bank_accounts",description:"Bank accounts, bank statement imports (CSV/OFX), bank records search, auto-reconciliation. For unreconciled queries: ALWAYS search bank records with status UNRECONCILED after listing accounts. Also: bank feeds, bank balance.",groups:["bank"]},{name:"bank_rules",description:"Bank reconciliation rules (action shortcuts). Create, search, update, delete bank rules. Configure auto-matching rules for bank records.",groups:["bank_rules"]},{name:"reconciliations",description:"Apply a reconciliation decision to a bank statement entry \u2014 write side. Match bank records to EXISTING open bills/invoices/payments (reconcile_with_payments \u2014 the primary path, creates the payment for you), or to journals, cash entries, or transfers, or CREATE new bills/invoices (invoice_receipt/bill_receipt). Distinct from bank_accounts/bank_rules (which configure auto-reconciliation) and view_auto_reconciliation (which queries suggestions). Eleven endpoints: quick_reconcile + apply_bank_rule + magic_match (bulk), and direct_cash_entry / cash_journal / manual_journal / cash_transfer / invoice_receipt / bill_receipt / with_payments / learned_prediction (per-entry). Match-to-existing is preferred over create-new to avoid duplicates. Most fields prefill from the bank entry when omitted; FX is resolved server-side.",groups:["reconciliations"]},{name:"financial_reports",description:"Core financial statements: trial balance (TB), balance sheet (BS/B/S), profit & loss (PnL/P&L/income statement), cash flow, general ledger (GL), cash balance/position, equity movement, VAT/GST ledger. Also: how profitable, what is the balance. XLSX/PDF file exports of any of these statements are produced via download_export (lives in operational_reports namespace \u2014 switch there or call by name).",groups:["financial_reports"]},{name:"operational_reports",description:"Aging and operational reports: aged receivables (AR aging), aged payables (AP aging), AR report, bank balance summary, bank reconciliation reports, fixed asset (FA) summary, FA reconciliation. Data exports (CSV/Excel/XLSX). Anomaly detection and audit analysis: anomalous invoices, anomalous bills, cashflow anomalies, GL journal audit, exchange rate audit, receivables customer risk, cash expense health. Also: overdue analysis, how much owed, suspicious transactions, audit trail.",groups:["operational_reports","exports"]},{name:"pseudo_sql",description:"Pseudo-SQL ad-hoc read-only queries against the curated reporting schema (custom select, custom report, query data, run sql). Includes live schema introspection (get_pseudo_sql_schema) + sync preview (\u2264100 rows) + async CSV export. Use when search_* / download_export canonical reports don't cover the question.",groups:["pseudo_sql"]},{name:"contacts",description:"Contacts (customers/suppliers/vendors), contact groups, customer segmentation. Create, search, get, update, delete contacts. Bulk upsert contacts from CSV / spreadsheet imports \u2014 async, returns jobId, poll background_jobs. List/create contact groups.",groups:["contacts","contact_groups"]},{name:"items_and_inventory",description:"Products, services, inventory items. Create, search, get, update, delete items. Check inventory balance. Also: SKU, catalog, stock.",groups:["items","inventory"]},{name:"tags_and_custom_fields",description:"Tags for categorizing transactions. Custom fields for adding metadata (text, date, dropdown). Create, search, delete tags and custom fields.",groups:["tags","custom_fields"]},{name:"nano_classifiers",description:"Nano classifiers (tracking categories/dimensions). List, search, create, update, delete classifiers and their classes. Used for line-item tagging and dimensional reporting. Also: tracking categories, cost centers, departments, projects.",groups:["nano_classifiers"]},{name:"chart_of_accounts",description:"Chart of accounts (COA/GL accounts). Create, search, update accounts \u2014 including setting or removing an account's period lock date (lock / unlock a period, lock date: block recording or editing transactions on the account dated on or before a date). Bookmarks (favorites/shortcuts). Also: ledger codes, account types.",groups:["accounts","bookmarks"]},{name:"currencies",description:"Currencies, exchange rates (FX/forex). List/add org currencies. Set, update, import currency rates. Also: multi-currency, FX rates.",groups:["currencies"]},{name:"tax_profiles",description:"Tax profiles (GST/VAT/sales tax), withholding tax codes (WHT/ATC). Search, create, update tax profiles. List WHT codes.",groups:["tax_profiles"]},{name:"capsules_and_recipes",description:"Capsules (transaction groupings/capsule types). Financial recipes: amortization, depreciation, deferred revenue, IFRS 16 leases, hire purchase, fixed deposits, FX revaluation, loan schedules, ECL/expected credit loss, IAS 37 provisions, asset disposal. Two recipe execution paths: offline (plan_recipe + execute_recipe \u2014 client-side calculators, no API key) and server-side (list/get/preview/resume/rollback_capsule_recipe \u2014 produce real capsule entities via Jaz API). Plus capsuleRecipe payload on trigger mutations (create_bill, create_journal, create_cash_in, etc.) to create and trigger a recipe in one shot, with optional templateOverrides to customize the generated text (Customize Recipe). Keywords: calculate, provision, schedule, expected credit loss, revaluation, amortize, rollback recipe, customize template overrides slots.",groups:["capsules","recipes","capsule_recipes"]},{name:"scheduled_transactions",description:"Scheduled/recurring invoices, bills, journals. Create scheduled invoices/bills/journals, search scheduled transactions. Also: recurring, auto-generate.",groups:["schedulers"]},{name:"subscriptions",description:"Subscriptions (recurring billing/payment plans). Create, update, cancel, search subscriptions. Also: recurring charges, subscription schedules.",groups:["subscriptions"]},{name:"organization",description:"Organization info (name, currency, country, fiscal year). User management: invite, update, remove, search org users. Bulk invite.",groups:["organization","org_users"]},{name:"document_ai",description:"File attachments, spreadsheets, and document AI. Read and parse rows from attached spreadsheets \u2014 CSV, Excel, XLSX. Extract data from PDFs and images via AI/OCR: invoice, receipt, and bill scanning. Upload and list attachments; track extraction workflows.",groups:["attachments","magic"]},{name:"fixed_assets",description:"Fixed assets (PP&E/property, plant, equipment). Search, create, update, discard, sell, transfer, undo disposal. Also: depreciation, asset register.",groups:["fixed_assets"]},{name:"payments_and_search",description:"Payment records: get, update, delete individual payments. List payments/credits on invoices and bills. Reverse credit applications. Cashflow transaction search. Universal cross-entity search. Also: payment run, batch payment, payment matching, void payment, payment history, credit note applications.",groups:["payments","cashflow","search"]},{name:"quick_fix",description:"Quick Fix: bulk-update multiple transactions or line items in one call. Change dates, contacts, tags, accounts, tax profiles, custom fields across many invoices/bills/journals/credit-notes/cash-entries/schedulers at once. Also: batch update, mass edit.",groups:["quick_fix"]},{name:"export_records",description:"Export records to XLSX. List available columns, preview export scope (row count + sample), generate export file with pre-signed download URL. Supports any entity type: invoices, bills, contacts, items, journals, bank records, cashflow, fixed assets, etc. Pass query (structured search syntax) or filter (JSON), never both.",groups:["export_records"]},{name:"background_jobs",description:"Background job tracking. Poll any async operation by jobId (contacts bulk-upsert, items bulk-upsert, bank import, magic file processing, etc.). Filter by resourceId field to look up a specific job. Poll until status is SUCCESS, FAILED, or PARTIAL_SUCCESS.",groups:["background_jobs"]},{name:"drafts",description:"Draft business transactions \u2014 both local payload validation (invoices, bills, journals, credit notes) AND BULK-FRIENDLY server-side lifecycle: validate_drafts (sync eligibility check), convert_drafts_to_active (async promote to ACTIVE), submit_drafts_for_approval (async route to approval). The lifecycle tools are GENERIC and BULK \u2014 one call accepts up to 500 items mixing any combination of {btResourceId, btType: SALE|PURCHASE|SALE_CREDIT_NOTE|PURCHASE_CREDIT_NOTE}. No need for per-entity tools when promoting/submitting drafts at scale. NOT idempotent on already-promoted drafts.",groups:["drafts"]},{name:"help_center",description:"Search the Jaz help center for how-to articles, feature guides, accounting concepts, and troubleshooting. Returns top matches with title, section, snippet, and source URL. Works without an API key.",groups:["help_center"]},{name:"navigation",description:"Dashboard navigation deep links. Build a URL to any dashboard screen or record for the user. Also: open, go to, take me to, link, deep link, navigate, show me the page/screen for invoices, bills, reports, settings, or a specific transaction.",groups:["navigation"]}]});function r0r(){if(!R8){R8=new Map;for(let t of kc)R8.set(t.name,t)}return R8}function sy(t){return r0r().get(t)}function Ux(){return Zue||(Zue=kc.filter(t=>!t.disabled)),Zue}function $h(t){return Ux().filter(e=>e.group===t)}var R8,Zue,hv=re(()=>{"use strict";ov();R8=null,Zue=null});function x8(t){let e={type:t.type};if(t.description&&(e.description=t.description),t.enum&&(e.enum=t.enum),t.type==="array"&&t.items&&(e.items=x8(t.items)),t.type==="object"&&t.properties){let r={};for(let[n,i]of Object.entries(t.properties))r[n]=x8(i);e.properties=r,t.required?.length&&(e.required=t.required)}return e}function id(t,e){let r={};for(let[n,i]of Object.entries(t))r[n]=x8(i);return{type:"object",properties:r,...e.length>0?{required:e}:{}}}function oy(t){return{name:t.name,description:t.description,input_schema:id(t.params,t.required),...t.searchHint?{searchHint:t.searchHint}:{}}}var qx=re(()=>{"use strict"});function jx(t){if(typeof t!="string")return t.isDestructive??!1;let e=t;return e.startsWith("delete_")||e.startsWith("pay_")||e.startsWith("finalize_")||e.includes("refund")||e==="remove_org_user"}function T8(t){return{readOnlyHint:t.readOnly,destructiveHint:!t.readOnly&&jx(t),idempotentHint:t.readOnly,openWorldHint:t.openWorld??!1}}function Kit(t){if(!t.trim())return{namespaces:Qc.map(i=>{let s=i.groups.flatMap(o=>$h(o));return{name:i.name,description:i.description,toolCount:s.length,tools:s.map(o=>o.name)}}),hint:"Call describe_tools with specific tool names to get full schemas before executing."};let e=Zit(t,5);if(e.length===0)return{matches:[],hint:`No tools match "${t}". Try broader terms or call search_tools with empty query to see all namespaces.`};let n=t.toLowerCase().split(/\s+/).filter(Boolean);return{matches:e.map(i=>{let s=i.groups.flatMap(u=>$h(u)),o=s.map(u=>`${u.name} ${u.searchHint??""} ${u.description}`.toLowerCase()),a=new Map(n.map(u=>{let f=o.filter(d=>d.includes(u)).length;return[u,Math.log((s.length+1)/(f+1))]})),c=s.map((u,f)=>{let d=o[f],p=n.reduce((h,A)=>d.includes(A)?h+(a.get(A)??0):h,0);return{tool:u,score:p}}).sort((u,f)=>f.score-u.score);return{namespace:i.name,description:i.description,tools:c.map(u=>({name:u.tool.name,description:u.tool.description.split(`
|
|
872
872
|
`)[0],...u.tool.searchHint?{searchHint:u.tool.searchHint}:{}}))}}),hint:"Call describe_tools with the tool names you need, then execute_tool to run them."}}function Xit(t){if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))return{error:"Invalid `tools` parameter. Expected string[]."};if(t.length===0)return{error:"Provide at least one tool name. Use search_tools first to discover tool names."};let e=[],r=[];for(let n of t){let i=sy(n);if(!i){r.push(n);continue}e.push({...oy(i),readOnly:i.readOnly,isDestructive:i.isDestructive??!1,isConcurrencySafe:i.isConcurrencySafe??!1,destructiveHint:!i.readOnly&&jx(i),group:i.group})}return{tools:e,...r.length>0?{notFound:r,hint:`Tools not found: ${r.join(", ")}. Use search_tools to find correct names.`}:{}}}var n0r,i0r,s0r,Uh,sd,Yx=re(()=>{"use strict";$x();hv();qx();n0r={name:"search_tools",description:"Search for available Jaz accounting tools by keyword. Returns matching tool namespaces with tool names and descriptions. Call with empty query to list all namespaces. ALWAYS call this first to discover what tools are available.",inputSchema:id({query:{type:"string",description:'Search keyword (e.g. "invoice", "bank recon", "depreciation"). Empty string lists all namespaces.'}},[])};i0r={name:"describe_tools",description:"Get full JSON Schema (parameters, types, required fields) for specific tools. Call this after search_tools to get the exact input format before calling execute_tool.",inputSchema:id({tools:{type:"array",items:{type:"string"},description:'Tool names to describe (e.g. ["create_invoice", "search_contacts"])'}},["tools"])},s0r={name:"execute_tool",description:"Execute a Jaz accounting tool. Call describe_tools first to get the required parameters. Pass the tool name and its arguments.",inputSchema:id({tool:{type:"string",description:'Tool name (e.g. "create_invoice")'},arguments:{type:"object",description:"Tool arguments (see describe_tools for schema)"},org_id:{type:"string",description:"Organization ID (UUID). Required in multi-org mode (PAT or multiple API keys). Call list_organizations to get available IDs."}},["tool"])},Uh={name:"list_organizations",description:"List organizations available to the current authentication. Returns org names and resource IDs for use as org_id in execute_tool calls.",inputSchema:id({},[])},sd=[n0r,i0r,s0r]});var Vx=b(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.regexpCode=Dr.getEsmExportName=Dr.getProperty=Dr.safeStringify=Dr.stringify=Dr.strConcat=Dr.addCodeArg=Dr.str=Dr._=Dr.nil=Dr._Code=Dr.Name=Dr.IDENTIFIER=Dr._CodeOrName=void 0;var Hx=class{};Dr._CodeOrName=Hx;Dr.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var ay=class extends Hx{constructor(e){if(super(),!Dr.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Dr.Name=ay;var Lc=class extends Hx{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof ay&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Dr._Code=Lc;Dr.nil=new Lc("");function nst(t,...e){let r=[t[0]],n=0;for(;n<e.length;)tle(r,e[n]),r.push(t[++n]);return new Lc(r)}Dr._=nst;var ele=new Lc("+");function ist(t,...e){let r=[Gx(t[0])],n=0;for(;n<e.length;)r.push(ele),tle(r,e[n]),r.push(ele,Gx(t[++n]));return d0r(r),new Lc(r)}Dr.str=ist;function tle(t,e){e instanceof Lc?t.push(...e._items):e instanceof ay?t.push(e):t.push(A0r(e))}Dr.addCodeArg=tle;function d0r(t){let e=1;for(;e<t.length-1;){if(t[e]===ele){let r=p0r(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function p0r(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof ay||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof ay))return`"${t}${e.slice(1)}`}function h0r(t,e){return e.emptyStr()?t:t.emptyStr()?e:ist`${t}${e}`}Dr.strConcat=h0r;function A0r(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Gx(Array.isArray(t)?t.join(","):t)}function m0r(t){return new Lc(Gx(t))}Dr.stringify=m0r;function Gx(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Dr.safeStringify=Gx;function g0r(t){return typeof t=="string"&&Dr.IDENTIFIER.test(t)?new Lc(`.${t}`):nst`[${t}]`}Dr.getProperty=g0r;function y0r(t){if(typeof t=="string"&&Dr.IDENTIFIER.test(t))return new Lc(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}Dr.getEsmExportName=y0r;function E0r(t){return new Lc(t.toString())}Dr.regexpCode=E0r});var ile=b(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});sa.ValueScope=sa.ValueScopeName=sa.Scope=sa.varKinds=sa.UsedValueState=void 0;var ia=Vx(),rle=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},F8;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(F8||(sa.UsedValueState=F8={}));sa.varKinds={const:new ia.Name("const"),let:new ia.Name("let"),var:new ia.Name("var")};var O8=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof ia.Name?e:this.name(e)}name(e){return new ia.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};sa.Scope=O8;var Q8=class extends ia.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,ia._)`.${new ia.Name(r)}[${n}]`}};sa.ValueScopeName=Q8;var b0r=(0,ia._)`\n`,nle=class extends O8{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?b0r:ia.nil}}get(){return this._scope}name(e){return new Q8(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:s}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let f=a.get(o);if(f)return f}else a=this._values[s]=new Map;a.set(o,i);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,i.setValue(r,{property:s,itemIndex:u}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,ia._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let s=ia.nil;for(let o in e){let a=e[o];if(!a)continue;let c=n[o]=n[o]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,F8.Started);let f=r(u);if(f){let d=this.opts.es5?sa.varKinds.var:sa.varKinds.const;s=(0,ia._)`${s}${d} ${u} = ${f};${this.opts._n}`}else if(f=i?.(u))s=(0,ia._)`${s}${f}${this.opts._n}`;else throw new rle(u);c.set(u,F8.Completed)})}return s}};sa.ValueScope=nle});var Pt=b(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.or=jt.and=jt.not=jt.CodeGen=jt.operators=jt.varKinds=jt.ValueScopeName=jt.ValueScope=jt.Scope=jt.Name=jt.regexpCode=jt.stringify=jt.getProperty=jt.nil=jt.strConcat=jt.str=jt._=void 0;var ur=Vx(),Fu=ile(),Yh=Vx();Object.defineProperty(jt,"_",{enumerable:!0,get:function(){return Yh._}});Object.defineProperty(jt,"str",{enumerable:!0,get:function(){return Yh.str}});Object.defineProperty(jt,"strConcat",{enumerable:!0,get:function(){return Yh.strConcat}});Object.defineProperty(jt,"nil",{enumerable:!0,get:function(){return Yh.nil}});Object.defineProperty(jt,"getProperty",{enumerable:!0,get:function(){return Yh.getProperty}});Object.defineProperty(jt,"stringify",{enumerable:!0,get:function(){return Yh.stringify}});Object.defineProperty(jt,"regexpCode",{enumerable:!0,get:function(){return Yh.regexpCode}});Object.defineProperty(jt,"Name",{enumerable:!0,get:function(){return Yh.Name}});var $8=ile();Object.defineProperty(jt,"Scope",{enumerable:!0,get:function(){return $8.Scope}});Object.defineProperty(jt,"ValueScope",{enumerable:!0,get:function(){return $8.ValueScope}});Object.defineProperty(jt,"ValueScopeName",{enumerable:!0,get:function(){return $8.ValueScopeName}});Object.defineProperty(jt,"varKinds",{enumerable:!0,get:function(){return $8.varKinds}});jt.operators={GT:new ur._Code(">"),GTE:new ur._Code(">="),LT:new ur._Code("<"),LTE:new ur._Code("<="),EQ:new ur._Code("==="),NEQ:new ur._Code("!=="),NOT:new ur._Code("!"),OR:new ur._Code("||"),AND:new ur._Code("&&"),ADD:new ur._Code("+")};var ad=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},sle=class extends ad{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Fu.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=gv(this.rhs,e,r)),this}get names(){return this.rhs instanceof ur._CodeOrName?this.rhs.names:{}}},L8=class extends ad{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof ur.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=gv(this.rhs,e,r),this}get names(){let e=this.lhs instanceof ur.Name?{}:{...this.lhs.names};return P8(e,this.rhs)}},ole=class extends L8{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},ale=class extends ad{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},cle=class extends ad{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},ule=class extends ad{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},lle=class extends ad{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=gv(this.code,e,r),this}get names(){return this.code instanceof ur._CodeOrName?this.code.names:{}}},Jx=class extends ad{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let s=n[i];s.optimizeNames(e,r)||(C0r(e,s.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>ly(e,r.names),{})}},cd=class extends Jx{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},fle=class extends Jx{},mv=class extends cd{};mv.kind="else";var cy=class t extends cd{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new mv(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(sst(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=gv(this.condition,e,r),this}get names(){let e=super.names;return P8(e,this.condition),this.else&&ly(e,this.else.names),e}};cy.kind="if";var uy=class extends cd{};uy.kind="for";var dle=class extends uy{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=gv(this.iteration,e,r),this}get names(){return ly(super.names,this.iteration.names)}},ple=class extends uy{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?Fu.varKinds.var:this.varKind,{name:n,from:i,to:s}=this;return`for(${r} ${n}=${i}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=P8(super.names,this.from);return P8(e,this.to)}},M8=class extends uy{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=gv(this.iterable,e,r),this}get names(){return ly(super.names,this.iterable.names)}},Wx=class extends cd{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Wx.kind="func";var Zx=class extends Jx{render(e){return"return "+super.render(e)}};Zx.kind="return";var hle=class extends cd{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&ly(e,this.catch.names),this.finally&&ly(e,this.finally.names),e}},Kx=class extends cd{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Kx.kind="catch";var Xx=class extends cd{render(e){return"finally"+super.render(e)}};Xx.kind="finally";var Ale=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
873
873
|
`:""},this._extScope=e,this._scope=new Fu.Scope({parent:e}),this._nodes=[new fle]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,i){let s=this._scope.toName(r);return n!==void 0&&i&&(this._constants[s.str]=n),this._leafNode(new sle(e,s,n)),s}const(e,r,n){return this._def(Fu.varKinds.const,e,r,n)}let(e,r,n){return this._def(Fu.varKinds.let,e,r,n)}var(e,r,n){return this._def(Fu.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new L8(e,r,n))}add(e,r){return this._leafNode(new ole(e,jt.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==ur.nil&&this._leafNode(new lle(e)),this}object(...e){let r=["{"];for(let[n,i]of e)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,ur.addCodeArg)(r,i));return r.push("}"),new ur._Code(r)}if(e,r,n){if(this._blockNode(new cy(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new cy(e))}else(){return this._elseNode(new mv)}endIf(){return this._endBlockNode(cy,mv)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new dle(e),r)}forRange(e,r,n,i,s=this.opts.es5?Fu.varKinds.var:Fu.varKinds.let){let o=this._scope.toName(e);return this._for(new ple(s,o,r,n),()=>i(o))}forOf(e,r,n,i=Fu.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let o=r instanceof ur.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,ur._)`${o}.length`,a=>{this.var(s,(0,ur._)`${o}[${a}]`),n(s)})}return this._for(new M8("of",i,s,r),()=>n(s))}forIn(e,r,n,i=this.opts.es5?Fu.varKinds.var:Fu.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,ur._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new M8("in",i,s,r),()=>n(s))}endFor(){return this._endBlockNode(uy)}label(e){return this._leafNode(new ale(e))}break(e){return this._leafNode(new cle(e))}return(e){let r=new Zx;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Zx)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new hle;if(this._blockNode(i),this.code(e),r){let s=this.name("e");this._currNode=i.catch=new Kx(s),r(s)}return n&&(this._currNode=i.finally=new Xx,this.code(n)),this._endBlockNode(Kx,Xx)}throw(e){return this._leafNode(new ule(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=ur.nil,n,i){return this._blockNode(new Wx(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(Wx)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof cy))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};jt.CodeGen=Ale;function ly(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function P8(t,e){return e instanceof ur._CodeOrName?ly(t,e.names):t}function gv(t,e,r){if(t instanceof ur.Name)return n(t);if(!i(t))return t;return new ur._Code(t._items.reduce((s,o)=>(o instanceof ur.Name&&(o=n(o)),o instanceof ur._Code?s.push(...o._items):s.push(o),s),[]));function n(s){let o=r[s.str];return o===void 0||e[s.str]!==1?s:(delete e[s.str],o)}function i(s){return s instanceof ur._Code&&s._items.some(o=>o instanceof ur.Name&&e[o.str]===1&&r[o.str]!==void 0)}}function C0r(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function sst(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,ur._)`!${mle(t)}`}jt.not=sst;var v0r=ost(jt.operators.AND);function w0r(...t){return t.reduce(v0r)}jt.and=w0r;var I0r=ost(jt.operators.OR);function _0r(...t){return t.reduce(I0r)}jt.or=_0r;function ost(t){return(e,r)=>e===ur.nil?r:r===ur.nil?e:(0,ur._)`${mle(e)} ${t} ${mle(r)}`}function mle(t){return t instanceof ur.Name?t:(0,ur._)`(${t})`}});var Ar=b(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.checkStrictMode=Xt.getErrorPath=Xt.Type=Xt.useFunc=Xt.setEvaluated=Xt.evaluatedPropsToName=Xt.mergeEvaluated=Xt.eachItem=Xt.unescapeJsonPointer=Xt.escapeJsonPointer=Xt.escapeFragment=Xt.unescapeFragment=Xt.schemaRefOrVal=Xt.schemaHasRulesButRef=Xt.schemaHasRules=Xt.checkUnknownRules=Xt.alwaysValidSchema=Xt.toHash=void 0;var un=Pt(),D0r=Vx();function S0r(t){let e={};for(let r of t)e[r]=!0;return e}Xt.toHash=S0r;function B0r(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(ust(t,e),!lst(e,t.self.RULES.all))}Xt.alwaysValidSchema=B0r;function ust(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let i=n.RULES.keywords;for(let s in e)i[s]||pst(t,`unknown keyword: "${s}"`)}Xt.checkUnknownRules=ust;function lst(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}Xt.schemaHasRules=lst;function R0r(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}Xt.schemaHasRulesButRef=R0r;function x0r({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,un._)`${r}`}return(0,un._)`${t}${e}${(0,un.getProperty)(n)}`}Xt.schemaRefOrVal=x0r;function T0r(t){return fst(decodeURIComponent(t))}Xt.unescapeFragment=T0r;function k0r(t){return encodeURIComponent(yle(t))}Xt.escapeFragment=k0r;function yle(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Xt.escapeJsonPointer=yle;function fst(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Xt.unescapeJsonPointer=fst;function N0r(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}Xt.eachItem=N0r;function ast({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,s,o,a)=>{let c=o===void 0?s:o instanceof un.Name?(s instanceof un.Name?t(i,s,o):e(i,s,o),o):s instanceof un.Name?(e(i,o,s),s):r(s,o);return a===un.Name&&!(c instanceof un.Name)?n(i,c):c}}Xt.mergeEvaluated={props:ast({mergeNames:(t,e,r)=>t.if((0,un._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,un._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,un._)`${r} || {}`).code((0,un._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,un._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,un._)`${r} || {}`),Ele(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:dst}),items:ast({mergeNames:(t,e,r)=>t.if((0,un._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,un._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,un._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,un._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function dst(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,un._)`{}`);return e!==void 0&&Ele(t,r,e),r}Xt.evaluatedPropsToName=dst;function Ele(t,e,r){Object.keys(r).forEach(n=>t.assign((0,un._)`${e}${(0,un.getProperty)(n)}`,!0))}Xt.setEvaluated=Ele;var cst={};function F0r(t,e){return t.scopeValue("func",{ref:e,code:cst[e.code]||(cst[e.code]=new D0r._Code(e.code))})}Xt.useFunc=F0r;var gle;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(gle||(Xt.Type=gle={}));function O0r(t,e,r){if(t instanceof un.Name){let n=e===gle.Num;return r?n?(0,un._)`"[" + ${t} + "]"`:(0,un._)`"['" + ${t} + "']"`:n?(0,un._)`"/" + ${t}`:(0,un._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,un.getProperty)(t).toString():"/"+yle(t)}Xt.getErrorPath=O0r;function pst(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}Xt.checkStrictMode=pst});var ud=b(ble=>{"use strict";Object.defineProperty(ble,"__esModule",{value:!0});var to=Pt(),Q0r={data:new to.Name("data"),valCxt:new to.Name("valCxt"),instancePath:new to.Name("instancePath"),parentData:new to.Name("parentData"),parentDataProperty:new to.Name("parentDataProperty"),rootData:new to.Name("rootData"),dynamicAnchors:new to.Name("dynamicAnchors"),vErrors:new to.Name("vErrors"),errors:new to.Name("errors"),this:new to.Name("this"),self:new to.Name("self"),scope:new to.Name("scope"),json:new to.Name("json"),jsonPos:new to.Name("jsonPos"),jsonLen:new to.Name("jsonLen"),jsonPart:new to.Name("jsonPart")};ble.default=Q0r});var eT=b(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.extendErrors=ro.resetErrorsCount=ro.reportExtraError=ro.reportError=ro.keyword$DataError=ro.keywordError=void 0;var mr=Pt(),U8=Ar(),To=ud();ro.keywordError={message:({keyword:t})=>(0,mr.str)`must pass "${t}" keyword validation`};ro.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,mr.str)`"${t}" keyword must be ${e} ($data)`:(0,mr.str)`"${t}" keyword is invalid ($data)`};function L0r(t,e=ro.keywordError,r,n){let{it:i}=t,{gen:s,compositeRule:o,allErrors:a}=i,c=mst(t,e,r);n??(o||a)?hst(s,c):Ast(i,(0,mr._)`[${c}]`)}ro.reportError=L0r;function M0r(t,e=ro.keywordError,r){let{it:n}=t,{gen:i,compositeRule:s,allErrors:o}=n,a=mst(t,e,r);hst(i,a),s||o||Ast(n,To.default.vErrors)}ro.reportExtraError=M0r;function P0r(t,e){t.assign(To.default.errors,e),t.if((0,mr._)`${To.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,mr._)`${To.default.vErrors}.length`,e),()=>t.assign(To.default.vErrors,null)))}ro.resetErrorsCount=P0r;function $0r({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:s}){if(i===void 0)throw new Error("ajv implementation error");let o=t.name("err");t.forRange("i",i,To.default.errors,a=>{t.const(o,(0,mr._)`${To.default.vErrors}[${a}]`),t.if((0,mr._)`${o}.instancePath === undefined`,()=>t.assign((0,mr._)`${o}.instancePath`,(0,mr.strConcat)(To.default.instancePath,s.errorPath))),t.assign((0,mr._)`${o}.schemaPath`,(0,mr.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,mr._)`${o}.schema`,r),t.assign((0,mr._)`${o}.data`,n))})}ro.extendErrors=$0r;function hst(t,e){let r=t.const("err",e);t.if((0,mr._)`${To.default.vErrors} === null`,()=>t.assign(To.default.vErrors,(0,mr._)`[${r}]`),(0,mr._)`${To.default.vErrors}.push(${r})`),t.code((0,mr._)`${To.default.errors}++`)}function Ast(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,mr._)`new ${t.ValidationError}(${e})`):(r.assign((0,mr._)`${n}.errors`,e),r.return(!1))}var fy={keyword:new mr.Name("keyword"),schemaPath:new mr.Name("schemaPath"),params:new mr.Name("params"),propertyName:new mr.Name("propertyName"),message:new mr.Name("message"),schema:new mr.Name("schema"),parentSchema:new mr.Name("parentSchema")};function mst(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,mr._)`{}`:U0r(t,e,r)}function U0r(t,e,r={}){let{gen:n,it:i}=t,s=[q0r(i,r),j0r(t,r)];return Y0r(t,e,s),n.object(...s)}function q0r({errorPath:t},{instancePath:e}){let r=e?(0,mr.str)`${t}${(0,U8.getErrorPath)(e,U8.Type.Str)}`:t;return[To.default.instancePath,(0,mr.strConcat)(To.default.instancePath,r)]}function j0r({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,mr.str)`${e}/${t}`;return r&&(i=(0,mr.str)`${i}${(0,U8.getErrorPath)(r,U8.Type.Str)}`),[fy.schemaPath,i]}function Y0r(t,{params:e,message:r},n){let{keyword:i,data:s,schemaValue:o,it:a}=t,{opts:c,propertyName:u,topSchemaRef:f,schemaPath:d}=a;n.push([fy.keyword,i],[fy.params,typeof e=="function"?e(t):e||(0,mr._)`{}`]),c.messages&&n.push([fy.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([fy.schema,o],[fy.parentSchema,(0,mr._)`${f}${d}`],[To.default.data,s]),u&&n.push([fy.propertyName,u])}});var yst=b(yv=>{"use strict";Object.defineProperty(yv,"__esModule",{value:!0});yv.boolOrEmptySchema=yv.topBoolOrEmptySchema=void 0;var z0r=eT(),H0r=Pt(),G0r=ud(),V0r={message:"boolean schema is false"};function J0r(t){let{gen:e,schema:r,validateName:n}=t;r===!1?gst(t,!1):typeof r=="object"&&r.$async===!0?e.return(G0r.default.data):(e.assign((0,H0r._)`${n}.errors`,null),e.return(!0))}yv.topBoolOrEmptySchema=J0r;function W0r(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),gst(t)):r.var(e,!0)}yv.boolOrEmptySchema=W0r;function gst(t,e){let{gen:r,data:n}=t,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,z0r.reportError)(i,V0r,void 0,e)}});var Cle=b(Ev=>{"use strict";Object.defineProperty(Ev,"__esModule",{value:!0});Ev.getRules=Ev.isJSONType=void 0;var Z0r=["string","number","integer","boolean","null","object","array"],K0r=new Set(Z0r);function X0r(t){return typeof t=="string"&&K0r.has(t)}Ev.isJSONType=X0r;function eCr(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Ev.getRules=eCr});var vle=b(zh=>{"use strict";Object.defineProperty(zh,"__esModule",{value:!0});zh.shouldUseRule=zh.shouldUseGroup=zh.schemaHasRulesForType=void 0;function tCr({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&Est(t,n)}zh.schemaHasRulesForType=tCr;function Est(t,e){return e.rules.some(r=>bst(t,r))}zh.shouldUseGroup=Est;function bst(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}zh.shouldUseRule=bst});var tT=b(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no.reportTypeError=no.checkDataTypes=no.checkDataType=no.coerceAndCheckDataType=no.getJSONTypes=no.getSchemaTypes=no.DataType=void 0;var rCr=Cle(),nCr=vle(),iCr=eT(),Lt=Pt(),Cst=Ar(),bv;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(bv||(no.DataType=bv={}));function sCr(t){let e=vst(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}no.getSchemaTypes=sCr;function vst(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(rCr.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}no.getJSONTypes=vst;function oCr(t,e){let{gen:r,data:n,opts:i}=t,s=aCr(e,i.coerceTypes),o=e.length>0&&!(s.length===0&&e.length===1&&(0,nCr.schemaHasRulesForType)(t,e[0]));if(o){let a=Ile(e,n,i.strictNumbers,bv.Wrong);r.if(a,()=>{s.length?cCr(t,e,s):_le(t)})}return o}no.coerceAndCheckDataType=oCr;var wst=new Set(["string","number","integer","boolean","null"]);function aCr(t,e){return e?t.filter(r=>wst.has(r)||e==="array"&&r==="array"):[]}function cCr(t,e,r){let{gen:n,data:i,opts:s}=t,o=n.let("dataType",(0,Lt._)`typeof ${i}`),a=n.let("coerced",(0,Lt._)`undefined`);s.coerceTypes==="array"&&n.if((0,Lt._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,Lt._)`${i}[0]`).assign(o,(0,Lt._)`typeof ${i}`).if(Ile(e,i,s.strictNumbers),()=>n.assign(a,i))),n.if((0,Lt._)`${a} !== undefined`);for(let u of r)(wst.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),_le(t),n.endIf(),n.if((0,Lt._)`${a} !== undefined`,()=>{n.assign(i,a),uCr(t,a)});function c(u){switch(u){case"string":n.elseIf((0,Lt._)`${o} == "number" || ${o} == "boolean"`).assign(a,(0,Lt._)`"" + ${i}`).elseIf((0,Lt._)`${i} === null`).assign(a,(0,Lt._)`""`);return;case"number":n.elseIf((0,Lt._)`${o} == "boolean" || ${i} === null
|
|
874
874
|
|| (${o} == "string" && ${i} && ${i} == +${i})`).assign(a,(0,Lt._)`+${i}`);return;case"integer":n.elseIf((0,Lt._)`${o} === "boolean" || ${i} === null
|