pinecall 0.11.36 → 0.11.38

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd663f2ac908de0654021d5dc138e4ad002ac230cf38ec009e54f584da87ae0f
4
- data.tar.gz: 5d77bede0caff859918d216df2e720ba325b142ea628892a5f037c8738c677ad
3
+ metadata.gz: 1c4e8cda5fdb84cf6de8ba3ab29b837f7074160549881a4d43fcadd358805390
4
+ data.tar.gz: 3dfb6fbeb1f817b5e2aa7016c46b612267afc8d8ceb0058a30e3343b53b3d517
5
5
  SHA512:
6
- metadata.gz: 711a9c4e364b402a33a775364259de49e34d5c9eca01b3c61a43399627c51ddcd9db315e84f76d2e6c77a3adc835354250ffcb50ae254ac950b0398692e6a510
7
- data.tar.gz: 6fd47736a98e81f66cd08fd9cc76b525aa2706df94bb28cf373714f6bf2bc67316cec98571279e3a663855d7b6aa1f68c9efb66a416ff724b1d7cae487caed16
6
+ metadata.gz: 7aeaeb85ef36d15d41312523d712904399c09cc3be1194d1799af9cfee3dd17da0f8d03e2615ec3478d880f9c18eeed2a43b529f2d9c09ca5c2a19e44e1a3c1c
7
+ data.tar.gz: 6ef954f08827aff74be2d88c94eb8b0558418d4427d10096856d36158c90187550ad8c9eb10d3549606e8dad23f557c93b0318f21503bbae5fa3a35c7f305bd6
data/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@ Every change a person using this gem would notice. The format is
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); version numbers and tags are the
5
5
  maintainer's call.
6
6
 
7
+ ## [0.11.38] — a page's chat is written, a visitor keeps the conversation from page to page, and an app of one agent is one row (2026-11-13)
8
+
9
+ - **A page may be one environment's alone.** `APP.page("site", only: "sandbox")` keeps a guide or a
10
+ demo to the sandbox: a deploy to production sends the app alone. `pinecall start` follows the same
11
+ rule, and anything but `sandbox` or `production` is refused as the app is declared.
12
+
13
+ ## [0.11.37] — an app's own page dictates, the widget's header is a menu, and a page going away ends its call (2026-11-13)
14
+
15
+ - **An app's page dictates on this machine too.** `pinecall start` answers `POST /pinecall/dictation` beside the
16
+ page's ticket and its code, with your key and no captcha: the gateway's socket whole, as the deployed
17
+ page's door answers it.
18
+
7
19
  ## [0.11.36] — a Python app names its agents by slug, and Brightside Dental is an example in every language (2026-11-13)
8
20
 
9
21
  - **A class is served as its folder's slug, whatever it is called.** `pinecall start` served a class
@@ -58,6 +58,7 @@ module Pinecall
58
58
  raise CannotServe, "#{app.name}'s page reaches #{app.paged.answers}, which no agent is" if served.nil?
59
59
 
60
60
  page = { dir: app.paged.dir, agent: served.slug }
61
+ page[:only] = app.paged.only unless app.paged.only.nil?
61
62
  end
62
63
  out.puts(JSON.generate({ name: app.name, page: }))
63
64
  0
@@ -92,6 +93,8 @@ module Pinecall
92
93
  paged = app.paged
93
94
  agent = paged && slugs[paged.answers]
94
95
  return nil if agent.nil? || !env["PINECALL_HOST"].to_s.empty?
96
+ # A page of one environment is not this one's: `pinecall start --prod` holds the app alone.
97
+ return nil if paged.only && client.env && paged.only != client.env.to_s
95
98
 
96
99
  port = Integer(env["PINECALL_PAGE_PORT"] || Paged::PORT)
