@ekwo-ai/mcp 0.24.1 → 0.25.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +34 -3
  2. package/dist/backend.d.ts.map +1 -1
  3. package/dist/backend.js +3 -0
  4. package/dist/backend.js.map +1 -1
  5. package/dist/config.d.ts +9 -0
  6. package/dist/config.d.ts.map +1 -1
  7. package/dist/config.js +17 -0
  8. package/dist/config.js.map +1 -1
  9. package/dist/index.d.ts +4 -2
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +3 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/server.d.ts +25 -2
  14. package/dist/server.d.ts.map +1 -1
  15. package/dist/server.js +138 -98
  16. package/dist/server.js.map +1 -1
  17. package/dist/start.d.ts.map +1 -1
  18. package/dist/start.js +8 -2
  19. package/dist/start.js.map +1 -1
  20. package/dist/stdio.d.ts +1 -1
  21. package/dist/stdio.d.ts.map +1 -1
  22. package/dist/stdio.js +3 -0
  23. package/dist/stdio.js.map +1 -1
  24. package/dist/tools/effect.d.ts +48 -0
  25. package/dist/tools/effect.d.ts.map +1 -0
  26. package/dist/tools/effect.js +42 -0
  27. package/dist/tools/effect.js.map +1 -0
  28. package/dist/tools/loading.d.ts +65 -0
  29. package/dist/tools/loading.d.ts.map +1 -0
  30. package/dist/tools/loading.js +119 -0
  31. package/dist/tools/loading.js.map +1 -0
  32. package/dist/tools/modules.d.ts +12 -1
  33. package/dist/tools/modules.d.ts.map +1 -1
  34. package/dist/tools/modules.js +55 -42
  35. package/dist/tools/modules.js.map +1 -1
  36. package/dist/tools/read.d.ts +15 -16
  37. package/dist/tools/read.d.ts.map +1 -1
  38. package/dist/tools/read.js +14 -166
  39. package/dist/tools/read.js.map +1 -1
  40. package/dist/tools/write.d.ts +7 -6
  41. package/dist/tools/write.d.ts.map +1 -1
  42. package/dist/tools/write.js +35 -81
  43. package/dist/tools/write.js.map +1 -1
  44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,EAAE,GAAG,aAAa,EAAE,CAGzE;AAED;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAW1E"}
