portage-cli 0.15.0 → 0.16.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 69287ce603532c28615398e7f5644e3b3e97e9ce143522e16f1da81959c84661
4
- data.tar.gz: 329e6e0cfc82dc92b660453ad495cb6f9513c54c0c5dccef980036343e962d20
3
+ metadata.gz: 7b58aee770288e6234255f5351c43c4cdeb712c4e1b397c29c13e09315af92f6
4
+ data.tar.gz: 6e10beb419ccea062ba6a4d69ddb03819c12f1332497c4cb2857fda8e66d6bc7
5
5
  SHA512:
6
- metadata.gz: b8444f6a3af65e371537b35e8e6084c74c8333607b3f09c725002af59f2c52b00ff86cb17b27e1a86d6e5870b17192d98982bcdd73cba61f494fbafebf6d96fc
7
- data.tar.gz: ebd73e011164df3d6a44ef69cb4bb7799dc482aa804a64b7804c7bd0bc5a0dddb826d6d9cedab94992d5b08730fce378edda71f1c9d51078c8f53a994b837f74
6
+ metadata.gz: 119a123b36d3002a42df72077a29d5307f61745c45f94ef0c2ee6dba81859a037a6ba9d25d34b591f659b339643c60c662c4826f564875e708e25c5f0bb16263
7
+ data.tar.gz: 0214b301b73c31f65fa0331ce6465e175dca3b533325f7e6a92e52458696b8c05ab9897e818f5cc1ef6e503dee8ab7f43fa5e2f3a534ae24a3766687f95c27b9
data/CHANGELOG.md CHANGED
@@ -6,6 +6,12 @@ pre-1.0, so APIs may still shift between minor versions.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.16.0] - 2026-11-18
10
+
11
+ - **Added: stores that serve only UCP REST work in `buy` and `find`.** Discovery now picks MCP or REST (UCP 2026-08-25's core transport) from the manifest, so a REST-only store such as the one in issue #178 no longer fails with "manifest has no mcp service entry". Requires `portage-ucp-client` `~> 0.8`.
12
+ - **Fix: a store's refusal keeps its HTTP status and text.** `buy` reports a REST refusal as `HTTP 403: Invalid API key` rather than dropping the status, and a refused completion now includes the store's text next to the permission-denied message.
13
+ - **Fix: `buy` sends the agent profile on `complete_checkout`.** The call was made without `meta`, so the client raised `MissingAgentProfileError` at the last step instead of completing the purchase.
14
+
9
15
  ## [0.15.0] - 2026-10-22
10
16
 
11
17
  - **Changed: requires `mcp` `~> 1.8`** (was `~> 0.24`), which serves MCP 2026-07-28 through `server/discover` and keeps `initialize` for 2025-11-25 and earlier, so `portage mcp` speaks the new spec. Minor bump because the `mcp` requirement moved from 0.x to 1.x; no CLI or tool change and no changes under `lib/`. Requires `portage-ucp` `~> 0.17` and `portage-ucp-client` `~> 0.7`, the first releases that also take `mcp` 1.x.
@@ -318,10 +318,17 @@ module Portage
318
318
  url = error.continue_url
319
319
  build_report(
320
320
  source: "native_ucp", outcome: "store_refused", browse: true, checkout: false, checkout_url: url,
321
- message: "#{@uri} couldn't complete this: #{error.summary}#{url && " — finish it at #{url}"}"
321
+ message: "#{@uri} couldn't complete this: #{server_error_text(error)}#{url && " — finish it at #{url}"}"
322
322
  )
323
323
  end
324
324
 
325
+ # A REST refusal's message is already the store's own text led by its
326
+ # HTTP status ("HTTP 403: Invalid API key"); #summary would drop the
327
+ # status. An MCP refusal's message is the whole envelope, so #summary.
328
+ def server_error_text(error)
329
+ error.message.start_with?("HTTP ") ? error.message : error.summary
330
+ end
331
+
325
332
  def catalog_only(session)
326
333
  products = safe_search(session)
327
334
  report = build_report(
@@ -1173,7 +1180,7 @@ module Portage
1173
1180
  return held if held
1174
1181
 
1175
1182
  completed = recording_transaction(source, checkout) do
1176
- session.complete_checkout(checkout_id: checkout["id"], payment_token: @payment_token)
1183
+ session.complete_checkout(checkout_id: checkout["id"], payment_token: @payment_token, meta: agent_meta)
1177
1184
  end
1178
1185
  # `complete_checkout` can hand back `requires_escalation` too (e.g.
1179
1186
  # Shopify's cartSubmitForCompletion result carrying `errors`) — this
@@ -1184,8 +1191,8 @@ module Portage
1184
1191
 
1185
1192
  checkout_report(source, products, completed, outcome: "purchased", message: "Purchased.",
1186
1193
  warnings: warnings + Array(@unrecorded_warning))
1187
- rescue Portage::Ucp::Client::PaymentPermissionError
1188
- permission_denied_report(source, products, checkout, warnings)
1194
+ rescue Portage::Ucp::Client::PaymentPermissionError => e
1195
+ permission_denied_report(source, products, checkout, warnings, e)
1189
1196
  end
1190
1197
 
1191
1198
  # PolicyGuard's rolling cap and velocity limit count the completed
@@ -1349,11 +1356,18 @@ module Portage
1349
1356
  # shopper finishes on the merchant's own continue_url/checkout link,
1350
1357
  # same hand-off requires_escalation already uses (see
1351
1358
  # Client::PaymentPermissionError).
1352
- def permission_denied_report(source, products, checkout, warnings)
1359
+ def permission_denied_report(source, products, checkout, warnings, error)
1353
1360
  handoff_report(source, products, checkout, warnings,
1354
1361
  outcome: "permission_denied",
1355
- message: "This agent isn't yet granted permission to complete checkout on this store — " \
1356
- "visit the link to finish it yourself.")
1362
+ message: "This agent isn't yet granted permission to complete checkout on this store " \
1363
+ "(#{permission_text(error)}) — visit the link to finish it yourself.")
1364
+ end
1365
+
1366
+ # Over MCP the refusal wraps the store's ServerError as its cause, whose
1367
+ # message is the whole envelope, so trim it the same way. REST raises
1368
+ # it with the status and store text already in the message.
1369
+ def permission_text(error)
1370
+ error.cause.is_a?(Portage::Ucp::Client::ServerError) ? server_error_text(error.cause) : error.message
1357
1371
  end
1358
1372
 
1359
1373
  def escalation_report(source, products, checkout, warnings)
@@ -1,5 +1,5 @@
1
1
  module Portage
2
2
  module Cli
3
- VERSION = "0.15.0".freeze
3
+ VERSION = "0.16.0".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: portage-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Whitbread
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2026-10-22 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: base64
@@ -72,14 +71,14 @@ dependencies:
72
71
  requirements:
73
72
  - - "~>"
74
73
  - !ruby/object:Gem::Version
75
- version: '0.7'
74
+ version: '0.8'
76
75
  type: :runtime
77
76
  prerelease: false
78
77
  version_requirements: !ruby/object:Gem::Requirement
79
78
  requirements:
80
79
  - - "~>"
81
80
  - !ruby/object:Gem::Version
82
- version: '0.7'
81
+ version: '0.8'
83
82
  - !ruby/object:Gem::Dependency
84
83
  name: portage-ucp-journal
85
84
  requirement: !ruby/object:Gem::Requirement
@@ -192,7 +191,6 @@ description: 'Ships the `portage` executable. `portage buy <url>` tries native U
192
191
  is a hard dependency. Ranking, escalation and the spend-policy check use portage-ucp
193
192
  core''s rules; portage-ucp-decision is optional and only the opt-in confidence gate
194
193
  needs it.'
195
- email:
196
194
  executables:
197
195
  - portage
198
196
  - portage-console
@@ -341,7 +339,6 @@ metadata:
341
339
  source_code_uri: https://github.com/tomtom87/Portage/tree/main/portage-cli
342
340
  changelog_uri: https://github.com/tomtom87/Portage/blob/main/portage-cli/CHANGELOG.md
343
341
  rubygems_mfa_required: 'true'
344
- post_install_message:
345
342
  rdoc_options: []
346
343
  require_paths:
347
344
  - lib
@@ -356,8 +353,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
356
353
  - !ruby/object:Gem::Version
357
354
  version: '0'
358
355
  requirements: []
359
- rubygems_version: 3.5.22
360
- signing_key:
356
+ rubygems_version: 4.0.20
361
357
  specification_version: 4
362
358
  summary: portage — one CLI command to buy from any store, native UCP or not
363
359
  test_files: []