@voctiv/agent-runtime 0.2.2 → 0.4.0
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/README.md +45 -20
- package/dist/barge-in/barge-in-module.d.ts +0 -1
- package/dist/barge-in/barge-in-module.js +0 -1
- package/dist/barge-in/barge-in-service.d.ts +1 -1
- package/dist/barge-in/barge-in-service.js +33 -2
- package/dist/barge-in/barge-in-strategy.d.ts +11 -9
- package/dist/barge-in/barge-in-strategy.js +39 -23
- package/dist/barge-in/echo-cancellation.d.ts +0 -1
- package/dist/barge-in/echo-cancellation.js +0 -1
- package/dist/barge-in/echo.d.ts +0 -1
- package/dist/barge-in/echo.js +0 -1
- package/dist/barge-in/lexicon.d.ts +0 -1
- package/dist/barge-in/lexicon.js +0 -1
- package/dist/barge-in/speech-ledger.d.ts +0 -2
- package/dist/barge-in/speech-ledger.js +3 -4
- package/dist/barge-in/word-classifier.d.ts +0 -1
- package/dist/barge-in/word-classifier.js +0 -1
- package/dist/call/asr-usage.d.ts +53 -0
- package/dist/call/asr-usage.js +42 -0
- package/dist/call/async.d.ts +2 -0
- package/dist/call/async.js +14 -0
- package/dist/call/env.d.ts +88 -0
- package/dist/call/env.js +294 -0
- package/dist/call/extraction/core.d.ts +99 -0
- package/dist/call/extraction/core.js +259 -0
- package/dist/call/extraction/defaults.d.ts +10 -0
- package/dist/call/extraction/defaults.js +25 -0
- package/dist/call/extraction/index.d.ts +7 -0
- package/dist/call/extraction/index.js +24 -0
- package/dist/call/extraction/orchestrator.d.ts +144 -0
- package/dist/call/extraction/orchestrator.js +309 -0
- package/dist/call/failed-leg.d.ts +43 -0
- package/dist/call/failed-leg.js +77 -0
- package/dist/call/http.d.ts +94 -0
- package/dist/call/http.js +145 -0
- package/dist/call/ledger.d.ts +18 -0
- package/dist/call/ledger.js +80 -0
- package/dist/call/llm-tap.d.ts +7 -0
- package/dist/call/llm-tap.js +41 -0
- package/dist/call/logging.d.ts +16 -0
- package/dist/call/logging.js +92 -0
- package/dist/call/outbound.d.ts +144 -0
- package/dist/call/outbound.js +404 -0
- package/dist/call/output.d.ts +108 -0
- package/dist/call/output.js +77 -0
- package/dist/call/plan.d.ts +119 -0
- package/dist/call/plan.js +2 -0
- package/dist/call/recall.d.ts +115 -0
- package/dist/call/recall.js +312 -0
- package/dist/call/records.d.ts +9 -0
- package/dist/call/records.js +71 -0
- package/dist/call/report.d.ts +65 -0
- package/dist/call/report.js +263 -0
- package/dist/call/sanitize.d.ts +16 -0
- package/dist/call/sanitize.js +72 -0
- package/dist/call/sip.d.ts +111 -0
- package/dist/call/sip.js +212 -0
- package/dist/call/voicemail.d.ts +159 -0
- package/dist/call/voicemail.js +246 -0
- package/dist/core/call-disposables.d.ts +2 -2
- package/dist/core/call-disposables.js +8 -3
- package/dist/core/call-ended-budget.d.ts +11 -0
- package/dist/core/call-ended-budget.js +31 -0
- package/dist/core/container.d.ts +1 -3
- package/dist/core/container.js +9 -49
- package/dist/core/create-agent-script.d.ts +6 -1
- package/dist/core/create-agent-script.js +161 -28
- package/dist/core/decorators.d.ts +0 -1
- package/dist/core/decorators.js +0 -1
- package/dist/core/define-module.d.ts +0 -1
- package/dist/core/define-module.js +0 -1
- package/dist/core/dump-policy.d.ts +0 -1
- package/dist/core/dump-policy.js +0 -1
- package/dist/core/hooks.d.ts +15 -4
- package/dist/core/hooks.js +0 -1
- package/dist/core/media-bootstrap.d.ts +19 -4
- package/dist/core/media-bootstrap.js +53 -13
- package/dist/core/open-timeout.d.ts +12 -0
- package/dist/core/open-timeout.js +48 -0
- package/dist/core/provide-media.d.ts +0 -8
- package/dist/core/provide-media.js +1 -22
- package/dist/core/runtime-events.d.ts +28 -0
- package/dist/{llm/llm-module.js → core/runtime-events.js} +19 -16
- package/dist/core/tokens.d.ts +0 -10
- package/dist/core/tokens.js +0 -1
- package/dist/core/types.d.ts +0 -1
- package/dist/core/types.js +0 -1
- package/dist/core/version.d.ts +2 -3
- package/dist/core/version.js +2 -3
- package/dist/dialog/dialog-definition.d.ts +0 -5
- package/dist/dialog/dialog-definition.js +1 -6
- package/dist/dialog/dialog-ports.d.ts +3 -1
- package/dist/dialog/dialog-ports.js +10 -2
- package/dist/dialog/online-call-host.d.ts +26 -4
- package/dist/dialog/online-call-host.js +94 -12
- package/dist/dialog/online-call-module.d.ts +5 -11
- package/dist/dialog/online-call-module.js +4 -36
- package/dist/dialog/turn-metrics.d.ts +46 -0
- package/dist/dialog/turn-metrics.js +141 -0
- package/dist/dialog-events/active-media.d.ts +50 -2
- package/dist/dialog-events/active-media.js +146 -34
- package/dist/dialog-events/event-source.d.ts +0 -1
- package/dist/dialog-events/event-source.js +0 -1
- package/dist/dialog-events/virtual-finals-module.d.ts +0 -1
- package/dist/dialog-events/virtual-finals-module.js +0 -1
- package/dist/dialog-events/virtual-finals.d.ts +2 -1
- package/dist/dialog-events/virtual-finals.js +1 -1
- package/dist/index.d.ts +1 -4
- package/dist/index.js +8 -26
- package/dist/lifecycle/lifecycle.d.ts +25 -3
- package/dist/lifecycle/lifecycle.js +92 -14
- package/dist/result/result-store.d.ts +0 -1
- package/dist/result/result-store.js +0 -1
- package/dist/templates/authoring.d.ts +222 -0
- package/dist/templates/authoring.js +2 -0
- package/dist/templates/builder/agent.d.ts +34 -0
- package/dist/templates/builder/agent.js +87 -0
- package/dist/templates/builder/blocks.d.ts +54 -0
- package/dist/templates/builder/blocks.js +92 -0
- package/dist/templates/builder/data-check.d.ts +2 -0
- package/dist/templates/builder/data-check.js +61 -0
- package/dist/templates/builder/draft.d.ts +73 -0
- package/dist/templates/builder/draft.js +142 -0
- package/dist/templates/builder/index.d.ts +8 -0
- package/dist/templates/builder/index.js +55 -0
- package/dist/templates/builder/presets.d.ts +34 -0
- package/dist/templates/builder/presets.js +45 -0
- package/dist/templates/builder/spec-of.d.ts +13 -0
- package/dist/templates/builder/spec-of.js +18 -0
- package/dist/templates/builder/steps.d.ts +25 -0
- package/dist/templates/builder/steps.js +27 -0
- package/dist/templates/business/adapter.d.ts +12 -0
- package/dist/templates/business/adapter.js +980 -0
- package/dist/templates/business/agent-integrations.d.ts +24 -0
- package/dist/templates/business/agent-integrations.js +233 -0
- package/dist/templates/business/extraction-rules-transcript.d.ts +158 -0
- package/dist/templates/business/extraction-rules-transcript.js +405 -0
- package/dist/templates/business/extraction-rules.d.ts +107 -0
- package/dist/templates/business/extraction-rules.js +267 -0
- package/dist/templates/business/index.d.ts +6 -0
- package/dist/{result → templates/business}/index.js +8 -2
- package/dist/templates/business/input.d.ts +56 -0
- package/dist/templates/business/input.js +299 -0
- package/dist/templates/business/integration-data.d.ts +87 -0
- package/dist/templates/business/integration-data.js +312 -0
- package/dist/templates/business/integrations.d.ts +76 -0
- package/dist/templates/business/integrations.js +535 -0
- package/dist/templates/business/legs-policy.d.ts +43 -0
- package/dist/templates/business/legs-policy.js +268 -0
- package/dist/templates/business/report-label.d.ts +7 -0
- package/dist/templates/business/report-label.js +29 -0
- package/dist/templates/business/report.d.ts +67 -0
- package/dist/templates/business/report.js +284 -0
- package/dist/templates/business/result-catalog.d.ts +142 -0
- package/dist/templates/business/result-catalog.js +208 -0
- package/dist/templates/business/result-rules.d.ts +105 -0
- package/dist/templates/business/result-rules.js +167 -0
- package/dist/templates/business/results.d.ts +73 -0
- package/dist/templates/business/results.js +183 -0
- package/dist/templates/business/rule-env.d.ts +18 -0
- package/dist/templates/business/rule-env.js +38 -0
- package/dist/templates/business/sources.d.ts +76 -0
- package/dist/templates/business/sources.js +239 -0
- package/dist/templates/business/test-presets.d.ts +10 -0
- package/dist/templates/business/test-presets.js +68 -0
- package/dist/templates/catalog-match/block.d.ts +32 -0
- package/dist/templates/catalog-match/block.js +95 -0
- package/dist/templates/catalog-match/catalog.d.ts +77 -0
- package/dist/templates/catalog-match/catalog.js +222 -0
- package/dist/templates/catalog-match/recognizer.d.ts +44 -0
- package/dist/templates/catalog-match/recognizer.js +206 -0
- package/dist/templates/catalog-match/reconcile.d.ts +4 -0
- package/dist/templates/catalog-match/reconcile.js +39 -0
- package/dist/templates/catalog-match/request.d.ts +57 -0
- package/dist/templates/catalog-match/request.js +139 -0
- package/dist/templates/catalog-match/types.d.ts +197 -0
- package/dist/templates/catalog-match/types.js +2 -0
- package/dist/templates/catalog-match/verify.d.ts +76 -0
- package/dist/templates/catalog-match/verify.js +220 -0
- package/dist/templates/decision-model/index.d.ts +52 -0
- package/dist/templates/decision-model/index.js +68 -0
- package/dist/templates/engine/asr-picks.d.ts +11 -0
- package/dist/templates/engine/asr-picks.js +44 -0
- package/dist/templates/engine/call.d.ts +104 -0
- package/dist/templates/engine/call.js +322 -0
- package/dist/templates/engine/config.d.ts +447 -0
- package/dist/templates/engine/config.js +493 -0
- package/dist/templates/engine/define.d.ts +1 -0
- package/dist/templates/engine/define.js +9 -0
- package/dist/templates/engine/dialog.d.ts +253 -0
- package/dist/templates/engine/dialog.js +167 -0
- package/dist/templates/engine/echo-numbers.d.ts +7 -0
- package/dist/templates/engine/echo-numbers.js +19 -0
- package/dist/templates/engine/expand.d.ts +6 -0
- package/dist/templates/engine/expand.js +125 -0
- package/dist/templates/engine/filters.d.ts +81 -0
- package/dist/templates/engine/filters.js +654 -0
- package/dist/templates/engine/hook-state.d.ts +18 -0
- package/dist/templates/engine/hook-state.js +100 -0
- package/dist/templates/engine/hooks.d.ts +51 -0
- package/dist/templates/engine/hooks.js +310 -0
- package/dist/templates/engine/index.d.ts +13 -0
- package/dist/templates/engine/index.js +30 -0
- package/dist/templates/engine/language-vars.d.ts +6 -0
- package/dist/templates/engine/language-vars.js +40 -0
- package/dist/templates/engine/language.d.ts +32 -0
- package/dist/templates/engine/language.js +155 -0
- package/dist/templates/engine/lookup.d.ts +20 -0
- package/dist/templates/engine/lookup.js +52 -0
- package/dist/templates/engine/match.d.ts +48 -0
- package/dist/templates/engine/match.js +253 -0
- package/dist/templates/engine/media.d.ts +428 -0
- package/dist/templates/engine/media.js +1240 -0
- package/dist/templates/engine/script.d.ts +11 -0
- package/dist/templates/engine/script.js +69 -0
- package/dist/templates/engine/turns/actions.d.ts +5 -0
- package/dist/templates/engine/turns/actions.js +128 -0
- package/dist/templates/engine/turns/carry.d.ts +15 -0
- package/dist/templates/engine/turns/carry.js +74 -0
- package/dist/templates/engine/turns/choices-offers.d.ts +21 -0
- package/dist/templates/engine/turns/choices-offers.js +143 -0
- package/dist/templates/engine/turns/choices.d.ts +22 -0
- package/dist/templates/engine/turns/choices.js +141 -0
- package/dist/templates/engine/turns/closing-guard.d.ts +73 -0
- package/dist/templates/engine/turns/closing-guard.js +162 -0
- package/dist/templates/engine/turns/closing.d.ts +10 -0
- package/dist/templates/engine/turns/closing.js +82 -0
- package/dist/templates/engine/turns/compile-forms.d.ts +24 -0
- package/dist/templates/engine/turns/compile-forms.js +68 -0
- package/dist/templates/engine/turns/context.d.ts +96 -0
- package/dist/templates/engine/turns/context.js +158 -0
- package/dist/templates/engine/turns/events.d.ts +409 -0
- package/dist/templates/engine/turns/events.js +5 -0
- package/dist/templates/engine/turns/hook-forms.d.ts +62 -0
- package/dist/templates/engine/turns/hook-forms.js +79 -0
- package/dist/templates/engine/turns/ladders.d.ts +42 -0
- package/dist/templates/engine/turns/ladders.js +119 -0
- package/dist/templates/engine/turns/language.d.ts +8 -0
- package/dist/templates/engine/turns/language.js +121 -0
- package/dist/templates/engine/turns/notes-dates.d.ts +9 -0
- package/dist/templates/engine/turns/notes-dates.js +42 -0
- package/dist/templates/engine/turns/notes-detect.d.ts +13 -0
- package/dist/templates/engine/turns/notes-detect.js +36 -0
- package/dist/templates/engine/turns/notes.d.ts +27 -0
- package/dist/templates/engine/turns/notes.js +176 -0
- package/dist/templates/engine/turns/opening.d.ts +34 -0
- package/dist/templates/engine/turns/opening.js +306 -0
- package/dist/templates/engine/turns/overtalk.d.ts +21 -0
- package/dist/templates/engine/turns/overtalk.js +247 -0
- package/dist/templates/engine/turns/pending.d.ts +9 -0
- package/dist/templates/engine/turns/pending.js +88 -0
- package/dist/templates/engine/turns/reply-rules.d.ts +184 -0
- package/dist/templates/engine/turns/reply-rules.js +335 -0
- package/dist/templates/engine/turns/rules.d.ts +20 -0
- package/dist/templates/engine/turns/rules.js +144 -0
- package/dist/templates/engine/turns/silence.d.ts +7 -0
- package/dist/templates/engine/turns/silence.js +127 -0
- package/dist/templates/engine/turns/state-spec.d.ts +305 -0
- package/dist/templates/engine/turns/state-spec.js +2 -0
- package/dist/templates/engine/turns/state.d.ts +38 -0
- package/dist/templates/engine/turns/state.js +101 -0
- package/dist/templates/engine/turns/tracking.d.ts +50 -0
- package/dist/templates/engine/turns/tracking.js +184 -0
- package/dist/templates/engine/turns/transfer.d.ts +19 -0
- package/dist/templates/engine/turns/transfer.js +93 -0
- package/dist/templates/engine/turns/turn.d.ts +17 -0
- package/dist/templates/engine/turns/turn.js +363 -0
- package/dist/templates/engine/turns/voicemail.d.ts +8 -0
- package/dist/templates/engine/turns/voicemail.js +101 -0
- package/dist/templates/engine/variants.d.ts +36 -0
- package/dist/templates/engine/variants.js +159 -0
- package/dist/templates/engine/voice-dialog.d.ts +24 -0
- package/dist/templates/engine/voice-dialog.js +157 -0
- package/dist/templates/engine/voice.d.ts +174 -0
- package/dist/templates/engine/voice.js +1337 -0
- package/dist/templates/expr/caller-after.d.ts +20 -0
- package/dist/templates/expr/caller-after.js +53 -0
- package/dist/templates/expr/check.d.ts +19 -0
- package/dist/templates/expr/check.js +314 -0
- package/dist/templates/expr/compiled.d.ts +8 -0
- package/dist/templates/expr/compiled.js +8 -0
- package/dist/templates/expr/context.d.ts +28 -0
- package/dist/templates/expr/context.js +55 -0
- package/dist/templates/expr/day-table.d.ts +4 -0
- package/dist/templates/expr/day-table.js +80 -0
- package/dist/templates/expr/evaluate.d.ts +26 -0
- package/dist/templates/expr/evaluate.js +885 -0
- package/dist/templates/expr/facts.d.ts +7 -0
- package/dist/templates/expr/facts.js +81 -0
- package/dist/templates/expr/index.d.ts +4 -0
- package/dist/templates/expr/index.js +11 -0
- package/dist/templates/expr/line-tally.d.ts +64 -0
- package/dist/templates/expr/line-tally.js +88 -0
- package/dist/templates/expr/matchers-state.d.ts +23 -0
- package/dist/templates/expr/matchers-state.js +37 -0
- package/dist/templates/expr/matchers.d.ts +12 -0
- package/dist/templates/expr/matchers.js +99 -0
- package/dist/templates/expr/readers.d.ts +14 -0
- package/dist/templates/expr/readers.js +351 -0
- package/dist/templates/expr/slots.d.ts +14 -0
- package/dist/templates/expr/slots.js +678 -0
- package/dist/templates/expr/template.d.ts +12 -0
- package/dist/templates/expr/template.js +76 -0
- package/dist/templates/expr/test-call.d.ts +8 -0
- package/dist/templates/expr/test-call.js +32 -0
- package/dist/templates/expr/transcript.d.ts +36 -0
- package/dist/templates/expr/transcript.js +394 -0
- package/dist/templates/expr/types.d.ts +1011 -0
- package/dist/templates/expr/types.js +2 -0
- package/dist/templates/expr/values.d.ts +42 -0
- package/dist/templates/expr/values.js +166 -0
- package/dist/templates/expr/voice-ops.d.ts +26 -0
- package/dist/templates/expr/voice-ops.js +85 -0
- package/dist/templates/helpers/decision.d.ts +55 -0
- package/dist/templates/helpers/decision.js +83 -0
- package/dist/templates/helpers/fuzzy.d.ts +9 -0
- package/dist/templates/helpers/fuzzy.js +44 -0
- package/dist/templates/helpers/index.d.ts +6 -0
- package/dist/templates/helpers/index.js +35 -0
- package/dist/templates/index.d.ts +9 -0
- package/dist/templates/index.js +68 -0
- package/dist/templates/integration-forms.d.ts +252 -0
- package/dist/templates/integration-forms.js +2 -0
- package/dist/templates/knowledge/block.d.ts +44 -0
- package/dist/templates/knowledge/block.js +199 -0
- package/dist/templates/knowledge/dense.d.ts +87 -0
- package/dist/templates/knowledge/dense.js +158 -0
- package/dist/templates/knowledge/flow.d.ts +328 -0
- package/dist/templates/knowledge/flow.js +509 -0
- package/dist/templates/knowledge/retriever.d.ts +75 -0
- package/dist/templates/knowledge/retriever.js +204 -0
- package/dist/templates/knowledge/service.d.ts +77 -0
- package/dist/templates/knowledge/service.js +316 -0
- package/dist/templates/knowledge/text.d.ts +31 -0
- package/dist/templates/knowledge/text.js +66 -0
- package/dist/templates/knowledge/types.d.ts +120 -0
- package/dist/templates/knowledge/types.js +2 -0
- package/dist/templates/locale.d.ts +259 -0
- package/dist/templates/locale.js +4 -0
- package/dist/templates/locales/en-lexicons.d.ts +9 -0
- package/dist/templates/locales/en-lexicons.js +101 -0
- package/dist/templates/locales/en.d.ts +132 -0
- package/dist/templates/locales/en.js +261 -0
- package/dist/templates/locales/es.d.ts +65 -0
- package/dist/templates/locales/es.js +208 -0
- package/dist/templates/locales/hi.d.ts +47 -0
- package/dist/templates/locales/hi.js +235 -0
- package/dist/templates/locales/id.d.ts +43 -0
- package/dist/templates/locales/id.js +127 -0
- package/dist/templates/locales/index.d.ts +34 -0
- package/dist/templates/locales/index.js +112 -0
- package/dist/templates/locales/kk-lexicons.d.ts +22 -0
- package/dist/templates/locales/kk-lexicons.js +89 -0
- package/dist/templates/locales/kk.d.ts +140 -0
- package/dist/templates/locales/kk.js +306 -0
- package/dist/templates/locales/kn.d.ts +29 -0
- package/dist/templates/locales/kn.js +22 -0
- package/dist/templates/locales/listen-only.d.ts +15 -0
- package/dist/templates/locales/listen-only.js +27 -0
- package/dist/templates/locales/ms-lexicons.d.ts +13 -0
- package/dist/templates/locales/ms-lexicons.js +113 -0
- package/dist/templates/locales/ms.d.ts +76 -0
- package/dist/templates/locales/ms.js +179 -0
- package/dist/templates/locales/parse.d.ts +86 -0
- package/dist/templates/locales/parse.js +461 -0
- package/dist/templates/locales/ru-lexicons.d.ts +27 -0
- package/dist/templates/locales/ru-lexicons.js +127 -0
- package/dist/templates/locales/ru-stem.d.ts +2 -0
- package/dist/templates/locales/ru-stem.js +53 -0
- package/dist/templates/locales/ru.d.ts +143 -0
- package/dist/templates/locales/ru.js +387 -0
- package/dist/templates/locales/shared.d.ts +122 -0
- package/dist/templates/locales/shared.js +318 -0
- package/dist/templates/locales/ta.d.ts +29 -0
- package/dist/templates/locales/ta.js +22 -0
- package/dist/templates/locales/te.d.ts +29 -0
- package/dist/templates/locales/te.js +22 -0
- package/dist/templates/locales/tl-lexicons.d.ts +2 -0
- package/dist/templates/locales/tl-lexicons.js +230 -0
- package/dist/templates/locales/tl.d.ts +59 -0
- package/dist/templates/locales/tl.js +82 -0
- package/dist/templates/locales/vi.d.ts +59 -0
- package/dist/templates/locales/vi.js +160 -0
- package/dist/templates/locales/word-regex.d.ts +13 -0
- package/dist/templates/locales/word-regex.js +43 -0
- package/dist/templates/locales/words-kk.d.ts +2 -0
- package/dist/templates/locales/words-kk.js +23 -0
- package/dist/templates/locales/words-ru.d.ts +4 -0
- package/dist/templates/locales/words-ru.js +92 -0
- package/dist/templates/spec.d.ts +2856 -0
- package/dist/templates/spec.js +2 -0
- package/dist/testing/fake-channel.d.ts +0 -1
- package/dist/testing/fake-channel.js +0 -1
- package/dist/testing/index.d.ts +24 -1
- package/dist/testing/index.js +117 -2
- package/dist/voice/call-voice.d.ts +581 -0
- package/dist/voice/call-voice.js +1399 -0
- package/dist/voice/intent-interrupt.d.ts +32 -0
- package/dist/voice/intent-interrupt.js +91 -0
- package/dist/voice/self-echo.d.ts +28 -0
- package/dist/voice/self-echo.js +135 -0
- package/dist/voice/sentence-tag.d.ts +5 -0
- package/dist/voice/sentence-tag.js +42 -0
- package/dist/voice/speech-leak.d.ts +74 -0
- package/dist/voice/speech-leak.js +216 -0
- package/dist/voice/transfer.d.ts +90 -0
- package/dist/voice/transfer.js +331 -0
- package/dist/voice/turn-timing.d.ts +293 -0
- package/dist/voice/turn-timing.js +567 -0
- package/docs/README.md +3 -6
- package/docs/framework/README.md +6 -10
- package/docs/framework/architecture.md +2 -2
- package/docs/framework/container-and-di.md +1 -2
- package/docs/framework/invariants.md +6 -6
- package/docs/framework/package-layout.md +16 -23
- package/docs/framework/testing.md +8 -6
- package/package.json +10 -54
- package/skill/SKILL.md +213 -0
- package/skill/references/agent-file.md +230 -0
- package/skill/references/blocks.md +246 -0
- package/skill/references/builder.md +163 -0
- package/skill/references/business.md +659 -0
- package/skill/references/conversation.md +586 -0
- package/skill/references/core.md +89 -0
- package/skill/references/examples.md +73 -0
- package/skill/references/expressions.md +342 -0
- package/skill/references/format.md +114 -0
- package/skill/references/locales.md +149 -0
- package/skill/references/migration.md +133 -0
- package/skill/references/new-agent.md +81 -0
- package/skill/references/porting.md +109 -0
- package/templates/agent/README.md +50 -0
- package/templates/agent/package.json +24 -0
- package/templates/agent/src/agent.spec.ts +51 -0
- package/templates/agent/src/agent.ts +268 -0
- package/templates/agent/src/entities.ts +44 -0
- package/templates/agent/src/prompt.sqrl +21 -0
- package/templates/agent/src/variants/fixed-opening.ts +144 -0
- package/templates/agent/tsconfig.build.json +4 -0
- package/templates/agent/tsconfig.json +18 -0
- package/dist/asr/index.d.ts +0 -3
- package/dist/asr/index.d.ts.map +0 -1
- package/dist/asr/index.js +0 -6
- package/dist/asr/index.js.map +0 -1
- package/dist/barge-in/barge-in-module.d.ts.map +0 -1
- package/dist/barge-in/barge-in-module.js.map +0 -1
- package/dist/barge-in/barge-in-service.d.ts.map +0 -1
- package/dist/barge-in/barge-in-service.js.map +0 -1
- package/dist/barge-in/barge-in-strategy.d.ts.map +0 -1
- package/dist/barge-in/barge-in-strategy.js.map +0 -1
- package/dist/barge-in/echo-cancellation.d.ts.map +0 -1
- package/dist/barge-in/echo-cancellation.js.map +0 -1
- package/dist/barge-in/echo.d.ts.map +0 -1
- package/dist/barge-in/echo.js.map +0 -1
- package/dist/barge-in/index.d.ts +0 -13
- package/dist/barge-in/index.d.ts.map +0 -1
- package/dist/barge-in/index.js +0 -28
- package/dist/barge-in/index.js.map +0 -1
- package/dist/barge-in/lexicon.d.ts.map +0 -1
- package/dist/barge-in/lexicon.js.map +0 -1
- package/dist/barge-in/lexicons/en.d.ts +0 -2
- package/dist/barge-in/lexicons/en.d.ts.map +0 -1
- package/dist/barge-in/lexicons/en.js +0 -36
- package/dist/barge-in/lexicons/en.js.map +0 -1
- package/dist/barge-in/lexicons/id.d.ts +0 -2
- package/dist/barge-in/lexicons/id.d.ts.map +0 -1
- package/dist/barge-in/lexicons/id.js +0 -39
- package/dist/barge-in/lexicons/id.js.map +0 -1
- package/dist/barge-in/lexicons/index.d.ts +0 -10
- package/dist/barge-in/lexicons/index.d.ts.map +0 -1
- package/dist/barge-in/lexicons/index.js +0 -11
- package/dist/barge-in/lexicons/index.js.map +0 -1
- package/dist/barge-in/lexicons/ru.d.ts +0 -2
- package/dist/barge-in/lexicons/ru.d.ts.map +0 -1
- package/dist/barge-in/lexicons/ru.js +0 -39
- package/dist/barge-in/lexicons/ru.js.map +0 -1
- package/dist/barge-in/speech-ledger.d.ts.map +0 -1
- package/dist/barge-in/speech-ledger.js.map +0 -1
- package/dist/barge-in/word-classifier.d.ts.map +0 -1
- package/dist/barge-in/word-classifier.js.map +0 -1
- package/dist/bridge/bridge.d.ts +0 -28
- package/dist/bridge/bridge.d.ts.map +0 -1
- package/dist/bridge/bridge.js +0 -117
- package/dist/bridge/bridge.js.map +0 -1
- package/dist/bridge/index.d.ts +0 -3
- package/dist/bridge/index.d.ts.map +0 -1
- package/dist/bridge/index.js +0 -8
- package/dist/bridge/index.js.map +0 -1
- package/dist/core/call-disposables.d.ts.map +0 -1
- package/dist/core/call-disposables.js.map +0 -1
- package/dist/core/container.d.ts.map +0 -1
- package/dist/core/container.js.map +0 -1
- package/dist/core/create-agent-script.d.ts.map +0 -1
- package/dist/core/create-agent-script.js.map +0 -1
- package/dist/core/decorators.d.ts.map +0 -1
- package/dist/core/decorators.js.map +0 -1
- package/dist/core/define-module.d.ts.map +0 -1
- package/dist/core/define-module.js.map +0 -1
- package/dist/core/dump-policy.d.ts.map +0 -1
- package/dist/core/dump-policy.js.map +0 -1
- package/dist/core/hooks.d.ts.map +0 -1
- package/dist/core/hooks.js.map +0 -1
- package/dist/core/index.d.ts +0 -16
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -36
- package/dist/core/index.js.map +0 -1
- package/dist/core/media-bootstrap.d.ts.map +0 -1
- package/dist/core/media-bootstrap.js.map +0 -1
- package/dist/core/provide-media.d.ts.map +0 -1
- package/dist/core/provide-media.js.map +0 -1
- package/dist/core/tokens.d.ts.map +0 -1
- package/dist/core/tokens.js.map +0 -1
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/types.js.map +0 -1
- package/dist/core/version.d.ts.map +0 -1
- package/dist/core/version.js.map +0 -1
- package/dist/dialog/basic-ports.d.ts +0 -54
- package/dist/dialog/basic-ports.d.ts.map +0 -1
- package/dist/dialog/basic-ports.js +0 -206
- package/dist/dialog/basic-ports.js.map +0 -1
- package/dist/dialog/define-dialog.d.ts +0 -21
- package/dist/dialog/define-dialog.d.ts.map +0 -1
- package/dist/dialog/define-dialog.js +0 -21
- package/dist/dialog/define-dialog.js.map +0 -1
- package/dist/dialog/dialog-definition.d.ts.map +0 -1
- package/dist/dialog/dialog-definition.js.map +0 -1
- package/dist/dialog/dialog-ports.d.ts.map +0 -1
- package/dist/dialog/dialog-ports.js.map +0 -1
- package/dist/dialog/index.d.ts +0 -7
- package/dist/dialog/index.d.ts.map +0 -1
- package/dist/dialog/index.js +0 -23
- package/dist/dialog/index.js.map +0 -1
- package/dist/dialog/online-call-host.d.ts.map +0 -1
- package/dist/dialog/online-call-host.js.map +0 -1
- package/dist/dialog/online-call-module.d.ts.map +0 -1
- package/dist/dialog/online-call-module.js.map +0 -1
- package/dist/dialog-events/active-media.d.ts.map +0 -1
- package/dist/dialog-events/active-media.js.map +0 -1
- package/dist/dialog-events/event-source.d.ts.map +0 -1
- package/dist/dialog-events/event-source.js.map +0 -1
- package/dist/dialog-events/index.d.ts +0 -8
- package/dist/dialog-events/index.d.ts.map +0 -1
- package/dist/dialog-events/index.js +0 -24
- package/dist/dialog-events/index.js.map +0 -1
- package/dist/dialog-events/max-listen-source.d.ts +0 -27
- package/dist/dialog-events/max-listen-source.d.ts.map +0 -1
- package/dist/dialog-events/max-listen-source.js +0 -98
- package/dist/dialog-events/max-listen-source.js.map +0 -1
- package/dist/dialog-events/overtalk-source.d.ts +0 -61
- package/dist/dialog-events/overtalk-source.d.ts.map +0 -1
- package/dist/dialog-events/overtalk-source.js +0 -232
- package/dist/dialog-events/overtalk-source.js.map +0 -1
- package/dist/dialog-events/silence-source.d.ts +0 -32
- package/dist/dialog-events/silence-source.d.ts.map +0 -1
- package/dist/dialog-events/silence-source.js +0 -128
- package/dist/dialog-events/silence-source.js.map +0 -1
- package/dist/dialog-events/virtual-finals-module.d.ts.map +0 -1
- package/dist/dialog-events/virtual-finals-module.js.map +0 -1
- package/dist/dialog-events/virtual-finals.d.ts.map +0 -1
- package/dist/dialog-events/virtual-finals.js.map +0 -1
- package/dist/dtmf/dtmf.d.ts +0 -27
- package/dist/dtmf/dtmf.d.ts.map +0 -1
- package/dist/dtmf/dtmf.js +0 -87
- package/dist/dtmf/dtmf.js.map +0 -1
- package/dist/dtmf/index.d.ts +0 -3
- package/dist/dtmf/index.d.ts.map +0 -1
- package/dist/dtmf/index.js +0 -8
- package/dist/dtmf/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lifecycle/index.d.ts +0 -3
- package/dist/lifecycle/index.d.ts.map +0 -1
- package/dist/lifecycle/index.js +0 -9
- package/dist/lifecycle/index.js.map +0 -1
- package/dist/lifecycle/lifecycle.d.ts.map +0 -1
- package/dist/lifecycle/lifecycle.js.map +0 -1
- package/dist/llm/index.d.ts +0 -7
- package/dist/llm/index.d.ts.map +0 -1
- package/dist/llm/index.js +0 -18
- package/dist/llm/index.js.map +0 -1
- package/dist/llm/llm-markers-module.d.ts +0 -15
- package/dist/llm/llm-markers-module.d.ts.map +0 -1
- package/dist/llm/llm-markers-module.js +0 -48
- package/dist/llm/llm-markers-module.js.map +0 -1
- package/dist/llm/llm-markers.d.ts +0 -36
- package/dist/llm/llm-markers.d.ts.map +0 -1
- package/dist/llm/llm-markers.js +0 -210
- package/dist/llm/llm-markers.js.map +0 -1
- package/dist/llm/llm-module.d.ts +0 -20
- package/dist/llm/llm-module.d.ts.map +0 -1
- package/dist/llm/llm-module.js.map +0 -1
- package/dist/match/index.d.ts +0 -3
- package/dist/match/index.d.ts.map +0 -1
- package/dist/match/index.js +0 -10
- package/dist/match/index.js.map +0 -1
- package/dist/match/match.d.ts +0 -33
- package/dist/match/match.d.ts.map +0 -1
- package/dist/match/match.js +0 -85
- package/dist/match/match.js.map +0 -1
- package/dist/outbound/index.d.ts +0 -3
- package/dist/outbound/index.d.ts.map +0 -1
- package/dist/outbound/index.js +0 -8
- package/dist/outbound/index.js.map +0 -1
- package/dist/outbound/outbound.d.ts +0 -40
- package/dist/outbound/outbound.d.ts.map +0 -1
- package/dist/outbound/outbound.js +0 -84
- package/dist/outbound/outbound.js.map +0 -1
- package/dist/result/index.d.ts +0 -2
- package/dist/result/index.d.ts.map +0 -1
- package/dist/result/index.js.map +0 -1
- package/dist/result/result-store.d.ts.map +0 -1
- package/dist/result/result-store.js.map +0 -1
- package/dist/testing/fake-channel.d.ts.map +0 -1
- package/dist/testing/fake-channel.js.map +0 -1
- package/dist/testing/index.d.ts.map +0 -1
- package/dist/testing/index.js.map +0 -1
- package/docs/agents/README.md +0 -41
- package/docs/agents/barge-in.md +0 -67
- package/docs/agents/dialog.md +0 -98
- package/docs/agents/getting-started.md +0 -142
- package/docs/agents/imports.md +0 -40
- package/docs/agents/media-and-ports.md +0 -82
- package/docs/agents/modules.md +0 -83
- package/docs/agents/phases.md +0 -83
- package/docs/framework/extending.md +0 -59
- package/docs/framework/idn-parity.md +0 -18
- package/examples/minimal-agent/README.md +0 -7
- package/examples/minimal-agent/agent.ts +0 -94
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.en = exports.enParse = exports.enDateWords = exports.EN_DATE_LISTS = exports.EN_MONTH_WORDS = exports.EN_NUMBER_WORDS = exports.enFormat = exports.enOrdinalFigure = exports.enOrdinalToWords = exports.enDate = exports.EN_WEEKDAYS = exports.EN_MONTHS = exports.enAmount = exports.enNumberToWords = void 0;
|
|
4
|
+
const parse_1 = require("./parse");
|
|
5
|
+
const en_lexicons_1 = require("./en-lexicons");
|
|
6
|
+
const shared_1 = require("./shared");
|
|
7
|
+
const EN_ONES = [
|
|
8
|
+
'', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen',
|
|
9
|
+
'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen',
|
|
10
|
+
];
|
|
11
|
+
const EN_TENS = ['', '', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety'];
|
|
12
|
+
const EN_SCALES = ['', 'thousand', 'million', 'billion'];
|
|
13
|
+
function upTo999(n, joiner) {
|
|
14
|
+
if (n === 0)
|
|
15
|
+
return '';
|
|
16
|
+
const parts = [];
|
|
17
|
+
const hundreds = Math.floor(n / 100);
|
|
18
|
+
if (hundreds > 0)
|
|
19
|
+
parts.push(`${EN_ONES[hundreds]} hundred`);
|
|
20
|
+
const rem = n % 100;
|
|
21
|
+
if (rem > 0) {
|
|
22
|
+
if (rem < 20)
|
|
23
|
+
parts.push(EN_ONES[rem]);
|
|
24
|
+
else {
|
|
25
|
+
const ones = rem % 10;
|
|
26
|
+
const tens = EN_TENS[Math.floor(rem / 10)];
|
|
27
|
+
parts.push(ones > 0 ? `${tens}${joiner}${EN_ONES[ones]}` : tens);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return parts.join(' ');
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Non-negative integer in words, short scale up to the billions: `5300` → «five thousand three hundred». The fraction
|
|
34
|
+
* is dropped; `''` for non-finite or negative input.
|
|
35
|
+
*/
|
|
36
|
+
function enNumberToWords(value, opts = {}) {
|
|
37
|
+
if (!Number.isFinite(value) || value < 0)
|
|
38
|
+
return '';
|
|
39
|
+
const n = Math.floor(value);
|
|
40
|
+
if (n === 0)
|
|
41
|
+
return 'zero';
|
|
42
|
+
const joiner = opts.hyphen === false ? ' ' : '-';
|
|
43
|
+
const parts = [];
|
|
44
|
+
for (let i = EN_SCALES.length - 1; i >= 0; i -= 1) {
|
|
45
|
+
const group = Math.floor(n / 1000 ** i) % 1000;
|
|
46
|
+
if (!group)
|
|
47
|
+
continue;
|
|
48
|
+
const words = upTo999(group, joiner);
|
|
49
|
+
parts.push(EN_SCALES[i] ? `${words} ${EN_SCALES[i]}` : words);
|
|
50
|
+
}
|
|
51
|
+
return parts.join(' ');
|
|
52
|
+
}
|
|
53
|
+
exports.enNumberToWords = enNumberToWords;
|
|
54
|
+
/** Currency words by ISO code: one unit, many units, the minor unit (plural). */
|
|
55
|
+
const EN_CURRENCY = {
|
|
56
|
+
PHP: { one: 'peso', many: 'pesos', minor: 'centavos' },
|
|
57
|
+
USD: { one: 'dollar', many: 'dollars', minor: 'cents' },
|
|
58
|
+
EUR: { one: 'euro', many: 'euros', minor: 'cents' },
|
|
59
|
+
INR: { one: 'rupee', many: 'rupees', minor: 'paise' },
|
|
60
|
+
ZAR: { one: 'rand', many: 'rand', minor: 'cents' },
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* `amount('5250.50', 'PHP')` → «five thousand two hundred fifty pesos and fifty centavos». Strings may carry currency
|
|
64
|
+
* marks and thousands commas. Without a currency (or an unknown one, read as given) only the number words are read.
|
|
65
|
+
*/
|
|
66
|
+
function enAmount(value, currency, opts = {}) {
|
|
67
|
+
const parsed = (0, shared_1.parseAmount)(value);
|
|
68
|
+
if (!parsed)
|
|
69
|
+
return opts.onInvalid === 'raw' ? String(value) : '';
|
|
70
|
+
const words = enNumberToWords(parsed.whole, opts);
|
|
71
|
+
const unit = currency ? EN_CURRENCY[currency] : undefined;
|
|
72
|
+
const unitWord = unit ? (opts.singularOne && parsed.whole === 1 ? unit.one : unit.many) : currency ?? '';
|
|
73
|
+
const main = unitWord ? `${words} ${unitWord}` : words;
|
|
74
|
+
const mode = opts.cents ?? 'and';
|
|
75
|
+
if (mode === 'drop' || parsed.cents === 0)
|
|
76
|
+
return main;
|
|
77
|
+
const centWords = enNumberToWords(parsed.cents, opts);
|
|
78
|
+
if (mode === 'point')
|
|
79
|
+
return unitWord ? `${words} point ${centWords} ${unitWord}` : `${words} point ${centWords}`;
|
|
80
|
+
return unit ? `${main} and ${centWords} ${unit.minor}` : `${main} and ${centWords}`;
|
|
81
|
+
}
|
|
82
|
+
exports.enAmount = enAmount;
|
|
83
|
+
/** Day-of-month ordinals 1-31. */
|
|
84
|
+
const EN_DAY_ORDINALS = [
|
|
85
|
+
'', 'first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth', 'eleventh',
|
|
86
|
+
'twelfth', 'thirteenth', 'fourteenth', 'fifteenth', 'sixteenth', 'seventeenth', 'eighteenth', 'nineteenth',
|
|
87
|
+
'twentieth', 'twenty-first', 'twenty-second', 'twenty-third', 'twenty-fourth', 'twenty-fifth', 'twenty-sixth',
|
|
88
|
+
'twenty-seventh', 'twenty-eighth', 'twenty-ninth', 'thirtieth', 'thirty-first',
|
|
89
|
+
];
|
|
90
|
+
exports.EN_MONTHS = [
|
|
91
|
+
'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November',
|
|
92
|
+
'December',
|
|
93
|
+
];
|
|
94
|
+
/** Weekday names, Sunday first (index = `Date#getUTCDay()`). */
|
|
95
|
+
exports.EN_WEEKDAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
96
|
+
/** Style presets: `dayMonth` «sixth of July» (default), `short` «July 6», `long` «July 6, 2026». */
|
|
97
|
+
const EN_DATE_STYLES = {
|
|
98
|
+
dayMonth: { ordinal: true },
|
|
99
|
+
short: { monthFirst: true },
|
|
100
|
+
long: { monthFirst: true, year: true },
|
|
101
|
+
};
|
|
102
|
+
function enDate(d, style = 'dayMonth', opts = {}) {
|
|
103
|
+
const o = { ...EN_DATE_STYLES[style], ...opts };
|
|
104
|
+
const p = (0, shared_1.partsOf)(d);
|
|
105
|
+
const month = o.lowercaseMonth ? exports.EN_MONTHS[p.month - 1].toLowerCase() : exports.EN_MONTHS[p.month - 1];
|
|
106
|
+
let text;
|
|
107
|
+
if (o.ordinal)
|
|
108
|
+
text = `${EN_DAY_ORDINALS[p.day] ?? String(p.day)} of ${month}`;
|
|
109
|
+
else if (o.monthFirst)
|
|
110
|
+
text = `${month} ${p.day}`;
|
|
111
|
+
else
|
|
112
|
+
text = `${p.day} ${month}`;
|
|
113
|
+
if (o.year)
|
|
114
|
+
text = o.monthFirst && !o.ordinal ? `${text}, ${p.year}` : `${text} ${p.year}`;
|
|
115
|
+
return o.weekday ? `${exports.EN_WEEKDAYS[p.weekday]}, ${text}` : text;
|
|
116
|
+
}
|
|
117
|
+
exports.enDate = enDate;
|
|
118
|
+
/** Last words of a number whose ordinal is not «-th» added (or «-y» → «-ieth»). */
|
|
119
|
+
const EN_ORDINAL_EXCEPTIONS = {
|
|
120
|
+
one: 'first', two: 'second', three: 'third', five: 'fifth', eight: 'eighth', nine: 'ninth', twelve: 'twelfth',
|
|
121
|
+
};
|
|
122
|
+
/** Any whole number as ordinal words: `1182` → «one thousand one hundred eighty-second». `''` like `enNumberToWords`. */
|
|
123
|
+
function enOrdinalToWords(value, opts = {}) {
|
|
124
|
+
const words = enNumberToWords(value, opts);
|
|
125
|
+
const m = /^(.*?)([a-z]+)$/.exec(words);
|
|
126
|
+
if (!m)
|
|
127
|
+
return words;
|
|
128
|
+
const last = m[2];
|
|
129
|
+
return m[1] + (EN_ORDINAL_EXCEPTIONS[last] ?? (last.endsWith('y') ? `${last.slice(0, -1)}ieth` : `${last}th`));
|
|
130
|
+
}
|
|
131
|
+
exports.enOrdinalToWords = enOrdinalToWords;
|
|
132
|
+
/** A day number with its ordinal suffix in figures: «1st», «22nd», «13th». */
|
|
133
|
+
function enOrdinalFigure(n) {
|
|
134
|
+
const suffix = n % 10 === 1 && n !== 11 ? 'st' : n % 10 === 2 && n !== 12 ? 'nd' : n % 10 === 3 && n !== 13 ? 'rd' : 'th';
|
|
135
|
+
return `${n}${suffix}`;
|
|
136
|
+
}
|
|
137
|
+
exports.enOrdinalFigure = enOrdinalFigure;
|
|
138
|
+
/** Default parts of the day: morning before 12, afternoon before 17, evening after. */
|
|
139
|
+
const EN_DAY_BANDS = { morning: 0, afternoon: 12, evening: 17 };
|
|
140
|
+
exports.enFormat = {
|
|
141
|
+
number: (n, opts) => enNumberToWords(n, opts),
|
|
142
|
+
amount: enAmount,
|
|
143
|
+
date: enDate,
|
|
144
|
+
/** Day ordinal 1-31 («twenty-first»); digits beyond. */
|
|
145
|
+
ordinal: (n) => EN_DAY_ORDINALS[n] ?? String(n),
|
|
146
|
+
months: exports.EN_MONTHS,
|
|
147
|
+
weekdays: exports.EN_WEEKDAYS,
|
|
148
|
+
/** Any whole number as ordinal words («one hundred eighty-second»). */
|
|
149
|
+
ordinalNumber: (n) => enOrdinalToWords(n),
|
|
150
|
+
/** A day number with its suffix in figures («22nd»). */
|
|
151
|
+
ordinalFigure: enOrdinalFigure,
|
|
152
|
+
ordinalSuffixes: ['st', 'nd', 'rd', 'th'],
|
|
153
|
+
/** «one day» / «five days»: the number in words, `forms[0]` for exactly one, else `forms[1]`. */
|
|
154
|
+
count: (n, forms, opts) => {
|
|
155
|
+
const words = enNumberToWords(n, opts);
|
|
156
|
+
return words ? `${words} ${n === 1 ? forms[0] ?? '' : forms[1] ?? forms[0] ?? ''}`.trim() : '';
|
|
157
|
+
},
|
|
158
|
+
/** Part of the day by the hour: morning (before 12), afternoon (before 17), evening; `opts.bands` moves the edges (adds night). */
|
|
159
|
+
timeOfDay: (0, shared_1.dayPartWords)({ morning: 'morning', afternoon: 'afternoon', evening: 'evening', night: 'night' }, EN_DAY_BANDS),
|
|
160
|
+
/** «Good morning» … «Good night», by the same bands. */
|
|
161
|
+
timeOfDayGreeting: (0, shared_1.dayPartWords)({ morning: 'Good morning', afternoon: 'Good afternoon', evening: 'Good evening', night: 'Good night' }, EN_DAY_BANDS),
|
|
162
|
+
};
|
|
163
|
+
// ── reading back ────────────────────────────────────────────────────────────────────────────────
|
|
164
|
+
const EN_ORDINAL_WORDS = [
|
|
165
|
+
'', 'first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth', 'eleventh',
|
|
166
|
+
'twelfth', 'thirteenth', 'fourteenth', 'fifteenth', 'sixteenth', 'seventeenth', 'eighteenth', 'nineteenth',
|
|
167
|
+
];
|
|
168
|
+
const EN_ORDINALS = new Map([
|
|
169
|
+
...EN_ORDINAL_WORDS.slice(1).map((w, i) => [w, i + 1]),
|
|
170
|
+
['twentieth', 20], ['thirtieth', 30],
|
|
171
|
+
]);
|
|
172
|
+
/** Number words: amounts said the way callers say them («seven five» = 75, «four ninety six» = 496). */
|
|
173
|
+
exports.EN_NUMBER_WORDS = {
|
|
174
|
+
values: new Map([
|
|
175
|
+
['zero', 0], ...EN_ONES.slice(1).map((w, i) => [w, i + 1]),
|
|
176
|
+
...EN_TENS.slice(2).map((w, i) => [w, (i + 2) * 10]),
|
|
177
|
+
]),
|
|
178
|
+
multipliers: new Map([['hundred', 100]]),
|
|
179
|
+
scales: new Map([['thousand', 1000], ['million', 1_000_000], ['billion', 1_000_000_000]]),
|
|
180
|
+
joiners: new Set(['and']),
|
|
181
|
+
ordinal: (w) => EN_ORDINALS.get(w) ?? null,
|
|
182
|
+
group: ',',
|
|
183
|
+
decimal: '.',
|
|
184
|
+
digitByDigit: true,
|
|
185
|
+
};
|
|
186
|
+
/** «23rd» → 23; a wrong suffix («23th») is not a day. */
|
|
187
|
+
function enFigureOrdinal(token) {
|
|
188
|
+
const m = /^([1-9]\d?)(st|nd|rd|th)$/.exec(token);
|
|
189
|
+
if (!m)
|
|
190
|
+
return null;
|
|
191
|
+
const d = Number(m[1]);
|
|
192
|
+
const teen = d % 100 >= 11 && d % 100 <= 13;
|
|
193
|
+
const suffix = !teen && d % 10 === 1 ? 'st' : !teen && d % 10 === 2 ? 'nd' : !teen && d % 10 === 3 ? 'rd' : 'th';
|
|
194
|
+
return m[2] === suffix ? d : null;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Month words. «may», «jan» and «jun» are left out: a modal verb and two common nicknames are said far more often than
|
|
198
|
+
* the months.
|
|
199
|
+
*/
|
|
200
|
+
exports.EN_MONTH_WORDS = [
|
|
201
|
+
['january'], ['february', 'feb'], ['march'], ['april', 'apr'], [], ['june'], ['july', 'jul'], ['august', 'aug'],
|
|
202
|
+
['september', 'sept', 'sep'], ['october', 'oct'], ['november', 'nov'], ['december', 'dec'],
|
|
203
|
+
];
|
|
204
|
+
/** Day words of English; a pack over English (`tl`) adds its own to these lists. */
|
|
205
|
+
exports.EN_DATE_LISTS = {
|
|
206
|
+
months: exports.EN_MONTH_WORDS,
|
|
207
|
+
relative: [['day after tomorrow', 2], ['tomorrow', 1], ['today', 0]],
|
|
208
|
+
weekdays: exports.EN_WEEKDAYS.map((w) => [w.toLowerCase()]),
|
|
209
|
+
nextBefore: ['next'],
|
|
210
|
+
dayLead: ['by', 'on', 'before', 'coming', 'until', 'till'],
|
|
211
|
+
ordinalLead: ['the'],
|
|
212
|
+
monthLink: ['of'],
|
|
213
|
+
dayLink: ['the'],
|
|
214
|
+
notDayAfter: [
|
|
215
|
+
'am', 'pm', 'oclock', 'minutes', 'minute', 'hours', 'hour', 'days', 'day', 'weeks', 'week', 'months', 'month', 'years',
|
|
216
|
+
'year',
|
|
217
|
+
],
|
|
218
|
+
filler: ['yes', 'ah', 'uh', 'um', 'eh', 'am', 'maam', 'sir'],
|
|
219
|
+
vagueOrdinals: ['first', 'second'],
|
|
220
|
+
};
|
|
221
|
+
/** Day words from lists (a pack over English merges its lists first). */
|
|
222
|
+
function enDateWords(lists, numbers = exports.EN_NUMBER_WORDS) {
|
|
223
|
+
return {
|
|
224
|
+
numbers,
|
|
225
|
+
months: new Map(lists.months.flatMap((ws, i) => ws.map((w) => [w, i + 1]))),
|
|
226
|
+
relative: new Map(lists.relative),
|
|
227
|
+
weekdays: new Map(lists.weekdays.flatMap((ws, i) => ws.map((w) => [w, i]))),
|
|
228
|
+
nextBefore: new Set(lists.nextBefore),
|
|
229
|
+
dayLead: new Set(lists.dayLead),
|
|
230
|
+
ordinalLead: new Set(lists.ordinalLead),
|
|
231
|
+
monthLink: new Set(lists.monthLink),
|
|
232
|
+
dayLink: new Set(lists.dayLink),
|
|
233
|
+
notDayAfter: new Set(lists.notDayAfter),
|
|
234
|
+
filler: new Set(lists.filler),
|
|
235
|
+
vagueOrdinals: new Set(lists.vagueOrdinals),
|
|
236
|
+
figureOrdinal: enFigureOrdinal,
|
|
237
|
+
dayJoiners: false,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
exports.enDateWords = enDateWords;
|
|
241
|
+
exports.enParse = (0, parse_1.makeParse)(exports.EN_NUMBER_WORDS, enDateWords(exports.EN_DATE_LISTS));
|
|
242
|
+
exports.en = {
|
|
243
|
+
code: 'en',
|
|
244
|
+
script: 'latin',
|
|
245
|
+
lexicons: {
|
|
246
|
+
yes: [],
|
|
247
|
+
no: [],
|
|
248
|
+
backchannel: [],
|
|
249
|
+
interrupt: [],
|
|
250
|
+
greeting: [],
|
|
251
|
+
notHeard: [],
|
|
252
|
+
repeat: [],
|
|
253
|
+
wait: [],
|
|
254
|
+
voicemail: [],
|
|
255
|
+
goodbye: [],
|
|
256
|
+
...en_lexicons_1.EN_LEXICONS,
|
|
257
|
+
},
|
|
258
|
+
patterns: en_lexicons_1.EN_PATTERNS,
|
|
259
|
+
format: exports.enFormat,
|
|
260
|
+
parse: exports.enParse,
|
|
261
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { DateInput, NameOptions } from '../locale';
|
|
2
|
+
import { type NumberWords } from './parse';
|
|
3
|
+
/** «uno» → «un», «veintiuno» → «veintiún» before a masculine noun (euros, céntimos, millones, mil). */
|
|
4
|
+
export declare function esApocopate(words: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* Non-negative integer in words, as counted alone: `21` → «veintiuno», `1500` → «mil quinientos». Up to the millions;
|
|
7
|
+
* the fraction is dropped; `''` for non-finite or negative input.
|
|
8
|
+
*/
|
|
9
|
+
export declare function esNumberToWords(value: number): string;
|
|
10
|
+
/**
|
|
11
|
+
* `"1500.50"` or `"1500,50"` → «mil quinientos euros con cincuenta céntimos»; «un euro», «veintiún euros». A zero
|
|
12
|
+
* decimal part is not read. Default currency EUR; `''` for anything but a plain non-negative number.
|
|
13
|
+
*/
|
|
14
|
+
export declare function esAmount(value: number | string, currency?: string): string;
|
|
15
|
+
export declare const ES_MONTHS: readonly ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"];
|
|
16
|
+
/** Weekday names, Sunday first (index = `Date#getUTCDay()`). */
|
|
17
|
+
export declare const ES_WEEKDAYS: readonly ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"];
|
|
18
|
+
/** «4 de octubre» (day in digits). Every style reads the same. */
|
|
19
|
+
export declare function esDate(d: DateInput, _style?: 'short' | 'long' | 'dayMonth'): string;
|
|
20
|
+
/** Small words inside Spanish surnames («de la Cruz»): never a surname of their own. */
|
|
21
|
+
export declare const ES_NAME_PARTICLES: readonly ["de", "del", "la", "las", "los", "y"];
|
|
22
|
+
/**
|
|
23
|
+
* «Apellido1 Apellido2 Nombre» → «Nombre Apellido1 Apellido2»: a block repeated at the end is dropped once, particles
|
|
24
|
+
* are lower-cased and belong to the surname after them, two words are swapped; a name of two surnames only is kept.
|
|
25
|
+
*/
|
|
26
|
+
export declare function esGivenFirst(name: string): string;
|
|
27
|
+
export declare const esFormat: {
|
|
28
|
+
number: typeof esNumberToWords;
|
|
29
|
+
amount: typeof esAmount;
|
|
30
|
+
date: typeof esDate;
|
|
31
|
+
months: readonly ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"];
|
|
32
|
+
weekdays: readonly ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"];
|
|
33
|
+
/** Cleaned like every Latin-script name (`NameOptions`); `order: 'givenFirst'` reorders it with {@link esGivenFirst}. */
|
|
34
|
+
name: (raw: string, _kase?: string, opts?: NameOptions) => string;
|
|
35
|
+
};
|
|
36
|
+
export declare const ES_NUMBER_WORDS: NumberWords;
|
|
37
|
+
export declare const esParse: import("../locale").LocaleParse;
|
|
38
|
+
export declare const es: {
|
|
39
|
+
code: "es";
|
|
40
|
+
script: "latin";
|
|
41
|
+
lexicons: {
|
|
42
|
+
yes: never[];
|
|
43
|
+
no: never[];
|
|
44
|
+
backchannel: never[];
|
|
45
|
+
interrupt: never[];
|
|
46
|
+
greeting: never[];
|
|
47
|
+
notHeard: never[];
|
|
48
|
+
repeat: never[];
|
|
49
|
+
wait: never[];
|
|
50
|
+
voicemail: never[];
|
|
51
|
+
goodbye: never[];
|
|
52
|
+
/** Small words inside surnames («de la Cruz»). */
|
|
53
|
+
nameParticles: readonly ["de", "del", "la", "las", "los", "y"];
|
|
54
|
+
};
|
|
55
|
+
format: {
|
|
56
|
+
number: typeof esNumberToWords;
|
|
57
|
+
amount: typeof esAmount;
|
|
58
|
+
date: typeof esDate;
|
|
59
|
+
months: readonly ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"];
|
|
60
|
+
weekdays: readonly ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"];
|
|
61
|
+
/** Cleaned like every Latin-script name (`NameOptions`); `order: 'givenFirst'` reorders it with {@link esGivenFirst}. */
|
|
62
|
+
name: (raw: string, _kase?: string, opts?: NameOptions) => string;
|
|
63
|
+
};
|
|
64
|
+
parse: import("../locale").LocaleParse;
|
|
65
|
+
};
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.es = exports.esParse = exports.ES_NUMBER_WORDS = exports.esFormat = exports.esGivenFirst = exports.ES_NAME_PARTICLES = exports.esDate = exports.ES_WEEKDAYS = exports.ES_MONTHS = exports.esAmount = exports.esNumberToWords = exports.esApocopate = void 0;
|
|
4
|
+
const parse_1 = require("./parse");
|
|
5
|
+
const shared_1 = require("./shared");
|
|
6
|
+
const ES_ONES = [
|
|
7
|
+
'', 'uno', 'dos', 'tres', 'cuatro', 'cinco', 'seis', 'siete', 'ocho', 'nueve', 'diez', 'once', 'doce', 'trece',
|
|
8
|
+
'catorce', 'quince', 'dieciséis', 'diecisiete', 'dieciocho', 'diecinueve', 'veinte', 'veintiuno', 'veintidós',
|
|
9
|
+
'veintitrés', 'veinticuatro', 'veinticinco', 'veintiséis', 'veintisiete', 'veintiocho', 'veintinueve',
|
|
10
|
+
];
|
|
11
|
+
const ES_TENS = ['', '', '', 'treinta', 'cuarenta', 'cincuenta', 'sesenta', 'setenta', 'ochenta', 'noventa'];
|
|
12
|
+
const ES_HUNDREDS = [
|
|
13
|
+
'', 'ciento', 'doscientos', 'trescientos', 'cuatrocientos', 'quinientos', 'seiscientos', 'setecientos', 'ochocientos',
|
|
14
|
+
'novecientos',
|
|
15
|
+
];
|
|
16
|
+
function esUpTo999(n) {
|
|
17
|
+
if (n === 0)
|
|
18
|
+
return '';
|
|
19
|
+
if (n === 100)
|
|
20
|
+
return 'cien';
|
|
21
|
+
const parts = [];
|
|
22
|
+
const hundreds = Math.floor(n / 100);
|
|
23
|
+
if (hundreds > 0)
|
|
24
|
+
parts.push(ES_HUNDREDS[hundreds]);
|
|
25
|
+
const rem = n % 100;
|
|
26
|
+
if (rem > 0) {
|
|
27
|
+
if (rem < 30)
|
|
28
|
+
parts.push(ES_ONES[rem]);
|
|
29
|
+
else {
|
|
30
|
+
const ones = rem % 10;
|
|
31
|
+
const tens = ES_TENS[Math.floor(rem / 10)];
|
|
32
|
+
parts.push(ones > 0 ? `${tens} y ${ES_ONES[ones]}` : tens);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return parts.join(' ');
|
|
36
|
+
}
|
|
37
|
+
/** «uno» → «un», «veintiuno» → «veintiún» before a masculine noun (euros, céntimos, millones, mil). */
|
|
38
|
+
function esApocopate(words) {
|
|
39
|
+
return words.replace(/\buno$/u, 'un').replace(/veintiuno$/u, 'veintiún');
|
|
40
|
+
}
|
|
41
|
+
exports.esApocopate = esApocopate;
|
|
42
|
+
/**
|
|
43
|
+
* Non-negative integer in words, as counted alone: `21` → «veintiuno», `1500` → «mil quinientos». Up to the millions;
|
|
44
|
+
* the fraction is dropped; `''` for non-finite or negative input.
|
|
45
|
+
*/
|
|
46
|
+
function esNumberToWords(value) {
|
|
47
|
+
if (!Number.isFinite(value) || value < 0)
|
|
48
|
+
return '';
|
|
49
|
+
const num = Math.floor(value);
|
|
50
|
+
if (num === 0)
|
|
51
|
+
return 'cero';
|
|
52
|
+
const parts = [];
|
|
53
|
+
const millions = Math.floor(num / 1_000_000);
|
|
54
|
+
const thousands = Math.floor((num % 1_000_000) / 1_000);
|
|
55
|
+
const remainder = num % 1000;
|
|
56
|
+
if (millions === 1)
|
|
57
|
+
parts.push('un millón');
|
|
58
|
+
else if (millions > 1)
|
|
59
|
+
parts.push(`${esApocopate(esUpTo999(millions))} millones`);
|
|
60
|
+
if (thousands === 1)
|
|
61
|
+
parts.push('mil');
|
|
62
|
+
else if (thousands > 1)
|
|
63
|
+
parts.push(`${esApocopate(esUpTo999(thousands))} mil`);
|
|
64
|
+
if (remainder)
|
|
65
|
+
parts.push(esUpTo999(remainder));
|
|
66
|
+
return parts.join(' ').trim();
|
|
67
|
+
}
|
|
68
|
+
exports.esNumberToWords = esNumberToWords;
|
|
69
|
+
const ES_CURRENCY = {
|
|
70
|
+
EUR: { one: 'euro', many: 'euros', minorOne: 'céntimo', minorMany: 'céntimos' },
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* `"1500.50"` or `"1500,50"` → «mil quinientos euros con cincuenta céntimos»; «un euro», «veintiún euros». A zero
|
|
74
|
+
* decimal part is not read. Default currency EUR; `''` for anything but a plain non-negative number.
|
|
75
|
+
*/
|
|
76
|
+
function esAmount(value, currency = 'EUR') {
|
|
77
|
+
const text = (typeof value === 'string' ? value.trim() : String(value)).replace(',', '.');
|
|
78
|
+
if (!/^\d+(\.\d+)?$/.test(text))
|
|
79
|
+
return '';
|
|
80
|
+
const [intRaw, decRaw] = text.split('.');
|
|
81
|
+
const whole = Number.parseInt(intRaw, 10);
|
|
82
|
+
const cur = ES_CURRENCY[currency] ?? { one: currency, many: currency, minorOne: '', minorMany: '' };
|
|
83
|
+
const parts = [esApocopate(esNumberToWords(whole))];
|
|
84
|
+
const unit = whole === 1 ? cur.one : cur.many;
|
|
85
|
+
if (unit)
|
|
86
|
+
parts.push(unit);
|
|
87
|
+
if (decRaw !== undefined) {
|
|
88
|
+
const cents = Number.parseInt(`${decRaw}00`.slice(0, 2), 10);
|
|
89
|
+
if (cents > 0) {
|
|
90
|
+
parts.push('con', esApocopate(esNumberToWords(cents)));
|
|
91
|
+
const minor = cents === 1 ? cur.minorOne : cur.minorMany;
|
|
92
|
+
if (minor)
|
|
93
|
+
parts.push(minor);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return parts.join(' ');
|
|
97
|
+
}
|
|
98
|
+
exports.esAmount = esAmount;
|
|
99
|
+
exports.ES_MONTHS = [
|
|
100
|
+
'enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre',
|
|
101
|
+
'diciembre',
|
|
102
|
+
];
|
|
103
|
+
/** Weekday names, Sunday first (index = `Date#getUTCDay()`). */
|
|
104
|
+
exports.ES_WEEKDAYS = ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado'];
|
|
105
|
+
/** «4 de octubre» (day in digits). Every style reads the same. */
|
|
106
|
+
function esDate(d, _style) {
|
|
107
|
+
const p = (0, shared_1.partsOf)(d);
|
|
108
|
+
return `${p.day} de ${exports.ES_MONTHS[p.month - 1]}`;
|
|
109
|
+
}
|
|
110
|
+
exports.esDate = esDate;
|
|
111
|
+
/** Small words inside Spanish surnames («de la Cruz»): never a surname of their own. */
|
|
112
|
+
exports.ES_NAME_PARTICLES = ['de', 'del', 'la', 'las', 'los', 'y'];
|
|
113
|
+
const PARTICLES = new Set(exports.ES_NAME_PARTICLES);
|
|
114
|
+
/**
|
|
115
|
+
* «Apellido1 Apellido2 Nombre» → «Nombre Apellido1 Apellido2»: a block repeated at the end is dropped once, particles
|
|
116
|
+
* are lower-cased and belong to the surname after them, two words are swapped; a name of two surnames only is kept.
|
|
117
|
+
*/
|
|
118
|
+
function esGivenFirst(name) {
|
|
119
|
+
let tokens = name.split(' ').filter(Boolean);
|
|
120
|
+
for (let k = Math.floor(tokens.length / 2); k > 0; k--) {
|
|
121
|
+
if (tokens.slice(-k).join(' ') === tokens.slice(-2 * k, -k).join(' ')) {
|
|
122
|
+
tokens = tokens.slice(0, -k);
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
tokens = tokens.map((t) => (PARTICLES.has(t.toLowerCase()) ? t.toLowerCase() : t));
|
|
127
|
+
if (tokens.length === 2)
|
|
128
|
+
return `${tokens[1]} ${tokens[0]}`;
|
|
129
|
+
let end = 0;
|
|
130
|
+
for (let surname = 0; surname < 2; surname++) {
|
|
131
|
+
while (end < tokens.length && PARTICLES.has(tokens[end]))
|
|
132
|
+
end++;
|
|
133
|
+
end++;
|
|
134
|
+
}
|
|
135
|
+
if (end >= tokens.length)
|
|
136
|
+
return tokens.join(' ');
|
|
137
|
+
return [...tokens.slice(end), ...tokens.slice(0, end)].join(' ');
|
|
138
|
+
}
|
|
139
|
+
exports.esGivenFirst = esGivenFirst;
|
|
140
|
+
exports.esFormat = {
|
|
141
|
+
number: esNumberToWords,
|
|
142
|
+
amount: esAmount,
|
|
143
|
+
date: esDate,
|
|
144
|
+
months: exports.ES_MONTHS,
|
|
145
|
+
weekdays: exports.ES_WEEKDAYS,
|
|
146
|
+
/** Cleaned like every Latin-script name (`NameOptions`); `order: 'givenFirst'` reorders it with {@link esGivenFirst}. */
|
|
147
|
+
name: (raw, _kase, opts = {}) => {
|
|
148
|
+
const name = (0, shared_1.cleanName)(raw, opts);
|
|
149
|
+
return opts.order === 'givenFirst' ? esGivenFirst(name) : name;
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
// ── reading back ────────────────────────────────────────────────────────────────────────────────
|
|
153
|
+
/** Accents dropped (the speech engine writes «miércoles» and «miercoles»); «ñ» kept. */
|
|
154
|
+
const esPlain = (s) => s.normalize('NFD').replace(/[\u0301\u0300\u0308]/g, '').normalize('NFC');
|
|
155
|
+
exports.ES_NUMBER_WORDS = {
|
|
156
|
+
values: new Map([
|
|
157
|
+
['cero', 0], ['un', 1], ['una', 1], ['veintiun', 21], ['veintiuna', 21], ['cien', 100],
|
|
158
|
+
...ES_ONES.slice(1).map((w, i) => [esPlain(w), i + 1]),
|
|
159
|
+
...ES_TENS.slice(3).map((w, i) => [w, (i + 3) * 10]),
|
|
160
|
+
...ES_HUNDREDS.slice(1).flatMap((w, i) => [[w, (i + 1) * 100], [w.replace(/os$/, 'as'), (i + 1) * 100]]),
|
|
161
|
+
]),
|
|
162
|
+
scales: new Map([['mil', 1000], ['millon', 1_000_000], ['millones', 1_000_000]]),
|
|
163
|
+
joiners: new Set(['y']),
|
|
164
|
+
ordinal: (w) => (w === 'primero' || w === 'primer' || w === 'primera' ? 1 : null),
|
|
165
|
+
group: '.',
|
|
166
|
+
decimal: ',',
|
|
167
|
+
normalize: esPlain,
|
|
168
|
+
};
|
|
169
|
+
exports.esParse = (0, parse_1.makeParse)(exports.ES_NUMBER_WORDS, {
|
|
170
|
+
numbers: exports.ES_NUMBER_WORDS,
|
|
171
|
+
months: new Map([...exports.ES_MONTHS.map((m, i) => [m, i + 1]), ['setiembre', 9]]),
|
|
172
|
+
// «la mañana» is «the morning», not «tomorrow».
|
|
173
|
+
relative: new Map([
|
|
174
|
+
['hoy', 0], ['manana', 1], ['mañana', 1], ['pasado manana', 2], ['pasado mañana', 2],
|
|
175
|
+
['la manana', null], ['la mañana', null], ['esta manana', null], ['esta mañana', null],
|
|
176
|
+
]),
|
|
177
|
+
weekdays: new Map(exports.ES_WEEKDAYS.map((d, i) => [esPlain(d), i])),
|
|
178
|
+
nextBefore: new Set(['proximo', 'proxima']),
|
|
179
|
+
nextAfter: new Set(['que viene']),
|
|
180
|
+
dayLead: new Set(['el', 'dia', 'hasta', 'antes', 'para']),
|
|
181
|
+
monthLink: new Set(['de', 'del']),
|
|
182
|
+
notDayAfter: new Set([
|
|
183
|
+
'euros', 'euro', 'centimos', 'dias', 'horas', 'hora', 'minutos', 'meses', 'mes', 'anos', 'años', 'semanas', 'semana',
|
|
184
|
+
'veces', 'por',
|
|
185
|
+
]),
|
|
186
|
+
filler: new Set(['si', 'pues', 'bueno', 'el', 'dia', 'vale']),
|
|
187
|
+
vagueOrdinals: new Set(['primero', 'primera', 'primer']),
|
|
188
|
+
});
|
|
189
|
+
exports.es = {
|
|
190
|
+
code: 'es',
|
|
191
|
+
script: 'latin',
|
|
192
|
+
lexicons: {
|
|
193
|
+
yes: [],
|
|
194
|
+
no: [],
|
|
195
|
+
backchannel: [],
|
|
196
|
+
interrupt: [],
|
|
197
|
+
greeting: [],
|
|
198
|
+
notHeard: [],
|
|
199
|
+
repeat: [],
|
|
200
|
+
wait: [],
|
|
201
|
+
voicemail: [],
|
|
202
|
+
goodbye: [],
|
|
203
|
+
/** Small words inside surnames («de la Cruz»). */
|
|
204
|
+
nameParticles: exports.ES_NAME_PARTICLES,
|
|
205
|
+
},
|
|
206
|
+
format: exports.esFormat,
|
|
207
|
+
parse: exports.esParse,
|
|
208
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { DateInput } from '../locale';
|
|
2
|
+
export declare const HI_MONTHS: readonly ["जनवरी", "फ़रवरी", "मार्च", "अप्रैल", "मई", "जून", "जुलाई", "अगस्त", "सितंबर", "अक्तूबर", "नवंबर", "दिसंबर"];
|
|
3
|
+
/** Weekday names, Sunday first (index = `Date#getUTCDay()`). */
|
|
4
|
+
export declare const HI_WEEKDAYS: readonly ["रविवार", "सोमवार", "मंगलवार", "बुधवार", "गुरुवार", "शुक्रवार", "शनिवार"];
|
|
5
|
+
/** Today, tomorrow, the day after, as Hinglish callers say them (index = days from today). */
|
|
6
|
+
export declare const HI_RELATIVE_DAYS: readonly ["aaj", "kal", "parson"];
|
|
7
|
+
/** «छह अगस्त»: the day as a cardinal and the month; every style reads the same. */
|
|
8
|
+
export declare function hiDate(d: DateInput, _style?: 'short' | 'long' | 'dayMonth'): string;
|
|
9
|
+
export declare const hiFormat: {
|
|
10
|
+
number: (n: number) => string;
|
|
11
|
+
amount: (n: number | string, currency?: string) => string;
|
|
12
|
+
date: typeof hiDate;
|
|
13
|
+
months: readonly ["जनवरी", "फ़रवरी", "मार्च", "अप्रैल", "मई", "जून", "जुलाई", "अगस्त", "सितंबर", "अक्तूबर", "नवंबर", "दिसंबर"];
|
|
14
|
+
weekdays: readonly ["रविवार", "सोमवार", "मंगलवार", "बुधवार", "गुरुवार", "शुक्रवार", "शनिवार"];
|
|
15
|
+
/** «aaj» / «kal» / «parson» for today and the next two days, else `null`. */
|
|
16
|
+
relativeDay: (d: Date, today: Date) => string | null;
|
|
17
|
+
};
|
|
18
|
+
/** Regular expressions of the `hi` pack by lexicon name. */
|
|
19
|
+
export declare const HI_PATTERNS: Readonly<Record<string, readonly RegExp[]>>;
|
|
20
|
+
export declare const hi: {
|
|
21
|
+
code: "hi";
|
|
22
|
+
script: "devanagari";
|
|
23
|
+
lexicons: {
|
|
24
|
+
yes: never[];
|
|
25
|
+
no: never[];
|
|
26
|
+
backchannel: never[];
|
|
27
|
+
interrupt: never[];
|
|
28
|
+
greeting: never[];
|
|
29
|
+
notHeard: never[];
|
|
30
|
+
repeat: never[];
|
|
31
|
+
wait: never[];
|
|
32
|
+
voicemail: never[];
|
|
33
|
+
goodbye: never[];
|
|
34
|
+
relativeDays: readonly ["aaj", "kal", "parson"];
|
|
35
|
+
};
|
|
36
|
+
patterns: Readonly<Record<string, readonly RegExp[]>>;
|
|
37
|
+
format: {
|
|
38
|
+
number: (n: number) => string;
|
|
39
|
+
amount: (n: number | string, currency?: string) => string;
|
|
40
|
+
date: typeof hiDate;
|
|
41
|
+
months: readonly ["जनवरी", "फ़रवरी", "मार्च", "अप्रैल", "मई", "जून", "जुलाई", "अगस्त", "सितंबर", "अक्तूबर", "नवंबर", "दिसंबर"];
|
|
42
|
+
weekdays: readonly ["रविवार", "सोमवार", "मंगलवार", "बुधवार", "गुरुवार", "शुक्रवार", "शनिवार"];
|
|
43
|
+
/** «aaj» / «kal» / «parson» for today and the next two days, else `null`. */
|
|
44
|
+
relativeDay: (d: Date, today: Date) => string | null;
|
|
45
|
+
};
|
|
46
|
+
partialFormat: true;
|
|
47
|
+
};
|