@@ -52,7 +52,7 @@ const FIXED_ASSETS = {
52
52
  {
53
53
  verb: 'list',
54
54
  title: 'Fixed assets',
55
- readOnly: true,
55
+ effect: 'read',
56
56
  description: 'The register of fixed assets of a company at a date: what each one cost, what has been written off it and what is left. It reads what has been *booked*, so it ties back to the accumulated depreciation account on the balance sheet. An asset disposed of before that date is not in it.',
57
57
  input: z.object({
58
58
  company_id: companyId,
@@ -75,7 +75,7 @@ const FIXED_ASSETS = {
75
75
  {
76
76
  verb: 'create',
77
77
  title: 'Record a fixed asset',
78
- readOnly: false,
78
+ effect: 'destructive',
79
79
  description: 'Creates a fixed asset and writes its depreciation schedule in one call. Give a `category_code` of the country pack — the categories are those of its `fixed_assets.json` — and the method, the duration and the coefficient come from it; anything you pass yourself wins over the category. The three accounts are the asset account, the accumulated depreciation account and the depreciation charge. Nothing is booked here: fixed_assets_run_depreciation is what posts.',
80
80
  input: z.object({
81
81
  company_id: companyId,
@@ -120,7 +120,7 @@ const FIXED_ASSETS = {
120
120
  {
121
121
  verb: 'schedule',
122
122
  title: 'Depreciation schedule',
123
- readOnly: true,
123
+ effect: 'read',
124
124
  description: 'The planned depreciation of one asset, period by period, with the amount, the accumulated total and the net book value after each one, and the entry that booked it where it has been booked. The schedule always sums to exactly the cost less the residual value: the last line takes the remainder.',
125
125
  input: z.object({ company_id: companyId, asset_id: uuid }),
126
126
  async run(backend, args) {
@@ -149,7 +149,8 @@ const FIXED_ASSETS = {
149
149
  {
150
150
  verb: 'run_depreciation',
151
151
  title: 'Book the depreciation',
152
- readOnly: false,
152
+ effect: 'destructive',
153
+ idempotent: true,
153
154
  description: 'Books every planned period that ends on or before a date, one ledger entry per period, through the socle\'s own posting function. It is idempotent: a period already booked is skipped, and the database refuses a second entry for it anyway. A closed financial year or a locked period refuses the posting — report the refusal, do not move the date.',
154
155
  input: z.object({
155
156
  company_id: companyId,
@@ -163,7 +164,7 @@ const FIXED_ASSETS = {
163
164
  {
164
165
  verb: 'dispose',
165
166
  title: 'Dispose of a fixed asset',
166
- readOnly: false,
167
+ effect: 'destructive',
167
168
  description: 'Takes an asset off the books on a date: clears its cost and its accumulated depreciation, books the proceeds against the account you name, and presents the result the way the country pack says — one gain or loss line, or the value sold and the proceeds in full. Run fixed_assets_run_depreciation first: a disposal is refused while a period that has already ended is still unbooked. There is no undo.',
168
169
  input: z.object({
169
170
  company_id: companyId,
@@ -200,7 +201,7 @@ const BUDGETS = {
200
201
  {
201
202
  verb: 'list',
202
203
  title: 'Budgets',
203
- readOnly: true,
204
+ effect: 'read',
204
205
  description: 'The budgets of a company, with the financial year each one is for and whether it is a draft, approved or closed. Start here: budgets_variance needs a budget_id.',
205
206
  input: z.object({ company_id: companyId }),
206
207
  async run(backend, args) {
@@ -217,7 +218,8 @@ const BUDGETS = {
217
218
  {
218
219
  verb: 'upsert_lines',
219
220
  title: 'Write budget lines',
220
- readOnly: false,
221
+ effect: 'destructive',
222
+ idempotent: true,
221
223
  description: 'Adds lines to a budget: one figure per account and per period. State the amount the way a business says it out loud — an income and a cost are both positive — and the comparison flips the ledger, not you. A line already there for the same account and period is replaced.',
222
224
  input: z.object({
223
225
  company_id: companyId,
@@ -275,7 +277,7 @@ const BUDGETS = {
275
277
  {
276
278
  verb: 'variance',
277
279
  title: 'Budget against ledger',
278
- readOnly: true,
280
+ effect: 'read',
279
281
  description: 'What was planned against what was booked, per account, over a period. Both figures are in the sign a business states them in, and the variance is the actual less the plan — so a negative figure on an income account is revenue that did not arrive, and a positive one on a cost account is overspending. It reads posted entries of kind `normal`: a closing or appropriation entry is not what a period earned. A budget line is taken whole or not at all, so ask for a window that contains the periods the budget was written in.',
280
282
  input: z.object({
281
283
  company_id: companyId,
@@ -321,7 +323,7 @@ const EINVOICING = {
321
323
  {
322
324
  verb: 'validate',
323
325
  title: 'Check an electronic invoice',
324
- readOnly: true,
326
+ effect: 'read',
325
327
  description: 'Writes the electronic invoice of a posted sale invoice or credit note, in the profile its company\'s country pack declares, and lists every rule of the format it breaks — as the format names them, word for word. Records nothing and sends nothing. A broken rule is fixed in the books (the customer\'s electronic address, a due date, a reference), never in the file. A profile no brick writes is refused as format_without_brick.',
326
328
  input: z.object({
327
329
  document_id: documentId,
@@ -337,7 +339,9 @@ const EINVOICING = {
337
339
  {
338
340
  verb: 'issue',
339
341
  title: 'Issue an electronic invoice',
340
- readOnly: false,
342
+ effect: 'destructive',
343
+ idempotent: true,
344
+ openWorld: true,
341
345
  description: 'Writes the electronic invoice of a posted sale and keeps it — the exact file, its checksum and the rules it breaks; the same file twice is one issue. With send, also hands it to the transport this server is configured with and records what came back. A file that breaks a rule is kept and never sent (einvoice_not_sendable, with the rules); a document already on its way is refused (einvoice_already_sent). Submitted is not delivered: follow it with einvoicing_status. Ask the user before sending: a file that leaves is in a customer\'s hands.',
342
346
  input: z.object({
343
347
  document_id: documentId,
@@ -355,7 +359,9 @@ const EINVOICING = {
355
359
  {
356
360
  verb: 'status',
357
361
  title: 'Where an electronic invoice stands',
358
- readOnly: false,
362
+ effect: 'additive',
363
+ idempotent: true,
364
+ openWorld: true,
359
365
  description: 'Everything known of the electronic invoice of one document: each file issued, each sending and every answer the service gave, verbatim. state is not_issued, issued, or the state of the latest sending: prepared, submitted, accepted_by_access_point, delivered, rejected or failed. With refresh, asks the configured transport again about the sending still open and records its answer. A rejected or failed document is sent again with einvoicing_issue.',
360
366
  input: z.object({
361
367
  document_id: documentId,
@@ -371,7 +377,7 @@ const EINVOICING = {
371
377
  {
372
378
  verb: 'fiscalise',
373
379
  title: 'Chain the fiscal record of an invoice',
374
- readOnly: false,
380
+ effect: 'destructive',
375
381
  description: 'Writes the fiscal record of a posted sale — the record its company\'s country pack requires the invoicing software to keep for every invoice, in the format of its einvoicing.fiscalisation block — chains it after the last record of the invoicing system, with the hash of that record, and keeps its file. Records nothing when the record breaks a rule (the rules are listed, as the format names them) or with dry_run. A record once chained is never changed: a mistake is an anulacion, then a new alta. The answer carries verification_url, what the QR code of the invoice encodes. Refused by name where the pack declares no regime (no_fiscalisation_regime) or no brick writes its format (format_without_brick). Ask the user before chaining: a record is kept as the law requires, for good.',
376
382
  input: z.object({
377
383
  document_id: documentId,
@@ -399,7 +405,7 @@ const EINVOICING = {
399
405
  {
400
406
  verb: 'fiscalisation_status',
401
407
  title: 'Where the fiscal records of a company stand',
402
- readOnly: true,
408
+ effect: 'read',
403
409
  description: 'The fiscalisation regime of a company, as its country pack declares it, and where its records stand: each chain of an invoicing system, walked both ways (verified, or the first break), the records still to be sent to the authority, the posted sales from the start of the obligation that have no record — named here, never fiscalised on their own — and the latest events. Under a clearance regime (kind clearance), missing is the posted sales without the authority\'s validation, and clearance counts those validated, waiting, rejected by the authority or by the buyer, and cancelled at the authority while still posted. A broken chain is for the company\'s accountant before anything else.',
404
410
  input: z.object({
405
411
  company_id: companyId,
@@ -414,7 +420,7 @@ const EINVOICING = {
414
420
  {
415
421
  verb: 'clearance',
416
422
  title: 'Record a submission to the authority, or its answer',
417
- readOnly: false,
423
+ effect: 'additive',
418
424
  description: 'Under a clearance regime — the authority validates every invoice before it is issued, and an invoice is valid only once validated — records what happened to a posted sale: submitted (it left for the authority, with the reference the authority gave on receipt), validated (with the identifier the authority gave it, the moment it validated it and, where the regime has one, the verification link the invoice carries as a QR code), rejected (by the authority, or by the buyer after validation and within the window the pack declares, with the reason) or cancelled (by the issuer, after validation and within the pack\'s window, with the reason). Nothing is sent by this tool: it records what the host that talks to the authority reports, and the answer verbatim in answer. Every transition that cannot have happened is refused by name (clearance_pending, clearance_state_backwards, clearance_window_closed, clearance_not_cancellable, clearance_verification_missing, clearance_verification_unbuilt…). Refused where the pack declares no clearance regime (fiscal_regime_not_clearance). Never record an answer nobody received: an invoice recorded as validated is one the books treat as valid.',
419
425
  input: z.object({
420
426
  document_id: documentId,
@@ -458,7 +464,7 @@ const EINVOICING = {
458
464
  {
459
465
  verb: 'list',
460
466
  title: 'Electronic invoices sent',
461
- readOnly: true,
467
+ effect: 'read',
462
468
  description: 'Every sending of electronic invoices of a company, or of one document, latest first: the document, the file, the channel and the service, the reference it gave, the state and the last words the service said.',
463
469
  input: z.object({
464
470
  company_id: companyId,
@@ -522,7 +528,7 @@ const TAX = {
522
528
  {
523
529
  verb: 'estimate',
524
530
  title: 'Corporate income tax of a year',
525
- readOnly: true,
531
+ effect: 'read',
526
532
  description: 'The corporate income tax of a financial year as the ledger stands on a day — the whole year when no day is given — line by line, each with its article: the accounting result the country pack starts from, every adjustment with its base and percentage, the losses of earlier years used, the taxable base, every rate with the slice it takes, a rate refused with the parameter in the way (`not_declared` or `not_met`), the credits, and `estimated_tax`. Reads and writes nothing. It is an estimate from what is booked and from a reading of the rules: never call it the tax due, never call it compliant, and say that the user\'s accountant checks it before anything is filed. During the year it is the tax on the year so far; it forecasts nothing. A rate refused as `not_declared` is a question for the user: tax_parameters, then tax_declare_parameter with their answer.',
527
533
  input: z.object({
528
534
  company_id: companyId,
@@ -543,7 +549,7 @@ const TAX = {
543
549
  {
544
550
  verb: 'parameters',
545
551
  title: 'What the company declares for its tax',
546
- readOnly: true,
552
+ effect: 'read',
547
553
  description: 'The facts the country pack asks a company to declare for a financial year — a judgement (is it a small company, who holds its capital) or an amount (its turnover, what it paid its director) — each with its article, and the company\'s answer, or `declared: false`. A condition of a rate that is not declared is not met, so a reduced rate waits for these. Only the user answers them: ask, then tax_declare_parameter.',
548
554
  input: z.object({ company_id: companyId, fiscal_year_id: fiscalYearId }),
549
555
  async run(backend, args) {
@@ -586,7 +592,8 @@ const TAX = {
586
592
  {
587
593
  verb: 'declare_parameter',
588
594
  title: 'Declare a fact for the tax',
589
- readOnly: false,
595
+ effect: 'additive',
596
+ idempotent: true,
590
597
  description: 'Writes the company\'s answer to one parameter of tax_parameters for one financial year, replacing an earlier answer: `true` or `false` for a judgement, a decimal string for an amount. Write only what the user has stated, in their words — never a judgement you inferred from the books, which say nothing of who holds the capital or whether a condition is met. Ask before writing. The database refuses a code the country does not ask for (`unknown_tax_parameter`) and a value of the wrong kind (`tax_parameter_type`).',
591
598
  input: z.object({
592
599
  company_id: companyId,
@@ -627,7 +634,7 @@ const TAX = {
627
634
  {
628
635
  verb: 'adjustments',
629
636
  title: 'What the tax adds back or deducts',
630
- readOnly: true,
637
+ effect: 'read',
631
638
  description: 'The adjustment rules of the country pack in force for a financial year — what each adds back to the accounting result or deducts from it, its percentage or the formula that works it out, the accounts the pack catches by itself, and its article — with what the company named under each: an account read from the ledger every time, for every year or for this one, or an amount stated for this year. The pack catches by itself only what a chart keeps on an account of its own; everything else counts only once it is named here, with tax_declare_adjustment. `not_in_force` lists what the company named under a rule that does not apply to this year.',
632
639
  input: z.object({ company_id: companyId, fiscal_year_id: fiscalYearId }),
633
640
  async run(backend, args) {
@@ -705,7 +712,8 @@ const TAX = {
705
712
  {
706
713
  verb: 'declare_adjustment',
707
714
  title: 'Name what falls under an adjustment',
708
- readOnly: false,
715
+ effect: 'additive',
716
+ idempotent: true,
709
717
  description: 'Names what falls under one rule of tax_adjustments: an account, whose balance the estimate reads from the ledger every time — for every year, or for one — or an amount stated for one year. A rule whose percentage is a formula needs the parameters the formula names (`adjustment_parameter_missing` says which). Which expense falls under which rule is the user\'s call, or their accountant\'s: take the account and the amount from them, ask before writing, and run tax_estimate afterwards to show what moved. The database refuses a rule the country does not carry (`unknown_adjustment_rule`).',
710
718
  input: z.object({
711
719
  company_id: companyId,
@@ -763,7 +771,7 @@ const TAX = {
763
771
  {
764
772
  verb: 'losses',
765
773
  title: 'Losses carried forward',
766
- readOnly: true,
774
+ effect: 'read',
767
775
  description: 'What is left of each loss of an earlier year, by the day its year ended: the loss, what final computations have used of it, and what remains for a later profit. The stock moves only when a computation is called final. How much of it a year may use is the country\'s limit, applied by tax_estimate.',
768
776
  input: z.object({
769
777
  company_id: companyId,
@@ -777,7 +785,7 @@ const TAX = {
777
785
  {
778
786
  verb: 'record_computation',
779
787
  title: 'Keep an estimate',
780
- readOnly: false,
788
+ effect: 'additive',
781
789
  description: 'Keeps what tax_estimate says now as the next computation of the year, numbered, with its lines, so that it can be read again after the ledger moves. It stays an estimate: calling a computation final is the owner\'s act, outside this server, and only a final one names the tax due. Writes nothing to the ledger. Record only when the user asks.',
782
790
  input: z.object({
783
791
  company_id: companyId,
@@ -792,7 +800,7 @@ const TAX = {
792
800
  {
793
801
  verb: 'computations',
794
802
  title: 'Computations kept',
795
- readOnly: true,
803
+ effect: 'read',
796
804
  description: 'The computations kept for a company, latest first, or for one financial year: the version, the day the ledger was read on, the accounting result, the taxable base, the loss of the year and the tax, and the status — `estimate`, `final` (called final by an owner; the only one whose tax is the tax due) or `superseded` (a final one withdrawn, kept).',
797
805
  input: z.object({
798
806
  company_id: companyId,
@@ -879,7 +887,7 @@ const CRM = {
879
887
  {
880
888
  verb: 'search',
881
889
  title: 'Search the cards',
882
- readOnly: true,
890
+ effect: 'read',
883
891
  description: 'The contacts the company follows — one card each — filtered: a text found in the name, the e-mail or the organisation\'s name, a relationship status, a segment the contact is in now, a stage one of its deals is at, a country and a language (ISO codes; the organisation\'s where the person has none), an owner, no_outbound, active since or inactive since a moment (inactive includes a card on which nothing ever happened). Every filter is optional. Most recently active first. Each row is the contact, its organisation\'s name, its status, priority, owner, last activity and the slugs of its segments. A contact without a card is not here: crm_upsert_card creates one. Merged contacts are left out.',
884
892
  input: z.object({
885
893
  company_id: companyId,
@@ -915,7 +923,7 @@ const CRM = {
915
923
  {
916
924
  verb: 'card',
917
925
  title: 'One contact, whole',
918
- readOnly: true,
926
+ effect: 'read',
919
927
  description: 'Everything on one contact in one object: the contact as the books hold it (its contact_type says whether it is a prospect — other — or a customer), its organisation, its card (null when it has none yet), the segments it is in now, the open deals with it — for an organisation, with its people too — and its 20 latest activities. Read this before writing anything about a contact. A contact of another company is refused, crm_unknown_contact.',
920
928
  input: z.object({ company_id: companyId, contact_id: contactId }),
921
929
  async run(backend, args) {
@@ -928,7 +936,7 @@ const CRM = {
928
936
  {
929
937
  verb: 'segments',
930
938
  title: 'The segments',
931
- readOnly: true,
939
+ effect: 'read',
932
940
  description: 'Every segment of the company as a tree — a taxonomy branch, a target segment, a cohort, a brand — each with its parent, its depth, the path of slugs from its root, and how many contacts are in it now (one who left is not counted). A parent comes just before its children. Start here for crm_join_segment, crm_leave_segment or a search by segment.',
933
941
  input: z.object({ company_id: companyId }),
934
942
  async run(backend, args) {
@@ -938,7 +946,7 @@ const CRM = {
938
946
  {
939
947
  verb: 'board',
940
948
  title: 'A pipeline, stage by stage',
941
- readOnly: true,
949
+ effect: 'read',
942
950
  description: 'A pipeline as a board: its stages in order — each open, won or lost — the deals at each stage with their contact, amount, currency, expected date and owner, how many there are, and the sum of the amounts by currency, for each stage and for the pipeline. Amounts are never added across currencies. Without pipeline_id, every pipeline of the company: that is where the pipeline and stage ids for crm_open_deal and crm_move_deal come from. Open deals only, unless include_closed. A company starts with no pipeline: one is created by its users, not by this server.',
943
951
  input: z.object({
944
952
  company_id: companyId,
@@ -956,7 +964,7 @@ const CRM = {
956
964
  {
957
965
  verb: 'timeline',
958
966
  title: 'What happened',
959
- readOnly: true,
967
+ effect: 'read',
960
968
  description: 'The activities of one contact, or of one deal — notes, e-mails, calls, meetings, messages, signals, enrichments, tasks, and the moves the module wrote itself — most recent first. Name a contact, a deal, or both. since keeps what happened from that moment on; kinds keeps those kinds only, each one of ' +
961
969
  words(CRM_ACTIVITY_KINDS) +
962
970
  '.',
@@ -982,7 +990,8 @@ const CRM = {
982
990
  {
983
991
  verb: 'upsert_card',
984
992
  title: 'Write a card',
985
- readOnly: false,
993
+ effect: 'additive',
994
+ idempotent: true,
986
995
  description: 'Creates the card of a contact, or changes it: each key the patch names takes its value, every other field keeps its own. The keys are status (where the relationship stands: one of ' +
987
996
  words(CRM_RELATIONSHIP_STATUSES) +
988
997
  '), priority (one of ' +
@@ -1006,7 +1015,7 @@ const CRM = {
1006
1015
  {
1007
1016
  verb: 'log_activity',
1008
1017
  title: 'Log an activity',
1009
- readOnly: false,
1018
+ effect: 'additive',
1010
1019
  description: 'Writes one thing that happened with a contact — a note, an e-mail sent or received, a call, a meeting, a message, a signal read elsewhere, an enrichment, a task — optionally about one of the company\'s deals, and moves the card\'s last activity. kind is one of ' +
1011
1020
  words(CRM_ACTIVITY_KINDS) +
1012
1021
  '. When the activity was read from somewhere else, name source (the mailbox, the network, the calendar) and source_ref (its identifier there, a message-id): the same pair a second time writes nothing and returns the activity already kept, so an import can run twice. A source_ref without its source is refused, crm_bad_activity. Log what the user did or told you; never invent an exchange that did not happen.',
@@ -1044,7 +1053,8 @@ const CRM = {
1044
1053
  {
1045
1054
  verb: 'join_segment',
1046
1055
  title: 'Put a contact in a segment',
1047
- readOnly: false,
1056
+ effect: 'additive',
1057
+ idempotent: true,
1048
1058
  description: 'Puts a contact in a segment of the company, or back in it: a contact who had left is in again, with the same membership. added_by is who did it, a handle; note is why. A segment of another company is refused, crm_unknown_segment.',
1049
1059
  input: z.object({
1050
1060
  company_id: companyId,
@@ -1066,7 +1076,7 @@ const CRM = {
1066
1076
  {
1067
1077
  verb: 'leave_segment',
1068
1078
  title: 'Take a contact out of a segment',
1069
- readOnly: false,
1079
+ effect: 'additive',
1070
1080
  description: 'Takes a contact out of a segment. The membership is kept with the moment it ended, so the history stays readable and crm_join_segment can put the contact back. A contact that was never in the segment is refused, crm_not_a_member.',
1071
1081
  input: z.object({ company_id: companyId, segment_id: segmentId, contact_id: contactId }),
1072
1082
  async run(backend, args) {
@@ -1080,7 +1090,7 @@ const CRM = {
1080
1090
  {
1081
1091
  verb: 'open_deal',
1082
1092
  title: 'Open a deal',
1083
- readOnly: false,
1093
+ effect: 'additive',
1084
1094
  description: 'Opens a piece of business with one contact in one pipeline, at the first open stage of that pipeline. An amount is always in a currency: name currency_code (ISO 4217), or the company\'s own currency is taken. Nothing is written to the books. A pipeline of another company is refused, crm_unknown_pipeline; one with no open stage, crm_pipeline_without_open_stage. Ask the user before opening a deal they did not ask for.',
1085
1095
  input: z.object({
1086
1096
  company_id: companyId,
@@ -1110,7 +1120,8 @@ const CRM = {
1110
1120
  {
1111
1121
  verb: 'move_deal',
1112
1122
  title: 'Move a deal',
1113
- readOnly: false,
1123
+ effect: 'additive',
1124
+ idempotent: true,
1114
1125
  description: 'Moves a deal to another stage of its own pipeline and logs the move as an activity. A won stage closes the deal and makes its party a customer — the organisation at the root of the contact\'s chain: a prospect becomes customer, a supplier becomes both — which also needs the right to write contacts; a lost stage closes it too; going back to an open stage opens it again. The same stage again changes nothing. A stage of another pipeline is refused, crm_stage_not_in_pipeline. Confirm with the user before moving a deal to won or lost.',
1115
1126
  input: z.object({
1116
1127
  company_id: companyId,
@@ -1169,7 +1180,7 @@ const CONTRACTS = {
1169
1180
  {
1170
1181
  verb: 'list',
1171
1182
  title: 'The contracts',
1172
- readOnly: true,
1183
+ effect: 'read',
1173
1184
  description: 'The contracts of the company, each with its party, its kind, its side (sale: the company invoices; purchase: it is invoiced), its state, its dates, its currency and value, and its nearest deadline. Filtered by state (one of ' +
1174
1185
  words(CONTRACT_STATES) +
1175
1186
  '), side, party, or a text found in the number, the name or the party\'s name; every filter optional. templates: true also lists the active templates a contract can be made from, for contracts_from_template.',
@@ -1197,7 +1208,7 @@ const CONTRACTS = {
1197
1208
  {
1198
1209
  verb: 'card',
1199
1210
  title: 'One contract, whole',
1200
- readOnly: true,
1211
+ effect: 'read',
1201
1212
  description: 'Everything on one contract in one object: the contract, its party, its signed file with its checksum, its schedules, its history — versions, amendments, tacit renewals — the latest documents it issued with their number, state and total, and its deadlines. Read this before changing a contract or issuing from it.',
1202
1213
  input: z.object({ company_id: companyId, contract_id: contractId }),
1203
1214
  async run(backend, args) {
@@ -1210,7 +1221,8 @@ const CONTRACTS = {
1210
1221
  {
1211
1222
  verb: 'upsert',
1212
1223
  title: 'Write a contract',
1213
- readOnly: false,
1224
+ effect: 'additive',
1225
+ idempotent: true,
1214
1226
  description: 'Creates the contract of that number, or changes it: each key the patch names takes its value, every other field keeps its own. The keys are ' +
1215
1227
  words(CONTRACT_FIELDS) +
1216
1228
  '. A new contract needs contact_id, name, kind (one of ' +
@@ -1236,7 +1248,7 @@ const CONTRACTS = {
1236
1248
  {
1237
1249
  verb: 'schedule',
1238
1250
  title: 'Write a schedule',
1239
- readOnly: false,
1251
+ effect: 'additive',
1240
1252
  description: 'Adds a line a contract invoices at its own rhythm, or changes one (schedule_id). The keys are ' +
1241
1253
  words(CONTRACT_SCHEDULE_FIELDS) +
1242
1254
  '. frequency is one of ' +
@@ -1260,7 +1272,8 @@ const CONTRACTS = {
1260
1272
  {
1261
1273
  verb: 'issue_due',
1262
1274
  title: 'Issue what is due',
1263
- readOnly: false,
1275
+ effect: 'destructive',
1276
+ idempotent: true,
1264
1277
  description: 'Issues every period that has come on that day: for each schedule of a signed or active contract whose next_on is on or before it, one draft document per period — a sales invoice on a sale, a purchase invoice on a purchase — to the contract\'s party, contract_reference set to its number, and next_on moved on. Renewals and expiries come first. Twice for the same day issues once: the socle refuses a second document for one period. Drafts stay drafts unless the schedule says auto_post. Show the user what is due first (contracts_deadlines, kinds next_issue) and issue only once they agree; then show the drafts before anything is posted.',
1265
1278
  input: z.object({
1266
1279
  company_id: companyId,
@@ -1276,7 +1289,7 @@ const CONTRACTS = {
1276
1289
  {
1277
1290
  verb: 'deadlines',
1278
1291
  title: 'What the contracts ask, and when',
1279
- readOnly: true,
1292
+ effect: 'read',
1280
1293
  description: 'Every date a running contract asks somebody to act on, soonest first: notice (the last day notice can be given before the next term, or before the end), renewal, end, next_issue (the next period a schedule issues) and indexation (when a price is due to be indexed). Filtered by a window of days, a contract, or kinds, each one of ' +
1281
1294
  words(CONTRACT_DEADLINE_KINDS) +
1282
1295
  '. A notice date is a reading of what was recorded: say so, and let the user and their counsel decide.',
@@ -1300,7 +1313,7 @@ const CONTRACTS = {
1300
1313
  {
1301
1314
  verb: 'amend',
1302
1315
  title: 'Record an amendment',
1303
- readOnly: false,
1316
+ effect: 'additive',
1304
1317
  description: 'Records what changes in a contract and from when, numbered next in its history, with the signed file (attachment_id) and the day it was signed. kind amendment applies its changes now: the fields of the contract by name, and under "schedules" the fields of each schedule, by id — a new unit_price after an indexation, for instance. kind version records another text of the contract with its file and changes nothing. A renewal is written by the module itself on its day. Kinds: ' +
1305
1318
  words(CONTRACT_AMENDMENT_KINDS.filter((kind) => kind !== 'renewal')) +
1306
1319
  '. Confirm the changes with the user before recording them.',
@@ -1330,7 +1343,7 @@ const CONTRACTS = {
1330
1343
  {
1331
1344
  verb: 'from_template',
1332
1345
  title: 'A contract from a template',
1333
- readOnly: false,
1346
+ effect: 'additive',
1334
1347
  description: 'Makes a draft contract of one of the company\'s templates (contracts_list with templates: true lists them): the number, party, side and kind given, starting on starts_on, the values of the template\'s variables kept on the contract — a required one left empty is refused, contracts_missing_variable — and the template\'s schedule copied, starting on starts_on. Answers the contract, its schedules, and the clauses: the html with the values in place, or the docx file to fill. Nothing is sent or signed. Ask the user for every value rather than inventing one.',
1335
1348
  input: z.object({
1336
1349
  company_id: companyId,