jaz-clio 5.46.13 → 5.46.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/skills/api/SKILL.md +1 -1
- package/assets/skills/cli/SKILL.md +1 -1
- package/assets/skills/conversion/SKILL.md +1 -1
- package/assets/skills/jaz-kit/SKILL.md +1 -1
- package/assets/skills/jaz-pseudo-sql/SKILL.md +1 -1
- package/assets/skills/jobs/SKILL.md +1 -1
- package/assets/skills/transaction-recipes/SKILL.md +1 -1
- package/cli.mjs +1 -1
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -687,7 +687,7 @@ Call with { operation, arguments${o?`, ${Zl}`:""}${a.length?", file":""}${t?", o
|
|
|
687
687
|
`+r.map(JI).join(`
|
|
688
688
|
`)+(t?`
|
|
689
689
|
|
|
690
|
-
Multiple organizations are accessible: pass org_id (from list_organizations) to target one. Confirm the organization with the user before any create/update/delete.`:""),u={operation:{type:"string",enum:n,description:`The ${e.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&&(u[Zl]={type:"string",description:Qot}),a.length&&(u.file={type:"object",description:`A file from the conversation, when the client supports passing one. Accepted by: ${a.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"]}),t&&(u.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:e.name,description:c,inputSchema:{type:"object",properties:u,required:["operation"],additionalProperties:!1},...a.length?{_meta:{"openai/fileParams":["file"]}}:{},annotations:{title:`${e.title??twr(e.name)} \xB7 ${r.length} operation${r.length===1?"":"s"}`,readOnlyHint:i,destructiveHint:!i&&s,idempotentHint:i,openWorldHint:!1}}})}function Pot(t){return rwr.has(t)}function Afe(t,e){let r=xi.find(o=>o.name===t);if(!r)return{error:`Unknown namespace: ${t}.`};let n=Mot(r.groups),i=n.find(o=>o.name===e||o.aliases?.includes(e));return i?{tool:i}:{error:`Unknown operation "${e}" for the ${t} tool.`,operations:n.map(o=>o.name)}}var rwr,OB=X(()=>{"use strict";rd();nd();GI();e3();rwr=new Set(xi.map(t=>t.name))});var Uot={};Es(Uot,{loadAgentSuiteContent:()=>cwr});import{readFileSync as nwr}from"node:fs";import{dirname as iwr,join as owr}from"node:path";import{fileURLToPath as swr}from"node:url";function cwr(){return gfe||(gfe=JSON.parse(nwr(owr(awr,"agent-suite-content.json"),"utf8"))),gfe}var awr,gfe,$ot=X(()=>{"use strict";awr=iwr(swr(import.meta.url)),gfe=null});var qot={};Es(qot,{buildCapabilityMap:()=>uwr});async function lwr(){try{let{loadAgentSuiteContent:t}=await Promise.resolve().then(()=>($ot(),Uot)),e=t().counts;return{cli_command_groups:e.commands,api_rules:e.apiRules,skills:e.skills,ifrs_recipes:e.recipes,calculators:e.calculators,job_playbooks:e.jobs}}catch{return}}async function uwr(t={}){if(t.query&&t.query.trim())return Z8(t.query);if(t.namespace){let r=xi.find(i=>i.name===t.namespace);if(!r)return{error:`Unknown namespace "${t.namespace}".`,namespaces:xi.map(i=>i.name),hint:"Call with no arguments for the full map, or pass `query` to rank operations by keyword."};let n=YI(r.groups);return{namespace:r.name,description:r.description,operations:n.length,operation_list:n.map(JI),hint:"Call the namespace tool with { operation, arguments }, or execute_tool with the operation name on a meta-tool surface."}}let e=ky(t.surface,t.multiOrg);return{...e,map:t.full?kB().map(r=>({...r,operation_list:YI(xi.find(n=>n.name===r.namespace).groups).map(JI)})):e.map,beyond_mcp:await lwr()}}var jot=X(()=>{"use strict";rd();OB();GI();J8()});import{randomUUID as dwr}from"node:crypto";function dst(t){let e=t.limit,r=t.offset;return{limit:e,offset:r,sortBy:void 0,sortOrder:void 0}}function hr(t,e,r,n,i,o){let s={..._fe};return o?.leanView&&(s.view={type:"string",enum:["lean","full"],description:"Payload tier: 'lean' (default) = summary row (id + key scalars); 'full' = whole entity per row (heavier). List lean, then drill in with get_*."}),{name:t,description:e,params:s,required:[],group:r,readOnly:!0,isConcurrencySafe:!0,maxResultSizeChars:5e4,...i?{searchHint:i}:{},execute:async(a,c)=>{let{limit:u,offset:d}=dst(c),f=o?.leanView?c.view==="full"?"full":"lean":void 0;return KD((h,m)=>n(a.client,h,m,f),u,d,f==="lean"?50:20)}}}function Ti(t,e,r,n,i,o){return{name:t,description:e,params:{resourceId:{type:"string",description:o?.paramDescription??"Resource ID (UUID)"}},required:["resourceId"],group:r,readOnly:!0,isConcurrencySafe:!0,maxResultSizeChars:2e4,...i?{searchHint:i}:{},execute:async(s,a)=>n(s.client,a.resourceId)}}function fst(t){if(!t||typeof t!="object"||Array.isArray(t))return{};let e=t.data;return e&&typeof e=="object"&&!Array.isArray(e)?e:t}function pst(t,e,r,n){return{[e]:!0,...fst(t),[r]:n}}function LB(t){return`Deletes a DRAFT ${t}; VOIDs an active one and KEEPS it. force: true hard-deletes either.`}function bwr(t,e,r){let n=fst(t);return{outcome:(typeof n.status=="string"?Ewr[n.status]:void 0)??(r?"DELETED":"DELETED_IF_DRAFT_VOIDED_IF_ACTIVE"),...n,resourceId:e}}function Wr(t,e,r,n,i,o){let s=o?.verb??"deleted";return{name:t,description:e,params:{resourceId:{type:"string",description:o?.paramDescription??"Resource ID (UUID)"},...o?.voidable?ywr:{}},required:["resourceId"],group:r,readOnly:!1,isDestructive:!0,...i?{searchHint:i}:{},execute:async(a,c)=>{let u=c.resourceId;es(u,"resourceId",`Nothing was deleted. Source a real resourceId from a search_* or list_* result before calling ${t}.`);let d=c.force,f=await n(a.client,u,{force:d,internalNotes:c.internalNotes});return o?.voidable?bwr(f,u,d):pst(f,s,"resourceId",u)}}}function MB(t,e,r,n){return{name:t,description:`Download ${/^[aeiou]/i.test(e)?"an":"a"} ${e} as PDF. Returns { fileUrl } (may be pending/empty if the document is not yet rendered).`,params:{resourceId:{type:"string",description:`${e[0].toUpperCase()}${e.slice(1)} resourceId`}},required:["resourceId"],group:r,readOnly:!0,searchHint:`download ${e} as PDF document file`,isConcurrencySafe:!0,execute:async(i,o)=>n(i.client,o.resourceId)}}function wfe(t,e,r,n,i){return{name:t,description:e,params:{resourceId:{type:"string",description:"Resource ID (UUID)"}},required:["resourceId"],group:r,readOnly:!1,...i?.destructive?{isDestructive:!0}:{},...i?.searchHint?{searchHint:i.searchHint}:{},execute:async(o,s)=>n(o.client,s.resourceId)}}function rst(t){if(typeof t!="string"||/^\d{4}-\d{2}-\d{2}$/.test(t))return t;let e=/^(\d{4}-\d{2}-\d{2})T/.exec(t);return e?e[1]:t}function Swr(t){return Array.isArray(t)?t.map(e=>{let r={};for(let[n,i]of Object.entries(e)){if(i==null)continue;let o=_X.get(n);if(o)r[o]=i;else if(n==="taxProfile"&&typeof i=="object"&&i!==null){let s=i.resourceId;s&&(r.taxProfileResourceId=s)}else if(n==="discount"&&typeof i=="object"&&i!==null){let s=i.rateValue;s&&Number(s)!==0&&(r.discount=i)}else Dwr.has(n)&&(r[n]=i)}return r}):t}async function PB(t,e,r,n){let s=(await(e==="invoice"?Fs:e==="bill"?Rs:e==="customer_credit_note"?Ol:Fl)(t,r)).data,a=_wr[e],c={};for(let[p,h]of Object.entries(s))a.has(p)&&h!==null&&h!==void 0&&(c[p]=h);c.valueDate&&(c.valueDate=rst(c.valueDate)),c.dueDate&&(c.dueDate=rst(c.dueDate)),c.lineItems&&(c.lineItems=Swr(c.lineItems));for(let[p,h]of Object.entries(n))h!==void 0&&(c[p]=h);let u=e==="invoice"?Vc:e==="bill"?ha:io,{missingFields:d,ready:f}=js(c,u);if(!f)throw new Error(`Cannot finalize: missing ${d.join(", ")}. Use search_accounts (filter by accountType) and search_contacts to resolve, then pass the missing fields to this tool.`);return c}async function nst(t,e,r,n){if((await t(e,r)).data.status==="DRAFT")throw new Error(`Cannot pay a DRAFT ${n}. Finalize it first with finalize_${n}.`)}function o3(t,e,r){if(!(typeof t=="string"&&e.includes(t)))return{error:`Unknown documentType ${JSON.stringify(t)}.`,status:422,hint:`Use one of: ${e.join(", ")}.`,repair:{tool:r,arguments:{},reason:"Pass a supported documentType."}}}function sst(t,e,r){let n=ost[t];if(!n)return{error:`Unknown documentType "${t}".`,status:422,hint:`Valid document types: ${Object.keys(ost).join(", ")}.`,repair:{tool:r,arguments:{},reason:"Pass a supported documentType."}};if(!n.includes(e)){let i=n.includes("ACCEPT")?"ACCEPT":"CONFIRM";return{error:`Action "${e}" is not valid for ${t}. Valid actions: ${n.join(", ")}.`,status:422,hint:`${t} advances its lifecycle with ${i}, not ${e}.`,repair:{tool:r,arguments:{documentType:t,action:i},reason:`${t} is advanced with ${i}.`}}}}async function ast(t,e,r,n,i,o,s){let a;try{a=(await e(t,r)).data?.status}catch{return}if(a==="DRAFT"||a==="VOID"){let c=a==="DRAFT"?`A DRAFT ${n} can't be linked or accepted \u2014 issue it by creating the ${n} with saveAsDraft:false (status ${s}), then link the order to that one.`:`A VOID ${n} can't be used \u2014 create a fresh ${n} (saveAsDraft:false) and link to it.`;return{error:`Cannot create an order linked to a ${a} ${n} (${r}).`,status:422,hint:`Pre-flight guard \u2014 request never hit the API. ${c}`,repair:{tool:o,arguments:{documentType:i,saveAsDraft:!1},reason:c}}}}async function cst(t,e,r,n,i,o){let s;try{s=(await e(t,r)).data?.status}catch{return}if(s==="VOID")return{error:`Cannot convert a VOID ${n} (${r}) into a ${i}.`,status:422,hint:`Pre-flight guard \u2014 request never hit the API. Convert a non-VOID ${n}.`,repair:{tool:o,arguments:{},reason:`The source ${n} is VOID.`}}}async function lst(t,e,r,n,i){let o;try{o=(await e(t,r,n)).data?.status}catch{return}if(o&&o!=="DRAFT")return{error:`Cannot DELETE a ${o} ${r} \u2014 delete is only allowed on DRAFT records.`,status:422,hint:"Use action VOID to cancel a non-draft quote/request/order.",repair:{tool:i,arguments:{documentType:r,resourceId:n,action:"VOID"},reason:`${r} is ${o}; void it instead of deleting.`}}}var fwr,Za,Co,Xl,vo,ui,id,r3,Oy,pwr,yfe,VI,FB,hwr,mwr,Efe,Yot,Hot,bfe,_fe,gm,Cfe,zot,Got,Jot,Vot,Fi,Wot,QB,Awr,vfe,n3,ma,Zot,ust,od,Fy,Qy,gwr,ywr,Ewr,hst,Cwr,Xot,Kot,est,vwr,Iwr,Ife,tst,wwr,_wr,Dwr,UB,$B,i3,ist,ost,Tf,s3=X(()=>{"use strict";mP();EC();DX();aMe();pMe();WD();Da();fr();mn();pA();lA();BE();fPe();APe();Xf();ig();_d();UX();$X();sg();qX();Ip();RF();YF();Fw();jX();QPe();X2();oU();dU();nit();Lw();WF();qw();FH();Hw();GP();YH();Ade();gde();oz();yde();Sde();Bde();Oit();Ip();AB();kde();Nde();gz();Git();$de();qde();jde();Zit();zde();mm();Mz();iD();Gde();Jde();zw();t7();eot();sot();cot();xX();lot();Zde();n8();Xde();Kde();efe();tfe();rfe();nfe();ife();ofe();Xf();ig();yot();sg();_ot();_d();X2();oU();sg();n8();Sn();cfe();ufe();fr();pfe();kot();fwr=SP.join(" | "),Za={type:"string",description:"Resource ID of the record"},Co={type:"string",description:"Transaction date (YYYY-MM-DD)"},Xl={type:"string",description:"Due date (YYYY-MM-DD)"},vo={type:"string",description:"Reference number"},ui={type:"string",description:"Notes or memo text"},id={type:"string",description:"Tag name for categorization"},r3={type:"boolean",description:"Save as draft (default true). Set false to finalize immediately."},Oy={type:"boolean",description:"Return full entity (default: minimal {resourceId} only). Saves a follow-up get_* round trip."},pwr={type:"boolean",description:"Retry-only: set true after the duplicate guard surfaced a candidate and the user confirmed this is a separate document. Never on a first attempt."},yfe={type:"string",description:"Contact resourceId (customer or supplier)"},VI={type:"string",description:"Chart-of-accounts account the line posts to (revenue on a sale, expense on a purchase)"},FB={type:"string",description:"Account the payment posts to. For paymentMethod BANK_TRANSFER/CASH/CHEQUE this MUST be a bank or cash account. Any other method accepts any org account \u2014 that is how a deposit drawdown works (paymentMethod OTHER + the deposit account)."},hwr={type:"number",description:"Payment amount (in bank currency)"},mwr={type:"string",description:"Period start date (YYYY-MM-DD)"},Efe={type:"string",description:"Period end date (YYYY-MM-DD)"},Yot={type:"string",enum:["full","aggregate"],description:`Output detail (default 'full'). 'aggregate' returns a compact aging-bucket summary (current, <1 month, 1/2/3 months, older + total outstanding + contact count). Prefer 'aggregate' for a general or unqualified report request (e.g. "show me my aged receivables", "my AR report") \u2014 it's the at-a-glance overview a chat user expects and it won't truncate on large orgs. Use 'full' only when the user explicitly asks for the per-contact (customer/supplier) breakdown for deeper analysis.`},Hot={type:"string",description:"Currency code (e.g. SGD, USD)"},bfe={type:"string",description:"Display name"},_fe={limit:{type:"number",description:"Max results per page (\u22641000)."},offset:{type:"number",description:"Page offset (0-indexed). Use with limit to paginate."}},gm={type:"object",properties:{sourceCurrency:{type:"string",description:"Foreign currency code (ISO 4217)."},exchangeRate:{type:"number",description:'Base\u2192source: N where 1 org-base unit = N sourceCurrency. Invert ONLY if your quote reads "1 source = X base" (send 1/X), or declare rateDirection and skip the arithmetic. Omit for the org/platform rate.'},rateDirection:{type:"string",enum:["FUNCTIONAL_TO_SOURCE","SOURCE_TO_FUNCTIONAL"],description:"How exchangeRate reads. SOURCE_TO_FUNCTIONAL accepts a bank quote verbatim. Default FUNCTIONAL_TO_SOURCE."}}},Cfe={type:"string",enum:[...Hd],description:"Entity type to export"},zot={type:"string",description:'Structured search query using dashboard syntax (e.g., "status:unpaid $500+ date:this month"). Mutually exclusive with filter \u2014 pass one or the other, never both.'},Got={type:"object",description:'Raw JSON filter object (e.g., {"status":{"in":["UNPAID"]}}). Mutually exclusive with query \u2014 pass one or the other, never both.'},Jot={type:"array",items:{type:"object",properties:{path:{type:"string",description:"Column path from get_export_columns (e.g., s.reference)"},header:{type:"string",description:"Column header label in the export file"},type:{type:"string",enum:["STRING","NUMBER","CURRENCY","DATE","BOOLEAN"],description:"Column data type (optional)"}},required:["path","header"]},description:"Custom column definitions. Omit to use default columns. Use get_export_columns to discover available paths."},Vot={type:"object",properties:{field:{type:"string",description:"Column path to sort by (e.g., s.total_amount)"},direction:{type:"string",enum:["ASC","DESC"],description:"Sort direction"}},required:["field"],description:"Sort results by a column path."},Fi={type:"array",items:{type:"object",properties:{customFieldName:{type:"string"},actualValue:{type:"string"}}},description:'Custom field values: [{ customFieldName: "PO Number", actualValue: "PO-123" }]'},Wot={type:"array",description:"Full replacement line-item set \u2014 non-empty REPLACES all lines, [] clears, omit = no change. claimTypeResourceId + name + unitPrice + quantity are required at submit time.",items:{type:"object",properties:{resourceId:{type:"string",description:"Existing line resourceId (omit to add a new line)"},claimTypeResourceId:{type:"string",description:"Claim type resourceId"},name:{type:"string",description:"Line name"},description:{type:"string",description:"Line description"},unitPrice:{type:"number",description:"Unit price"},quantity:{type:"number",description:"Quantity"},currency:{type:"string",description:"Line currency (ISO 4217; falls back to header)"},itemSubTotal:{type:"number",description:"Line subtotal (unitPrice \xD7 quantity)"}}}},QB={type:"array",items:{type:"string"},description:"Claim resourceIds (1-500)"},Awr={type:"array",items:{type:"object",properties:{resourceId:{type:"string",description:"Capsule type resourceId"},type:{type:"string",enum:["invoice","bill"],description:"Resource type"},selectedClasses:{type:"array",items:{type:"object",properties:{className:{type:"string"},resourceId:Za}}},printable:{type:"boolean"}}},description:"Nano classifier config for line items. Each entry links a capsule type with selected classes."},vfe={type:"array",items:{type:"object",properties:{accountResourceId:{type:"string",description:"Account resourceId"},type:{type:"string",enum:["DEBIT","CREDIT"],description:"Debit or credit"},amount:{type:"number",description:"Amount"},description:{type:"string",description:"Line description"}},required:["accountResourceId","type","amount"]},description:"Journal entries (debit/credit lines with accountResourceId, type, amount)"},n3={type:"array",items:{type:"object",properties:{accountResourceId:{type:"string",description:"Offset account resourceId"},amount:{type:"number",description:"Amount (positive; direction comes from the endpoint)"},description:{type:"string",description:"Line description"},taxProfileResourceId:{type:"string",description:"Tax profile resourceId"}},required:["accountResourceId","amount"]},description:"Offset lines. No `type` \u2014 cash-in credits these and cash-out debits them, decided by the endpoint."},ma={type:"array",items:{type:"object",properties:{name:{type:"string",description:"Line item description/name"},quantity:{type:"number"},unitPrice:{type:"number"},accountResourceId:VI,taxProfileResourceId:{type:"string"},classifierConfig:Awr},required:["name","quantity","unitPrice"]},description:"Line items \u2014 include accountResourceId on each line when finalizing (saveAsDraft: false)"},Zot={type:"array",items:{type:"object",properties:{itemName:{type:"string",description:"Display name of the catalog item"},itemResourceId:{type:"string",description:"Underlying item resourceId (from search_items)"},price:{type:"number",description:"Default unit price (0-1e9)"},unit:{type:"string",description:"Unit of measure"},quantityDefault:{type:"number",description:"Default quantity when added to a document (0-100)"},discountDefault:{type:"number",description:"Default discount % when added to a document (0-100)"},uiIndex:{type:"number",description:"Display position in the catalog (integer, min 0)"},classifiers:{type:"array",items:{type:"object"},description:"Classifier assignments. Same shape as classifierConfig on invoice/bill line items."}},required:["itemName","itemResourceId","price"]},description:"Catalog item rows. itemName, itemResourceId and price are required on every row."},ust={type:"array",items:{type:"object",properties:{slotKey:{type:"string",description:"Slot from get_capsule_recipe templateSlots[]."},template:{type:"string",description:"Text with {{vars}} for that slot; empty string clears a nullable slot. Max 2000."}},required:["slotKey"]},description:"Optional. Customize recipe-generated text via published slots (see get_capsule_recipe)."},od={type:"object",description:"Optional IFRS recipe trigger. Mutex with capsuleResourceId. Silent-null on failure \u2014 preview_capsule_recipe first. Rule 143.",properties:{recipeName:{type:"string",enum:["LOAN_AMORTIZATION","ACCRUAL_REVERSAL","PREPAID_AMORTIZATION","DEFERRED_REVENUE","IFRS16_LEASE"],description:"Must match mutation's allowedBaseTransactionTypes (see list_capsule_recipes)."},recipeVersion:{type:"number",description:"Optional version pin."},inputs:{type:"object",description:"Schema at versions[0].inputSchema. Single-currency; *AccountResourceId x-accountClass-locked."},templateOverrides:ust},required:["recipeName","inputs"]},Fy={type:"string",enum:[...MMe],description:"Payment method (default BANK_TRANSFER)"},Qy={type:"object",description:"Cash-leg adjustment (overpayment/rounding). Bank leg only, never AR/AP. Not with DEBT_WRITE_OFF/CLEARING_SETTLEMENT/INTER_COMPANY/WITHHOLDING_TAX_CERTIFICATE. See rule 160.",properties:{adjustmentValue:{type:"number",description:"Signed, non-zero, max 2dp"},adjustmentAccountResourceId:{type:"string",description:"Non-controlled account, not bank/cash"},adjustmentDescription:{type:"string",description:"Optional"}},required:["adjustmentValue","adjustmentAccountResourceId"]},gwr={...Qy,description:"Adding or changing an adjustment applies here. REMOVING does not: 0 is rejected and null reads as omitted, so both leave the stored value unchanged. To remove one, delete the payment and record it again. A change is rejected if the payment is reconciled or lock-dated, and amount, account and description are all compared, so resend all three unchanged if you are not editing it. See rule 160."};ywr={force:{type:"boolean",description:"Hard-delete instead of voiding."},internalNotes:{type:"string",description:"Note recorded with the void."}},Ewr={VOID:"VOIDED",SUCCEEDED:"DELETED"};hst=["invoices","bills","customer-credit-notes","supplier-credit-notes"],Cwr=[...hst,"purchase-orders","purchase-requests","sale-orders","sale-quotes","claims"],Xot={type:"string",description:"Document family",enum:hst},Kot={type:"string",description:"Document family",enum:Cwr},est={type:"string",description:"Why it is sent back. Opens a thread; the only record of the reason."},vwr=[{name:"approve_documents",description:"Approve one document awaiting approval. Posts its ledger entries and makes it live. One-shot, and the refusal channel differs by entity: invoices/bills THROW 422; credit notes return 200 with isSuccess:false and a STALE approvalStatus of APPROVED. Check isSuccess and catch the throw \u2014 approvalStatus alone cannot tell refusal from success.",params:{entity:Xot,resourceId:{type:"string",description:"Document resourceId"}},required:["entity","resourceId"],group:"approvals",readOnly:!1,searchHint:"approve pending invoice bill credit note post ledger",execute:async(t,e)=>pot(t.client,e.entity,e.resourceId)},{name:"bulk_approve_documents",description:"Approve up to 100 documents awaiting approval. Async \u2014 returns a jobId; poll search_background_jobs. Each approval posts a ledger.",params:{entity:Xot,resourceIds:{type:"array",items:{type:"string"},description:"resourceIds (1-100)"}},required:["entity","resourceIds"],group:"approvals",readOnly:!1,searchHint:"bulk approve many pending documents at once",execute:async(t,e)=>hot(t.client,e.entity,e.resourceIds)},{name:"request_document_changes",description:"Send one document back for changes instead of approving it. Also covers orders, quotes, requests and claims.",params:{entity:Kot,resourceId:{type:"string",description:"Document resourceId"},message:est},required:["entity","resourceId","message"],group:"approvals",readOnly:!1,searchHint:"request changes reject send back document for revision",execute:async(t,e)=>mot(t.client,e.entity,e.resourceId,e.message)},{name:"bulk_request_document_changes",description:"Send up to 500 documents back for changes with one message. Async \u2014 returns a jobId; poll search_background_jobs.",params:{entity:Kot,resourceIds:{type:"array",items:{type:"string"},description:"resourceIds (1-500)"},message:est},required:["entity","resourceIds","message"],group:"approvals",readOnly:!1,searchHint:"bulk request changes send back many documents",execute:async(t,e)=>Aot(t.client,e.entity,e.resourceIds,e.message)}],Iwr=["journals","purchases","sales","purchase-credit-notes","sale-credit-notes"],Ife={type:"string",description:"Document family",enum:Iwr},tst={type:"string",description:"Version id from get_document_version_history"},wwr=[{name:"get_document_version_history",description:"The stored versions of a document, newest first. Not paginated. Use before restoring to pick a version id.",params:{entity:Ife,resourceId:{type:"string",description:"Document resourceId"}},required:["entity","resourceId"],group:"versions",readOnly:!0,searchHint:"list document version history revisions audit trail",isConcurrencySafe:!0,execute:async(t,e)=>Cot(t.client,e.entity,e.resourceId)},{name:"get_document_version",description:"Read one stored version of a document. An unknown resourceId/version pair returns 422.",params:{entity:Ife,resourceId:{type:"string",description:"Document resourceId"},version:tst},required:["entity","resourceId","version"],group:"versions",readOnly:!0,searchHint:"get read one document version snapshot",isConcurrencySafe:!0,execute:async(t,e)=>vot(t.client,e.entity,e.resourceId,e.version)},{name:"rollback_document_version",description:"Restore a document to a stored version. REPLACES current state \u2014 read the version first with get_document_version.",params:{entity:Ife,resourceId:{type:"string",description:"Document resourceId"},version:tst},required:["entity","resourceId","version"],group:"versions",readOnly:!1,searchHint:"restore rollback document to previous version undo changes",isDestructive:!0,execute:async(t,e)=>Iot(t.client,e.entity,e.resourceId,e.version)},{name:"get_currency_effective_rate",description:"The organization effective rate for a currency on a date: its own custom rate when set, else the platform daily rate. Defaults to today.",params:{currencyCode:{type:"string",description:"ISO 4217 code, e.g. USD (not a resourceId)"},date:{type:"string",description:"YYYY-MM-DD (optional, defaults to today)"}},required:["currencyCode"],group:"currencies",readOnly:!0,searchHint:"currency effective exchange rate for a date custom or platform",isConcurrencySafe:!0,execute:async(t,e)=>wot(t.client,e.currencyCode,e.date)}];_wr={invoice:new Set(["reference","valueDate","dueDate","contactResourceId","lineItems","notes","invoiceNotes","internalNotes","tag","tags","isTaxVatApplicable","isTaxVATApplicable","taxInclusion","terms","currency","customFields","capsuleResourceId","capsuleRecipe","taxProfileResourceId","customerPaymentProfileResourceId"]),bill:new Set(["reference","valueDate","dueDate","contactResourceId","lineItems","invoiceNotes","internalNotes","tag","tags","isTaxVatApplicable","isTaxVATApplicable","taxInclusion","terms","currency","customFields","capsuleResourceId","capsuleRecipe","taxProfileResourceId"]),customer_credit_note:new Set(["reference","valueDate","contactResourceId","lineItems","invoiceNotes","tag","tags","isTaxVatApplicable","isTaxVATApplicable","taxInclusion","currency","customFields","capsuleResourceId","taxProfileResourceId"]),supplier_credit_note:new Set(["reference","valueDate","contactResourceId","lineItems","invoiceNotes","tag","tags","isTaxVatApplicable","isTaxVATApplicable","taxInclusion","currency","customFields","capsuleResourceId","taxProfileResourceId"])};Dwr=new Set(["name","quantity","unitPrice","unit","accountResourceId","taxProfileResourceId","description","classifierConfig","itemResourceId","discount"]);UB={type:"string",enum:["SALE_QUOTE","SALE_ORDER"],description:"Which sales document: SALE_QUOTE (estimate) or SALE_ORDER."},$B={type:"string",enum:["PURCHASE_REQUEST","PURCHASE_ORDER"],description:"Which purchase document: PURCHASE_REQUEST (requisition) or PURCHASE_ORDER."},i3={type:"number",description:"Payment terms in days (one of 0, 7, 15, 30, 45, 60)."},ist={type:"string",enum:["ACCEPT","CONFIRM","VOID","DELETE"],description:"Lifecycle action. ACCEPT=quote/request only; CONFIRM=order only; VOID=any non-draft; DELETE=draft only."},ost={SALE_QUOTE:["ACCEPT","VOID","DELETE"],SALE_ORDER:["CONFIRM","VOID","DELETE"],PURCHASE_REQUEST:["ACCEPT","VOID","DELETE"],PURCHASE_ORDER:["CONFIRM","VOID","DELETE"]};Tf=[{name:"get_organization",description:"Get organization details: name, base currency, country, and financial year end.",params:{},required:[],group:"organization",readOnly:!0,searchHint:"get organization details currency country fiscal year",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async t=>Sa(t.client)},{name:"get_my_context",description:"Resolve the CALLER's own context \u2014 identity, the employee bound to their login (if any), and per-module access (moduleRoles). Use to route a receipt (bill if PURCHASES access, expense claim if EMPLOYEE_CLAIMS access). A service api-key usually has no bound employee. Magic claim drafts auto-bind the uploader server-side \u2014 no need to read employee.resourceId to bind one.",params:{},required:[],group:"organization",readOnly:!0,searchHint:"who am i my employee my permissions module roles what can i do self caller capabilities bills claims",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async t=>WIe(t.client)},hr("list_accounts","List chart of accounts. Returns account name, code, type, class, status. Paginated \u2014 response includes totalElements. Use limit/offset to page.","accounts",(t,e,r)=>Dd(t,{limit:r,offset:e}),"list chart of accounts with code type class status"),Wt({name:"search_accounts",description:'Search chart of accounts. For OR (name or code), use filter: {"or":{"name":{"contains":"X"},"code":{"contains":"X"}}}.',group:"accounts",fields:PS,defaults:US,fetcher:TE,searchHint:"find accounts chart of accounts CoA by name code type class status OR search"}),{name:"create_account",description:"Create a new chart of accounts entry. Auto-checks for duplicates by name \u2014 returns existing account if found. Code must be unique. Account class is inferred from accountType.",params:{name:{type:"string",description:"Account name"},code:{type:"string",description:"Account code (unique)"},accountType:{type:"string",description:`Exact API string: ${fwr}. COGS = "Direct Costs". Common variants normalized client-side. "interest expense"/"interest income" is NOT auto-classified \u2014 ask, do not infer: Finance/Financing, Investing or Operating by main business activity.`},currencyCode:{type:"string",description:'Currency code (e.g., "SGD")'},lockDate:{type:"string",description:"Period lock date (YYYY-MM-DD, org timezone). Blocks recording or modifying any GL transaction on this account on or before this date."}},required:["name","code","accountType"],group:"accounts",readOnly:!1,searchHint:"create new chart of accounts entry with type code lock date",execute:async(t,e)=>{let r=e.name,n=await g1(t.client,r);if(n)return{_guard:"duplicate_skipped",message:`Account "${r}" already exists.`,existing:n};let i=kE(e.accountType);return kw(t.client,{code:e.code,name:r,accountType:i,currencyCode:e.currencyCode,lockDate:e.lockDate})}},{name:"update_account",description:"Update a chart of accounts entry \u2014 rename, re-code, set its period lock date, or remove an existing lock date. Setting lockDate (YYYY-MM-DD) is how an individual ledger account is locked for a period: it blocks recording or editing any transaction on that account dated on or before the lock date. Pass clearLockDate to remove (unlock) an existing lock.",params:{resourceId:{type:"string",description:"Account resourceId"},name:{type:"string",description:"New account name"},code:{type:"string",description:"New account code"},lockDate:{type:"string",description:"Period lock date (YYYY-MM-DD, org timezone). Blocks recording or modifying any GL transaction on this account on or before this date."},clearLockDate:{type:"boolean",description:"Set true to remove an existing period lock date (unlock the period). Use when the user asks to remove, delete, clear, lift, or unset the lock. Do not also pass lockDate."}},required:["resourceId"],group:"accounts",readOnly:!1,searchHint:"update rename chart of accounts entry name code lock date unlock remove clear lock",execute:async(t,e)=>{let r=e.resourceId,n=(await T0e(t.client,r)).data,o=Object.fromEntries(["name","code","classificationType","taxProfileResourceId","currency","description"].filter(a=>n[a]!==void 0&&n[a]!==null).map(a=>[a,n[a]]));!o.classificationType&&n.accountType&&(o.classificationType=n.accountType);let s=e.clearLockDate===!0;if(s&&e.lockDate!==void 0)throw new Error("clearLockDate and lockDate are mutually exclusive \u2014 pass one or the other.");return!s&&typeof n.accountLockDate=="string"&&n.accountLockDate&&(o.lockDate=n.accountLockDate.slice(0,10)),e.name!==void 0&&(o.name=e.name),e.code!==void 0&&(o.code=e.code),!s&&e.lockDate!==void 0&&(o.lockDate=e.lockDate),B0e(t.client,r,o)}},{name:"bulk_upsert_chart_of_accounts",description:`Bulk create/update CoA entries (max 500). SYNC: returns { resourceIds, failedRows: [{rowIndex, columnName, columnValue, errorCode, errorMessage}], failedCount } \u2014 no jobId polling. PARTIAL_SUCCESS: failed rows surface in failedRows[]; others still succeed.
|
|
690
|
+
Multiple organizations are accessible: pass org_id (from list_organizations) to target one. Confirm the organization with the user before any create/update/delete.`:""),u={operation:{type:"string",enum:n,description:`The ${e.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&&(u[Zl]={type:"string",description:Qot}),a.length&&(u.file={type:"object",description:`A file from the conversation, when the client supports passing one. Accepted by: ${a.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"]}),t&&(u.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:e.name,description:c,inputSchema:{type:"object",properties:u,required:["operation"],additionalProperties:!1},...a.length?{_meta:{"openai/fileParams":["file"]}}:{},annotations:{title:`${e.title??twr(e.name)} \xB7 ${r.length} operation${r.length===1?"":"s"}`,readOnlyHint:i,destructiveHint:!i&&s,idempotentHint:i,openWorldHint:!1}}})}function Pot(t){return rwr.has(t)}function Afe(t,e){let r=xi.find(o=>o.name===t);if(!r)return{error:`Unknown namespace: ${t}.`};let n=Mot(r.groups),i=n.find(o=>o.name===e||o.aliases?.includes(e));return i?{tool:i}:{error:`Unknown operation "${e}" for the ${t} tool.`,operations:n.map(o=>o.name)}}var rwr,OB=X(()=>{"use strict";rd();nd();GI();e3();rwr=new Set(xi.map(t=>t.name))});var Uot={};Es(Uot,{loadAgentSuiteContent:()=>cwr});import{readFileSync as nwr}from"node:fs";import{dirname as iwr,join as owr}from"node:path";import{fileURLToPath as swr}from"node:url";function cwr(){return gfe||(gfe=JSON.parse(nwr(owr(awr,"agent-suite-content.json"),"utf8"))),gfe}var awr,gfe,$ot=X(()=>{"use strict";awr=iwr(swr(import.meta.url)),gfe=null});var qot={};Es(qot,{buildCapabilityMap:()=>uwr});async function lwr(){try{let{loadAgentSuiteContent:t}=await Promise.resolve().then(()=>($ot(),Uot)),e=t().counts;return{cli_command_groups:e.commands,api_rules:e.apiRules,skills:e.skills,ifrs_recipes:e.recipes,calculators:e.calculators,job_playbooks:e.jobs}}catch{return}}async function uwr(t={}){if(t.query&&t.query.trim())return Z8(t.query);if(t.namespace){let r=xi.find(i=>i.name===t.namespace);if(!r)return{error:`Unknown namespace "${t.namespace}".`,namespaces:xi.map(i=>i.name),hint:"Call with no arguments for the full map, or pass `query` to rank operations by keyword."};let n=YI(r.groups);return{namespace:r.name,description:r.description,operations:n.length,operation_list:n.map(JI),hint:"Call the namespace tool with { operation, arguments }, or execute_tool with the operation name on a meta-tool surface."}}let e=ky(t.surface,t.multiOrg);return{...e,map:t.full?kB().map(r=>({...r,operation_list:YI(xi.find(n=>n.name===r.namespace).groups).map(JI)})):e.map,beyond_mcp:await lwr()}}var jot=X(()=>{"use strict";rd();OB();GI();J8()});import{randomUUID as dwr}from"node:crypto";function dst(t){let e=t.limit,r=t.offset;return{limit:e,offset:r,sortBy:void 0,sortOrder:void 0}}function hr(t,e,r,n,i,o){let s={..._fe};return o?.leanView&&(s.view={type:"string",enum:["lean","full"],description:"Payload tier: 'lean' (default) = summary row (id + key scalars); 'full' = whole entity per row (heavier). List lean, then drill in with get_*."}),{name:t,description:e,params:s,required:[],group:r,readOnly:!0,isConcurrencySafe:!0,maxResultSizeChars:5e4,...i?{searchHint:i}:{},execute:async(a,c)=>{let{limit:u,offset:d}=dst(c),f=o?.leanView?c.view==="full"?"full":"lean":void 0;return KD((h,m)=>n(a.client,h,m,f),u,d,f==="lean"?50:20)}}}function Ti(t,e,r,n,i,o){return{name:t,description:e,params:{resourceId:{type:"string",description:o?.paramDescription??"Resource ID (UUID)"}},required:["resourceId"],group:r,readOnly:!0,isConcurrencySafe:!0,maxResultSizeChars:2e4,...i?{searchHint:i}:{},execute:async(s,a)=>n(s.client,a.resourceId)}}function fst(t){if(!t||typeof t!="object"||Array.isArray(t))return{};let e=t.data;return e&&typeof e=="object"&&!Array.isArray(e)?e:t}function pst(t,e,r,n){return{[e]:!0,...fst(t),[r]:n}}function LB(t){return`Deletes a DRAFT ${t}; VOIDs an active one and KEEPS it. force: true hard-deletes either.`}function bwr(t,e,r){let n=fst(t);return{outcome:(typeof n.status=="string"?Ewr[n.status]:void 0)??(r?"DELETED":"DELETED_IF_DRAFT_VOIDED_IF_ACTIVE"),...n,resourceId:e}}function Wr(t,e,r,n,i,o){let s=o?.verb??"deleted";return{name:t,description:e,params:{resourceId:{type:"string",description:o?.paramDescription??"Resource ID (UUID)"},...o?.voidable?ywr:{}},required:["resourceId"],group:r,readOnly:!1,isDestructive:!0,...i?{searchHint:i}:{},execute:async(a,c)=>{let u=c.resourceId;es(u,"resourceId",`Nothing was deleted. Source a real resourceId from a search_* or list_* result before calling ${t}.`);let d=c.force,f=await n(a.client,u,{force:d,internalNotes:c.internalNotes});return o?.voidable?bwr(f,u,d):pst(f,s,"resourceId",u)}}}function MB(t,e,r,n){return{name:t,description:`Download ${/^[aeiou]/i.test(e)?"an":"a"} ${e} as PDF. Returns { fileUrl } (may be pending/empty if the document is not yet rendered).`,params:{resourceId:{type:"string",description:`${e[0].toUpperCase()}${e.slice(1)} resourceId`}},required:["resourceId"],group:r,readOnly:!0,searchHint:`download ${e} as PDF document file`,isConcurrencySafe:!0,execute:async(i,o)=>n(i.client,o.resourceId)}}function wfe(t,e,r,n,i){return{name:t,description:e,params:{resourceId:{type:"string",description:"Resource ID (UUID)"}},required:["resourceId"],group:r,readOnly:!1,...i?.destructive?{isDestructive:!0}:{},...i?.searchHint?{searchHint:i.searchHint}:{},execute:async(o,s)=>n(o.client,s.resourceId)}}function rst(t){if(typeof t!="string"||/^\d{4}-\d{2}-\d{2}$/.test(t))return t;let e=/^(\d{4}-\d{2}-\d{2})T/.exec(t);return e?e[1]:t}function Swr(t){return Array.isArray(t)?t.map(e=>{let r={};for(let[n,i]of Object.entries(e)){if(i==null)continue;let o=_X.get(n);if(o)r[o]=i;else if(n==="taxProfile"&&typeof i=="object"&&i!==null){let s=i.resourceId;s&&(r.taxProfileResourceId=s)}else if(n==="discount"&&typeof i=="object"&&i!==null){let s=i.rateValue;s&&Number(s)!==0&&(r.discount=i)}else Dwr.has(n)&&(r[n]=i)}return r}):t}async function PB(t,e,r,n){let s=(await(e==="invoice"?Fs:e==="bill"?Rs:e==="customer_credit_note"?Ol:Fl)(t,r)).data,a=_wr[e],c={};for(let[p,h]of Object.entries(s))a.has(p)&&h!==null&&h!==void 0&&(c[p]=h);c.valueDate&&(c.valueDate=rst(c.valueDate)),c.dueDate&&(c.dueDate=rst(c.dueDate)),c.lineItems&&(c.lineItems=Swr(c.lineItems));for(let[p,h]of Object.entries(n))h!==void 0&&(c[p]=h);let u=e==="invoice"?Vc:e==="bill"?ha:io,{missingFields:d,ready:f}=js(c,u);if(!f)throw new Error(`Cannot finalize: missing ${d.join(", ")}. Use search_accounts (filter by accountType) and search_contacts to resolve, then pass the missing fields to this tool.`);return c}async function nst(t,e,r,n){if((await t(e,r)).data.status==="DRAFT")throw new Error(`Cannot pay a DRAFT ${n}. Finalize it first with finalize_${n}.`)}function o3(t,e,r){if(!(typeof t=="string"&&e.includes(t)))return{error:`Unknown documentType ${JSON.stringify(t)}.`,status:422,hint:`Use one of: ${e.join(", ")}.`,repair:{tool:r,arguments:{},reason:"Pass a supported documentType."}}}function sst(t,e,r){let n=ost[t];if(!n)return{error:`Unknown documentType "${t}".`,status:422,hint:`Valid document types: ${Object.keys(ost).join(", ")}.`,repair:{tool:r,arguments:{},reason:"Pass a supported documentType."}};if(!n.includes(e)){let i=n.includes("ACCEPT")?"ACCEPT":"CONFIRM";return{error:`Action "${e}" is not valid for ${t}. Valid actions: ${n.join(", ")}.`,status:422,hint:`${t} advances its lifecycle with ${i}, not ${e}.`,repair:{tool:r,arguments:{documentType:t,action:i},reason:`${t} is advanced with ${i}.`}}}}async function ast(t,e,r,n,i,o,s){let a;try{a=(await e(t,r)).data?.status}catch{return}if(a==="DRAFT"||a==="VOID"){let c=a==="DRAFT"?`A DRAFT ${n} can't be linked or accepted \u2014 issue it by creating the ${n} with saveAsDraft:false (status ${s}), then link the order to that one.`:`A VOID ${n} can't be used \u2014 create a fresh ${n} (saveAsDraft:false) and link to it.`;return{error:`Cannot create an order linked to a ${a} ${n} (${r}).`,status:422,hint:`Pre-flight guard \u2014 request never hit the API. ${c}`,repair:{tool:o,arguments:{documentType:i,saveAsDraft:!1},reason:c}}}}async function cst(t,e,r,n,i,o){let s;try{s=(await e(t,r)).data?.status}catch{return}if(s==="VOID")return{error:`Cannot convert a VOID ${n} (${r}) into a ${i}.`,status:422,hint:`Pre-flight guard \u2014 request never hit the API. Convert a non-VOID ${n}.`,repair:{tool:o,arguments:{},reason:`The source ${n} is VOID.`}}}async function lst(t,e,r,n,i){let o;try{o=(await e(t,r,n)).data?.status}catch{return}if(o&&o!=="DRAFT")return{error:`Cannot DELETE a ${o} ${r} \u2014 delete is only allowed on DRAFT records.`,status:422,hint:"Use action VOID to cancel a non-draft quote/request/order.",repair:{tool:i,arguments:{documentType:r,resourceId:n,action:"VOID"},reason:`${r} is ${o}; void it instead of deleting.`}}}var fwr,Za,Co,Xl,vo,ui,id,r3,Oy,pwr,yfe,VI,FB,hwr,mwr,Efe,Yot,Hot,bfe,_fe,gm,Cfe,zot,Got,Jot,Vot,Fi,Wot,QB,Awr,vfe,n3,ma,Zot,ust,od,Fy,Qy,gwr,ywr,Ewr,hst,Cwr,Xot,Kot,est,vwr,Iwr,Ife,tst,wwr,_wr,Dwr,UB,$B,i3,ist,ost,Tf,s3=X(()=>{"use strict";mP();EC();DX();aMe();pMe();WD();Da();fr();mn();pA();lA();BE();fPe();APe();Xf();ig();_d();UX();$X();sg();qX();Ip();RF();YF();Fw();jX();QPe();X2();oU();dU();nit();Lw();WF();qw();FH();Hw();GP();YH();Ade();gde();oz();yde();Sde();Bde();Oit();Ip();AB();kde();Nde();gz();Git();$de();qde();jde();Zit();zde();mm();Mz();iD();Gde();Jde();zw();t7();eot();sot();cot();xX();lot();Zde();n8();Xde();Kde();efe();tfe();rfe();nfe();ife();ofe();Xf();ig();yot();sg();_ot();_d();X2();oU();sg();n8();Sn();cfe();ufe();fr();pfe();kot();fwr=SP.join(" | "),Za={type:"string",description:"Resource ID of the record"},Co={type:"string",description:"Transaction date (YYYY-MM-DD)"},Xl={type:"string",description:"Due date (YYYY-MM-DD)"},vo={type:"string",description:"Reference number"},ui={type:"string",description:"Notes or memo text"},id={type:"string",description:"Tag name for categorization"},r3={type:"boolean",description:"Save as draft (default true). Set false to finalize immediately."},Oy={type:"boolean",description:"Return full entity (default: minimal {resourceId} only). Saves a follow-up get_* round trip."},pwr={type:"boolean",description:"Retry-only: set true after the duplicate guard surfaced a candidate and the user confirmed this is a separate document. Never on a first attempt."},yfe={type:"string",description:"Contact resourceId (customer or supplier)"},VI={type:"string",description:"Chart-of-accounts account the line posts to (revenue on a sale, expense on a purchase)"},FB={type:"string",description:"Account the payment posts to. For paymentMethod BANK_TRANSFER/CASH/CHEQUE this MUST be a bank or cash account. Any other method accepts any org account \u2014 that is how a deposit drawdown works (paymentMethod OTHER + the deposit account)."},hwr={type:"number",description:"Payment amount (in bank currency)"},mwr={type:"string",description:"Period start date (YYYY-MM-DD)"},Efe={type:"string",description:"Period end date (YYYY-MM-DD)"},Yot={type:"string",enum:["full","aggregate"],description:`Output detail (default 'full'). 'aggregate' returns a compact aging-bucket summary (current, <1 month, 1/2/3 months, older + total outstanding + contact count). Prefer 'aggregate' for a general or unqualified report request (e.g. "show me my aged receivables", "my AR report") \u2014 it's the at-a-glance overview a chat user expects and it won't truncate on large orgs. Use 'full' only when the user explicitly asks for the per-contact (customer/supplier) breakdown for deeper analysis.`},Hot={type:"string",description:"Currency code (e.g. SGD, USD)"},bfe={type:"string",description:"Display name"},_fe={limit:{type:"number",description:"Max results per page (\u22641000)."},offset:{type:"number",description:"Page offset (0-indexed). Use with limit to paginate."}},gm={type:"object",required:["sourceCurrency"],properties:{sourceCurrency:{type:"string",description:"Foreign currency code (ISO 4217)."},exchangeRate:{type:"number",description:'Base\u2192source: N where 1 org-base unit = N sourceCurrency. Invert ONLY if your quote reads "1 source = X base" (send 1/X), or declare rateDirection and skip the arithmetic. Omit for the org/platform rate.'},rateDirection:{type:"string",enum:["FUNCTIONAL_TO_SOURCE","SOURCE_TO_FUNCTIONAL"],description:"How exchangeRate reads. SOURCE_TO_FUNCTIONAL accepts a bank quote verbatim. Default FUNCTIONAL_TO_SOURCE."}}},Cfe={type:"string",enum:[...Hd],description:"Entity type to export"},zot={type:"string",description:'Structured search query using dashboard syntax (e.g., "status:unpaid $500+ date:this month"). Mutually exclusive with filter \u2014 pass one or the other, never both.'},Got={type:"object",description:'Raw JSON filter object (e.g., {"status":{"in":["UNPAID"]}}). Mutually exclusive with query \u2014 pass one or the other, never both.'},Jot={type:"array",items:{type:"object",properties:{path:{type:"string",description:"Column path from get_export_columns (e.g., s.reference)"},header:{type:"string",description:"Column header label in the export file"},type:{type:"string",enum:["STRING","NUMBER","CURRENCY","DATE","BOOLEAN"],description:"Column data type (optional)"}},required:["path","header"]},description:"Custom column definitions. Omit to use default columns. Use get_export_columns to discover available paths."},Vot={type:"object",properties:{field:{type:"string",description:"Column path to sort by (e.g., s.total_amount)"},direction:{type:"string",enum:["ASC","DESC"],description:"Sort direction"}},required:["field"],description:"Sort results by a column path."},Fi={type:"array",items:{type:"object",properties:{customFieldName:{type:"string"},actualValue:{type:"string"}}},description:'Custom field values: [{ customFieldName: "PO Number", actualValue: "PO-123" }]'},Wot={type:"array",description:"Full replacement line-item set \u2014 non-empty REPLACES all lines, [] clears, omit = no change. claimTypeResourceId + name + unitPrice + quantity are required at submit time.",items:{type:"object",properties:{resourceId:{type:"string",description:"Existing line resourceId (omit to add a new line)"},claimTypeResourceId:{type:"string",description:"Claim type resourceId"},name:{type:"string",description:"Line name"},description:{type:"string",description:"Line description"},unitPrice:{type:"number",description:"Unit price"},quantity:{type:"number",description:"Quantity"},currency:{type:"string",description:"Line currency (ISO 4217; falls back to header)"},itemSubTotal:{type:"number",description:"Line subtotal (unitPrice \xD7 quantity)"}}}},QB={type:"array",items:{type:"string"},description:"Claim resourceIds (1-500)"},Awr={type:"array",items:{type:"object",required:["resourceId","type","selectedClasses","printable"],properties:{resourceId:{type:"string",description:"Capsule type resourceId"},type:{type:"string",enum:["invoice","bill"],description:"Resource type"},selectedClasses:{type:"array",items:{type:"object",required:["className"],properties:{className:{type:"string"},resourceId:Za}}},printable:{type:"boolean"}}},description:"Nano classifier config for line items. Each entry links a capsule type with selected classes."},vfe={type:"array",items:{type:"object",properties:{accountResourceId:{type:"string",description:"Account resourceId"},type:{type:"string",enum:["DEBIT","CREDIT"],description:"Debit or credit"},amount:{type:"number",description:"Amount"},description:{type:"string",description:"Line description"}},required:["accountResourceId","type","amount"]},description:"Journal entries (debit/credit lines with accountResourceId, type, amount)"},n3={type:"array",items:{type:"object",properties:{accountResourceId:{type:"string",description:"Offset account resourceId"},amount:{type:"number",description:"Amount (positive; direction comes from the endpoint)"},description:{type:"string",description:"Line description"},taxProfileResourceId:{type:"string",description:"Tax profile resourceId"}},required:["accountResourceId","amount"]},description:"Offset lines. No `type` \u2014 cash-in credits these and cash-out debits them, decided by the endpoint."},ma={type:"array",items:{type:"object",properties:{name:{type:"string",description:"Line item description/name"},quantity:{type:"number"},unitPrice:{type:"number"},accountResourceId:VI,taxProfileResourceId:{type:"string"},classifierConfig:Awr},required:["name","quantity","unitPrice"]},description:"Line items \u2014 include accountResourceId on each line when finalizing (saveAsDraft: false)"},Zot={type:"array",items:{type:"object",properties:{itemName:{type:"string",description:"Display name of the catalog item"},itemResourceId:{type:"string",description:"Underlying item resourceId (from search_items)"},price:{type:"number",description:"Default unit price (0-1e9)"},unit:{type:"string",description:"Unit of measure"},quantityDefault:{type:"number",description:"Default quantity when added to a document (0-100)"},discountDefault:{type:"number",description:"Default discount % when added to a document (0-100)"},uiIndex:{type:"number",description:"Display position in the catalog (integer, min 0)"},classifiers:{type:"array",items:{type:"object"},description:"Classifier assignments. Same shape as classifierConfig on invoice/bill line items."}},required:["itemName","itemResourceId","price"]},description:"Catalog item rows. itemName, itemResourceId and price are required on every row."},ust={type:"array",items:{type:"object",properties:{slotKey:{type:"string",description:"Slot from get_capsule_recipe templateSlots[]."},template:{type:"string",description:"Text with {{vars}} for that slot; empty string clears a nullable slot. Max 2000."}},required:["slotKey"]},description:"Optional. Customize recipe-generated text via published slots (see get_capsule_recipe)."},od={type:"object",description:"Optional IFRS recipe trigger. Mutex with capsuleResourceId. Silent-null on failure \u2014 preview_capsule_recipe first. Rule 143.",properties:{recipeName:{type:"string",enum:["LOAN_AMORTIZATION","ACCRUAL_REVERSAL","PREPAID_AMORTIZATION","DEFERRED_REVENUE","IFRS16_LEASE"],description:"Must match mutation's allowedBaseTransactionTypes (see list_capsule_recipes)."},recipeVersion:{type:"number",description:"Optional version pin."},inputs:{type:"object",description:"Schema at versions[0].inputSchema. Single-currency; *AccountResourceId x-accountClass-locked."},templateOverrides:ust},required:["recipeName","inputs"]},Fy={type:"string",enum:[...MMe],description:"Payment method (default BANK_TRANSFER)"},Qy={type:"object",description:"Cash-leg adjustment (overpayment/rounding). Bank leg only, never AR/AP. Not with DEBT_WRITE_OFF/CLEARING_SETTLEMENT/INTER_COMPANY/WITHHOLDING_TAX_CERTIFICATE. See rule 160.",properties:{adjustmentValue:{type:"number",description:"Signed, non-zero, max 2dp"},adjustmentAccountResourceId:{type:"string",description:"Non-controlled account, not bank/cash"},adjustmentDescription:{type:"string",description:"Optional"}},required:["adjustmentValue","adjustmentAccountResourceId"]},gwr={...Qy,description:"Adding or changing an adjustment applies here. REMOVING does not: 0 is rejected and null reads as omitted, so both leave the stored value unchanged. To remove one, delete the payment and record it again. A change is rejected if the payment is reconciled or lock-dated, and amount, account and description are all compared, so resend all three unchanged if you are not editing it. See rule 160."};ywr={force:{type:"boolean",description:"Hard-delete instead of voiding."},internalNotes:{type:"string",description:"Note recorded with the void."}},Ewr={VOID:"VOIDED",SUCCEEDED:"DELETED"};hst=["invoices","bills","customer-credit-notes","supplier-credit-notes"],Cwr=[...hst,"purchase-orders","purchase-requests","sale-orders","sale-quotes","claims"],Xot={type:"string",description:"Document family",enum:hst},Kot={type:"string",description:"Document family",enum:Cwr},est={type:"string",description:"Why it is sent back. Opens a thread; the only record of the reason."},vwr=[{name:"approve_documents",description:"Approve one document awaiting approval. Posts its ledger entries and makes it live. One-shot, and the refusal channel differs by entity: invoices/bills THROW 422; credit notes return 200 with isSuccess:false and a STALE approvalStatus of APPROVED. Check isSuccess and catch the throw \u2014 approvalStatus alone cannot tell refusal from success.",params:{entity:Xot,resourceId:{type:"string",description:"Document resourceId"}},required:["entity","resourceId"],group:"approvals",readOnly:!1,searchHint:"approve pending invoice bill credit note post ledger",execute:async(t,e)=>pot(t.client,e.entity,e.resourceId)},{name:"bulk_approve_documents",description:"Approve up to 100 documents awaiting approval. Async \u2014 returns a jobId; poll search_background_jobs. Each approval posts a ledger.",params:{entity:Xot,resourceIds:{type:"array",items:{type:"string"},description:"resourceIds (1-100)"}},required:["entity","resourceIds"],group:"approvals",readOnly:!1,searchHint:"bulk approve many pending documents at once",execute:async(t,e)=>hot(t.client,e.entity,e.resourceIds)},{name:"request_document_changes",description:"Send one document back for changes instead of approving it. Also covers orders, quotes, requests and claims.",params:{entity:Kot,resourceId:{type:"string",description:"Document resourceId"},message:est},required:["entity","resourceId","message"],group:"approvals",readOnly:!1,searchHint:"request changes reject send back document for revision",execute:async(t,e)=>mot(t.client,e.entity,e.resourceId,e.message)},{name:"bulk_request_document_changes",description:"Send up to 500 documents back for changes with one message. Async \u2014 returns a jobId; poll search_background_jobs.",params:{entity:Kot,resourceIds:{type:"array",items:{type:"string"},description:"resourceIds (1-500)"},message:est},required:["entity","resourceIds","message"],group:"approvals",readOnly:!1,searchHint:"bulk request changes send back many documents",execute:async(t,e)=>Aot(t.client,e.entity,e.resourceIds,e.message)}],Iwr=["journals","purchases","sales","purchase-credit-notes","sale-credit-notes"],Ife={type:"string",description:"Document family",enum:Iwr},tst={type:"string",description:"Version id from get_document_version_history"},wwr=[{name:"get_document_version_history",description:"The stored versions of a document, newest first. Not paginated. Use before restoring to pick a version id.",params:{entity:Ife,resourceId:{type:"string",description:"Document resourceId"}},required:["entity","resourceId"],group:"versions",readOnly:!0,searchHint:"list document version history revisions audit trail",isConcurrencySafe:!0,execute:async(t,e)=>Cot(t.client,e.entity,e.resourceId)},{name:"get_document_version",description:"Read one stored version of a document. An unknown resourceId/version pair returns 422.",params:{entity:Ife,resourceId:{type:"string",description:"Document resourceId"},version:tst},required:["entity","resourceId","version"],group:"versions",readOnly:!0,searchHint:"get read one document version snapshot",isConcurrencySafe:!0,execute:async(t,e)=>vot(t.client,e.entity,e.resourceId,e.version)},{name:"rollback_document_version",description:"Restore a document to a stored version. REPLACES current state \u2014 read the version first with get_document_version.",params:{entity:Ife,resourceId:{type:"string",description:"Document resourceId"},version:tst},required:["entity","resourceId","version"],group:"versions",readOnly:!1,searchHint:"restore rollback document to previous version undo changes",isDestructive:!0,execute:async(t,e)=>Iot(t.client,e.entity,e.resourceId,e.version)},{name:"get_currency_effective_rate",description:"The organization effective rate for a currency on a date: its own custom rate when set, else the platform daily rate. Defaults to today.",params:{currencyCode:{type:"string",description:"ISO 4217 code, e.g. USD (not a resourceId)"},date:{type:"string",description:"YYYY-MM-DD (optional, defaults to today)"}},required:["currencyCode"],group:"currencies",readOnly:!0,searchHint:"currency effective exchange rate for a date custom or platform",isConcurrencySafe:!0,execute:async(t,e)=>wot(t.client,e.currencyCode,e.date)}];_wr={invoice:new Set(["reference","valueDate","dueDate","contactResourceId","lineItems","notes","invoiceNotes","internalNotes","tag","tags","isTaxVatApplicable","isTaxVATApplicable","taxInclusion","terms","currency","customFields","capsuleResourceId","capsuleRecipe","taxProfileResourceId","customerPaymentProfileResourceId"]),bill:new Set(["reference","valueDate","dueDate","contactResourceId","lineItems","invoiceNotes","internalNotes","tag","tags","isTaxVatApplicable","isTaxVATApplicable","taxInclusion","terms","currency","customFields","capsuleResourceId","capsuleRecipe","taxProfileResourceId"]),customer_credit_note:new Set(["reference","valueDate","contactResourceId","lineItems","invoiceNotes","tag","tags","isTaxVatApplicable","isTaxVATApplicable","taxInclusion","currency","customFields","capsuleResourceId","taxProfileResourceId"]),supplier_credit_note:new Set(["reference","valueDate","contactResourceId","lineItems","invoiceNotes","tag","tags","isTaxVatApplicable","isTaxVATApplicable","taxInclusion","currency","customFields","capsuleResourceId","taxProfileResourceId"])};Dwr=new Set(["name","quantity","unitPrice","unit","accountResourceId","taxProfileResourceId","description","classifierConfig","itemResourceId","discount"]);UB={type:"string",enum:["SALE_QUOTE","SALE_ORDER"],description:"Which sales document: SALE_QUOTE (estimate) or SALE_ORDER."},$B={type:"string",enum:["PURCHASE_REQUEST","PURCHASE_ORDER"],description:"Which purchase document: PURCHASE_REQUEST (requisition) or PURCHASE_ORDER."},i3={type:"number",description:"Payment terms in days (one of 0, 7, 15, 30, 45, 60)."},ist={type:"string",enum:["ACCEPT","CONFIRM","VOID","DELETE"],description:"Lifecycle action. ACCEPT=quote/request only; CONFIRM=order only; VOID=any non-draft; DELETE=draft only."},ost={SALE_QUOTE:["ACCEPT","VOID","DELETE"],SALE_ORDER:["CONFIRM","VOID","DELETE"],PURCHASE_REQUEST:["ACCEPT","VOID","DELETE"],PURCHASE_ORDER:["CONFIRM","VOID","DELETE"]};Tf=[{name:"get_organization",description:"Get organization details: name, base currency, country, and financial year end.",params:{},required:[],group:"organization",readOnly:!0,searchHint:"get organization details currency country fiscal year",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async t=>Sa(t.client)},{name:"get_my_context",description:"Resolve the CALLER's own context \u2014 identity, the employee bound to their login (if any), and per-module access (moduleRoles). Use to route a receipt (bill if PURCHASES access, expense claim if EMPLOYEE_CLAIMS access). A service api-key usually has no bound employee. Magic claim drafts auto-bind the uploader server-side \u2014 no need to read employee.resourceId to bind one.",params:{},required:[],group:"organization",readOnly:!0,searchHint:"who am i my employee my permissions module roles what can i do self caller capabilities bills claims",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async t=>WIe(t.client)},hr("list_accounts","List chart of accounts. Returns account name, code, type, class, status. Paginated \u2014 response includes totalElements. Use limit/offset to page.","accounts",(t,e,r)=>Dd(t,{limit:r,offset:e}),"list chart of accounts with code type class status"),Wt({name:"search_accounts",description:'Search chart of accounts. For OR (name or code), use filter: {"or":{"name":{"contains":"X"},"code":{"contains":"X"}}}.',group:"accounts",fields:PS,defaults:US,fetcher:TE,searchHint:"find accounts chart of accounts CoA by name code type class status OR search"}),{name:"create_account",description:"Create a new chart of accounts entry. Auto-checks for duplicates by name \u2014 returns existing account if found. Code must be unique. Account class is inferred from accountType.",params:{name:{type:"string",description:"Account name"},code:{type:"string",description:"Account code (unique)"},accountType:{type:"string",description:`Exact API string: ${fwr}. COGS = "Direct Costs". Common variants normalized client-side. "interest expense"/"interest income" is NOT auto-classified \u2014 ask, do not infer: Finance/Financing, Investing or Operating by main business activity.`},currencyCode:{type:"string",description:'Currency code (e.g., "SGD")'},lockDate:{type:"string",description:"Period lock date (YYYY-MM-DD, org timezone). Blocks recording or modifying any GL transaction on this account on or before this date."}},required:["name","code","accountType"],group:"accounts",readOnly:!1,searchHint:"create new chart of accounts entry with type code lock date",execute:async(t,e)=>{let r=e.name,n=await g1(t.client,r);if(n)return{_guard:"duplicate_skipped",message:`Account "${r}" already exists.`,existing:n};let i=kE(e.accountType);return kw(t.client,{code:e.code,name:r,accountType:i,currencyCode:e.currencyCode,lockDate:e.lockDate})}},{name:"update_account",description:"Update a chart of accounts entry \u2014 rename, re-code, set its period lock date, or remove an existing lock date. Setting lockDate (YYYY-MM-DD) is how an individual ledger account is locked for a period: it blocks recording or editing any transaction on that account dated on or before the lock date. Pass clearLockDate to remove (unlock) an existing lock.",params:{resourceId:{type:"string",description:"Account resourceId"},name:{type:"string",description:"New account name"},code:{type:"string",description:"New account code"},lockDate:{type:"string",description:"Period lock date (YYYY-MM-DD, org timezone). Blocks recording or modifying any GL transaction on this account on or before this date."},clearLockDate:{type:"boolean",description:"Set true to remove an existing period lock date (unlock the period). Use when the user asks to remove, delete, clear, lift, or unset the lock. Do not also pass lockDate."}},required:["resourceId"],group:"accounts",readOnly:!1,searchHint:"update rename chart of accounts entry name code lock date unlock remove clear lock",execute:async(t,e)=>{let r=e.resourceId,n=(await T0e(t.client,r)).data,o=Object.fromEntries(["name","code","classificationType","taxProfileResourceId","currency","description"].filter(a=>n[a]!==void 0&&n[a]!==null).map(a=>[a,n[a]]));!o.classificationType&&n.accountType&&(o.classificationType=n.accountType);let s=e.clearLockDate===!0;if(s&&e.lockDate!==void 0)throw new Error("clearLockDate and lockDate are mutually exclusive \u2014 pass one or the other.");return!s&&typeof n.accountLockDate=="string"&&n.accountLockDate&&(o.lockDate=n.accountLockDate.slice(0,10)),e.name!==void 0&&(o.name=e.name),e.code!==void 0&&(o.code=e.code),!s&&e.lockDate!==void 0&&(o.lockDate=e.lockDate),B0e(t.client,r,o)}},{name:"bulk_upsert_chart_of_accounts",description:`Bulk create/update CoA entries (max 500). SYNC: returns { resourceIds, failedRows: [{rowIndex, columnName, columnValue, errorCode, errorMessage}], failedCount } \u2014 no jobId polling. PARTIAL_SUCCESS: failed rows surface in failedRows[]; others still succeed.
|
|
691
691
|
|
|
692
692
|
resourceId per row \u2192 update; omit \u2192 create. Note: dedup is by NAME (not code) \u2014 duplicate name surfaces ORGANIZATION_CHART_OF_ACCOUNT_DUPLICATED per row. Accepts all 23 accountType values (see create_account); common variants normalized via normalizeAccountType.
|
|
693
693
|
|