97
100
  page = Paged.new(folder: File.join(File.dirname(File.expand_path(file)), paged.dir), agent:, url: client.url,
@@ -44,7 +44,7 @@ module Pinecall
44
44
  file_of(path)
45
45
  end
46
46
 
47
- # A POST: a visitor's ticket or code, asked of the gateway with the key.
47
+ # A POST: a visitor's ticket, code or dictation, asked of the gateway with the key.
48
48
  def posted(path, body)
49
49
  asked = begin
50
50
  JSON.parse(body.to_s.empty? ? "{}" : body, symbolize_names: true)
@@ -55,10 +55,29 @@ module Pinecall
55
55
  when "/pinecall/token"
56
56
  passed("/v1/tokens", { agent: @agent, scope: asked[:scope] == "chat" ? "chat" : "talk", resume: asked[:resume] }.compact)
57
57
  when "/pinecall/code" then passed("/v1/codes", { agent: @agent })
58
+ when "/pinecall/dictation"
59
+ language = asked[:language]
60
+ asked_in = language.is_a?(String) ? "?language=#{URI.encode_www_form_component(language)}" : ""
61
+ dictating(passed("/v1/transcriptions/token#{asked_in}", {}))
58
62
  else Said.new(405, JSON.generate({ detail: "a page is read" }), "application/json")
59
63
  end
60
64
  end
61
65
 
66
+ # The gateway answers a token and the path of its socket; a page's door answers the socket whole,
67
+ # at the gateway's own name, and the words to expect, of which a page served here has none.
68
+ def dictating(minted)
69
+ return minted if minted.status >= 300
70
+
71
+ path = begin
72
+ JSON.parse(minted.body)["path"]
73
+ rescue JSON::ParserError
74
+ nil
75
+ end
76
+ return Said.new(502, JSON.generate({ detail: "the gateway answered no dictation" }), "application/json") unless path.is_a?(String)
77
+
78
+ Said.new(200, JSON.generate({ url: "#{@url.chomp("/").sub(/\Ahttp/, "ws")}#{path}", hear: [] }), "application/json")
79
+ end
80
+
62
81
  # A path that names no file is the page itself, so its own router reads it.
63
82
  def file_of(path)
64
83
  asked = File.expand_path(File.join(@folder, URI.decode_www_form_component(path)))
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Pinecall
4
4
  # Set by the maintainer at release time.
5
- VERSION = "0.11.36"
5
+ VERSION = "0.11.38"
6
6
  end
@@ -18,7 +18,10 @@ module Pinecall
18
18
  # One number of the app and who answers it.
19
19
  Line = Data.define(:number, :answers, :team, :greeting, :chooses)
20
20
  # The app's page: the built folder the platform serves, and the agent a visitor reaches.
21
- Page = Data.define(:dir, :answers)
21
+ # `only` is the one environment the page is served in ("sandbox" or "production"); both when nil.
22
+ Page = Data.define(:dir, :answers, :only)
23
+ WORLDS = %w[sandbox production].freeze
24
+ NOT_A_PAGE_ENV = "a page is served in both environments, or in one: app.page(dir, only: \"sandbox\") or only: \"production\""
22
25
  # The call an entry belongs to, as a handler is told it; `id` is nil for an entry of no call.
23
26
  Heard = Data.define(:id, :agent)
24
27
 
@@ -95,8 +98,9 @@ module Pinecall
95
98
  self
96
99
  end
97
100
 
98
- # The app's page: `app.page("ui/dist")`, served by the platform at the app's own name.
99
- def page(dir, answers: nil)
101
+ # The app's page: `app.page("ui/dist")`, served by the platform at the app's own name;
102
+ # `only: "sandbox"` keeps it out of production, whose deploy sends the app alone.
103
+ def page(dir, answers: nil, only: nil)
100
104
  folder = dir.to_s.delete_prefix("./").chomp("/")
101
105
  raise DeclarationRefused, NOT_A_PAGE if folder.empty? || folder.start_with?("/") || folder.split("/").include?("..")
102
106
  raise DeclarationRefused, "#{@name} has its page already, #{@paged.dir}: an app has one" unless @paged.nil?
@@ -104,7 +108,9 @@ module Pinecall
104
108
  reached = answers || @lines.first&.answers
105
109
  raise DeclarationRefused, "a page's visitors reach an agent: write a line before the page, or name one with page(dir, answers: FrontDesk)" unless agent?(reached)
106
110
 
107
- @paged = Page.new(dir: folder, answers: reached)
111
+ raise DeclarationRefused, NOT_A_PAGE_ENV unless only.nil? || WORLDS.include?(only.to_s)
112
+
113
+ @paged = Page.new(dir: folder, answers: reached, only: only&.to_s)
108
114
  self
109
115
  end
110
116
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pinecall
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.36
4
+ version: 0.11.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pinecall