jaz-clio 5.20.17 → 5.20.19

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,6 +1,6 @@
1
1
  ---
2
2
  name: jaz-api
3
- version: 5.20.17
3
+ version: 5.20.19
4
4
  description: >-
5
5
  Use this skill whenever you call, debug, or review code that touches the Jaz
6
6
  REST API. Covers field names, response shapes, 158 production gotchas, error
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: jaz-cli
3
- version: 5.20.17
3
+ version: 5.20.19
4
4
  description: >-
5
5
  Use this skill when running Clio CLI commands, building shell scripts with
6
6
  Clio, debugging auth issues, understanding --json output, paginating results,
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: jaz-conversion
3
- version: 5.20.17
3
+ version: 5.20.19
4
4
  description: >-
5
5
  Use this skill when migrating accounting data into Jaz — importing from Xero,
6
6
  QuickBooks, Sage, MYOB, or Excel exports. Covers the full conversion pipeline:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: jaz-pseudo-sql
3
- version: 5.20.17
3
+ version: 5.20.19
4
4
  description: >-
5
5
  Use this skill when answering ad-hoc data questions that aren't covered by
6
6
  download_export (canonical reports — anomaly, audit, aging, P&L, BS, GL,
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: jaz-jobs
3
- version: 5.20.17
3
+ version: 5.20.19
4
4
  description: >-
5
5
  Use this skill for recurring accounting workflows — month/quarter/year-end
6
6
  close, bank reconciliation, GST/VAT filing, payment runs, credit control,
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: jaz-recipes
3
- version: 5.20.17
3
+ version: 5.20.19
4
4
  description: >-
5
5
  Use this skill when modeling complex multi-step accounting transactions —
6
6
  anything that spans multiple periods, involves changing amounts, or requires
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(e,t)=>(sv(t.items),xY(e.client,t.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(e,t)=>(sv(t.items),TY(e.client,t.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(e,t)=>(sv(t.items),kY(e.client,t.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(e,t)=>{let r=String(t.query??"").trim();if(!r)return{error:"Query is required.",hint:"Pass a natural-language question or keywords."};let n=typeof t.limit=="number"&&!Number.isNaN(t.limit)?t.limit:3,i=Math.max(1,Math.min(10,Math.floor(n))),s=typeof t.section=="string"?t.section:void 0;try{let o=JR();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=WR(),c=await ZR(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 (or a short sequence of them) as an interactive pick-list, instead of asking in prose. Use as your FINAL action when the user must choose among a KNOWN, finite set of options you ALREADY have from context (a prior search/list result, org defaults, or your own knowledge) to continue (e.g. "which bank account?", "which of these duplicate bills?"). Give 2-4 options per question \u2014 curate to the most likely, never dump a long list \u2014 and at most 4 questions; set multiSelect per question when more than one may apply. List the options and stop \u2014 the user's pick arrives as their next message and starts a new turn. Ask several questions at once when more than one thing is unspecified. Prose-ask only when there's no bounded set to offer (a free-text name or amount), to confirm destructive actions, or instead of fetching data just to populate options. Terminal: do not call further tools or re-list the options in text afterward.`,params:{questions:{type:"array",description:"Questions to ask, each rendered as one page of the pick-list (at most 4). Provide one unless you genuinely have several distinct choices to collect 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-4 concrete choices (hard cap \u2014 curate to the most likely; the user can still type a different answer if none fit).",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:"Set true to let the user select multiple options for this question; omit or false for a single pick."}},required:["question","options"]}}},required:["questions"],group:"interaction",alwaysLoaded:!0,interactive:!0,readOnly:!0,isConcurrencySafe:!0,searchHint:"present questions options choices pick select ask user interactive widget",maxResultSizeChars:2e4,execute:async(e,t)=>{let n=(Array.isArray(t?.questions)?t.questions:[]).filter(s=>typeof s=="object"&&s!==null).map(s=>{let o=(Array.isArray(s.options)?s.options:[]).filter(c=>typeof c=="object"&&c!==null).map(c=>{let u=String(c.label??"").trim();return c.description?{label:u,description:String(c.description)}:{label:u}}).filter(c=>c.label),a=String(s.question??"").trim();return{...s.header?{header:String(s.header)}:{},question:a,options:o,multiSelect:!!s.multiSelect}}).filter(s=>s.question&&s.options.length>=2);if(n.length===0)return{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."};if(n.length>4)return{error:`present_questions renders at most 4 questions (got ${n.length}).`,hint:"Ask the 4 most important now; collect the rest on a later turn."};let i=n.find(s=>s.options.length>4);return i?{error:`Each question may offer at most 4 options ("${i.question}" has ${i.options.length}).`,hint:"Curate to the 4 most likely choices \u2014 the user can still type a different answer if none fit."}:{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",alwaysLoaded:!0,readOnly:!0,isConcurrencySafe:!0,searchHint:"list dashboard destinations find screens modals navigation keys catalog",maxResultSizeChars:16e3,execute:async(e,t)=>{let r=t.kind==="screen"||t.kind==="modal"?t.kind:void 0,n=qFe({query:typeof t.query=="string"?t.query:void 0,resource:typeof t.resource=="string"?t.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 }. Never write dashboard URLs or destination keys from memory \u2014 always resolve them through these tools.',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",alwaysLoaded:!0,readOnly:!0,isConcurrencySafe:!0,searchHint:"dashboard url deep link navigate go to open screen record modal page share shareable",execute:async(e,t)=>{let{dashboardUrl:r}=QFe(e.platform??"jaz");try{return UFe(typeof t.destination=="string"?t.destination:"",typeof t.resourceId=="string"&&t.resourceId?t.resourceId:void 0,{dashboardUrl:r,orgResourceId:e.org?.resourceId})}catch(n){return{error:n instanceof Error?n.message:String(n)}}}}]});function Kit(e,t=5){let r=e.trim().toLowerCase();if(!r)return[];let n=r.split(/[\s_-]+/).filter(s=>s.length>=2&&!a0r.has(s));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,t).map(s=>s.ns)}var Qc,a0r,Ux=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 \u2014 including the view link for a record just created or updated (a reply reporting on a record carries its link, and dashboard URLs always come from these tools, never written from memory). Also: open, go to, take me to, link, deep link, share a link, url, navigate, show me the page/screen, where can I see \u2014 for invoices, bills, reports, settings, or a specific transaction.",groups:["navigation"]}],a0r=new Set(["a","an","and","are","at","be","by","can","do","does","for","how","i","in","is","it","me","my","of","on","or","our","please","that","the","this","to","us","we","what","when","where","which","with","you","your"])});function c0r(){if(!x8){x8=new Map;for(let e of kc)x8.set(e.name,e)}return x8}function sy(e){return c0r().get(e)}function qx(){return Zue||(Zue=kc.filter(e=>!e.disabled)),Zue}function l0r(){return Kue||(Kue=qx().filter(e=>!e.interactive)),Kue}function Xit(e){return e!==void 0&&u0r.has(e)?qx():l0r()}function $h(e){return qx().filter(t=>t.group===e)}var x8,Zue,u0r,Kue,Av=re(()=>{"use strict";av();x8=null,Zue=null;u0r=new Set(["chat"]),Kue=null});function T8(e){let t={type:e.type};if(e.description&&(t.description=e.description),e.enum&&(t.enum=e.enum),e.type==="array"&&e.items&&(t.items=T8(e.items)),e.type==="object"&&e.properties){let r={};for(let[n,i]of Object.entries(e.properties))r[n]=T8(i);t.properties=r,e.required?.length&&(t.required=e.required)}return t}function id(e,t){let r={};for(let[n,i]of Object.entries(e))r[n]=T8(i);return{type:"object",properties:r,...t.length>0?{required:t}:{}}}function oy(e){return{name:e.name,description:e.description,input_schema:id(e.params,e.required),...e.searchHint?{searchHint:e.searchHint}:{}}}var jx=re(()=>{"use strict"});function Yx(e){if(typeof e!="string")return e.isDestructive??!1;let t=e;return t.startsWith("delete_")||t.startsWith("pay_")||t.startsWith("finalize_")||t.includes("refund")||t==="remove_org_user"}function k8(e){return{readOnlyHint:e.readOnly,destructiveHint:!e.readOnly&&Yx(e),idempotentHint:e.readOnly,openWorldHint:e.openWorld??!1}}function est(e){if(!e.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 t=Kit(e,5);if(t.length===0)return{matches:[],hint:`No tools match "${e}". Try broader terms or call search_tools with empty query to see all namespaces.`};let n=e.toLowerCase().split(/\s+/).filter(Boolean);return{matches:t.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(e,t)=>(sv(t.items),xY(e.client,t.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(e,t)=>(sv(t.items),TY(e.client,t.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(e,t)=>(sv(t.items),kY(e.client,t.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(e,t)=>{let r=String(t.query??"").trim();if(!r)return{error:"Query is required.",hint:"Pass a natural-language question or keywords."};let n=typeof t.limit=="number"&&!Number.isNaN(t.limit)?t.limit:3,i=Math.max(1,Math.min(10,Math.floor(n))),s=typeof t.section=="string"?t.section:void 0;try{let o=JR();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=WR(),c=await ZR(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 (or a short sequence of them) as an interactive pick-list, instead of asking in prose. Use as your FINAL action when the user must choose among a KNOWN, finite set of options you ALREADY have from context (a prior search/list result, org defaults, or your own knowledge) to continue (e.g. "which bank account?", "which of these duplicate bills?"). Give 2-4 options per question \u2014 curate to the most likely, never dump a long list \u2014 and at most 4 questions; set multiSelect per question when more than one may apply. List the options and stop \u2014 the user's pick arrives as their next message and starts a new turn. Ask several questions at once when more than one thing is unspecified. Prose-ask only when there's no bounded set to offer (a free-text name or amount), to confirm destructive actions, or instead of fetching data just to populate options. Terminal: do not call further tools or re-list the options in text afterward.`,params:{questions:{type:"array",description:"Questions to ask, each rendered as one page of the pick-list (at most 4). Provide one unless you genuinely have several distinct choices to collect 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-4 concrete choices (hard cap \u2014 curate to the most likely; the user can still type a different answer if none fit).",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:"Set true to let the user select multiple options for this question; omit or false for a single pick."}},required:["question","options"]}}},required:["questions"],group:"interaction",alwaysLoaded:!0,interactive:!0,readOnly:!0,isConcurrencySafe:!0,searchHint:"present questions options choices pick select ask user interactive widget",maxResultSizeChars:2e4,execute:async(e,t)=>{let n=(Array.isArray(t?.questions)?t.questions:[]).filter(s=>typeof s=="object"&&s!==null).map(s=>{let o=(Array.isArray(s.options)?s.options:[]).filter(c=>typeof c=="object"&&c!==null).map(c=>{let u=String(c.label??"").trim();return c.description?{label:u,description:String(c.description)}:{label:u}}).filter(c=>c.label),a=String(s.question??"").trim();return{...s.header?{header:String(s.header)}:{},question:a,options:o,multiSelect:!!s.multiSelect}}).filter(s=>s.question&&s.options.length>=2);if(n.length===0)return{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."};if(n.length>4)return{error:`present_questions renders at most 4 questions (got ${n.length}).`,hint:"Ask the 4 most important now; collect the rest on a later turn."};let i=n.find(s=>s.options.length>4);return i?{error:`Each question may offer at most 4 options ("${i.question}" has ${i.options.length}).`,hint:"Curate to the 4 most likely choices \u2014 the user can still type a different answer if none fit."}:{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",alwaysLoaded:!0,readOnly:!0,isConcurrencySafe:!0,searchHint:"list dashboard destinations find screens modals navigation keys catalog",maxResultSizeChars:16e3,execute:async(e,t)=>{let r=t.kind==="screen"||t.kind==="modal"?t.kind:void 0,n=qFe({query:typeof t.query=="string"?t.query:void 0,resource:typeof t.resource=="string"?t.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 }. Never write dashboard URLs or destination keys from memory \u2014 always resolve them through these tools.',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",alwaysLoaded:!0,readOnly:!0,isConcurrencySafe:!0,searchHint:"dashboard url deep link navigate go to open screen record modal page share shareable",execute:async(e,t)=>{let{dashboardUrl:r}=QFe(e.platform??"jaz");try{return UFe(typeof t.destination=="string"?t.destination:"",typeof t.resourceId=="string"&&t.resourceId?t.resourceId:void 0,{dashboardUrl:r,orgResourceId:e.org?.resourceId})}catch(n){return{error:n instanceof Error?n.message:String(n)}}}}]});function Kit(e,t=5){let r=e.trim().toLowerCase();if(!r)return[];let n=r.split(/[\s_-]+/).filter(s=>s.length>=2&&!a0r.has(s));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,t).map(s=>s.ns)}var Qc,a0r,Ux=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. To create from an uploaded invoice file/PDF/image, use the document_ai namespace (AI extraction), not manual entry.",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. To create from an uploaded bill/invoice file/PDF/image, use the document_ai namespace (AI extraction), not manual entry.",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. Scan an invoice / bill / receipt PDF or image to create a draft bill or invoice via AI extraction (create_bt_from_attachment, with the file or a sourceUrl). 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 \u2014 including the view link for a record just created or updated (a reply reporting on a record carries its link, and dashboard URLs always come from these tools, never written from memory). Also: open, go to, take me to, link, deep link, share a link, url, navigate, show me the page/screen, where can I see \u2014 for invoices, bills, reports, settings, or a specific transaction.",groups:["navigation"]}],a0r=new Set(["a","an","and","are","at","be","by","can","do","does","for","how","i","in","is","it","me","my","of","on","or","our","please","that","the","this","to","us","we","what","when","where","which","with","you","your"])});function c0r(){if(!x8){x8=new Map;for(let e of kc)x8.set(e.name,e)}return x8}function sy(e){return c0r().get(e)}function qx(){return Zue||(Zue=kc.filter(e=>!e.disabled)),Zue}function l0r(){return Kue||(Kue=qx().filter(e=>!e.interactive)),Kue}function Xit(e){return e!==void 0&&u0r.has(e)?qx():l0r()}function $h(e){return qx().filter(t=>t.group===e)}var x8,Zue,u0r,Kue,Av=re(()=>{"use strict";av();x8=null,Zue=null;u0r=new Set(["chat"]),Kue=null});function T8(e){let t={type:e.type};if(e.description&&(t.description=e.description),e.enum&&(t.enum=e.enum),e.type==="array"&&e.items&&(t.items=T8(e.items)),e.type==="object"&&e.properties){let r={};for(let[n,i]of Object.entries(e.properties))r[n]=T8(i);t.properties=r,e.required?.length&&(t.required=e.required)}return t}function id(e,t){let r={};for(let[n,i]of Object.entries(e))r[n]=T8(i);return{type:"object",properties:r,...t.length>0?{required:t}:{}}}function oy(e){return{name:e.name,description:e.description,input_schema:id(e.params,e.required),...e.searchHint?{searchHint:e.searchHint}:{}}}var jx=re(()=>{"use strict"});function Yx(e){if(typeof e!="string")return e.isDestructive??!1;let t=e;return t.startsWith("delete_")||t.startsWith("pay_")||t.startsWith("finalize_")||t.includes("refund")||t==="remove_org_user"}function k8(e){return{readOnlyHint:e.readOnly,destructiveHint:!e.readOnly&&Yx(e),idempotentHint:e.readOnly,openWorldHint:e.openWorld??!1}}function est(e){if(!e.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 t=Kit(e,5);if(t.length===0)return{matches:[],hint:`No tools match "${e}". Try broader terms or call search_tools with empty query to see all namespaces.`};let n=e.toLowerCase().split(/\s+/).filter(Boolean);return{matches:t.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 tst(e){if(!Array.isArray(e)||!e.every(n=>typeof n=="string"))return{error:"Invalid `tools` parameter. Expected string[]."};if(e.length===0)return{error:"Provide at least one tool name. Use search_tools first to discover tool names."};let t=[],r=[];for(let n of e){let i=sy(n);if(!i){r.push(n);continue}t.push({...oy(i),readOnly:i.readOnly,isDestructive:i.isDestructive??!1,isConcurrencySafe:i.isConcurrencySafe??!1,destructiveHint:!i.readOnly&&Yx(i),group:i.group})}return{tools:t,...r.length>0?{notFound:r,hint:`Tools not found: ${r.join(", ")}. Use search_tools to find correct names.`}:{}}}var f0r,d0r,p0r,Uh,sd,zx=re(()=>{"use strict";Ux();Av();jx();f0r={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.'}},[])};d0r={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"])},p0r={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=[f0r,d0r,p0r]});var Jx=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 Gx=class{};Dr._CodeOrName=Gx;Dr.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var ay=class extends Gx{constructor(t){if(super(),!Dr.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Dr.Name=ay;var Lc=class extends Gx{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t: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 sst(e,...t){let r=[e[0]],n=0;for(;n<t.length;)rle(r,t[n]),r.push(e[++n]);return new Lc(r)}Dr._=sst;var tle=new Lc("+");function ost(e,...t){let r=[Vx(e[0])],n=0;for(;n<t.length;)r.push(tle),rle(r,t[n]),r.push(tle,Vx(e[++n]));return b0r(r),new Lc(r)}Dr.str=ost;function rle(e,t){t instanceof Lc?e.push(...t._items):t instanceof ay?e.push(t):e.push(w0r(t))}Dr.addCodeArg=rle;function b0r(e){let t=1;for(;t<e.length-1;){if(e[t]===tle){let r=C0r(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function C0r(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof ay||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof ay))return`"${e}${t.slice(1)}`}function v0r(e,t){return t.emptyStr()?e:e.emptyStr()?t:ost`${e}${t}`}Dr.strConcat=v0r;function w0r(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Vx(Array.isArray(e)?e.join(","):e)}function I0r(e){return new Lc(Vx(e))}Dr.stringify=I0r;function Vx(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Dr.safeStringify=Vx;function _0r(e){return typeof e=="string"&&Dr.IDENTIFIER.test(e)?new Lc(`.${e}`):sst`[${e}]`}Dr.getProperty=_0r;function D0r(e){if(typeof e=="string"&&Dr.IDENTIFIER.test(e))return new Lc(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}Dr.getEsmExportName=D0r;function S0r(e){return new Lc(e.toString())}Dr.regexpCode=S0r});var sle=b(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});sa.ValueScope=sa.ValueScopeName=sa.Scope=sa.varKinds=sa.UsedValueState=void 0;var ia=Jx(),nle=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},O8;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(O8||(sa.UsedValueState=O8={}));sa.varKinds={const:new ia.Name("const"),let:new ia.Name("let"),var:new ia.Name("var")};var Q8=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof ia.Name?t:this.name(t)}name(t){return new ia.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};sa.Scope=Q8;var L8=class extends ia.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,ia._)`.${new ia.Name(r)}[${n}]`}};sa.ValueScopeName=L8;var B0r=(0,ia._)`\n`,ile=class extends Q8{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?B0r:ia.nil}}get(){return this._scope}name(t){return new L8(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(t),{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(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,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._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(t,r,n={},i){let s=ia.nil;for(let o in t){let a=t[o];if(!a)continue;let c=n[o]=n[o]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,O8.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 nle(u);c.set(u,O8.Completed)})}return s}};sa.ValueScope=ile});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=Jx(),Fu=sle(),Yh=Jx();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 U8=sle();Object.defineProperty(jt,"Scope",{enumerable:!0,get:function(){return U8.Scope}});Object.defineProperty(jt,"ValueScope",{enumerable:!0,get:function(){return U8.ValueScope}});Object.defineProperty(jt,"ValueScopeName",{enumerable:!0,get:function(){return U8.ValueScopeName}});Object.defineProperty(jt,"varKinds",{enumerable:!0,get:function(){return U8.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(t,r){return this}},ole=class extends ad{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?Fu.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=yv(this.rhs,t,r)),this}get names(){return this.rhs instanceof ur._CodeOrName?this.rhs.names:{}}},M8=class extends ad{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof ur.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=yv(this.rhs,t,r),this}get names(){let t=this.lhs instanceof ur.Name?{}:{...this.lhs.names};return $8(t,this.rhs)}},ale=class extends M8{constructor(t,r,n,i){super(t,n,i),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},cle=class extends ad{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},ule=class extends ad{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},lle=class extends ad{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},fle=class extends ad{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=yv(this.code,t,r),this}get names(){return this.code instanceof ur._CodeOrName?this.code.names:{}}},Wx=class extends ad{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,i=n.length;for(;i--;){let s=n[i];s.optimizeNames(t,r)||(R0r(t,s.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>ly(t,r.names),{})}},cd=class extends Wx{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},dle=class extends Wx{},gv=class extends cd{};gv.kind="else";var cy=class e extends cd{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new gv(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(ast(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=yv(this.condition,t,r),this}get names(){let t=super.names;return $8(t,this.condition),this.else&&ly(t,this.else.names),t}};cy.kind="if";var uy=class extends cd{};uy.kind="for";var ple=class extends uy{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=yv(this.iteration,t,r),this}get names(){return ly(super.names,this.iteration.names)}},hle=class extends uy{constructor(t,r,n,i){super(),this.varKind=t,this.name=r,this.from=n,this.to=i}render(t){let r=t.es5?Fu.varKinds.var:this.varKind,{name:n,from:i,to:s}=this;return`for(${r} ${n}=${i}; ${n}<${s}; ${n}++)`+super.render(t)}get names(){let t=$8(super.names,this.from);return $8(t,this.to)}},P8=class extends uy{constructor(t,r,n,i){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=i}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=yv(this.iterable,t,r),this}get names(){return ly(super.names,this.iterable.names)}},Zx=class extends cd{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Zx.kind="func";var Kx=class extends Wx{render(t){return"return "+super.render(t)}};Kx.kind="return";var Ale=class extends cd{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,i;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(i=this.finally)===null||i===void 0||i.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&ly(t,this.catch.names),this.finally&&ly(t,this.finally.names),t}},Xx=class extends cd{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Xx.kind="catch";var eT=class extends cd{render(t){return"finally"+super.render(t)}};eT.kind="finally";var mle=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
873
873
  `:""},this._extScope=t,this._scope=new Fu.Scope({parent:t}),this._nodes=[new dle]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,i){let s=this._scope.toName(r);return n!==void 0&&i&&(this._constants[s.str]=n),this._leafNode(new ole(t,s,n)),s}const(t,r,n){return this._def(Fu.varKinds.const,t,r,n)}let(t,r,n){return this._def(Fu.varKinds.let,t,r,n)}var(t,r,n){return this._def(Fu.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new M8(t,r,n))}add(t,r){return this._leafNode(new ale(t,jt.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==ur.nil&&this._leafNode(new fle(t)),this}object(...t){let r=["{"];for(let[n,i]of t)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(t,r,n){if(this._blockNode(new cy(t)),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(t){return this._elseNode(new cy(t))}else(){return this._elseNode(new gv)}endIf(){return this._endBlockNode(cy,gv)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new ple(t),r)}forRange(t,r,n,i,s=this.opts.es5?Fu.varKinds.var:Fu.varKinds.let){let o=this._scope.toName(t);return this._for(new hle(s,o,r,n),()=>i(o))}forOf(t,r,n,i=Fu.varKinds.const){let s=this._scope.toName(t);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 P8("of",i,s,r),()=>n(s))}forIn(t,r,n,i=this.opts.es5?Fu.varKinds.var:Fu.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,ur._)`Object.keys(${r})`,n);let s=this._scope.toName(t);return this._for(new P8("in",i,s,r),()=>n(s))}endFor(){return this._endBlockNode(uy)}label(t){return this._leafNode(new cle(t))}break(t){return this._leafNode(new ule(t))}return(t){let r=new Kx;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Kx)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new Ale;if(this._blockNode(i),this.code(t),r){let s=this.name("e");this._currNode=i.catch=new Xx(s),r(s)}return n&&(this._currNode=i.finally=new eT,this.code(n)),this._endBlockNode(Xx,eT)}throw(t){return this._leafNode(new lle(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){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||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=ur.nil,n,i){return this._blockNode(new Zx(t,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(Zx)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof cy))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};jt.CodeGen=mle;function ly(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function $8(e,t){return t instanceof ur._CodeOrName?ly(e,t.names):e}function yv(e,t,r){if(e instanceof ur.Name)return n(e);if(!i(e))return e;return new ur._Code(e._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||t[s.str]!==1?s:(delete t[s.str],o)}function i(s){return s instanceof ur._Code&&s._items.some(o=>o instanceof ur.Name&&t[o.str]===1&&r[o.str]!==void 0)}}function R0r(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function ast(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,ur._)`!${gle(e)}`}jt.not=ast;var x0r=cst(jt.operators.AND);function T0r(...e){return e.reduce(x0r)}jt.and=T0r;var k0r=cst(jt.operators.OR);function N0r(...e){return e.reduce(k0r)}jt.or=N0r;function cst(e){return(t,r)=>t===ur.nil?r:r===ur.nil?t:(0,ur._)`${gle(t)} ${e} ${gle(r)}`}function gle(e){return e instanceof ur.Name?e:(0,ur._)`(${e})`}});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(),F0r=Jx();function O0r(e){let t={};for(let r of e)t[r]=!0;return t}Xt.toHash=O0r;function Q0r(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(fst(e,t),!dst(t,e.self.RULES.all))}Xt.alwaysValidSchema=Q0r;function fst(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let i=n.RULES.keywords;for(let s in t)i[s]||Ast(e,`unknown keyword: "${s}"`)}Xt.checkUnknownRules=fst;function dst(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Xt.schemaHasRules=dst;function L0r(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}Xt.schemaHasRulesButRef=L0r;function M0r({topSchemaRef:e,schemaPath:t},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._)`${e}${t}${(0,un.getProperty)(n)}`}Xt.schemaRefOrVal=M0r;function P0r(e){return pst(decodeURIComponent(e))}Xt.unescapeFragment=P0r;function $0r(e){return encodeURIComponent(Ele(e))}Xt.escapeFragment=$0r;function Ele(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}Xt.escapeJsonPointer=Ele;function pst(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Xt.unescapeJsonPointer=pst;function U0r(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Xt.eachItem=U0r;function ust({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(i,s,o,a)=>{let c=o===void 0?s:o instanceof un.Name?(s instanceof un.Name?e(i,s,o):t(i,s,o),o):s instanceof un.Name?(t(i,o,s),s):r(s,o);return a===un.Name&&!(c instanceof un.Name)?n(i,c):c}}Xt.mergeEvaluated={props:ust({mergeNames:(e,t,r)=>e.if((0,un._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,un._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,un._)`${r} || {}`).code((0,un._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,un._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,un._)`${r} || {}`),ble(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:hst}),items:ust({mergeNames:(e,t,r)=>e.if((0,un._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,un._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,un._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,un._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function hst(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,un._)`{}`);return t!==void 0&&ble(e,r,t),r}Xt.evaluatedPropsToName=hst;function ble(e,t,r){Object.keys(r).forEach(n=>e.assign((0,un._)`${t}${(0,un.getProperty)(n)}`,!0))}Xt.setEvaluated=ble;var lst={};function q0r(e,t){return e.scopeValue("func",{ref:t,code:lst[t.code]||(lst[t.code]=new F0r._Code(t.code))})}Xt.useFunc=q0r;var yle;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(yle||(Xt.Type=yle={}));function j0r(e,t,r){if(e instanceof un.Name){let n=t===yle.Num;return r?n?(0,un._)`"[" + ${e} + "]"`:(0,un._)`"['" + ${e} + "']"`:n?(0,un._)`"/" + ${e}`:(0,un._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,un.getProperty)(e).toString():"/"+Ele(e)}Xt.getErrorPath=j0r;function Ast(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}Xt.checkStrictMode=Ast});var ud=b(Cle=>{"use strict";Object.defineProperty(Cle,"__esModule",{value:!0});var to=Pt(),Y0r={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")};Cle.default=Y0r});var tT=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(),q8=Ar(),To=ud();ro.keywordError={message:({keyword:e})=>(0,mr.str)`must pass "${e}" keyword validation`};ro.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,mr.str)`"${e}" keyword must be ${t} ($data)`:(0,mr.str)`"${e}" keyword is invalid ($data)`};function z0r(e,t=ro.keywordError,r,n){let{it:i}=e,{gen:s,compositeRule:o,allErrors:a}=i,c=yst(e,t,r);n??(o||a)?mst(s,c):gst(i,(0,mr._)`[${c}]`)}ro.reportError=z0r;function H0r(e,t=ro.keywordError,r){let{it:n}=e,{gen:i,compositeRule:s,allErrors:o}=n,a=yst(e,t,r);mst(i,a),s||o||gst(n,To.default.vErrors)}ro.reportExtraError=H0r;function G0r(e,t){e.assign(To.default.errors,t),e.if((0,mr._)`${To.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,mr._)`${To.default.vErrors}.length`,t),()=>e.assign(To.default.vErrors,null)))}ro.resetErrorsCount=G0r;function V0r({gen:e,keyword:t,schemaValue:r,data:n,errsCount:i,it:s}){if(i===void 0)throw new Error("ajv implementation error");let o=e.name("err");e.forRange("i",i,To.default.errors,a=>{e.const(o,(0,mr._)`${To.default.vErrors}[${a}]`),e.if((0,mr._)`${o}.instancePath === undefined`,()=>e.assign((0,mr._)`${o}.instancePath`,(0,mr.strConcat)(To.default.instancePath,s.errorPath))),e.assign((0,mr._)`${o}.schemaPath`,(0,mr.str)`${s.errSchemaPath}/${t}`),s.opts.verbose&&(e.assign((0,mr._)`${o}.schema`,r),e.assign((0,mr._)`${o}.data`,n))})}ro.extendErrors=V0r;function mst(e,t){let r=e.const("err",t);e.if((0,mr._)`${To.default.vErrors} === null`,()=>e.assign(To.default.vErrors,(0,mr._)`[${r}]`),(0,mr._)`${To.default.vErrors}.push(${r})`),e.code((0,mr._)`${To.default.errors}++`)}function gst(e,t){let{gen:r,validateName:n,schemaEnv:i}=e;i.$async?r.throw((0,mr._)`new ${e.ValidationError}(${t})`):(r.assign((0,mr._)`${n}.errors`,t),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 yst(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,mr._)`{}`:J0r(e,t,r)}function J0r(e,t,r={}){let{gen:n,it:i}=e,s=[W0r(i,r),Z0r(e,r)];return K0r(e,t,s),n.object(...s)}function W0r({errorPath:e},{instancePath:t}){let r=t?(0,mr.str)`${e}${(0,q8.getErrorPath)(t,q8.Type.Str)}`:e;return[To.default.instancePath,(0,mr.strConcat)(To.default.instancePath,r)]}function Z0r({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let i=n?t:(0,mr.str)`${t}/${e}`;return r&&(i=(0,mr.str)`${i}${(0,q8.getErrorPath)(r,q8.Type.Str)}`),[fy.schemaPath,i]}function K0r(e,{params:t,message:r},n){let{keyword:i,data:s,schemaValue:o,it:a}=e,{opts:c,propertyName:u,topSchemaRef:f,schemaPath:d}=a;n.push([fy.keyword,i],[fy.params,typeof t=="function"?t(e):t||(0,mr._)`{}`]),c.messages&&n.push([fy.message,typeof r=="function"?r(e):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 bst=b(Ev=>{"use strict";Object.defineProperty(Ev,"__esModule",{value:!0});Ev.boolOrEmptySchema=Ev.topBoolOrEmptySchema=void 0;var X0r=tT(),eCr=Pt(),tCr=ud(),rCr={message:"boolean schema is false"};function nCr(e){let{gen:t,schema:r,validateName:n}=e;r===!1?Est(e,!1):typeof r=="object"&&r.$async===!0?t.return(tCr.default.data):(t.assign((0,eCr._)`${n}.errors`,null),t.return(!0))}Ev.topBoolOrEmptySchema=nCr;function iCr(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),Est(e)):r.var(t,!0)}Ev.boolOrEmptySchema=iCr;function Est(e,t){let{gen:r,data:n}=e,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,X0r.reportError)(i,rCr,void 0,t)}});var vle=b(bv=>{"use strict";Object.defineProperty(bv,"__esModule",{value:!0});bv.getRules=bv.isJSONType=void 0;var sCr=["string","number","integer","boolean","null","object","array"],oCr=new Set(sCr);function aCr(e){return typeof e=="string"&&oCr.has(e)}bv.isJSONType=aCr;function cCr(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}bv.getRules=cCr});var wle=b(zh=>{"use strict";Object.defineProperty(zh,"__esModule",{value:!0});zh.shouldUseRule=zh.shouldUseGroup=zh.schemaHasRulesForType=void 0;function uCr({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&Cst(e,n)}zh.schemaHasRulesForType=uCr;function Cst(e,t){return t.rules.some(r=>vst(e,r))}zh.shouldUseGroup=Cst;function vst(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}zh.shouldUseRule=vst});var rT=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 lCr=vle(),fCr=wle(),dCr=tT(),Lt=Pt(),wst=Ar(),Cv;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Cv||(no.DataType=Cv={}));function pCr(e){let t=Ist(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}no.getSchemaTypes=pCr;function Ist(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(lCr.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}no.getJSONTypes=Ist;function hCr(e,t){let{gen:r,data:n,opts:i}=e,s=ACr(t,i.coerceTypes),o=t.length>0&&!(s.length===0&&t.length===1&&(0,fCr.schemaHasRulesForType)(e,t[0]));if(o){let a=_le(t,n,i.strictNumbers,Cv.Wrong);r.if(a,()=>{s.length?mCr(e,t,s):Dle(e)})}return o}no.coerceAndCheckDataType=hCr;var _st=new Set(["string","number","integer","boolean","null"]);function ACr(e,t){return t?e.filter(r=>_st.has(r)||t==="array"&&r==="array"):[]}function mCr(e,t,r){let{gen:n,data:i,opts:s}=e,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(_le(t,i,s.strictNumbers),()=>n.assign(a,i))),n.if((0,Lt._)`${a} !== undefined`);for(let u of r)(_st.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),Dle(e),n.endIf(),n.if((0,Lt._)`${a} !== undefined`,()=>{n.assign(i,a),gCr(e,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
@@ -1161,10 +1161,10 @@ Call with { operation, arguments${o.length?", file":""}${e?", org_id":""} }. Ope
1161
1161
 
1162
1162
  Multiple organizations are accessible: pass org_id (from list_organizations) to target one. Confirm the organization with the user before any create/update/delete.`:""),c={operation:{type:"string",enum:n,description:`The ${t.name} operation to run.`},arguments:{type:"object",description:"Parameters for the chosen operation (see the operation list above). Validated by the Jaz API.",additionalProperties:!0}};return o.length&&(c.file={type:"object",description:`A file from the conversation, when the client supports passing one. Accepted by: ${o.join(", ")}. The content is fetched server-side \u2014 leave source arguments out of \`arguments\`.`,properties:{download_url:{type:"string",description:"URL the file content can be fetched from (may be temporary)."},file_id:{type:"string",description:"Host-side file identifier."},mime_type:{type:"string"},file_name:{type:"string"}},required:["download_url"]}),e&&(c.org_id={type:"string",description:"The organization (resourceId from list_organizations) to run this operation against. Required when more than one organization is accessible."}),{name:t.name,description:a,inputSchema:{type:"object",properties:c,required:["operation"],additionalProperties:!1},...o.length?{_meta:{"openai/fileParams":["file"]}}:{},annotations:{title:fDr(t.name),readOnlyHint:i,destructiveHint:!i&&s,idempotentHint:i,openWorldHint:!1}}})}var pDr=new Set(Qc.map(e=>e.name));function Wat(e){return pDr.has(e)}function Gfe(e,t){let r=Qc.find(s=>s.name===e);if(!r)return{error:`Unknown namespace: ${e}.`};let n=Vat(r.groups),i=n.find(s=>s.name===t);return i?{tool:i}:{error:`Unknown operation "${t}" for the ${e} tool.`,operations:n.map(s=>s.name)}}eO();var hDr=10*1024*1024,ADr=2e4;function mDr(e){return e[0]===37&&e[1]===80&&e[2]===68&&e[3]===70?"application/pdf":e[0]===255&&e[1]===216?"image/jpeg":e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71?"image/png":e[0]===80&&e[1]===75?"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":null}function gDr(e,t){let r=t.pathname.split("/").pop()??"",n;try{n=decodeURIComponent(r)}catch{n=r}let i=(e||n).trim();return!i||i==="."||i===".."||i.includes("/")||i.includes("\\")||/[\x00-\x1f\x7f]/.test(i)?"attachment":i.slice(0,255)}async function Zat(e,t=WE){if(typeof e!="object"||e===null||Array.isArray(e))return{error:{error:"The file was passed as a reference this server cannot fetch \u2014 some clients (notably mobile apps) cannot deliver conversation files yet.",hint:"Ask the user to retry from the web/desktop client, or upload the file in the Jaz dashboard and pass its attachmentId instead."}};let r=e,n;try{if(n=new URL(String(r.download_url??"")),n.protocol!=="https:")throw new Error("not https")}catch{return{error:{error:"The file reference has no fetchable https download_url.",hint:"Ask the user to re-attach the file, or upload it in the Jaz dashboard and pass its attachmentId instead."}}}try{let i=await t(n,{timeoutMs:ADr,maxBytes:hDr});if(!i.ok)return{error:{error:`Downloading the provided file failed (${i.status} ${i.statusText}) \u2014 the link may have expired.`,hint:"Ask the user to re-attach the file and retry."}};let s=await i.arrayBuffer(),o=(i.headers.get("content-type")??"").split(";")[0].trim(),a=typeof r.mime_type=="string"&&r.mime_type||(o&&o!=="application/octet-stream"?o:null)||mDr(new Uint8Array(s.slice(0,8)))||"application/octet-stream";return{file:{data:new Blob([s],{type:a}),fileName:gDr(typeof r.file_name=="string"?r.file_name:void 0,n)}}}catch(i){return{error:{error:`Downloading the provided file failed: ${i instanceof Error?i.message:String(i)}`,hint:"Ask the user to re-attach the file and retry. Files over 10MB cannot be ingested this way."}}}}Vu();Vu();Av();var yDr=["search_","list_","get_","view_","describe_"];function EDr(e){return yDr.some(t=>e.startsWith(t))}function vT(e){if(EDr(e.tool)&&sy(e.tool))return e}function Kat(e,t,r){if(!(e instanceof Lo))return;let n=e.message.toLowerCase(),i=e.status;if(i===404||n.includes("not found")){if(typeof r.contactResourceId=="string"&&n.includes("contact"))return vT({tool:"search_contacts",arguments:{},reason:`Contact ${r.contactResourceId} not found. Search by name to find the correct resourceId before retrying.`});let o=/^(get|update|delete|finalize|pay)_(.+)$/.exec(t);if(o){let a=o[2],c=`search_${a}s`,u=typeof r.resourceId=="string"?r.resourceId:void 0;return vT({tool:c,arguments:{},reason:`${a} ${u??""} not found. Search to locate the correct resourceId, then retry.`.trim()})}}if(i===422&&(n.includes("accountresourceid")||n.includes("account resource id")))return vT({tool:"search_accounts",arguments:{},reason:"Line item missing accountResourceId. Search for the right GL account first (e.g. by name or accountType), then retry with the resourceId on each line item."});if(i===422&&(n.includes("duplicate")||n.includes("already exists"))){let o=typeof r.reference=="string"?r.reference:void 0;if(o){let a=/^create_(.+)$/.exec(t);if(a){let c=a[1];return vT({tool:`search_${c}s`,arguments:{filter:{reference:{eq:o}}},reason:`Reference "${o}" already exists in ${c}s. Look up the existing record before deciding whether to update it or use a new reference.`})}}}if(i===422&&(n.includes("taxprofileresourceid")||n.includes("tax profile")||n.includes("tax_profile"))&&(n.includes("direction")||n.includes("appliesto")||n.includes("applies to")||n.includes("sale")||n.includes("purchase")))return vT({tool:"search_tax_profiles",arguments:{},reason:'Tax profile rejected \u2014 direction mismatch. Use search_tax_profiles with the correct appliesTo direction ("sale" for invoices, "purchase" for bills) before retrying.'})}function bDr(e){switch(e){case 401:return"Invalid or missing API key. Run `clio auth add` or set JAZ_API_KEY.";case 403:return"Insufficient permissions for this operation.";case 404:return"Resource not found \u2014 check the resourceId. Use a search/list tool to look it up.";case 409:return"Conflict \u2014 resource may have been modified. Re-fetch and retry.";case 422:return"Validation error \u2014 check field values against the tool description.";case 429:return"Rate limited \u2014 wait a moment and retry.";default:return""}}function Xat(e,t={}){if(e instanceof Lo){let n=bDr(e.status),i={error:e.message,status:e.status,endpoint:e.endpoint,...n?{hint:n}:{}};if(t.toolName&&t.input){let s=Kat(e,t.toolName,t.input);s&&(i.repair=s)}return i}return{error:e instanceof Error?e.message:String(e)}}function ect(e,t){if(e.readOnly)return{valid:!0,errors:[]};let r=[];for(let n of e.required){let i=t[n];if(i==null){r.push(`Missing required field: ${n}`);continue}typeof i=="string"&&i.trim()===""&&r.push(`Required field "${n}" is empty`)}for(let[n,i]of Object.entries(t)){if(i==null)continue;let s=e.params[n];if(!s)continue;let o=CDr(n,i,s);o&&r.push(o),s.enum&&typeof i=="string"&&(s.enum.includes(i)||r.push(`Field "${n}" value "${i}" not in allowed values: ${s.enum.join(", ")}`))}return{valid:r.length===0,errors:r}}function CDr(e,t,r){switch(r.type){case"string":if(typeof t!="string")return`Field "${e}" expected string, got ${typeof t}`;break;case"number":if(typeof t!="number"||!Number.isFinite(t))return`Field "${e}" expected finite number, got ${typeof t=="number"?"non-finite":typeof t}`;break;case"boolean":if(typeof t!="boolean")return`Field "${e}" expected boolean, got ${typeof t}`;break;case"array":if(!Array.isArray(t))return`Field "${e}" expected array, got ${typeof t}`;break;case"object":if(typeof t!="object"||Array.isArray(t))return`Field "${e}" expected object, got ${Array.isArray(t)?"array":typeof t}`;break}return null}jx();zx();Vu();TA();Yae();import{readFileSync as vDr,readdirSync as wDr,statSync as IDr}from"node:fs";import{dirname as rct,join as Kh,relative as _Dr}from"node:path";import{fileURLToPath as nct}from"node:url";function DDr(e,t){let r;try{r=IDr(e)}catch{return[]}if(!r.isDirectory())return[];let n=[],i=20,s=(o,a)=>{if(a>i)return;let c;try{c=wDr(o,{withFileTypes:!0})}catch{return}for(let u of c){let f=Kh(o,u.name);if(u.isDirectory())s(f,a+1);else if(u.isFile()&&u.name.endsWith(".md")){let d=_Dr(e,f).split(/[\\/]/).join("/");(!t||!t(d))&&n.push(d)}}};return s(e,0),n.sort()}function tct(e){let t=e.fileFilter??(()=>!0);return DDr(e.rootDir,n=>!t(n)).map(n=>{let i=e.uriPathBuilder?e.uriPathBuilder(n):n.replace(/\.md$/,"");return{uri:`${e.uriPrefix}/${i}`,name:e.nameBuilder(n),description:e.descriptionBuilder?.(n),mimeType:"text/markdown",filePath:Kh(e.rootDir,n)}})}function SDr(){let e=nct(import.meta.url),t=rct(e);return jae([Kh(t,"..","..","..","assets","skills"),Kh(t,"..","..","..","..","assets","skills"),Kh(t,"skills")])}function BDr(){let e=nct(import.meta.url),t=rct(e);return jae([Kh(t,"..","..","..","help-center-mirror"),Kh(t,"..","..","..","assets","skills","api","help-center-mirror"),Kh(t,"help-center-mirror")])}var RDr=["api","cli","conversion","jobs","transaction-recipes"],xDr={api:"Jaz REST API rules: every endpoint, field name, error code, production gotchas.",cli:"Jaz CLI commands, auth, calculators, jobs.",conversion:"Migration from Xero, QuickBooks, Sage, MYOB, or Excel exports into Jaz.",jobs:"12 recurring accounting workflow playbooks (close, reconciliation, GST/VAT, etc.).","transaction-recipes":"16 IFRS-compliant transaction recipes plus 13 financial calculators."};function TDr(e){if(e.includes("/help-center-mirror/"))return!1;let t=e.split("/")[0];return RDr.includes(t)}function kDr(e){let t=e.split("/"),r=t[0];if(t.length===2&&t[1]==="SKILL.md")return`Jaz ${r} skill`;if(t[1]==="references"){let n=t.slice(2).join("/").replace(/\.md$/,"");return`Jaz ${r} reference: ${n}`}return`Jaz ${r}: ${e}`}function NDr(e){let t=e.split("/")[0];return xDr[t]}function FDr(e){return!e.includes("/")}function ODr(e){return`Jaz help center: ${e.replace(/\.md$/,"").split("-").map(n=>n[0]?.toUpperCase()+n.slice(1)).join(" ")}`}var Vfe=null,Jfe=null;function Wfe(){if(Vfe)return Vfe;let e=SDr(),t=BDr(),r=[];return e&&r.push(...tct({rootDir:e,uriPrefix:"jaz://skill",fileFilter:TDr,nameBuilder:kDr,descriptionBuilder:NDr,uriPathBuilder:n=>{let i=n.split("/");return i.length===2&&i[1]==="SKILL.md"?i[0]:n.replace(/\.md$/,"")}})),t&&r.push(...tct({rootDir:t,uriPrefix:"jaz://help-center",fileFilter:FDr,nameBuilder:ODr,descriptionBuilder:()=>"Jaz help center article. Same corpus search_help_center indexes."})),Vfe=r,Jfe=new Map(r.map(n=>[n.uri,n])),r}function ict(e){Jfe||Wfe();let t=Jfe.get(e);if(!t)throw new Error(`Resource not found: ${e}`);let r=vDr(t.filePath,"utf-8");return{mimeType:t.mimeType,text:r}}var QDr=new Set(["help_center"]),Kfe="Calculators, blueprints, and help center search work without an account.",Xfe="Get an API key or token from jaz.ai";function Zfe(e,t){return!!(QDr.has(e)||e==="recipes"&&t==="plan_recipe")}function LDr(e,t){return new Ls({mode:"pat",token:e,orgId:t},"mcp")}async function ede(e,t=5e3){let r=new Map,n=[],i=async a=>{let c,u=new Promise(f=>{c=setTimeout(()=>f(null),t)});try{return await Promise.race([a,u])}finally{c&&clearTimeout(c)}},s=e.map(a=>({auth:a,client:new Ls(a,"mcp")})),o=s[0]?.client??null;return await Promise.all(s.map(async({auth:a,client:c})=>{try{let u=await i(pa(c));if(u)r.set(u.resourceId,{name:u.name,resourceId:u.resourceId,currency:u.currency,client:c});else{let f=a.mode==="direct"?"api-key":a.mode;n.push(`Org lookup returned empty (${f}).`)}}catch(u){let f=a.mode==="direct"?"api-key":a.mode;n.push(`Org lookup failed (${f}): ${u instanceof Error?u.message:"unknown"}`)}})),{orgMap:r,primaryClient:o,errors:n}}function sct(e){let t=new yz({name:"jaz-ai",version:e.version},{capabilities:{tools:{},resources:{}},instructions:e.instructions});t.setRequestHandler(Gue,async()=>{if(e.flatMode){let s=Xit(void 0).reduce((o,a)=>{try{let c=oy(a);o.push({name:c.name,description:c.description,inputSchema:c.input_schema,annotations:k8(a)})}catch(c){let u=c instanceof Error?c.message:String(c);process.stderr.write(`[jaz-mcp] flat-mode: skipping malformed tool '${a.name}': ${u}
1163
1163
  `)}return o},[]);return e.isMultiOrg&&e.orgMap.size>0&&s.unshift({name:Uh.name,description:Uh.description,inputSchema:Uh.inputSchema,annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}}),{tools:s}}if(e.namespaceMode){let s=e.isMultiOrg&&e.orgMap.size>0,o=Jat(s);return s&&o.unshift({name:Uh.name,description:Uh.description,inputSchema:Uh.inputSchema,annotations:{title:"List Organizations",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}}),{tools:o}}return{tools:(e.isMultiOrg&&e.orgMap.size>0?[...sd,Uh]:sd).map(s=>({name:s.name,description:s.description,inputSchema:s.inputSchema,annotations:{readOnlyHint:s.name!=="execute_tool",openWorldHint:!1}}))}}),t.setRequestHandler($ue,async()=>({resources:Wfe().map(({uri:i,name:s,description:o,mimeType:a})=>({uri:i,name:s,...o?{description:o}:{},mimeType:a}))})),t.setRequestHandler(que,async i=>{let s=i.params.uri;try{let{mimeType:o,text:a}=ict(s);return{contents:[{uri:s,mimeType:o,text:a}]}}catch(o){throw new xt(Mt.InvalidRequest,o instanceof Error?o.message:`Resource not found: ${s}`)}});let r=(i,s=!1)=>({content:[{type:"text",text:typeof i=="string"?i:JSON.stringify(i,null,2)}],...s?{isError:!0}:{}});async function n(i,s,o,a){if(!e.primaryClient&&!Zfe(i.group,i.name))return r({error:"No API key configured.",hint:`${Xfe} to use API tools. ${Kfe}`},!0);let c=e.primaryClient,u;if(e.isMultiOrg&&!Zfe(i.group,i.name)){if(e.orgMap.size===0)return r({error:"Organization discovery is unavailable, so this tenant-scoped tool cannot be run safely.",hint:"Retry once organizations resolve, or call list_organizations to refresh."},!0);let p=o;if(!p)if(e.orgMap.size===1)p=e.orgMap.keys().next().value;else return r({error:"Missing org_id. Multiple organizations are accessible \u2014 specify which one.",hint:"Call list_organizations to see available orgs, then include org_id.",organizations:[...e.orgMap.values()].map(({name:m,resourceId:g})=>({name:m,resourceId:g}))},!0);let h=e.orgMap.get(p);if(!h)return r({error:`Unknown org_id: "${p}".`,hint:"Call list_organizations to refresh the org list.",available:[...e.orgMap.values()].map(({name:m,resourceId:g})=>({name:m,resourceId:g}))},!0);u=h;let A=e.authConfigs[0];c=A?.mode==="pat"?LDr(A.token,p):h.client}let f=ect(i,s);if(!f.valid)return r({error:`Validation: ${f.errors.join("; ")}`,hint:"Check required fields and types."},!0);let d;if(a!=null){let p=await Zat(a);if(p.error)return r(p.error,!0);d=p.file}try{if(!c&&!Zfe(i.group,i.name))return r({error:"No API client available.",hint:"Set JAZ_API_KEY or pass --api-key."},!0);let p={client:c,org:u?{resourceId:u.resourceId}:void 0,file_blob:d},h=await i.execute(p,s);return u&&h&&typeof h=="object"&&!Array.isArray(h)?r({...h,_organization:{name:u.name,resourceId:u.resourceId,currency:u.currency}}):r(h)}catch(p){return r(Xat(p,{toolName:i.name,input:s}),!0)}}return t.setRequestHandler(Mx,async i=>{let s=i.params.name,o=i.params.arguments??{};if(s==="search_tools"){let u=o.query;if(u!==void 0&&typeof u!="string")return{content:[{type:"text",text:JSON.stringify({error:"Invalid `query` parameter. Expected string."})}],isError:!0};let f=est(u??"");return{content:[{type:"text",text:JSON.stringify(f,null,2)}]}}if(s==="describe_tools"){let u=tst(o.tools);return{content:[{type:"text",text:JSON.stringify(u,null,2)}]}}if(s==="list_organizations"){if(!e.isMultiOrg||e.orgMap.size===0)return{content:[{type:"text",text:JSON.stringify({error:"list_organizations is only available in multi-org mode (PAT or multiple API keys)."})}],isError:!0};let u=e.refreshOrgs??(e.authConfigs[0]?.mode==="pat"?async()=>(await ede(e.authConfigs,5e3)).orgMap:void 0);if(u)try{let f=await u();if(f.size>0){e.orgMap.clear();for(let[d,p]of f)e.orgMap.set(d,p)}}catch(f){process.stderr.write(`warning: org refresh failed, using cached list: ${f instanceof Error?f.message:"unknown"}
1164
- `)}return{content:[{type:"text",text:JSON.stringify({organizations:[...e.orgMap.values()].map(({name:f,resourceId:d,currency:p})=>({name:f,resourceId:d,currency:p}))},null,2)}]}}if(s==="execute_tool"){let u=o.tool;if(!u)return r({error:"Missing `tool` parameter.",hint:'Call search_tools first, then describe_tools, then execute_tool with { tool: "tool_name", arguments: {...} }.'},!0);let f=sy(u);if(!f)throw new xt(Mt.MethodNotFound,`Unknown tool: ${u}. Use search_tools to find available tools.`);return n(f,o.arguments??{},o.org_id)}if(e.namespaceMode&&Wat(s)){let u=o.operation;if(!u)return r({error:`Missing \`operation\` for the ${s} tool.`,operations:Gfe(s,"").operations},!0);let f=Gfe(s,u);return f.tool?o.file!==void 0&&o.file!==null&&!f.tool.acceptsHostFile?r({error:`Operation "${u}" does not ingest files.`,hint:"Pick a file-capable operation (the tool description marks them), or omit `file`."},!0):n(f.tool,o.arguments??{},o.org_id,o.file):r({error:f.error,operations:f.operations},!0)}let a=sy(s);if(a){let{org_id:u,...f}=o;return n(a,f,u)}let c=e.isMultiOrg&&e.orgMap.size>0?"search_tools, describe_tools, execute_tool, list_organizations":"search_tools, describe_tools, execute_tool";throw new xt(Mt.MethodNotFound,`Unknown tool: ${s}. Available tools: ${c}.`)}),t}function oct(e){let t=Qc.map(i=>i.name).join(", "),r=e.hasAuth?"All API tools hit api.getjaz.com using the configured credentials.":`${Xfe} to bring Jaz into Claude for real accounting and finance work. ${Kfe}`,n=e.isMultiOrg&&e.orgs.length>0?["","MULTI-ORG MODE:",`You have access to ${e.orgs.length} organization(s):`,...e.orgs.map(i=>` - ${i.name} (org_id: ${i.resourceId}, ${i.currency})`),"","RULES:","1. Pass org_id on each API tool call. With exactly one organization it may be omitted (it defaults); with two or more it is required.","2. If the user mentions an org by name, match it to the org_id above.",'3. If the user has not specified an org and more than one is accessible, ask: "Which organization?"','4. Confirm the target organization with the user BEFORE any create, update, or delete (e.g. "Create this invoice in [Org Name]?"). Reads need no confirmation.',"5. Once the user picks an org, use it for subsequent calls until they say to switch.","6. Every tool result includes the organization it acted on (`_organization`) \u2014 surface it so the user can catch a wrong-org call.",'7. For cross-org queries (e.g. "compare Acme and Beta"), make separate calls with different org_ids.',"8. Call list_organizations to refresh the org list if needed."]:[];return[`Jaz accounting platform \u2014 ${kc.length} tools across ${Qc.length} namespaces.`,e.orgDisplay,"","WORKFLOW: search_tools \u2192 describe_tools \u2192 execute_tool.","1. Call search_tools with a keyword to find relevant tools.","2. Call describe_tools with tool names to get full parameter schemas.","3. Call execute_tool with the tool name and arguments to run it.","",`Namespaces: ${t}.`,"","Key API rules (apply to all tools):","- All IDs are `resourceId` (never `id`).","- All transaction dates are `valueDate` (not issueDate/invoiceDate/date). Format: YYYY-MM-DD.","- Line item text field is `name` (not `description`).","- `saveAsDraft` defaults to false \u2014 omitting it finalizes the transaction.","- Response dates are epoch milliseconds (convert with new Date(ms)).","- Pagination: `limit`/`offset` (not page/size). `offset` is a 0-indexed PAGE NUMBER, not a row-skip (offset=1 = second page of `limit` rows). Search sort is required when offset present.","- Create responses return only `{ resourceId }` \u2014 GET the full entity after creation.","","Offline tools (no auth needed): plan_recipe calculator and search_help_center for the Jaz help center.",r,...n].filter(i=>i!==void 0).join(`
1164
+ `)}return{content:[{type:"text",text:JSON.stringify({organizations:[...e.orgMap.values()].map(({name:f,resourceId:d,currency:p})=>({name:f,resourceId:d,currency:p}))},null,2)}]}}if(s==="execute_tool"){let u=o.tool;if(!u)return r({error:"Missing `tool` parameter.",hint:'Call search_tools first, then describe_tools, then execute_tool with { tool: "tool_name", arguments: {...} }.'},!0);let f=sy(u);if(!f)throw new xt(Mt.MethodNotFound,`Unknown tool: ${u}. Use search_tools to find available tools.`);return n(f,o.arguments??{},o.org_id)}if(e.namespaceMode&&Wat(s)){let u=o.operation;if(!u)return r({error:`Missing \`operation\` for the ${s} tool.`,operations:Gfe(s,"").operations},!0);let f=Gfe(s,u);return f.tool?o.file!==void 0&&o.file!==null&&!f.tool.acceptsHostFile?r({error:`Operation "${u}" does not ingest files.`,hint:"Pick a file-capable operation (the tool description marks them), or omit `file`."},!0):n(f.tool,o.arguments??{},o.org_id,o.file):r({error:f.error,operations:f.operations},!0)}let a=sy(s);if(a){let{org_id:u,...f}=o;return n(a,f,u)}let c=e.isMultiOrg&&e.orgMap.size>0?"search_tools, describe_tools, execute_tool, list_organizations":"search_tools, describe_tools, execute_tool";throw new xt(Mt.MethodNotFound,`Unknown tool: ${s}. Available tools: ${c}.`)}),t}function oct(e){let t=Qc.map(s=>s.name).join(", "),r=e.hasAuth?"All API tools hit api.getjaz.com using the configured credentials.":`${Xfe} to bring Jaz into Claude for real accounting and finance work. ${Kfe}`,n=e.surface==="namespace"?["WORKFLOW: each namespace below is ONE tool. Call it with `{ operation, arguments }` (plus `file` or `org_id` when the tool offers them).","1. Pick the namespace that fits the task (see the list below).","2. Set `operation` to the action and `arguments` to its parameters.","3. Read the result and chain follow-up calls as needed."]:e.surface==="flat"?["WORKFLOW: every tool is listed directly \u2014 call a tool by its own name with its arguments.","1. Find the tool for the task in the tool list.","2. Call it with its arguments. No separate discovery step is needed."]:["WORKFLOW: search_tools \u2192 describe_tools \u2192 execute_tool.","1. Call search_tools with a keyword to find relevant tools.","2. Call describe_tools with tool names to get full parameter schemas.","3. Call execute_tool with the tool name and arguments to run it."],i=e.isMultiOrg&&e.orgs.length>0?["","MULTI-ORG MODE:",`You have access to ${e.orgs.length} organization(s):`,...e.orgs.map(s=>` - ${s.name} (org_id: ${s.resourceId}, ${s.currency})`),"","RULES:","1. Pass org_id on each API tool call. With exactly one organization it may be omitted (it defaults); with two or more it is required.","2. If the user mentions an org by name, match it to the org_id above.",'3. If the user has not specified an org and more than one is accessible, ask: "Which organization?"','4. Confirm the target organization with the user BEFORE any create, update, or delete (e.g. "Create this invoice in [Org Name]?"). Reads need no confirmation.',"5. Once the user picks an org, use it for subsequent calls until they say to switch.","6. Every tool result includes the organization it acted on (`_organization`) \u2014 surface it so the user can catch a wrong-org call.",'7. For cross-org queries (e.g. "compare Acme and Beta"), make separate calls with different org_ids.',"8. Call list_organizations to refresh the org list if needed."]:[];return[`Jaz accounting platform \u2014 ${kc.length} tools across ${Qc.length} namespaces.`,e.orgDisplay,"",...n,"",`Namespaces: ${t}.`,"","Key API rules (apply to all tools):","- All IDs are `resourceId` (never `id`).","- All transaction dates are `valueDate` (not issueDate/invoiceDate/date). Format: YYYY-MM-DD.","- Line item text field is `name` (not `description`).","- `saveAsDraft` defaults to false \u2014 omitting it finalizes the transaction.","- Response dates are epoch milliseconds (convert with new Date(ms)).","- Pagination: `limit`/`offset` (not page/size). `offset` is a 0-indexed PAGE NUMBER, not a row-skip (offset=1 = second page of `limit` rows). Search sort is required when offset present.","- Create responses return only `{ resourceId }` \u2014 GET the full entity after creation.","- Documents: when the user provides or uploads an invoice / bill / receipt / credit note, prefer AI extraction over re-keying \u2014 use the `document_ai` namespace's `create_bt_from_attachment` with the file (the `file` slot) or a `sourceUrl`, and set `businessTransactionType` (bill / purchase invoice \u2192 BILL, invoice / sales invoice \u2192 INVOICE, credit note \u2192 its matching type; ask if genuinely unclear). A bank or card statement is NOT one of these \u2014 that is a bank import (`import_bank_statement` / reconciliation), never a bill or invoice. Extraction is asynchronous: it returns a workflow id, NOT a record \u2014 tell the user the draft is being prepared and will appear in their Drafts, and do not claim a specific record or invent a link until a status check confirms one. If you cannot get the file or a URL, create from the fields you have (e.g. `create_bill`) and ask for anything missing \u2014 do not stop at only describing it. (This never overrides org confirmation before a create.)","","Offline tools (no auth needed): plan_recipe calculator and search_help_center for the Jaz help center.",r,...i].filter(s=>s!==void 0).join(`
1165
1165
  `)}function act(e){let t=(process.env[e]??"").trim().toLowerCase();return t==="1"||t==="true"||t==="yes"}jx();function hct(e){e.command("mcp").description("Start MCP stdio server for Claude Code / Cowork").option("--api-key <key>","API key, PAT, or comma-separated keys (overrides stored/env)").action(async t=>{let r=[];try{r=xG(t.apiKey)}catch(C){let E=C instanceof Error?C.message:String(C);process.stderr.write(`jaz-ai: ${E} (continuing in offline mode)
1166
1166
  `)}let n=e.version()??"0.0.0",i=new Map,s=null,o=r.length>1||r[0]?.mode==="pat";if(r.length>0){let C=await ede(r);i=C.orgMap,s=C.primaryClient;for(let E of C.errors)process.stderr.write(`warning: ${E}
1167
- `)}let a="",c="";if(i.size>1){let C=[...i.values()].map(E=>`${E.name} (${E.currency})`);a=`Connected to ${i.size} organizations: ${C.join(", ")}.`,c=`${i.size} orgs`}else if(i.size===1){let C=[...i.values()][0];a=`Connected to: ${C.name} (${C.currency}).`,c=C.name}else if(s){let C=Lw();if(C){let E=Za(C);E?.orgName&&(a=`Connected to: ${E.orgName} (${E.currency}).`,c=`${E.orgName} (${C})`)}}let u=oct({orgDisplay:a,hasAuth:s!=null,isMultiOrg:o,orgs:[...i.values()].map(({name:C,resourceId:E,currency:v})=>({name:C,resourceId:E,currency:v}))}),f=act("JAZ_MCP_FLAT"),p=sct({version:n,instructions:u,flatMode:f,isMultiOrg:o,orgMap:i,primaryClient:s,authConfigs:r}),h=new R8;await p.connect(h);try{let{measureAllScenarios:C,emitManifestSizeLog:E}=await Promise.resolve().then(()=>(pct(),dct));E("mcp",C())}catch(C){process.stderr.write(`R4 manifest-size emit failed (non-fatal): ${C.message}
1167
+ `)}let a="",c="";if(i.size>1){let C=[...i.values()].map(E=>`${E.name} (${E.currency})`);a=`Connected to ${i.size} organizations: ${C.join(", ")}.`,c=`${i.size} orgs`}else if(i.size===1){let C=[...i.values()][0];a=`Connected to: ${C.name} (${C.currency}).`,c=C.name}else if(s){let C=Lw();if(C){let E=Za(C);E?.orgName&&(a=`Connected to: ${E.orgName} (${E.currency}).`,c=`${E.orgName} (${C})`)}}let u=act("JAZ_MCP_FLAT"),f=oct({orgDisplay:a,hasAuth:s!=null,isMultiOrg:o,orgs:[...i.values()].map(({name:C,resourceId:E,currency:v})=>({name:C,resourceId:E,currency:v})),surface:u?"flat":"meta"}),p=sct({version:n,instructions:f,flatMode:u,isMultiOrg:o,orgMap:i,primaryClient:s,authConfigs:r}),h=new R8;await p.connect(h);try{let{measureAllScenarios:C,emitManifestSizeLog:E}=await Promise.resolve().then(()=>(pct(),dct));E("mcp",C())}catch(C){process.stderr.write(`R4 manifest-size emit failed (non-fatal): ${C.message}
1168
1168
  `)}let A=async()=>{await p.close(),process.exit(0)};process.on("SIGINT",A),process.on("SIGTERM",A),process.stdin.on("end",A);let m=c?` \u2014 ${c}`:"",g=s?"":" [offline mode, no API key]",y=o&&i.size>0?sd.length+1:sd.length;process.stderr.write(`jaz-ai MCP server v${n} started (${kc.length} tools, ${y} meta-tools, dynamic toolset)${m}${g}
1169
1169
  `)})}Le();hce();Tt();or();qt();Pr();ir();Jr();var Act=[{key:"resourceId",header:"ID",format:qe},{key:"name",header:"Name"}];function mct(e){let t=e.command("bank-rules").description("Manage bank reconciliation rules").addHelpText("after",`
1170
1170
  Dynamic Strings (usable in name, reference \u2014 any free text field):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jaz-clio",
3
- "version": "5.20.17",
3
+ "version": "5.20.19",
4
4
  "description": "Clio: Command Line Interface Operator for Jaz AI.",
5
5
  "type": "module",
6
6
  "bin": {