@bendyline/gilde 0.3.16 → 0.3.18
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/authoring/chat-models/inkling2-mini-26b-nvfp4.json +26 -0
- package/authoring/chat-models/kolibri-1.1-75b-iq2.json +1 -1
- package/authoring/chat-models/minicpm5-15b-a2.5b-q4.json +138 -0
- package/authoring/chat-models/qwen3.8-flash-next-iq4.json +4 -14
- package/authoring/chat-models/qwen4-35b-a3b-q4.json +200 -0
- package/authoring/chat-models/spark-x2.6-4b-q4.json +26 -0
- package/data/chat-models/in/inkling2-mini-26b-nvfp4/manifest.json +26 -0
- package/data/chat-models/index.json +1 -1
- package/data/chat-models/ko/kolibri-1.1-75b-iq2/manifest.json +1 -1
- package/data/chat-models/mi/minicpm5-15b-a2.5b-q4/manifest.json +186 -0
- package/data/chat-models/mi/minicpm5-15b-a2.5b-q4/versions/1.0.0/manifest.json +64 -0
- package/data/chat-models/mi/minicpm5-15b-a2.5b-q4/versions/1.0.1/manifest.json +64 -0
- package/data/chat-models/qw/qwen3.8-flash-next-iq4/manifest.json +3 -211
- package/data/chat-models/qw/qwen3.8-flash-next-iq4/versions/1.1.2/manifest.json +36 -0
- package/data/chat-models/qw/qwen4-35b-a3b-q4/manifest.json +317 -0
- package/data/chat-models/qw/qwen4-35b-a3b-q4/versions/1.0.0/manifest.json +120 -0
- package/data/chat-models/qw/qwen4-35b-a3b-q4/versions/1.0.1/manifest.json +135 -0
- package/data/chat-models/raw-index.json +1 -1
- package/data/chat-models/sp/spark-x2.6-4b-q4/manifest.json +26 -0
- package/data/craftbook-templates/al/album-curate/versions/1.0.6/craftbook.json +344 -0
- package/data/craftbook-templates/al/album-curate/versions/1.0.6/test.json +160 -0
- package/data/craftbook-templates/al/album-curate/versions/1.0.7/craftbook.json +362 -0
- package/data/craftbook-templates/al/album-curate/versions/1.0.7/test.json +192 -0
- package/data/craftbook-templates/an/annual-document-review/versions/1.0.5/craftbook.json +306 -0
- package/data/craftbook-templates/an/annual-document-review/versions/1.0.5/test.json +115 -0
- package/data/craftbook-templates/ce/celebration-day-plan/manifest.json +22 -0
- package/data/craftbook-templates/ce/celebration-day-plan/versions/1.0.0/craftbook.json +242 -0
- package/data/craftbook-templates/ce/celebration-day-plan/versions/1.0.0/test.json +118 -0
- package/data/craftbook-templates/da/dataset-clean/versions/1.2.7/craftbook.json +263 -0
- package/data/craftbook-templates/da/dataset-clean/versions/1.2.7/test.json +111 -0
- package/data/craftbook-templates/em/email-template/versions/1.0.6/craftbook.json +335 -0
- package/data/craftbook-templates/em/email-template/versions/1.0.6/test.json +112 -0
- package/data/craftbook-templates/ex/expense-categorize/manifest.json +0 -5
- package/data/craftbook-templates/ex/expense-categorize/versions/1.0.7/craftbook.json +306 -0
- package/data/craftbook-templates/ex/expense-categorize/versions/1.0.7/test.json +120 -0
- package/data/craftbook-templates/ex/expense-categorize/versions/1.0.9/craftbook.json +330 -0
- package/data/craftbook-templates/ex/expense-categorize/versions/1.0.9/test.json +120 -0
- package/data/craftbook-templates/fa/family-story-chapter/manifest.json +0 -5
- package/data/craftbook-templates/fa/family-story-chapter/versions/1.0.6/craftbook.json +213 -0
- package/data/craftbook-templates/fa/family-story-chapter/versions/1.0.6/test.json +118 -0
- package/data/craftbook-templates/fa/family-story-chapter/versions/1.0.7/craftbook.json +249 -0
- package/data/craftbook-templates/fa/family-story-chapter/versions/1.0.7/test.json +121 -0
- package/data/craftbook-templates/fa/family-story-chapter/versions/1.0.8/craftbook.json +269 -0
- package/data/craftbook-templates/fa/family-story-chapter/versions/1.0.8/test.json +147 -0
- package/data/craftbook-templates/fa/faq-from-docs/versions/1.1.3/craftbook.json +275 -0
- package/data/craftbook-templates/fa/faq-from-docs/versions/1.1.3/test.json +116 -0
- package/data/craftbook-templates/fo/folder-to-audio/versions/1.0.6/craftbook.json +263 -0
- package/data/craftbook-templates/fo/folder-to-audio/versions/1.0.6/test.json +114 -0
- package/data/craftbook-templates/in/inbox-triage/manifest.json +0 -4
- package/data/craftbook-templates/in/inbox-triage/versions/1.0.6/craftbook.json +305 -0
- package/data/craftbook-templates/in/inbox-triage/versions/1.0.6/test.json +175 -0
- package/data/craftbook-templates/in/inbox-triage/versions/1.0.7/craftbook.json +311 -0
- package/data/craftbook-templates/in/inbox-triage/versions/1.0.7/test.json +189 -0
- package/data/craftbook-templates/in/invoice-generator/manifest.json +0 -4
- package/data/craftbook-templates/in/invoice-generator/versions/1.0.6/craftbook.json +246 -0
- package/data/craftbook-templates/in/invoice-generator/versions/1.0.6/test.json +183 -0
- package/data/craftbook-templates/index.json +1 -1
- package/data/craftbook-templates/me/meeting-minutes/manifest.json +1 -5
- package/data/craftbook-templates/me/meeting-minutes/versions/1.1.3/craftbook.json +276 -0
- package/data/craftbook-templates/me/meeting-minutes/versions/1.1.3/test.json +97 -0
- package/data/craftbook-templates/me/meeting-minutes/versions/1.1.4/craftbook.json +272 -0
- package/data/craftbook-templates/me/meeting-minutes/versions/1.1.4/test.json +97 -0
- package/data/craftbook-templates/me/meeting-notes-to-actions/versions/1.1.4/craftbook.json +285 -0
- package/data/craftbook-templates/me/meeting-notes-to-actions/versions/1.1.4/samples/team-sync/notes.md +47 -0
- package/data/craftbook-templates/me/meeting-notes-to-actions/versions/1.1.4/test.json +90 -0
- package/data/craftbook-templates/me/memory-prompt-session/manifest.json +0 -4
- package/data/craftbook-templates/me/memory-prompt-session/versions/1.0.5/craftbook.json +317 -0
- package/data/craftbook-templates/me/memory-prompt-session/versions/1.0.5/test.json +237 -0
- package/data/craftbook-templates/mo/mock-interview/manifest.json +0 -4
- package/data/craftbook-templates/mo/mock-interview/versions/1.0.7/craftbook.json +352 -0
- package/data/craftbook-templates/mo/mock-interview/versions/1.0.7/test.json +209 -0
- package/data/craftbook-templates/of/offer-compare/versions/1.0.6/craftbook.json +244 -0
- package/data/craftbook-templates/of/offer-compare/versions/1.0.6/test.json +129 -0
- package/data/craftbook-templates/on/onboarding-checklist/versions/1.0.6/craftbook.json +248 -0
- package/data/craftbook-templates/on/onboarding-checklist/versions/1.0.6/test.json +101 -0
- package/data/craftbook-templates/ph/photo-cull/versions/1.0.6/craftbook.json +315 -0
- package/data/craftbook-templates/ph/photo-cull/versions/1.0.6/test.json +196 -0
- package/data/craftbook-templates/ph/photo-cull/versions/1.0.7/craftbook.json +336 -0
- package/data/craftbook-templates/ph/photo-cull/versions/1.0.7/test.json +204 -0
- package/data/craftbook-templates/pr/pre-departure-countdown/manifest.json +0 -1
- package/data/craftbook-templates/pr/pre-departure-countdown/versions/1.0.6/craftbook.json +306 -0
- package/data/craftbook-templates/pr/pre-departure-countdown/versions/1.0.6/test.json +119 -0
- package/data/craftbook-templates/pr/pre-departure-countdown/versions/1.0.7/craftbook.json +315 -0
- package/data/craftbook-templates/pr/pre-departure-countdown/versions/1.0.7/test.json +127 -0
- package/data/craftbook-templates/pu/pull-request-review/versions/1.9.19/craftbook.json +611 -0
- package/data/craftbook-templates/pu/pull-request-review/versions/1.9.19/test.json +156 -0
- package/data/craftbook-templates/pu/pull-request-review/versions/1.9.20/craftbook.json +632 -0
- package/data/craftbook-templates/pu/pull-request-review/versions/1.9.20/test.json +156 -0
- package/data/craftbook-templates/raw-index.json +1 -1
- package/data/craftbook-templates/re/reading-list/versions/1.0.6/craftbook.json +247 -0
- package/data/craftbook-templates/re/reading-list/versions/1.0.6/test.json +101 -0
- package/data/craftbook-templates/re/receipt-ocr-ledger/manifest.json +0 -4
- package/data/craftbook-templates/re/receipt-ocr-ledger/versions/1.0.7/craftbook.json +312 -0
- package/data/craftbook-templates/re/receipt-ocr-ledger/versions/1.0.7/test.json +160 -0
- package/data/craftbook-templates/re/receipt-ocr-ledger/versions/1.0.8/craftbook.json +322 -0
- package/data/craftbook-templates/re/receipt-ocr-ledger/versions/1.0.8/test.json +194 -0
- package/data/craftbook-templates/re/receipt-ocr-ledger/versions/1.0.9/craftbook.json +353 -0
- package/data/craftbook-templates/re/receipt-ocr-ledger/versions/1.0.9/test.json +215 -0
- package/data/craftbook-templates/re/record-a-relative/manifest.json +0 -1
- package/data/craftbook-templates/re/record-a-relative/versions/1.0.5/craftbook.json +318 -0
- package/data/craftbook-templates/re/record-a-relative/versions/1.0.5/test.json +208 -0
- package/data/craftbook-templates/re/record-a-relative/versions/1.0.6/craftbook.json +381 -0
- package/data/craftbook-templates/re/record-a-relative/versions/1.0.6/test.json +224 -0
- package/data/craftbook-templates/re/resume-cv/manifest.json +1 -5
- package/data/craftbook-templates/re/resume-cv/versions/1.0.6/craftbook.json +310 -0
- package/data/craftbook-templates/re/resume-cv/versions/1.0.6/test.json +121 -0
- package/data/craftbook-templates/re/resume-cv/versions/1.0.7/craftbook.json +312 -0
- package/data/craftbook-templates/re/resume-cv/versions/1.0.7/test.json +129 -0
- package/data/craftbook-templates/re/resume-cv/versions/1.0.8/craftbook.json +329 -0
- package/data/craftbook-templates/re/resume-cv/versions/1.0.8/test.json +144 -0
- package/data/craftbook-templates/re/reviewer-loop/versions/1.0.4/craftbook.json +178 -0
- package/data/craftbook-templates/re/reviewer-loop/versions/1.0.4/test.json +117 -0
- package/data/craftbook-templates/ro/rough-cut-assembly/versions/1.0.7/craftbook.json +333 -0
- package/data/craftbook-templates/ro/rough-cut-assembly/versions/1.0.7/test.json +142 -0
- package/data/craftbook-templates/se/seasonal-maintenance-sweep/manifest.json +0 -1
- package/data/craftbook-templates/se/seasonal-maintenance-sweep/versions/1.0.6/craftbook.json +307 -0
- package/data/craftbook-templates/se/seasonal-maintenance-sweep/versions/1.0.6/test.json +121 -0
- package/data/craftbook-templates/se/seasonal-maintenance-sweep/versions/1.0.7/craftbook.json +314 -0
- package/data/craftbook-templates/se/seasonal-maintenance-sweep/versions/1.0.7/test.json +121 -0
- package/data/craftbook-templates/su/subscription-audit/manifest.json +0 -5
- package/data/craftbook-templates/su/subscription-audit/versions/1.0.6/craftbook.json +307 -0
- package/data/craftbook-templates/su/subscription-audit/versions/1.0.6/test.json +134 -0
- package/data/craftbook-templates/su/subscription-audit/versions/1.0.7/craftbook.json +300 -0
- package/data/craftbook-templates/su/subscription-audit/versions/1.0.7/test.json +140 -0
- package/data/craftbook-templates/su/subscription-audit/versions/1.0.8/craftbook.json +320 -0
- package/data/craftbook-templates/su/subscription-audit/versions/1.0.8/test.json +144 -0
- package/data/craftbook-templates/su/summarize-long/manifest.json +0 -1
- package/data/craftbook-templates/su/summarize-long/versions/1.0.7/craftbook.json +251 -0
- package/data/craftbook-templates/su/summarize-long/versions/1.0.7/test.json +115 -0
- package/data/craftbook-templates/su/summarize-long/versions/1.0.8/craftbook.json +261 -0
- package/data/craftbook-templates/su/summarize-long/versions/1.0.8/test.json +123 -0
- package/data/craftbook-templates/su/survey-analysis/versions/1.0.6/craftbook.json +345 -0
- package/data/craftbook-templates/su/survey-analysis/versions/1.0.6/test.json +214 -0
- package/data/craftbook-templates/su/survey-analysis/versions/1.0.7/craftbook.json +362 -0
- package/data/craftbook-templates/su/survey-analysis/versions/1.0.7/test.json +231 -0
- package/data/craftbook-templates/su/survey-analysis/versions/1.0.8/craftbook.json +378 -0
- package/data/craftbook-templates/su/survey-analysis/versions/1.0.8/test.json +240 -0
- package/data/craftbook-templates/ta/tailor-resume/manifest.json +0 -4
- package/data/craftbook-templates/ta/tailor-resume/versions/1.0.7/craftbook.json +255 -0
- package/data/craftbook-templates/ta/tailor-resume/versions/1.0.7/test.json +113 -0
- package/data/craftbook-templates/ta/tailor-resume/versions/1.0.8/craftbook.json +267 -0
- package/data/craftbook-templates/ta/tailor-resume/versions/1.0.8/test.json +120 -0
- package/data/craftbook-templates/ta/tailor-resume/versions/1.0.9/craftbook.json +278 -0
- package/data/craftbook-templates/ta/tailor-resume/versions/1.0.9/test.json +134 -0
- package/data/craftbook-templates/to/tone-rewrite/manifest.json +0 -1
- package/data/craftbook-templates/to/tone-rewrite/versions/1.0.6/craftbook.json +245 -0
- package/data/craftbook-templates/to/tone-rewrite/versions/1.0.6/test.json +120 -0
- package/data/craftbook-templates/to/tone-rewrite/versions/1.0.7/craftbook.json +243 -0
- package/data/craftbook-templates/to/tone-rewrite/versions/1.0.7/test.json +127 -0
- package/data/craftbook-templates/to/topic-explainer/versions/1.0.6/craftbook.json +319 -0
- package/data/craftbook-templates/to/topic-explainer/versions/1.0.6/test.json +124 -0
- package/data/craftbook-templates/to/topic-explainer/versions/1.0.7/craftbook.json +327 -0
- package/data/craftbook-templates/to/topic-explainer/versions/1.0.7/test.json +131 -0
- package/data/craftbook-templates/tr/transcribe-audio/manifest.json +0 -5
- package/data/craftbook-templates/tr/transcribe-audio/versions/1.0.6/craftbook.json +248 -0
- package/data/craftbook-templates/tr/transcribe-audio/versions/1.0.6/test.json +137 -0
- package/data/craftbook-templates/tr/transcribe-audio/versions/1.0.7/craftbook.json +324 -0
- package/data/craftbook-templates/tr/transcribe-audio/versions/1.0.7/test.json +197 -0
- package/data/craftbook-templates/tr/translate-content/versions/1.1.6/craftbook.json +141 -0
- package/data/craftbook-templates/tr/translate-content/versions/1.1.6/test.json +172 -0
- package/data/craftbook-templates/tr/translate-content/versions/1.1.7/craftbook.json +143 -0
- package/data/craftbook-templates/tr/translate-content/versions/1.1.7/test.json +202 -0
- package/data/craftbook-templates/tr/translate-content/versions/1.1.8/craftbook.json +151 -0
- package/data/craftbook-templates/tr/translate-content/versions/1.1.8/test.json +206 -0
- package/data/craftbook-templates/tr/translate-content/versions/1.1.9/craftbook.json +165 -0
- package/data/craftbook-templates/tr/translate-content/versions/1.1.9/test.json +237 -0
- package/data/craftbook-templates/vi/visit-prep/manifest.json +0 -5
- package/data/craftbook-templates/vi/visit-prep/versions/1.0.6/craftbook.json +303 -0
- package/data/craftbook-templates/vi/visit-prep/versions/1.0.6/test.json +134 -0
- package/data/craftbook-templates/vi/visit-prep/versions/1.0.7/craftbook.json +326 -0
- package/data/craftbook-templates/vi/visit-prep/versions/1.0.7/test.json +152 -0
- package/data/craftbook-templates/we/weekly-menu-plan/versions/1.1.0/craftbook.json +309 -0
- package/data/craftbook-templates/we/weekly-menu-plan/versions/1.1.0/test.json +152 -0
- package/data/craftbook-templates/we/weekly-review/versions/1.0.7/craftbook.json +253 -0
- package/data/craftbook-templates/we/weekly-review/versions/1.0.7/test.json +113 -0
- package/data/craftbook-templates/ye/year-in-review/manifest.json +0 -5
- package/data/craftbook-templates/ye/year-in-review/versions/1.0.6/craftbook.json +314 -0
- package/data/craftbook-templates/ye/year-in-review/versions/1.0.6/test.json +140 -0
- package/data/gezel-templates/index.json +1 -1
- package/data/gezel-templates/raw-index.json +1 -1
- package/data/gezel-templates/re/reviewer/versions/1.4.2/about.md +53 -0
- package/data/gezel-templates/re/reviewer/versions/1.4.2/manifest.json +21 -0
- package/data/gezel-templates/re/reviewer/versions/1.4.3/about.md +53 -0
- package/data/gezel-templates/re/reviewer/versions/1.4.3/manifest.json +21 -0
- package/data/image-models/index.json +1 -1
- package/data/image-models/mi/ming-image-0.2-design-q8/manifest.json +39 -0
- package/data/image-models/mi/ming-image-0.2-design-q8/versions/1.0.0/manifest.json +37 -0
- package/data/image-models/raw-index.json +1 -1
- package/data/project-types/ca/caregiving-binder/versions/1.2.1/about.md +7 -0
- package/data/project-types/ca/caregiving-binder/versions/1.2.1/care.json +4 -0
- package/data/project-types/ca/caregiving-binder/versions/1.2.1/manifest.json +233 -0
- package/data/project-types/ca/caregiving-binder/versions/1.2.1/meds.json +8 -0
- package/data/project-types/ca/caregiving-binder/versions/1.2.1/mission.md +7 -0
- package/data/project-types/ca/caregiving-binder/versions/1.2.1/pages/dashboard/application.js +186 -0
- package/data/project-types/ca/caregiving-binder/versions/1.2.1/pages/dashboard/demo-chat.js +224 -0
- package/data/project-types/ca/caregiving-binder/versions/1.2.1/pages/dashboard/index.html +365 -0
- package/data/project-types/ev/event-planner/versions/1.2.0/about.md +7 -0
- package/data/project-types/ev/event-planner/versions/1.2.0/budget.json +5 -0
- package/data/project-types/ev/event-planner/versions/1.2.0/guests.json +10 -0
- package/data/project-types/ev/event-planner/versions/1.2.0/manifest.json +260 -0
- package/data/project-types/ev/event-planner/versions/1.2.0/mission.md +6 -0
- package/data/project-types/ev/event-planner/versions/1.2.0/pages/dashboard/application.js +234 -0
- package/data/project-types/ev/event-planner/versions/1.2.0/pages/dashboard/demo-chat.js +231 -0
- package/data/project-types/ev/event-planner/versions/1.2.0/pages/dashboard/index.html +322 -0
- package/data/project-types/fl/flashcards/versions/1.3.1/about.md +8 -0
- package/data/project-types/fl/flashcards/versions/1.3.1/deck.json +7 -0
- package/data/project-types/fl/flashcards/versions/1.3.1/manifest.json +243 -0
- package/data/project-types/fl/flashcards/versions/1.3.1/mission.md +6 -0
- package/data/project-types/fl/flashcards/versions/1.3.1/pages/review/application.js +147 -0
- package/data/project-types/fl/flashcards/versions/1.3.1/pages/review/demo-chat.js +331 -0
- package/data/project-types/fl/flashcards/versions/1.3.1/pages/review/index.html +665 -0
- package/data/project-types/index.json +1 -1
- package/data/project-types/me/meal-planner/versions/1.2.0/about.md +10 -0
- package/data/project-types/me/meal-planner/versions/1.2.0/manifest.json +259 -0
- package/data/project-types/me/meal-planner/versions/1.2.0/menu.json +5 -0
- package/data/project-types/me/meal-planner/versions/1.2.0/mission.md +5 -0
- package/data/project-types/me/meal-planner/versions/1.2.0/pages/dashboard/application.js +247 -0
- package/data/project-types/me/meal-planner/versions/1.2.0/pages/dashboard/demo-chat.js +134 -0
- package/data/project-types/me/meal-planner/versions/1.2.0/pages/dashboard/index.html +280 -0
- package/data/project-types/me/meal-planner/versions/1.2.0/pantry.json +9 -0
- package/data/project-types/qu/quotes-and-bids/versions/1.1.1/about.md +15 -0
- package/data/project-types/qu/quotes-and-bids/versions/1.1.1/manifest.json +639 -0
- package/data/project-types/qu/quotes-and-bids/versions/1.1.1/mission.md +3 -0
- package/data/project-types/qu/quotes-and-bids/versions/1.1.1/pages/quotes/application.js +386 -0
- package/data/project-types/qu/quotes-and-bids/versions/1.1.1/pages/quotes/demo-chat.js +263 -0
- package/data/project-types/qu/quotes-and-bids/versions/1.1.1/pages/quotes/index.html +998 -0
- package/data/project-types/qu/quotes-and-bids/versions/1.1.1/quotes.json +10 -0
- package/data/project-types/qu/quotes-and-bids/versions/1.1.1/rates.json +8 -0
- package/data/project-types/raw-index.json +1 -1
- package/data/project-types/tr/trip-planner/versions/1.1.1/about.md +7 -0
- package/data/project-types/tr/trip-planner/versions/1.1.1/journal.json +4 -0
- package/data/project-types/tr/trip-planner/versions/1.1.1/manifest.json +297 -0
- package/data/project-types/tr/trip-planner/versions/1.1.1/mission.md +4 -0
- package/data/project-types/tr/trip-planner/versions/1.1.1/packing.json +8 -0
- package/data/project-types/tr/trip-planner/versions/1.1.1/pages/dashboard/application.js +176 -0
- package/data/project-types/tr/trip-planner/versions/1.1.1/pages/dashboard/demo-chat.js +264 -0
- package/data/project-types/tr/trip-planner/versions/1.1.1/pages/dashboard/index.html +373 -0
- package/data/project-types/tr/trip-planner/versions/1.1.1/trip.json +8 -0
- package/package.json +1 -1
- package/schemas/chat-model-version.schema.json +3 -0
- package/schemas/craftbook-doc.schema.json +21 -0
- package/schemas/craftbook-template-version.schema.json +21 -0
- package/schemas/craftbook-test.schema.json +1261 -183
|
@@ -0,0 +1,639 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"version": "1.1.1",
|
|
4
|
+
"releasedAt": "2026-11-30T00:00:00.000Z",
|
|
5
|
+
"meesterManaged": false,
|
|
6
|
+
"params": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"business": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"title": "What kind of business is this?",
|
|
12
|
+
"description": "e.g. 'a three-person electrical contractor', 'a painting and drywall crew'.",
|
|
13
|
+
"default": "the business"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"required": [
|
|
17
|
+
"business"
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"nameTemplate": "Quotes & Bids",
|
|
21
|
+
"aboutTemplate": "about.md",
|
|
22
|
+
"missionTemplate": "mission.md",
|
|
23
|
+
"gezels": [
|
|
24
|
+
{
|
|
25
|
+
"templateId": "estimator",
|
|
26
|
+
"voorman": true
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"templateId": "kantoormeester"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"toolsets": [
|
|
33
|
+
{
|
|
34
|
+
"id": "docblocks",
|
|
35
|
+
"need": "suggested",
|
|
36
|
+
"reason": "Turns a finished quote into a PDF or Word document to send."
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"quote-store": "import { type InferredInput, defineScript, gezel } from '@bendyline/gezel-sdk';\nimport { rosterStore } from '@bendyline/gezel-sdk/stores';\n\nexport const meta = defineScript({\n name: 'quote-store',\n description:\n \"Price jobs and track quotes (quotes.json) at the business's own rates, tax and terms (rates.json). action:'status' for every quote with its exact total, the follow-ups due and the win/loss record; 'add' to start a quote (an existing title is updated, never duplicated); 'add_line' and 'remove_line' to price it (the script works out every amount and the tax); 'send', 'follow_up' and 'outcome' as it moves; 'set_rate' and 'set_terms' for the business's rates, tax and quote terms; 'show' for one quote line by line.\",\n inputs: {\n action: {\n type: 'string',\n description:\n \"One of 'status', 'add', 'add_line', 'remove_line', 'send', 'follow_up', 'outcome', 'set_rate', 'set_terms', 'export_copy', 'show', or 'list'.\",\n required: true,\n },\n id: { type: 'string', description: \"Quote id, e.g. 'q-3'.\" },\n title: {\n type: 'string',\n description: \"The job, e.g. 'Harbor Street Café kitchen rewire'. Also finds the quote (or its client) when no id is given.\",\n },\n client: { type: 'string', description: 'Who the quote is for.' },\n contact: { type: 'string', description: 'The person there.' },\n site: { type: 'string', description: 'Where the work is.' },\n kind: { type: 'string', description: 'labor, materials, or other.' },\n description: { type: 'string', description: \"What the line is, e.g. 'Electrician labor' or '200A panel'.\" },\n qty: { type: 'number', description: 'Quantity, e.g. 16 hours or 2 panels (default 1).' },\n addQty: { type: 'number', description: \"Add to the quantity of the line with this description, e.g. 6 more hours.\" },\n unit: { type: 'string', description: 'hour, each, foot, or lot.' },\n rate: { type: 'number', description: 'Price per unit in dollars, e.g. 95.' },\n rateName: { type: 'string', description: \"A saved rate by name, e.g. 'Electrician'; it fills the rate, unit and kind.\" },\n line: { type: 'number', description: 'Line number, for remove_line.' },\n name: { type: 'string', description: \"For set_rate: the rate's name, e.g. 'Electrician'.\" },\n taxRate: { type: 'number', description: 'For set_terms: the sales tax percent the business charges, e.g. 8.25 (0 for none).' },\n taxOn: { type: 'string', description: 'For set_terms: materials (tax on materials only) or all (the whole quote).' },\n validDays: { type: 'number', description: 'How many days a quote stays valid after sending.' },\n followUpDays: { type: 'number', description: 'For set_terms: days after sending to follow up.' },\n followUpAt: { type: 'string', description: 'Next follow-up date, YYYY-MM-DD.' },\n inDays: { type: 'number', description: 'Next follow-up this many days from today, instead of followUpAt.' },\n outcome: { type: 'string', description: 'won or lost.' },\n note: { type: 'string', description: 'What happened or why, in the words given.' },\n withinDays: { type: 'number', description: 'How many days ahead counts for follow-ups (default 7).' },\n },\n outputs: {\n drafts: { type: 'number', description: 'Quotes still being priced.' },\n waiting: { type: 'number', description: 'Quotes sent and waiting for an answer.' },\n followUpsDue: { type: 'number', description: 'Follow-ups overdue or due today.' },\n total: { type: 'number', description: 'The total of the quote this call acted on, in dollars (0 when none).' },\n summary: { type: 'string', description: 'What changed, then the quotes picture; or one quote line by line; or the listing.' },\n },\n requires: ['workspace.read', 'workspace.write', 'reminders'],\n} as const);\n\nconst input = gezel.input as InferredInput<typeof meta>;\n\n// ── quote-rules-start ──\n// Pure derivations: money in integer cents, line amounts and quote totals that\n// are exact to the cent (quantities to a thousandth, tax rates in basis\n// points, both rounded half up), local calendar days for follow-ups, finding a\n// quote or a line by name, and the quotes picture the crew reads. Kept\n// self-contained between these sentinels so unit tests execute the shipped\n// bytes.\nvar DAY_MS = 86400000;\nvar STAGES = ['draft', 'sent', 'won', 'lost'];\nvar KINDS = ['labor', 'materials', 'other'];\nvar NAME_STOP = ['the', 'and', 'for', 'with', 'our', 'quote', 'bid', 'job', 'estimate'];\n\nfunction pad(n) {\n return n < 10 ? '0' + n : String(n);\n}\nfunction localDay(ms) {\n var d = new Date(ms);\n return d.getFullYear() + '-' + pad(d.getMonth() + 1) + '-' + pad(d.getDate());\n}\nfunction normalizeDate(text) {\n var raw = String(text || '').trim();\n if (/^\\d{4}-\\d{2}-\\d{2}/.test(raw)) return raw.slice(0, 10);\n var parsed = Date.parse(raw);\n return isFinite(parsed) ? localDay(parsed) : null;\n}\nfunction daysLeft(day, nowMs) {\n var due = Date.parse(String(day).slice(0, 10) + 'T00:00:00');\n var today = Date.parse(localDay(nowMs) + 'T00:00:00');\n return Math.round((due - today) / DAY_MS);\n}\nfunction addDays(day, n) {\n var d = new Date(String(day).slice(0, 10) + 'T12:00:00');\n d.setDate(d.getDate() + n);\n return localDay(d.getTime());\n}\nfunction when(days) {\n if (days < 0) return -days + (days === -1 ? ' day late' : ' days late');\n if (days === 0) return 'today';\n if (days === 1) return 'tomorrow';\n return 'in ' + days + ' days';\n}\nfunction cap(text) {\n return String(text).charAt(0).toUpperCase() + String(text).slice(1);\n}\nfunction ago(days) {\n return days <= 0 ? 'today' : days === 1 ? 'yesterday' : days + ' days ago';\n}\n// Dollars as a number or text ('$1,850', '95.50') to integer cents; null when it is not money.\nfunction toCents(value) {\n if (typeof value === 'string') value = Number(value.replace(/[$,\\s]/g, ''));\n if (typeof value !== 'number' || !isFinite(value)) return null;\n return (value < 0 ? -1 : 1) * Math.round(Math.abs(value) * 100);\n}\n// A quantity in thousandths, so 6.5 hours or 12.25 feet multiply exactly.\nfunction toMilli(qty) {\n if (typeof qty === 'string') qty = Number(qty.replace(/[,\\s]/g, ''));\n return typeof qty === 'number' && isFinite(qty) && qty > 0 ? Math.round(qty * 1000) : null;\n}\nfunction money(cents) {\n var n = Math.round(Number(cents) || 0);\n var abs = Math.abs(n);\n var whole = String(Math.floor(abs / 100)).replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n return (n < 0 ? '-$' : '$') + whole + '.' + pad(abs % 100);\n}\nfunction percent(bp) {\n return (bp / 100).toFixed(2).replace(/\\.?0+$/, '') + '%';\n}\nfunction fold(text) {\n return String(text || '')\n .normalize('NFD')\n .replace(/[̀-ͯ]/g, '')\n .replace(/[‘’]/g, \"'\")\n .toLowerCase()\n .trim();\n}\n// Quantity times rate, rounded half away from zero to the cent.\nfunction lineAmount(qtyMilli, rateCents) {\n var x = qtyMilli * rateCents;\n return (x < 0 ? -1 : 1) * Math.floor((Math.abs(x) + 500) / 1000);\n}\nfunction qtyText(qty, unit) {\n var n = Math.round(Number(qty) * 1000) / 1000;\n var u = String(unit || 'each');\n if (n === 1 || u === 'each' || u === 'lot' || /s$/.test(u)) return n + ' ' + u;\n return n + ' ' + (u === 'foot' ? 'feet' : /(x|ch|sh)$/.test(u) ? u + 'es' : u + 's');\n}\nfunction totals(lines, taxBp, taxOn) {\n var t = { labor: 0, materials: 0, other: 0, subtotal: 0, taxable: 0, tax: 0, total: 0 };\n (lines || []).forEach(function (l) {\n var a = Number(l.amountCents) || 0;\n t[KINDS.indexOf(l.kind) >= 0 ? l.kind : 'other'] += a;\n t.subtotal += a;\n });\n t.taxable = Math.max(0, taxOn === 'all' ? t.subtotal : t.materials);\n t.tax = Math.floor((t.taxable * (taxBp || 0) + 5000) / 10000);\n t.total = t.subtotal + t.tax;\n return t;\n}\nfunction quoteTotals(record) {\n var f = record.fields || {};\n return totals(f.lines, f.taxBp, f.taxOn);\n}\n// The fields a quote stores beside its lines, so a reader never re-adds them.\nfunction totalFields(lines, taxBp, taxOn) {\n var t = totals(lines, taxBp, taxOn);\n return { laborCents: t.labor, materialsCents: t.materials, otherCents: t.other, subtotalCents: t.subtotal, taxCents: t.tax, totalCents: t.total };\n}\nfunction normalizeTerms(doc) {\n var d = doc && typeof doc === 'object' ? doc : {};\n var whole = function (v, fallback) {\n return typeof v === 'number' && Number.isInteger(v) && v > 0 ? v : fallback;\n };\n return {\n version: 1,\n taxBp: typeof d.taxBp === 'number' && Number.isInteger(d.taxBp) && d.taxBp >= 0 ? d.taxBp : 0,\n taxOn: d.taxOn === 'all' ? 'all' : 'materials',\n validDays: whole(d.validDays, 30),\n followUpDays: whole(d.followUpDays, 5),\n rates: (Array.isArray(d.rates) ? d.rates : []).filter(function (r) {\n return r && typeof r.name === 'string' && typeof r.rateCents === 'number' && Number.isInteger(r.rateCents);\n }),\n };\n}\nfunction rateText(r) {\n return r.name + ' ' + money(r.rateCents) + '/' + r.unit + ' (' + r.kind + ')';\n}\nfunction findRate(rates, name) {\n var wanted = fold(name);\n if (!wanted) return null;\n var exact = rates.filter(function (r) { return fold(r.name) === wanted; });\n if (exact.length) return exact[0];\n var partial = rates.filter(function (r) { return fold(r.name).indexOf(wanted) >= 0 || wanted.indexOf(fold(r.name)) >= 0; });\n return partial.length === 1 ? partial[0] : null;\n}\nfunction lineText(l) {\n return '#' + l.n + ' ' + l.description + ', ' + qtyText(l.qty, l.unit) + ' x ' + money(l.rateCents) + ' = ' + money(l.amountCents) + ' (' + l.kind + ')';\n}\n// Add a line, or change the one with the same description. Returns the new\n// list and what changed; the caller re-totals.\nfunction upsertLine(lines, input, terms) {\n var list = (lines || []).map(function (l) { return Object.assign({}, l); });\n var saved = input.rateName ? findRate(terms.rates, input.rateName) : null;\n if (input.rateName && !saved) {\n throw new Error(\n \"No saved rate named '\" + input.rateName + \"'. Saved rates: \" +\n (terms.rates.map(rateText).join(', ') || 'none yet; pass rate in dollars') + '.',\n );\n }\n var description = String(input.description || (saved && saved.name) || '').trim();\n if (!description) throw new Error(\"add_line needs 'description', e.g. 'Electrician labor' or '200A panel'.\");\n var existing = list.filter(function (l) { return fold(l.description) === fold(description); })[0] || null;\n if (!existing && !saved && (input.rate === undefined || input.rate === null || input.rate === '')) saved = findRate(terms.rates, description);\n var rateCents =\n input.rate !== undefined && input.rate !== null && input.rate !== ''\n ? toCents(input.rate)\n : saved ? saved.rateCents : existing ? existing.rateCents : null;\n if (rateCents === null) {\n throw new Error(\n \"'\" + description + \"' needs 'rate' (dollars per unit) or 'rateName'\" +\n (terms.rates.length ? ' from the saved rates: ' + terms.rates.map(rateText).join(', ') : '') + '.',\n );\n }\n var kind = KINDS.indexOf(input.kind) >= 0 ? input.kind : saved ? saved.kind : existing ? existing.kind : 'other';\n if (rateCents < 0 && kind !== 'other') throw new Error('Only an \"other\" line can be a credit with a negative rate.');\n var unit = input.unit ? String(input.unit).trim() : saved ? saved.unit : existing ? existing.unit : 'each';\n var add = input.addQty !== undefined && input.addQty !== null && input.addQty !== '' ? toMilli(input.addQty) : null;\n var set = input.qty !== undefined && input.qty !== null && input.qty !== '' ? toMilli(input.qty) : null;\n if (add === null && input.addQty !== undefined && input.addQty !== null && input.addQty !== '') throw new Error('addQty must be a positive number.');\n if (set === null && input.qty !== undefined && input.qty !== null && input.qty !== '') throw new Error('qty must be a positive number.');\n var before = existing ? Math.round(existing.qty * 1000) : 0;\n var qtyMilli = add !== null ? before + add : set !== null ? set : existing ? before : 1000;\n var line = { description: existing ? existing.description : description, kind: kind, qty: qtyMilli / 1000, unit: unit, rateCents: rateCents, amountCents: lineAmount(qtyMilli, rateCents) };\n if (existing) Object.assign(existing, line);\n else list.push(line);\n list.forEach(function (l, i) { l.n = i + 1; });\n var placed = existing || list[list.length - 1];\n return {\n lines: list,\n note:\n (existing ? 'Updated line ' : 'Added line ') + lineText(placed) +\n (existing && add !== null ? ' (' + before / 1000 + ' + ' + add / 1000 + ')' : '') + '.',\n };\n}\nfunction removeLine(lines, input) {\n var list = (lines || []).map(function (l) { return Object.assign({}, l); });\n var hit = null;\n if (input.line !== undefined && input.line !== null && input.line !== '') {\n hit = list.filter(function (l) { return l.n === Number(input.line); })[0] || null;\n } else if (input.description) {\n var wanted = fold(input.description);\n var exact = list.filter(function (l) { return fold(l.description) === wanted; });\n var partial = list.filter(function (l) { return fold(l.description).indexOf(wanted) >= 0; });\n hit = exact[0] || (partial.length === 1 ? partial[0] : null);\n }\n if (!hit) {\n throw new Error(\n \"Name the line by 'line' number or 'description'. Lines: \" + (list.map(lineText).join('; ') || 'none') + '.',\n );\n }\n var rest = list.filter(function (l) { return l !== hit; });\n rest.forEach(function (l, i) { l.n = i + 1; });\n return { lines: rest, note: 'Removed ' + hit.description + ' (' + money(hit.amountCents) + ').' };\n}\nfunction isOpen(record) {\n return record.status === 'draft' || record.status === 'sent';\n}\n// The quote a person means: its id, its exact title, a title or client that\n// contains what they wrote, or one whose name holds every word they used.\n// Several matches prefer the open quotes; a tie is an error that names them.\nfunction findQuote(records, input) {\n if (input.id) {\n var byId = records.filter(function (r) { return r.id === String(input.id).trim(); });\n if (byId.length) return byId[0];\n if (!input.title && !input.client) throw new Error(\"No quote '\" + input.id + \"'. \" + roll(records));\n }\n var wanted = fold(input.title || input.client);\n if (!wanted) throw new Error(\"Pass 'id' (e.g. 'q-3') or the quote's 'title'. \" + roll(records));\n var name = function (r) { return fold(r.fields.title); };\n var both = function (r) { return name(r) + ' ' + fold(r.fields.client); };\n var words = wanted.split(/[^a-z0-9']+/).filter(function (w) { return w.length > 2 && NAME_STOP.indexOf(w) < 0; });\n var tiers = [\n function (r) { return name(r) === wanted; },\n function (r) { return name(r).indexOf(wanted) >= 0 || fold(r.fields.client) === wanted; },\n function (r) {\n return words.length > 0 && words.every(function (w) { return both(r).indexOf(w) >= 0 || both(r).indexOf(w.replace(/s$/, '')) >= 0; });\n },\n ];\n for (var i = 0; i < tiers.length; i++) {\n var hits = records.filter(tiers[i]);\n if (hits.length > 1) {\n var open = hits.filter(isOpen);\n if (open.length) hits = open;\n }\n if (hits.length === 1) return hits[0];\n if (hits.length > 1) {\n throw new Error(\n \"More than one quote matches '\" + (input.title || input.client) + \"': \" +\n hits.map(function (r) { return r.id + ' ' + r.fields.title; }).join(', ') + '. Pass id.',\n );\n }\n }\n throw new Error(\"No quote matches '\" + (input.title || input.client) + \"'. \" + roll(records));\n}\nfunction roll(records) {\n return records.length\n ? 'Quotes: ' + records.map(function (r) { return r.id + ' ' + r.fields.title + ' (' + r.status + ')'; }).join(', ') + '.'\n : 'There are no quotes yet.';\n}\nfunction lastNote(record) {\n var notes = (record.history || []).filter(function (h) { return h.note; });\n return notes.length ? notes[notes.length - 1].note : '';\n}\nfunction quoteLine(record, nowMs) {\n var f = record.fields || {};\n var t = quoteTotals(record);\n var lines = (f.lines || []).length;\n var head =\n record.id + (f.client && fold(f.title).indexOf(fold(f.client)) < 0 ? ', ' + f.client : '') + ', ' + record.status + ', ' +\n lines + (lines === 1 ? ' line' : ' lines') + ', total ' + money(t.total) + (t.tax ? ' with ' + money(t.tax) + ' tax' : '');\n var parts = [head];\n if (record.status === 'sent') {\n if (f.sentAt) parts.push('sent ' + ago(-daysLeft(f.sentAt, nowMs)));\n if (f.followUpAt) parts.push('follow up ' + when(daysLeft(f.followUpAt, nowMs)) + ' (' + f.followUpAt + ')');\n if (f.validUntil) parts.push((daysLeft(f.validUntil, nowMs) < 0 ? 'expired ' : 'valid until ') + f.validUntil);\n }\n if (!isOpen(record) && f.closedAt) parts.push(record.status + ' ' + f.closedAt + (f.reason ? ': ' + f.reason : ''));\n return f.title + ' (' + parts.join('; ') + ')';\n}\nfunction followLine(record, nowMs) {\n var f = record.fields;\n var note = lastNote(record).replace(/[.\\s]+$/, '');\n return (\n f.title + ' (' + record.id + (f.contact ? ', ' + f.contact : '') + ', ' + money(quoteTotals(record).total) +\n (f.sentAt ? ', sent ' + ago(-daysLeft(f.sentAt, nowMs)) : '') + ') ' + when(daysLeft(f.followUpAt, nowMs)) +\n (note && note !== 'Sent to the client' ? '; last note: ' + note : '')\n );\n}\nfunction picture(records, terms, nowMs, withinDays) {\n var byStatus = function (s) { return records.filter(function (r) { return r.status === s; }); };\n var drafts = byStatus('draft');\n var sent = byStatus('sent');\n var won = byStatus('won');\n var lost = byStatus('lost');\n var total = function (list) { return list.reduce(function (t, r) { return t + quoteTotals(r).total; }, 0); };\n var due = sent\n .filter(function (r) { return r.fields.followUpAt && daysLeft(r.fields.followUpAt, nowMs) <= withinDays; })\n .sort(function (a, b) { return String(a.fields.followUpAt).localeCompare(String(b.fields.followUpAt)); });\n var dueNow = due.filter(function (r) { return daysLeft(r.fields.followUpAt, nowMs) <= 0; });\n var recentFirst = function (list) {\n return list.slice().sort(function (a, b) { return String(b.fields.closedAt || '').localeCompare(String(a.fields.closedAt || '')); });\n };\n var parts = [\n records.length + (records.length === 1 ? ' quote: ' : ' quotes: ') + drafts.length + ' draft, ' + sent.length +\n ' sent and waiting (' + money(total(sent)) + '), ' + won.length + ' won, ' + lost.length + ' lost.',\n ];\n // One list, overdue first: a model asked what needs chasing reads a separate late list as out of scope.\n parts.push(\n due.length\n ? 'Follow-ups within ' + withinDays + ' days, overdue first: ' + due.map(function (r) { return followLine(r, nowMs); }).join(' | ') + '.'\n : 'No follow-ups due in the next ' + withinDays + ' days.',\n );\n if (drafts.length) parts.push('Drafts: ' + drafts.map(function (r) { var ls = r.fields.lines || []; return quoteLine(r, nowMs) + (ls.length ? ': ' + ls.map(lineText).join('; ') : ''); }).join(' | ') + '.');\n if (sent.length) parts.push('Sent and waiting: ' + sent.map(function (r) { return quoteLine(r, nowMs); }).join(' | ') + '.');\n if (won.length) parts.push('Won (latest first): ' + recentFirst(won).slice(0, 5).map(function (r) { return quoteLine(r, nowMs); }).join(' | ') + '.');\n if (lost.length) parts.push('Lost (latest first): ' + recentFirst(lost).slice(0, 5).map(function (r) { return quoteLine(r, nowMs); }).join(' | ') + '.');\n if (won.length + lost.length) {\n var decided = total(won) + total(lost);\n parts.push(\n 'Win rate: ' + won.length + ' of ' + (won.length + lost.length) + ' decided quotes (' + Math.round((won.length / (won.length + lost.length)) * 100) + '%), ' +\n money(total(won)) + ' of ' + money(decided) + ' by value.',\n );\n }\n parts.push(\n 'Tax: ' + (terms.taxBp ? percent(terms.taxBp) + ' on ' + (terms.taxOn === 'all' ? 'the whole quote' : 'materials') : 'none set') +\n '. Quotes stay valid ' + terms.validDays + ' days; follow up ' + terms.followUpDays + ' days after sending. Saved rates: ' +\n (terms.rates.map(rateText).join(', ') || 'none yet') + '.',\n );\n return {\n drafts: drafts.length,\n waiting: sent.length,\n followUpsDue: dueNow.length,\n summary: parts.join(' '),\n };\n}\n// One quote line by line, for the person to read or the crew to quote exactly.\n\n\nfunction detail(record, nowMs) {\n var f = record.fields || {};\n var t = quoteTotals(record);\n var rows = (f.lines || []).map(lineText);\n return [\n f.title + ' (' + record.id + ', ' + record.status + (f.client ? ', for ' + f.client : '') + (f.site ? ' at ' + f.site : '') + ').',\n rows.length ? 'Lines: ' + rows.join('; ') + '.' : 'No lines yet.',\n 'Labor ' + money(t.labor) + ', materials ' + money(t.materials) + (t.other ? ', other ' + money(t.other) : '') +\n '. Subtotal ' + money(t.subtotal) + '. Tax ' + money(t.tax) +\n (f.taxBp ? ' (' + percent(f.taxBp) + ' on ' + (f.taxOn === 'all' ? 'the whole quote' : 'materials ' + money(t.materials)) + ')' : ' (no tax set)') +\n '. Total ' + money(t.total) + '.',\n record.status === 'sent'\n ? 'Sent ' + f.sentAt + (f.followUpAt ? '; follow up ' + when(daysLeft(f.followUpAt, nowMs)) + ' (' + f.followUpAt + ')' : '') +\n (f.validUntil ? '; valid until ' + f.validUntil : '') + '.'\n : !isOpen(record) && f.closedAt\n ? cap(record.status) + ' ' + f.closedAt + (f.reason ? ': ' + f.reason : '') + '.'\n : '',\n ]\n .filter(Boolean)\n .join(' ');\n}\n// ── quote-rules-end ──\n\nfunction quoteCopy(record) {\n var f = record.fields, t = quoteTotals(record);\n function text(value) {\n return String(value || '').replace(/[\\r\\n]+/g, ' ').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')\n .replace(/[\\\\`*_{}\\[\\]()#+.!|~-]/g, function (c) { return '\\\\' + c; });\n }\n var rows = ['# ' + text(f.title), '', '**Quote ' + text(record.id) + '**', ''];\n if (f.client) rows.push('Prepared for ' + text(f.client), '');\n if (f.contact) rows.push('Contact · ' + text(f.contact), '');\n if (f.site) rows.push('Site · ' + text(f.site), '');\n rows.push('| Item | Quantity | Unit price | Amount |', '| --- | ---: | ---: | ---: |');\n (f.lines || []).forEach(function (line) {\n rows.push('| ' + [text(line.description), text(qtyText(line.qty, line.unit)), money(line.rateCents), money(line.amountCents)].join(' | ') + ' |');\n });\n rows.push('', 'Subtotal · ' + money(t.subtotal), '', 'Tax · ' + money(t.tax), '', '**Total · ' + money(t.total) + '**');\n if (f.validUntil) rows.push('', 'Valid until ' + text(f.validUntil));\n return rows.join('\\n') + '\\n';\n}\n\ntype Quote = { id: string; status: string; fields: Record<string, unknown>; history?: Array<{ note?: string }> };\ntype Line = Record<string, unknown>;\n\nconst quotes = rosterStore(gezel.fs, 'quotes.json', { stages: ['draft', 'sent', 'won', 'lost'], idPrefix: 'q' });\nconst now = Date.now();\nconst today = localDay(now);\n\nfunction given(value: unknown): boolean {\n return value !== undefined && value !== null && value !== '';\n}\n\nasync function readTerms(): Promise<ReturnType<typeof normalizeTerms>> {\n let raw: string | null = null;\n try {\n raw = await gezel.fs.read('rates.json');\n } catch {\n raw = null;\n }\n if (raw === null) return normalizeTerms(null);\n try {\n return normalizeTerms(JSON.parse(raw));\n } catch {\n throw new Error('rates.json is not valid JSON. Fix or remove it; it will not be overwritten automatically.');\n }\n}\n\nasync function writeTerms(terms: ReturnType<typeof normalizeTerms>): Promise<void> {\n await gezel.fs.write('rates.json', JSON.stringify(terms, null, 2) + '\\n');\n}\n\nfunction followUpInput(): string | undefined {\n if (typeof input.inDays === 'number' && isFinite(input.inDays)) return addDays(today, Math.max(0, Math.round(input.inDays)));\n if (given(input.followUpAt)) {\n const day = normalizeDate(input.followUpAt);\n if (!day) throw new Error(\"followUpAt must be a date, e.g. '2026-11-20', or pass inDays.\");\n return day;\n }\n return undefined;\n}\n\nfunction wholeDays(value: unknown, label: string): number | undefined {\n if (!given(value)) return undefined;\n const n = Number(value);\n if (!isFinite(n) || n < 1 || n > 365) throw new Error(label + ' is a number of days from 1 to 365.');\n return Math.round(n);\n}\n\n// Lines change only on an open quote; a sent one goes back to draft so the\n// client is never holding a price the register no longer shows.\nasync function reprice(record: Quote, lines: Line[], what: string): Promise<string> {\n const f = record.fields;\n const title = String(f.title);\n if (!isOpen(record)) throw new Error(title + ' is ' + record.status + '; its price is settled. Start a new quote for more work.');\n await quotes.update(record.id, { fields: { lines, ...totalFields(lines, f.taxBp, f.taxOn) } });\n let tail = '';\n if (record.status === 'sent') {\n await quotes.update(record.id, { fields: { followUpAt: null } });\n await quotes.transition(record.id, 'draft', { note: 'Revised after sending: ' + what });\n tail = ' It had been sent, so it is back in draft: send it again when the client should see the new price.';\n }\n return what + ' ' + title + ' total now ' + money(totals(lines, f.taxBp, f.taxOn).total) + '.' + tail;\n}\n\n// The quotes' one reminder sits on the soonest follow-up, the morning it is due.\nasync function remindNextFollowUp(): Promise<void> {\n const next = (await quotes.list())\n .filter((r) => r.status === 'sent' && typeof r.fields.followUpAt === 'string')\n .map((r) => ({ record: r, at: Date.parse(String(r.fields.followUpAt) + 'T09:00:00') }))\n .filter((r) => r.at > now)\n .sort((a, b) => a.at - b.at)[0];\n try {\n if (!next || next.at - now > 30 * DAY_MS) await gezel.reminder.clear();\n else {\n const f = next.record.fields;\n await gezel.reminder.set({\n at: new Date(next.at).toISOString(),\n title: ('Follow up on the quote for ' + String(f.client || f.title)).slice(0, 80),\n body: (String(f.title) + ', ' + money(quoteTotals(next.record).total) + ', sent ' + String(f.sentAt) + '.').slice(0, 160),\n });\n }\n } catch {\n // Reminders are a convenience; the quotes are the record.\n }\n}\n\nconst withinDays = typeof input.withinDays === 'number' && input.withinDays > 0 ? Math.round(input.withinDays) : 7;\nlet note = '';\nlet acted: string | null = null;\nlet shown = '';\n\nif (input.action === 'add') {\n const all = (await quotes.list()) as Quote[];\n const title = String(input.title || input.client || '').trim();\n let existing: Quote | null = null;\n if (given(input.id)) existing = findQuote(all, { id: input.id, title: input.title });\n else if (title) existing = all.find((r) => fold(r.fields.title) === fold(title)) ?? null;\n if (!existing && !title) throw new Error(\"add needs 'title': the job, e.g. 'Maple Row panel upgrade'.\");\n const fields: Record<string, unknown> = {};\n if (input.client) fields.client = input.client.trim();\n if (input.contact) fields.contact = input.contact.trim();\n if (input.site) fields.site = input.site.trim();\n if (input.note) fields.note = input.note.trim();\n if (existing) {\n if (given(input.id) && input.title && fold(input.title) !== fold(existing.fields.title)) fields.title = input.title.trim();\n await quotes.update(existing.id, { fields });\n acted = existing.id;\n note = 'Updated ' + String(existing.fields.title) + '.';\n } else {\n const terms = await readTerms();\n const record = await quotes.add({\n status: 'draft',\n fields: { title, ...fields, lines: [], taxBp: terms.taxBp, taxOn: terms.taxOn, ...totalFields([], terms.taxBp, terms.taxOn) },\n });\n acted = record.id;\n note = 'Started ' + record.id + ': ' + title + ' (draft). Add its lines next.';\n }\n} else if (input.action === 'add_line' || input.action === 'remove_line') {\n const record = findQuote((await quotes.list()) as Quote[], input);\n const lines = (record.fields.lines ?? []) as Line[];\n const change = input.action === 'add_line' ? upsertLine(lines, input, await readTerms()) : removeLine(lines, input);\n note = await reprice(record, change.lines, change.note);\n acted = record.id;\n} else if (input.action === 'export_copy') {\n const record = findQuote((await quotes.list()) as Quote[], { id: input.id });\n if (!/^q-\\d+$/.test(record.id) || !(record.fields.lines as Line[])?.length) throw new Error('Add a line before exporting this quote.');\n const at = new Date().toISOString();\n const suffix = at.replace(/[^0-9]/g, '') + '-' + Math.random().toString(36).slice(2, 10);\n const path = 'Quote exports/' + record.id + '-' + suffix + '.md';\n await gezel.fs.write(path, quoteCopy(record));\n const title = String(record.fields.title);\n const copies = Array.isArray(record.fields.exports) ? record.fields.exports : [];\n await quotes.update(record.id, { fields: { exports: [...copies, { path, at, title, totalCents: quoteTotals(record).total }] }, note: 'Exported a copy of ' + title + '.' });\n acted = record.id;\n note = 'Exported a copy of ' + title + '.';\n} else if (input.action === 'send') {\n const record = findQuote((await quotes.list()) as Quote[], input);\n const title = String(record.fields.title);\n acted = record.id;\n if (record.status === 'sent') note = title + ' was already sent on ' + String(record.fields.sentAt) + '.';\n else if (!isOpen(record)) throw new Error(title + ' is ' + record.status + '; it cannot be sent again.');\n else {\n if (!((record.fields.lines ?? []) as Line[]).length) throw new Error(title + ' has no lines yet; add them before sending.');\n const terms = await readTerms();\n const validUntil = addDays(today, wholeDays(input.validDays, 'validDays') ?? terms.validDays);\n const follow = followUpInput() ?? addDays(today, terms.followUpDays);\n await quotes.update(record.id, { fields: { sentAt: today, validUntil, followUpAt: follow } });\n await quotes.transition(record.id, 'sent', { note: input.note || 'Sent to the client.' });\n note = 'Marked as sent: ' + title + ', total ' + money(quoteTotals(record).total) + '. Valid until ' + validUntil + '; first follow-up ' + follow + '.';\n }\n} else if (input.action === 'follow_up') {\n const record = findQuote((await quotes.list()) as Quote[], input);\n const title = String(record.fields.title);\n if (record.status !== 'sent') {\n throw new Error(title + ' is ' + record.status + (record.status === 'draft' ? '; send it before following up.' : '; it is closed.'));\n }\n const next = followUpInput() ?? addDays(today, (await readTerms()).followUpDays);\n await quotes.update(record.id, { fields: { followUpAt: next, lastFollowUpAt: today }, note: input.note || 'Followed up.' });\n acted = record.id;\n note = 'Logged the follow-up on ' + title + (input.note ? ': ' + input.note.trim() : '') + '. Next follow-up ' + next + '.';\n} else if (input.action === 'outcome') {\n const outcome = String(input.outcome || '').trim().toLowerCase();\n if (outcome !== 'won' && outcome !== 'lost') throw new Error(\"outcome needs 'outcome': won or lost.\");\n const record = findQuote((await quotes.list()) as Quote[], input);\n const title = String(record.fields.title);\n acted = record.id;\n if (record.status === outcome) note = title + ' is already ' + outcome + '.';\n else if (!isOpen(record)) throw new Error(title + ' is already ' + record.status + '.');\n else {\n await quotes.update(record.id, { fields: { closedAt: today, followUpAt: null, ...(input.note ? { reason: input.note.trim() } : {}) } });\n await quotes.transition(record.id, outcome, { note: input.note || (outcome === 'won' ? 'Won.' : 'Lost.') });\n note = (outcome === 'won' ? 'Won ' : 'Lost ') + title + ', ' + money(quoteTotals(record).total) + (input.note ? ' (' + input.note.trim() + ')' : '') + '.';\n }\n} else if (input.action === 'set_rate') {\n const name = String(input.name || input.description || '').trim();\n if (!name) throw new Error(\"set_rate needs 'name', e.g. 'Electrician'.\");\n const rateCents = toCents(input.rate);\n if (rateCents === null || rateCents < 0) throw new Error(\"set_rate needs 'rate' in dollars per unit, e.g. 95.\");\n const kind = KINDS.indexOf(String(input.kind)) >= 0 ? String(input.kind) : 'labor';\n const unit = input.unit ? input.unit.trim() : kind === 'labor' ? 'hour' : 'each';\n const terms = await readTerms();\n const at = terms.rates.findIndex((r) => fold(r.name) === fold(name));\n const rate = { name, kind, unit, rateCents };\n if (at >= 0) terms.rates[at] = rate;\n else terms.rates.push(rate);\n await writeTerms(terms);\n note = (at >= 0 ? 'Updated the rate ' : 'Saved the rate ') + rateText(rate) + '. Lines already on quotes keep their price; new lines use this one.';\n} else if (input.action === 'set_terms') {\n const terms = await readTerms();\n let changed = false;\n if (given(input.taxRate)) {\n const p = Number(String(input.taxRate).replace('%', ''));\n if (!isFinite(p) || p < 0 || p > 50) throw new Error('taxRate is a percent, e.g. 8.25 (0 for none).');\n terms.taxBp = Math.round(p * 100);\n changed = true;\n }\n if (given(input.taxOn)) {\n const on = String(input.taxOn).trim().toLowerCase();\n if (on !== 'materials' && on !== 'all') throw new Error('taxOn is materials or all.');\n terms.taxOn = on;\n changed = true;\n }\n const valid = wholeDays(input.validDays, 'validDays');\n if (valid !== undefined) terms.validDays = valid;\n const follow = wholeDays(input.followUpDays, 'followUpDays');\n if (follow !== undefined) terms.followUpDays = follow;\n if (!changed && valid === undefined && follow === undefined) throw new Error('set_terms needs taxRate, taxOn, validDays or followUpDays.');\n await writeTerms(terms);\n // Drafts follow the business's tax; sent and closed quotes keep the tax they went out with.\n const drafts = (await quotes.list()).filter((r) => r.status === 'draft');\n for (const d of drafts) {\n await quotes.update(d.id, {\n fields: { taxBp: terms.taxBp, taxOn: terms.taxOn, ...totalFields((d.fields.lines ?? []) as Line[], terms.taxBp, terms.taxOn) },\n });\n }\n note =\n 'Tax is ' + (terms.taxBp ? percent(terms.taxBp) + ' on ' + (terms.taxOn === 'all' ? 'the whole quote' : 'materials') : 'not charged') +\n '; quotes stay valid ' + terms.validDays + ' days; follow up ' + terms.followUpDays + ' days after sending.' +\n (drafts.length ? ' Re-totaled ' + drafts.length + (drafts.length === 1 ? ' draft' : ' drafts') + '; sent quotes keep the tax they went out with.' : '');\n} else if (input.action === 'show') {\n const record = findQuote((await quotes.list()) as Quote[], input);\n acted = record.id;\n shown = detail(record, now);\n} else if (input.action !== 'status' && input.action !== 'list') {\n throw new Error(\n \"Unknown action '\" + input.action + \"'. Use status, add, add_line, remove_line, send, follow_up, outcome, set_rate, set_terms, show, or list.\",\n );\n}\n\nconst records = (await quotes.list()) as Quote[];\nconst view = picture(records, await readTerms(), now, withinDays);\nconst touched = acted ? records.find((r) => r.id === acted) : undefined;\nawait remindNextFollowUp();\n\ngezel.output({\n drafts: view.drafts,\n waiting: view.waiting,\n followUpsDue: view.followUpsDue,\n total: touched ? quoteTotals(touched).total / 100 : 0,\n summary: shown\n ? shown\n : input.action === 'list'\n ? records.map((r) => '[' + r.status + '] ' + quoteLine(r, now)).join('\\n') || 'There are no quotes yet.'\n : (note ? note + ' ' : '') + view.summary,\n});\n"
|
|
41
|
+
},
|
|
42
|
+
"tools": [
|
|
43
|
+
{
|
|
44
|
+
"name": "quotes_status",
|
|
45
|
+
"description": "Every quote with its id and exact total: the follow-ups due (overdue first), the drafts being priced, the quotes sent and waiting, the win/loss record, and the saved rates, tax and terms. Call it first when asked about quotes, follow-ups or totals.",
|
|
46
|
+
"script": "quote-store",
|
|
47
|
+
"inputs": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"properties": {
|
|
50
|
+
"withinDays": {
|
|
51
|
+
"type": "number"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"bind": {
|
|
56
|
+
"action": "status"
|
|
57
|
+
},
|
|
58
|
+
"state": true
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "start_quote",
|
|
62
|
+
"description": "Start a quote the moment a job is mentioned, before you describe it: a short title for the job, the client, contact and site. An existing title is updated, never duplicated. Then price it with add_quote_line.",
|
|
63
|
+
"script": "quote-store",
|
|
64
|
+
"inputs": {
|
|
65
|
+
"type": "object",
|
|
66
|
+
"properties": {
|
|
67
|
+
"id": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"description": "Pass it to change an existing quote."
|
|
70
|
+
},
|
|
71
|
+
"title": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"description": "The job, e.g. \"Maple Row panel upgrade\"."
|
|
74
|
+
},
|
|
75
|
+
"client": {
|
|
76
|
+
"type": "string"
|
|
77
|
+
},
|
|
78
|
+
"contact": {
|
|
79
|
+
"type": "string"
|
|
80
|
+
},
|
|
81
|
+
"site": {
|
|
82
|
+
"type": "string"
|
|
83
|
+
},
|
|
84
|
+
"note": {
|
|
85
|
+
"type": "string"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"required": [
|
|
89
|
+
"title"
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
"bind": {
|
|
93
|
+
"action": "add"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"name": "add_quote_line",
|
|
98
|
+
"description": "Add one line to a quote: labor, materials or other, with a description, quantity, unit and rate in dollars (or rateName for a saved rate). The tool works out the amount, the tax and the total exactly; never add them up yourself. The same description updates that line, and addQty adds to its quantity (e.g. 6 more hours).",
|
|
99
|
+
"script": "quote-store",
|
|
100
|
+
"inputs": {
|
|
101
|
+
"type": "object",
|
|
102
|
+
"properties": {
|
|
103
|
+
"id": {
|
|
104
|
+
"type": "string"
|
|
105
|
+
},
|
|
106
|
+
"title": {
|
|
107
|
+
"type": "string",
|
|
108
|
+
"description": "The quote’s title or client, when no id."
|
|
109
|
+
},
|
|
110
|
+
"description": {
|
|
111
|
+
"type": "string",
|
|
112
|
+
"description": "What the line is, e.g. \"Electrician labor\" or \"200A panel\"."
|
|
113
|
+
},
|
|
114
|
+
"kind": {
|
|
115
|
+
"type": "string",
|
|
116
|
+
"enum": [
|
|
117
|
+
"labor",
|
|
118
|
+
"materials",
|
|
119
|
+
"other"
|
|
120
|
+
]
|
|
121
|
+
},
|
|
122
|
+
"qty": {
|
|
123
|
+
"type": "number",
|
|
124
|
+
"description": "The quantity (default 1)."
|
|
125
|
+
},
|
|
126
|
+
"addQty": {
|
|
127
|
+
"type": "number",
|
|
128
|
+
"description": "Instead of qty: how much to add to that line’s quantity, e.g. 6 more hours."
|
|
129
|
+
},
|
|
130
|
+
"unit": {
|
|
131
|
+
"type": "string",
|
|
132
|
+
"description": "hour, each, foot, or lot."
|
|
133
|
+
},
|
|
134
|
+
"rate": {
|
|
135
|
+
"type": "number",
|
|
136
|
+
"description": "Price per unit in dollars."
|
|
137
|
+
},
|
|
138
|
+
"rateName": {
|
|
139
|
+
"type": "string",
|
|
140
|
+
"description": "Or: a saved rate by name, e.g. \"Electrician\"."
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"required": [
|
|
144
|
+
"description"
|
|
145
|
+
]
|
|
146
|
+
},
|
|
147
|
+
"bind": {
|
|
148
|
+
"action": "add_line"
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"name": "remove_quote_line",
|
|
153
|
+
"description": "Take a line off a quote, by its number or description.",
|
|
154
|
+
"script": "quote-store",
|
|
155
|
+
"inputs": {
|
|
156
|
+
"type": "object",
|
|
157
|
+
"properties": {
|
|
158
|
+
"id": {
|
|
159
|
+
"type": "string"
|
|
160
|
+
},
|
|
161
|
+
"title": {
|
|
162
|
+
"type": "string",
|
|
163
|
+
"description": "The quote’s title or client, when no id."
|
|
164
|
+
},
|
|
165
|
+
"line": {
|
|
166
|
+
"type": "number",
|
|
167
|
+
"description": "The line number."
|
|
168
|
+
},
|
|
169
|
+
"description": {
|
|
170
|
+
"type": "string"
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
"bind": {
|
|
175
|
+
"action": "remove_line"
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"name": "send_quote",
|
|
180
|
+
"description": "Mark a quote sent the moment the person says it went out. It sets the valid-until date and the first follow-up from the business’s terms.",
|
|
181
|
+
"script": "quote-store",
|
|
182
|
+
"inputs": {
|
|
183
|
+
"type": "object",
|
|
184
|
+
"properties": {
|
|
185
|
+
"id": {
|
|
186
|
+
"type": "string"
|
|
187
|
+
},
|
|
188
|
+
"title": {
|
|
189
|
+
"type": "string",
|
|
190
|
+
"description": "The quote’s title or client, when no id."
|
|
191
|
+
},
|
|
192
|
+
"validDays": {
|
|
193
|
+
"type": "number"
|
|
194
|
+
},
|
|
195
|
+
"followUpAt": {
|
|
196
|
+
"type": "string",
|
|
197
|
+
"description": "First follow-up date, YYYY-MM-DD, when not the usual."
|
|
198
|
+
},
|
|
199
|
+
"note": {
|
|
200
|
+
"type": "string"
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
"bind": {
|
|
205
|
+
"action": "send"
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"name": "log_quote_follow_up",
|
|
210
|
+
"description": "Record a follow-up on a sent quote (a call, an email, what the client said) and when to chase next: followUpAt or inDays, or the usual gap when not given.",
|
|
211
|
+
"script": "quote-store",
|
|
212
|
+
"inputs": {
|
|
213
|
+
"type": "object",
|
|
214
|
+
"properties": {
|
|
215
|
+
"id": {
|
|
216
|
+
"type": "string"
|
|
217
|
+
},
|
|
218
|
+
"title": {
|
|
219
|
+
"type": "string",
|
|
220
|
+
"description": "The quote’s title or client, when no id."
|
|
221
|
+
},
|
|
222
|
+
"note": {
|
|
223
|
+
"type": "string",
|
|
224
|
+
"description": "What happened, in the person’s words."
|
|
225
|
+
},
|
|
226
|
+
"followUpAt": {
|
|
227
|
+
"type": "string",
|
|
228
|
+
"description": "Next follow-up date, YYYY-MM-DD."
|
|
229
|
+
},
|
|
230
|
+
"inDays": {
|
|
231
|
+
"type": "number",
|
|
232
|
+
"description": "Or: the next follow-up this many days from today."
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
"bind": {
|
|
237
|
+
"action": "follow_up"
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"name": "record_quote_outcome",
|
|
242
|
+
"description": "Record that a quote was won or lost the moment the person says so, with the reason in note. Won and lost quotes are closed and their price is settled.",
|
|
243
|
+
"script": "quote-store",
|
|
244
|
+
"inputs": {
|
|
245
|
+
"type": "object",
|
|
246
|
+
"properties": {
|
|
247
|
+
"id": {
|
|
248
|
+
"type": "string"
|
|
249
|
+
},
|
|
250
|
+
"title": {
|
|
251
|
+
"type": "string",
|
|
252
|
+
"description": "The quote’s title or client, when no id."
|
|
253
|
+
},
|
|
254
|
+
"outcome": {
|
|
255
|
+
"type": "string",
|
|
256
|
+
"enum": [
|
|
257
|
+
"won",
|
|
258
|
+
"lost"
|
|
259
|
+
]
|
|
260
|
+
},
|
|
261
|
+
"note": {
|
|
262
|
+
"type": "string",
|
|
263
|
+
"description": "Why, in the person’s words."
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
"required": [
|
|
267
|
+
"outcome"
|
|
268
|
+
]
|
|
269
|
+
},
|
|
270
|
+
"bind": {
|
|
271
|
+
"action": "outcome"
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
"name": "save_rate",
|
|
276
|
+
"description": "Save one of the business’s rates: a name (e.g. \"Electrician\"), labor, materials or other, the unit (hour, each, foot) and the price in dollars. The same name updates the rate.",
|
|
277
|
+
"script": "quote-store",
|
|
278
|
+
"inputs": {
|
|
279
|
+
"type": "object",
|
|
280
|
+
"properties": {
|
|
281
|
+
"name": {
|
|
282
|
+
"type": "string"
|
|
283
|
+
},
|
|
284
|
+
"kind": {
|
|
285
|
+
"type": "string",
|
|
286
|
+
"enum": [
|
|
287
|
+
"labor",
|
|
288
|
+
"materials",
|
|
289
|
+
"other"
|
|
290
|
+
]
|
|
291
|
+
},
|
|
292
|
+
"unit": {
|
|
293
|
+
"type": "string"
|
|
294
|
+
},
|
|
295
|
+
"rate": {
|
|
296
|
+
"type": "number",
|
|
297
|
+
"description": "Dollars per unit."
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
"required": [
|
|
301
|
+
"name",
|
|
302
|
+
"rate"
|
|
303
|
+
]
|
|
304
|
+
},
|
|
305
|
+
"bind": {
|
|
306
|
+
"action": "set_rate"
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"name": "set_quote_terms",
|
|
311
|
+
"description": "Set the sales tax the business charges (a percent, 0 for none) and whether it applies to materials only or the whole quote, and how many days quotes stay valid and wait before a follow-up. Draft quotes are re-totaled; sent quotes keep their tax.",
|
|
312
|
+
"script": "quote-store",
|
|
313
|
+
"inputs": {
|
|
314
|
+
"type": "object",
|
|
315
|
+
"properties": {
|
|
316
|
+
"taxRate": {
|
|
317
|
+
"type": "number",
|
|
318
|
+
"description": "The sales tax percent the business charges, e.g. 8.25 (0 for none)."
|
|
319
|
+
},
|
|
320
|
+
"taxOn": {
|
|
321
|
+
"type": "string",
|
|
322
|
+
"enum": [
|
|
323
|
+
"materials",
|
|
324
|
+
"all"
|
|
325
|
+
]
|
|
326
|
+
},
|
|
327
|
+
"validDays": {
|
|
328
|
+
"type": "number"
|
|
329
|
+
},
|
|
330
|
+
"followUpDays": {
|
|
331
|
+
"type": "number"
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
"bind": {
|
|
336
|
+
"action": "set_terms"
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
"name": "show_quote",
|
|
341
|
+
"description": "One quote line by line: each line’s quantity, rate and amount, then the subtotal, tax and total.",
|
|
342
|
+
"script": "quote-store",
|
|
343
|
+
"inputs": {
|
|
344
|
+
"type": "object",
|
|
345
|
+
"properties": {
|
|
346
|
+
"id": {
|
|
347
|
+
"type": "string"
|
|
348
|
+
},
|
|
349
|
+
"title": {
|
|
350
|
+
"type": "string",
|
|
351
|
+
"description": "The quote’s title or client, when no id."
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
"bind": {
|
|
356
|
+
"action": "show"
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
"name": "page_start_quote",
|
|
361
|
+
"description": "Start or update a quote.",
|
|
362
|
+
"script": "quote-store",
|
|
363
|
+
"inputs": {
|
|
364
|
+
"type": "object",
|
|
365
|
+
"properties": {
|
|
366
|
+
"id": {
|
|
367
|
+
"type": "string",
|
|
368
|
+
"description": "Pass it to change an existing quote."
|
|
369
|
+
},
|
|
370
|
+
"title": {
|
|
371
|
+
"type": "string",
|
|
372
|
+
"description": "The job, e.g. \"Maple Row panel upgrade\"."
|
|
373
|
+
},
|
|
374
|
+
"client": {
|
|
375
|
+
"type": "string"
|
|
376
|
+
},
|
|
377
|
+
"contact": {
|
|
378
|
+
"type": "string"
|
|
379
|
+
},
|
|
380
|
+
"site": {
|
|
381
|
+
"type": "string"
|
|
382
|
+
},
|
|
383
|
+
"note": {
|
|
384
|
+
"type": "string"
|
|
385
|
+
}
|
|
386
|
+
},
|
|
387
|
+
"required": [
|
|
388
|
+
"title"
|
|
389
|
+
]
|
|
390
|
+
},
|
|
391
|
+
"bind": {
|
|
392
|
+
"action": "add"
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
"name": "page_add_quote_line",
|
|
397
|
+
"description": "Add or change a line on a quote.",
|
|
398
|
+
"script": "quote-store",
|
|
399
|
+
"inputs": {
|
|
400
|
+
"type": "object",
|
|
401
|
+
"properties": {
|
|
402
|
+
"id": {
|
|
403
|
+
"type": "string"
|
|
404
|
+
},
|
|
405
|
+
"title": {
|
|
406
|
+
"type": "string",
|
|
407
|
+
"description": "The quote’s title or client, when no id."
|
|
408
|
+
},
|
|
409
|
+
"description": {
|
|
410
|
+
"type": "string",
|
|
411
|
+
"description": "What the line is, e.g. \"Electrician labor\" or \"200A panel\"."
|
|
412
|
+
},
|
|
413
|
+
"kind": {
|
|
414
|
+
"type": "string",
|
|
415
|
+
"enum": [
|
|
416
|
+
"labor",
|
|
417
|
+
"materials",
|
|
418
|
+
"other"
|
|
419
|
+
]
|
|
420
|
+
},
|
|
421
|
+
"qty": {
|
|
422
|
+
"type": "number",
|
|
423
|
+
"description": "The quantity (default 1)."
|
|
424
|
+
},
|
|
425
|
+
"addQty": {
|
|
426
|
+
"type": "number",
|
|
427
|
+
"description": "Instead of qty: how much to add to that line’s quantity, e.g. 6 more hours."
|
|
428
|
+
},
|
|
429
|
+
"unit": {
|
|
430
|
+
"type": "string",
|
|
431
|
+
"description": "hour, each, foot, or lot."
|
|
432
|
+
},
|
|
433
|
+
"rate": {
|
|
434
|
+
"type": "number",
|
|
435
|
+
"description": "Price per unit in dollars."
|
|
436
|
+
},
|
|
437
|
+
"rateName": {
|
|
438
|
+
"type": "string",
|
|
439
|
+
"description": "Or: a saved rate by name, e.g. \"Electrician\"."
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
"required": [
|
|
443
|
+
"description"
|
|
444
|
+
]
|
|
445
|
+
},
|
|
446
|
+
"bind": {
|
|
447
|
+
"action": "add_line"
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
"name": "page_send_quote",
|
|
452
|
+
"description": "Mark a quote sent.",
|
|
453
|
+
"script": "quote-store",
|
|
454
|
+
"inputs": {
|
|
455
|
+
"type": "object",
|
|
456
|
+
"properties": {
|
|
457
|
+
"id": {
|
|
458
|
+
"type": "string"
|
|
459
|
+
},
|
|
460
|
+
"title": {
|
|
461
|
+
"type": "string",
|
|
462
|
+
"description": "The quote’s title or client, when no id."
|
|
463
|
+
},
|
|
464
|
+
"validDays": {
|
|
465
|
+
"type": "number"
|
|
466
|
+
},
|
|
467
|
+
"followUpAt": {
|
|
468
|
+
"type": "string",
|
|
469
|
+
"description": "First follow-up date, YYYY-MM-DD, when not the usual."
|
|
470
|
+
},
|
|
471
|
+
"note": {
|
|
472
|
+
"type": "string"
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
"bind": {
|
|
477
|
+
"action": "send"
|
|
478
|
+
}
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
"name": "page_log_quote_follow_up",
|
|
482
|
+
"description": "Record a follow-up on a sent quote.",
|
|
483
|
+
"script": "quote-store",
|
|
484
|
+
"inputs": {
|
|
485
|
+
"type": "object",
|
|
486
|
+
"properties": {
|
|
487
|
+
"id": {
|
|
488
|
+
"type": "string"
|
|
489
|
+
},
|
|
490
|
+
"title": {
|
|
491
|
+
"type": "string",
|
|
492
|
+
"description": "The quote’s title or client, when no id."
|
|
493
|
+
},
|
|
494
|
+
"note": {
|
|
495
|
+
"type": "string",
|
|
496
|
+
"description": "What happened, in the person’s words."
|
|
497
|
+
},
|
|
498
|
+
"followUpAt": {
|
|
499
|
+
"type": "string",
|
|
500
|
+
"description": "Next follow-up date, YYYY-MM-DD."
|
|
501
|
+
},
|
|
502
|
+
"inDays": {
|
|
503
|
+
"type": "number",
|
|
504
|
+
"description": "Or: the next follow-up this many days from today."
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
},
|
|
508
|
+
"bind": {
|
|
509
|
+
"action": "follow_up"
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
"name": "page_record_quote_outcome",
|
|
514
|
+
"description": "Record that a quote was won or lost.",
|
|
515
|
+
"script": "quote-store",
|
|
516
|
+
"inputs": {
|
|
517
|
+
"type": "object",
|
|
518
|
+
"properties": {
|
|
519
|
+
"id": {
|
|
520
|
+
"type": "string"
|
|
521
|
+
},
|
|
522
|
+
"title": {
|
|
523
|
+
"type": "string",
|
|
524
|
+
"description": "The quote’s title or client, when no id."
|
|
525
|
+
},
|
|
526
|
+
"outcome": {
|
|
527
|
+
"type": "string",
|
|
528
|
+
"enum": [
|
|
529
|
+
"won",
|
|
530
|
+
"lost"
|
|
531
|
+
]
|
|
532
|
+
},
|
|
533
|
+
"note": {
|
|
534
|
+
"type": "string",
|
|
535
|
+
"description": "Why, in the person’s words."
|
|
536
|
+
}
|
|
537
|
+
},
|
|
538
|
+
"required": [
|
|
539
|
+
"outcome"
|
|
540
|
+
]
|
|
541
|
+
},
|
|
542
|
+
"bind": {
|
|
543
|
+
"action": "outcome"
|
|
544
|
+
},
|
|
545
|
+
"reaction": {
|
|
546
|
+
"gezel": "estimator",
|
|
547
|
+
"hideSeed": true,
|
|
548
|
+
"prompt": "The person just recorded a quote’s outcome on the quotes page. The quotes now read (its first sentence is what changed):\n{{output.summary}}\nIn two short sentences, confirm the outcome and the win rate now; after a win, offer to turn the quote into an invoice, and after a loss, note what the reason says about pricing the next one. Do not call tools."
|
|
549
|
+
}
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
"name": "page_set_quote_terms",
|
|
553
|
+
"description": "Set the sales tax and quote terms.",
|
|
554
|
+
"script": "quote-store",
|
|
555
|
+
"inputs": {
|
|
556
|
+
"type": "object",
|
|
557
|
+
"properties": {
|
|
558
|
+
"taxRate": {
|
|
559
|
+
"type": "number",
|
|
560
|
+
"description": "The sales tax percent the business charges, e.g. 8.25 (0 for none)."
|
|
561
|
+
},
|
|
562
|
+
"taxOn": {
|
|
563
|
+
"type": "string",
|
|
564
|
+
"enum": [
|
|
565
|
+
"materials",
|
|
566
|
+
"all"
|
|
567
|
+
]
|
|
568
|
+
},
|
|
569
|
+
"validDays": {
|
|
570
|
+
"type": "number"
|
|
571
|
+
},
|
|
572
|
+
"followUpDays": {
|
|
573
|
+
"type": "number"
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
},
|
|
577
|
+
"bind": {
|
|
578
|
+
"action": "set_terms"
|
|
579
|
+
}
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
"name": "page_export_quote",
|
|
583
|
+
"description": "Save a dated copy of the selected quote in this project.",
|
|
584
|
+
"script": "quote-store",
|
|
585
|
+
"inputs": {
|
|
586
|
+
"type": "object",
|
|
587
|
+
"properties": {
|
|
588
|
+
"id": {
|
|
589
|
+
"type": "string"
|
|
590
|
+
}
|
|
591
|
+
},
|
|
592
|
+
"required": [
|
|
593
|
+
"id"
|
|
594
|
+
]
|
|
595
|
+
},
|
|
596
|
+
"bind": {
|
|
597
|
+
"action": "export_copy"
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
],
|
|
601
|
+
"craftbooks": [
|
|
602
|
+
"proposal-sow",
|
|
603
|
+
"invoice-generator"
|
|
604
|
+
],
|
|
605
|
+
"schedules": [],
|
|
606
|
+
"pages": {
|
|
607
|
+
"entry": "quotes/index.html",
|
|
608
|
+
"api": 1,
|
|
609
|
+
"reads": [
|
|
610
|
+
{
|
|
611
|
+
"source": "workspace",
|
|
612
|
+
"path": "quotes.json"
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
"source": "workspace",
|
|
616
|
+
"path": "rates.json"
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
"source": "workspace",
|
|
620
|
+
"path": "Quote exports",
|
|
621
|
+
"subtree": true
|
|
622
|
+
}
|
|
623
|
+
],
|
|
624
|
+
"tools": [
|
|
625
|
+
"page_start_quote",
|
|
626
|
+
"page_add_quote_line",
|
|
627
|
+
"page_send_quote",
|
|
628
|
+
"page_log_quote_follow_up",
|
|
629
|
+
"page_record_quote_outcome",
|
|
630
|
+
"page_set_quote_terms",
|
|
631
|
+
"page_export_quote"
|
|
632
|
+
]
|
|
633
|
+
},
|
|
634
|
+
"workspaceSeed": [
|
|
635
|
+
"quotes.json",
|
|
636
|
+
"rates.json"
|
|
637
|
+
],
|
|
638
|
+
"minGezelVersion": "1.26280"
|
|
639
|
+
}
|