@integraledger/lcp-placement-ucp 0.9.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/CHANGELOG.md +13 -0
- package/LICENSE +202 -0
- package/NOTICE +14 -0
- package/README.md +125 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.d.ts +88 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +126 -0
- package/dist/manifest.js.map +1 -0
- package/dist/placement.d.ts +23 -0
- package/dist/placement.d.ts.map +1 -0
- package/dist/placement.js +40 -0
- package/dist/placement.js.map +1 -0
- package/package.json +59 -0
- package/src/index.ts +2 -0
- package/src/manifest.ts +129 -0
- package/src/placement.ts +43 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @integraledger/lcp-placement-ucp
|
|
2
|
+
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
First public release.
|
|
6
|
+
|
|
7
|
+
`0.9.0` is deliberate: this is a release candidate for 1.0, not a preview. The implementation is complete
|
|
8
|
+
against LCP v1.38 and certified by the conformance corpus, and the remaining distance to 1.0 is the
|
|
9
|
+
specification's own — the standard is still moving through its steering committee, and this package will not
|
|
10
|
+
claim a stability its protocol has not yet promised.
|
|
11
|
+
|
|
12
|
+
Development before this release happened in a private repository and is not reproduced here; no earlier
|
|
13
|
+
version was ever available to install.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Integra Protocol
|
|
2
|
+
Copyright 2026 Integra Ledger
|
|
3
|
+
|
|
4
|
+
This product includes software developed by Integra Ledger (https://integraledger.com).
|
|
5
|
+
|
|
6
|
+
"Integra", "Integra Ledger", and the Integra logo are trademarks of Integra Ledger.
|
|
7
|
+
Trademark use is not granted by the Apache License 2.0 (see Section 6).
|
|
8
|
+
|
|
9
|
+
The Legal Context Protocol is co-stewarded by Integra Ledger and AAA-ICDR. This repository is a
|
|
10
|
+
reference implementation of the standard's open layer; the specification itself is published at
|
|
11
|
+
https://legalcontextprotocol.org/standard and is not part of this distribution.
|
|
12
|
+
|
|
13
|
+
The vendored submodule under lib/commerce-payments is Coinbase's AuthCaptureEscrow and carries its own
|
|
14
|
+
MIT licence at lib/commerce-payments/LICENSE.md. It is not covered by the Apache License above.
|
package/README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# @integraledger/lcp-placement-ucp
|
|
2
|
+
|
|
3
|
+
Places an LCP reference into a [UCP](https://ucp.dev) (Universal Commerce Protocol) checkout, and reads it
|
|
4
|
+
back out.
|
|
5
|
+
|
|
6
|
+
**Integrity is Tier A today, via a `policies[]` entry.** The canonical carrier is a policy entry tagged
|
|
7
|
+
`com.integraledger.policy.legal_context`, carrying the reference under the reverse-DNS key
|
|
8
|
+
`com.integraledger.legal_context`. `policies[]` is in UCP's **base** checkout schema, so it needs no
|
|
9
|
+
negotiated intersection, no hosted schema at a namespace authority, and nothing the counterparty can prune.
|
|
10
|
+
The `links[type=terms_of_service].url` entry is the declared **discovery** alias: it locates the terms, it
|
|
11
|
+
attests nothing about them.
|
|
12
|
+
|
|
13
|
+
An earlier release wrote into `extensions["com.integraledger.legal-context"]`. **UCP has no such map.**
|
|
14
|
+
Verified at `universal-commerce-protocol/ucp` HEAD 2026-08-08: `checkout.json` has eighteen properties and
|
|
15
|
+
`extensions` is not among them — its own description reads *"Base checkout schema. Extensions compose onto
|
|
16
|
+
this using allOf."* Because the schema is `additionalProperties: true`, the write **landed on every document
|
|
17
|
+
and was read by nothing**. A refused write is a bug report; an accepted write nobody reads is a placement
|
|
18
|
+
that reports success forever while carrying no legal context at all.
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @integraledger/lcp-placement-ucp
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
| | |
|
|
25
|
+
|---|---|
|
|
26
|
+
| **Chain** | none — UCP settles through whatever payment method the checkout selects |
|
|
27
|
+
| **Pattern** | `http-advisory` (LCP §8.3.7, Tier A) |
|
|
28
|
+
| **Field** | `policies[type=com.integraledger.policy.legal_context]` — reference under `com.integraledger.legal_context` |
|
|
29
|
+
| **Read also** | `links[type=terms_of_service].url` (discovery, tagged-array) |
|
|
30
|
+
| **Carrier types** | `sha256`, `url` |
|
|
31
|
+
| **Spec** | UCP checkout + policy schemas, re-verified at HEAD **2026-08-08** |
|
|
32
|
+
|
|
33
|
+
## Use
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { UCP_PLACEMENT, ucpPlacement } from "@integraledger/lcp-placement-ucp";
|
|
37
|
+
|
|
38
|
+
declare const checkout: unknown; // the UCP checkout response, as received
|
|
39
|
+
|
|
40
|
+
const placed = ucpPlacement.place({ type: "sha256", value: "0x…" }, checkout);
|
|
41
|
+
const ref = ucpPlacement.extract(checkout);
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Both members are total: a refusal is a returned value, never a thrown exception.
|
|
45
|
+
|
|
46
|
+
## Specification provenance — verified against the live host, 2026-07-29 — and it re-cut the package
|
|
47
|
+
|
|
48
|
+
Read against the live spec at ucp.dev, version `2026-04-08` (`overview#capabilities`,
|
|
49
|
+
`overview#namespace-governance`, `overview#intersection-algorithm`, and the checkout capability page), the
|
|
50
|
+
gate falsified the completion plan's P1 twice:
|
|
51
|
+
|
|
52
|
+
1. **Vendor capabilities are Tier A.** The plan specced a links-only placement on the premise that UCP's
|
|
53
|
+
strict schema rejects unregistered keys, making the integrity path Tier B. The live spec says the
|
|
54
|
+
opposite: "Vendors MUST use their own reverse-domain namespace for custom capabilities" — no central
|
|
55
|
+
registry, no maintainer approval. What replaces registration is **authority binding**: "the origin of
|
|
56
|
+
these URLs MUST match the namespace authority" and "Platform MUST validate this binding and SHOULD
|
|
57
|
+
reject capabilities where the spec origin does not match." Built as planned, this package would have
|
|
58
|
+
shipped a URL and no hash while a hash-bearing carrier was available the whole time.
|
|
59
|
+
2. **`links[].type` is an OPEN set** ("Businesses MAY define custom types"), not the closed enum the plan
|
|
60
|
+
claimed — that enum is ACP's; an earlier reading conflated the two protocols. `links[]` is REQUIRED on checkout
|
|
61
|
+
responses; entries are `{type (req), url (req), title (opt)}`; `terms_of_service` is a recommended
|
|
62
|
+
well-known type, used here because it is the spelling counterparties already read.
|
|
63
|
+
|
|
64
|
+
One more finding shapes the failure mode: negotiation **silently prunes** orphaned extensions ("Remove any
|
|
65
|
+
capability where extends is set but none of its parent capabilities are in the intersection") — a vendor
|
|
66
|
+
capability the counterparty did not declare disappears without a loud rejection, which is why the discovery
|
|
67
|
+
alias exists and why `extract` falls to it.
|
|
68
|
+
|
|
69
|
+
## A placement, not a binding
|
|
70
|
+
|
|
71
|
+
UCP describes a checkout; settling it is the selected payment method's business. This package is a
|
|
72
|
+
`ReferencePlacementAdapter` — two pure functions and a manifest, no ports, no chain, no lifecycle. Where the
|
|
73
|
+
selected method is a bound rail, that rail binding welds the record; otherwise this placement is the
|
|
74
|
+
record's whole protocol reach and reads with an honest `not-attempted` at settlement-enumeration.
|
|
75
|
+
|
|
76
|
+
## The one rule the kit cannot know
|
|
77
|
+
|
|
78
|
+
`makePlacement(UCP_PLACEMENT)` — `makePlacement` comes from [`@integraledger/lcp-binding-core`](../binding-core#readme) — is the whole adapter
|
|
79
|
+
except for a single wrap on `extract`: a url-typed
|
|
80
|
+
result that does not start with `https://` refuses `ucp/insecure-terms-url`, because an `http:` link is
|
|
81
|
+
rewritable in transit and accepting one would put an unauthenticated document behind a reference the record
|
|
82
|
+
cites. The wrap is scoped by TYPE — a sha256 answer is never blocked by a bad link sitting beside it; the
|
|
83
|
+
`policies[]` entry wins over `links`, and the vectors pin exactly that.
|
|
84
|
+
|
|
85
|
+
## `description` is required, and it is an object
|
|
86
|
+
|
|
87
|
+
UCP's policy schema is `required: ["type", "description"]`, so an entry carrying only a tag and a reference
|
|
88
|
+
is an invalid document. The manifest therefore declares `constants`, and the writer emits them:
|
|
89
|
+
|
|
90
|
+
```jsonc
|
|
91
|
+
{
|
|
92
|
+
"description": { "plain": "Terms of sale for this order, identified by a Legal Context Protocol reference…" },
|
|
93
|
+
"type": "com.integraledger.policy.legal_context",
|
|
94
|
+
"com.integraledger.legal_context": { "type": "sha256", "value": "0x…" }
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
`description` is a **Description object** (`{plain|html|markdown}`, `minProperties: 1`), not a bare string.
|
|
99
|
+
|
|
100
|
+
The constants are written only when the entry is **created**. If the counterparty already declared this
|
|
101
|
+
policy type, they wrote their own prose, and overwriting it in order to place our reference would be an
|
|
102
|
+
edit to their document nobody asked for — so `place` merges the reference in and leaves the description
|
|
103
|
+
alone. Both arms are pinned as vectors.
|
|
104
|
+
|
|
105
|
+
## Why the links alias has no `write` flag
|
|
106
|
+
|
|
107
|
+
The links entry carries the terms **URL** — a different datum than the atrHash — and `place(ref, doc)`
|
|
108
|
+
holds one reference, not two data: writing `ref.value` into `links[].url` would put a bare hash where every
|
|
109
|
+
UCP client expects a URL. Publishing the links entry is the deployment's act (UCP already makes `links[]`
|
|
110
|
+
required on checkout responses), and this placement **reads** it: `extract` falls to the alias when no policy entry is
|
|
111
|
+
present, the `url` carrier type itself signalling discovery-not-integrity.
|
|
112
|
+
|
|
113
|
+
## Provenance
|
|
114
|
+
|
|
115
|
+
Cut against UCP `2026-04-08` (ucp.dev) and reconciled against LCP v1.37 §C.3. A deployment advertises under
|
|
116
|
+
its own reverse-domain namespace; `org.legalcontextprotocol.*` is reserved for a TSC-ratified capability.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
**Requires Node >= 24.** Part of the
|
|
121
|
+
[Legal Context Protocol open layer](https://github.com/IntegraLedger/integra-protocol) — see the
|
|
122
|
+
[documentation](https://github.com/IntegraLedger/integra-protocol/blob/main/docs/developer/index.md)
|
|
123
|
+
and the
|
|
124
|
+
[package index](https://github.com/IntegraLedger/integra-protocol/blob/main/docs/developer/reference.md).
|
|
125
|
+
Apache-2.0.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { PlacementManifest } from "@integraledger/lcp-binding-core";
|
|
2
|
+
/**
|
|
3
|
+
* UCP (Universal Commerce Protocol) reference placement, cut against the live spec (2026-04-08, ucp.dev —
|
|
4
|
+
* overview §capabilities, §namespace-governance, §intersection-algorithm, and the checkout capability's
|
|
5
|
+
* response schema), gate discharged 2026-07-29 against LCP v1.37 §C.3, and re-cut against the live UCP schemas and v1.38 §C.3
|
|
6
|
+
* on 2026-08-08 when the canonical carrier moved.
|
|
7
|
+
*
|
|
8
|
+
* **THE CANONICAL CARRIER IS A `policies[]` ENTRY, AND UCP HAS NO `extensions` MAP TO WRITE INTO.** A
|
|
9
|
+
* vendor capability under an authority-bound reverse-domain namespace is a real UCP surface — it is what
|
|
10
|
+
* `/.well-known/ucp` advertisement uses — but a checkout RESPONSE carries no map to read one back out of.
|
|
11
|
+
* Verified at
|
|
12
|
+
* `universal-commerce-protocol/ucp` HEAD 2026-08-08, `source/schemas/shopping/checkout.json` has eighteen
|
|
13
|
+
* properties — actions, attribution, buyer, context, continue_url, currency, expires_at, id, line_items,
|
|
14
|
+
* links, messages, order, payment, policies, signals, status, totals, ucp — and `extensions` is not among
|
|
15
|
+
* them. Its own description reads "Base checkout schema. Extensions compose onto this using allOf": UCP
|
|
16
|
+
* extensions surface as top-level fields via schema composition, not as entries in a map.
|
|
17
|
+
*
|
|
18
|
+
* **The failure mode was SILENCE, which is worse than rejection.** `checkout.json` is
|
|
19
|
+
* `additionalProperties: true`, so the write landed on every document and was read by nothing. A refused
|
|
20
|
+
* write is a bug report; an accepted write nobody reads is a placement that reports success forever while
|
|
21
|
+
* carrying no legal context at all.
|
|
22
|
+
*
|
|
23
|
+
* **`policies[]` is in the base schema and needs nothing negotiated.** Verified at HEAD
|
|
24
|
+
* (`source/schemas/shopping/types/policy.json`): `required: ["type", "description"]`,
|
|
25
|
+
* `additionalProperties: true`, and `type` is an open reverse-DNS vocabulary — "Businesses MAY define
|
|
26
|
+
* custom types in their own domain (e.g., `com.example.policy.price_match`). Platforms MUST tolerate
|
|
27
|
+
* unknown values." It is also per-transaction by the schema's own words: "A durable business rule about
|
|
28
|
+
* the items in a response … at the time of purchase." So the reference travels with the checkout it
|
|
29
|
+
* governs, with no negotiated intersection, no hosted schema at the namespace authority, and no
|
|
30
|
+
* capability the counterparty can silently prune.
|
|
31
|
+
*
|
|
32
|
+
* **`description` is REQUIRED, and it is an OBJECT.** An entry carrying only `type` and our reference
|
|
33
|
+
* fails UCP's own schema, so the container declares `constants` and the writer emits them — otherwise
|
|
34
|
+
* this placement would put an invalid document on the wire, which is the shape-assertion this seam
|
|
35
|
+
* refuses. `description` is a Description (`{plain|html|markdown}`, `minProperties: 1`), NOT a bare
|
|
36
|
+
* string. The constants are written only when the entry is CREATED: a counterparty that already declared
|
|
37
|
+
* this policy type wrote its own prose, and overwriting it to place our reference would be an edit to
|
|
38
|
+
* their document nobody asked for.
|
|
39
|
+
*
|
|
40
|
+
* **The reference field is reverse-DNS namespaced**, `com.integraledger.legal_context`, because
|
|
41
|
+
* `additionalProperties: true` tolerates an added key but UCP's own convention namespaces
|
|
42
|
+
* extension-contributed keys — `reverse_domain_name.json` names exactly that use. A bare `value` would be
|
|
43
|
+
* an unnamespaced claim on a shared object.
|
|
44
|
+
*
|
|
45
|
+
* **pattern is `http-advisory`, NOT `protocol-extension`, on the same reasoning applied to ACP.** UCP
|
|
46
|
+
* does nothing atrHash-aware with the entry — §8.3.6 means the HOST protocol's own verification and
|
|
47
|
+
* settlement procedure understands the hash, which no UCP implementation does. §8.3.6 is also Tier B by
|
|
48
|
+
* definition, which would misdescribe a carrier that works today against stock UCP. The schema rejects
|
|
49
|
+
* the protocol-extension/Tier-A pairing outright.
|
|
50
|
+
*
|
|
51
|
+
* **The vendor capability is not gone, it is just not the carrier.** `/.well-known/ucp` advertisement
|
|
52
|
+
* remains a real UCP surface and `discovery` implements it — that is where the authority-bound namespace
|
|
53
|
+
* reasoning belongs, and it is correct there. What was wrong was believing a checkout RESPONSE carries an
|
|
54
|
+
* `extensions` map to read it back out of.
|
|
55
|
+
*
|
|
56
|
+
* **The links entry is the declared DISCOVERY alias, and it has no `write` flag — deliberately.** §C.3's
|
|
57
|
+
* limitation is real: a vendor capability the counterparty did not declare is SILENTLY pruned from the
|
|
58
|
+
* negotiated intersection, so the deployment SHOULD publish terms at the `links` level too, where discovery
|
|
59
|
+
* does not depend on negotiation. But the links entry carries the terms URL — a DIFFERENT datum than the
|
|
60
|
+
* atrHash — and `place(ref, doc)` holds one reference, not two data: writing `ref.value` into `links[].url`
|
|
61
|
+
* would put a bare hash where every UCP client expects a URL. Publishing the links entry is the
|
|
62
|
+
* DEPLOYMENT's act (UCP already makes `links[]` REQUIRED on checkout responses with `terms_of_service` a
|
|
63
|
+
* recommended type — a conformant merchant publishes it as part of being a UCP merchant at all), and this
|
|
64
|
+
* placement READS it: extract falls to the alias when the capability was pruned, the `url` carrier type
|
|
65
|
+
* itself signalling discovery-not-integrity. The gate also found the "closed enum" claim false —
|
|
66
|
+
* `links[].type` is an OPEN set ("Businesses MAY define custom types"); the well-known `terms_of_service`
|
|
67
|
+
* tag is used because it is the spelling counterparties already read, not because it is the only one legal.
|
|
68
|
+
*
|
|
69
|
+
* **`termsUrlField` is deliberately OMITTED.** The terms URL rides `links[type=terms_of_service].url` — a
|
|
70
|
+
* tagged-array locator that a dotted-path parser cannot resolve. Declaring it as `termsUrlField` would
|
|
71
|
+
* repeat the defect S7 fixed for `field`: a declared property that is not the declared thing. The discovery
|
|
72
|
+
* alias states the same fact WITH its machine-readable container, and the `PlacementManifest` contract says
|
|
73
|
+
* an absent `termsUrlField` means a parser must not demand one.
|
|
74
|
+
*
|
|
75
|
+
* **`carrierTypes` permits `sha256` and `url`, and `url` is load-bearing.** extract checks every decoded
|
|
76
|
+
* reference against this list, so the discovery alias's url-typed hits would refuse
|
|
77
|
+
* `carrier-type-not-permitted` without it. The capability's own schema (ours, published at the namespace
|
|
78
|
+
* authority when advertised) pins `sha256`; a url-typed reference in the capability is legal but adds
|
|
79
|
+
* nothing over the links entry. `ipfs`/`ar` are excluded: §C.3's example carries a sha256 and our schema
|
|
80
|
+
* should not advertise carrier forms no UCP counterparty has ever seen.
|
|
81
|
+
*
|
|
82
|
+
* UCP settles through whatever payment method the checkout selects, and that settlement is NOT this
|
|
83
|
+
* package's business — the same division ACP draws: a bound rail welds the record; otherwise this
|
|
84
|
+
* placement is the record's whole protocol reach and reads with an honest `not-attempted` at
|
|
85
|
+
* settlement-enumeration.
|
|
86
|
+
*/
|
|
87
|
+
export declare const UCP_PLACEMENT: PlacementManifest;
|
|
88
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AACH,eAAO,MAAM,aAAa,EAAE,iBAyC3B,CAAC"}
|
package/dist/manifest.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UCP (Universal Commerce Protocol) reference placement, cut against the live spec (2026-04-08, ucp.dev —
|
|
3
|
+
* overview §capabilities, §namespace-governance, §intersection-algorithm, and the checkout capability's
|
|
4
|
+
* response schema), gate discharged 2026-07-29 against LCP v1.37 §C.3, and re-cut against the live UCP schemas and v1.38 §C.3
|
|
5
|
+
* on 2026-08-08 when the canonical carrier moved.
|
|
6
|
+
*
|
|
7
|
+
* **THE CANONICAL CARRIER IS A `policies[]` ENTRY, AND UCP HAS NO `extensions` MAP TO WRITE INTO.** A
|
|
8
|
+
* vendor capability under an authority-bound reverse-domain namespace is a real UCP surface — it is what
|
|
9
|
+
* `/.well-known/ucp` advertisement uses — but a checkout RESPONSE carries no map to read one back out of.
|
|
10
|
+
* Verified at
|
|
11
|
+
* `universal-commerce-protocol/ucp` HEAD 2026-08-08, `source/schemas/shopping/checkout.json` has eighteen
|
|
12
|
+
* properties — actions, attribution, buyer, context, continue_url, currency, expires_at, id, line_items,
|
|
13
|
+
* links, messages, order, payment, policies, signals, status, totals, ucp — and `extensions` is not among
|
|
14
|
+
* them. Its own description reads "Base checkout schema. Extensions compose onto this using allOf": UCP
|
|
15
|
+
* extensions surface as top-level fields via schema composition, not as entries in a map.
|
|
16
|
+
*
|
|
17
|
+
* **The failure mode was SILENCE, which is worse than rejection.** `checkout.json` is
|
|
18
|
+
* `additionalProperties: true`, so the write landed on every document and was read by nothing. A refused
|
|
19
|
+
* write is a bug report; an accepted write nobody reads is a placement that reports success forever while
|
|
20
|
+
* carrying no legal context at all.
|
|
21
|
+
*
|
|
22
|
+
* **`policies[]` is in the base schema and needs nothing negotiated.** Verified at HEAD
|
|
23
|
+
* (`source/schemas/shopping/types/policy.json`): `required: ["type", "description"]`,
|
|
24
|
+
* `additionalProperties: true`, and `type` is an open reverse-DNS vocabulary — "Businesses MAY define
|
|
25
|
+
* custom types in their own domain (e.g., `com.example.policy.price_match`). Platforms MUST tolerate
|
|
26
|
+
* unknown values." It is also per-transaction by the schema's own words: "A durable business rule about
|
|
27
|
+
* the items in a response … at the time of purchase." So the reference travels with the checkout it
|
|
28
|
+
* governs, with no negotiated intersection, no hosted schema at the namespace authority, and no
|
|
29
|
+
* capability the counterparty can silently prune.
|
|
30
|
+
*
|
|
31
|
+
* **`description` is REQUIRED, and it is an OBJECT.** An entry carrying only `type` and our reference
|
|
32
|
+
* fails UCP's own schema, so the container declares `constants` and the writer emits them — otherwise
|
|
33
|
+
* this placement would put an invalid document on the wire, which is the shape-assertion this seam
|
|
34
|
+
* refuses. `description` is a Description (`{plain|html|markdown}`, `minProperties: 1`), NOT a bare
|
|
35
|
+
* string. The constants are written only when the entry is CREATED: a counterparty that already declared
|
|
36
|
+
* this policy type wrote its own prose, and overwriting it to place our reference would be an edit to
|
|
37
|
+
* their document nobody asked for.
|
|
38
|
+
*
|
|
39
|
+
* **The reference field is reverse-DNS namespaced**, `com.integraledger.legal_context`, because
|
|
40
|
+
* `additionalProperties: true` tolerates an added key but UCP's own convention namespaces
|
|
41
|
+
* extension-contributed keys — `reverse_domain_name.json` names exactly that use. A bare `value` would be
|
|
42
|
+
* an unnamespaced claim on a shared object.
|
|
43
|
+
*
|
|
44
|
+
* **pattern is `http-advisory`, NOT `protocol-extension`, on the same reasoning applied to ACP.** UCP
|
|
45
|
+
* does nothing atrHash-aware with the entry — §8.3.6 means the HOST protocol's own verification and
|
|
46
|
+
* settlement procedure understands the hash, which no UCP implementation does. §8.3.6 is also Tier B by
|
|
47
|
+
* definition, which would misdescribe a carrier that works today against stock UCP. The schema rejects
|
|
48
|
+
* the protocol-extension/Tier-A pairing outright.
|
|
49
|
+
*
|
|
50
|
+
* **The vendor capability is not gone, it is just not the carrier.** `/.well-known/ucp` advertisement
|
|
51
|
+
* remains a real UCP surface and `discovery` implements it — that is where the authority-bound namespace
|
|
52
|
+
* reasoning belongs, and it is correct there. What was wrong was believing a checkout RESPONSE carries an
|
|
53
|
+
* `extensions` map to read it back out of.
|
|
54
|
+
*
|
|
55
|
+
* **The links entry is the declared DISCOVERY alias, and it has no `write` flag — deliberately.** §C.3's
|
|
56
|
+
* limitation is real: a vendor capability the counterparty did not declare is SILENTLY pruned from the
|
|
57
|
+
* negotiated intersection, so the deployment SHOULD publish terms at the `links` level too, where discovery
|
|
58
|
+
* does not depend on negotiation. But the links entry carries the terms URL — a DIFFERENT datum than the
|
|
59
|
+
* atrHash — and `place(ref, doc)` holds one reference, not two data: writing `ref.value` into `links[].url`
|
|
60
|
+
* would put a bare hash where every UCP client expects a URL. Publishing the links entry is the
|
|
61
|
+
* DEPLOYMENT's act (UCP already makes `links[]` REQUIRED on checkout responses with `terms_of_service` a
|
|
62
|
+
* recommended type — a conformant merchant publishes it as part of being a UCP merchant at all), and this
|
|
63
|
+
* placement READS it: extract falls to the alias when the capability was pruned, the `url` carrier type
|
|
64
|
+
* itself signalling discovery-not-integrity. The gate also found the "closed enum" claim false —
|
|
65
|
+
* `links[].type` is an OPEN set ("Businesses MAY define custom types"); the well-known `terms_of_service`
|
|
66
|
+
* tag is used because it is the spelling counterparties already read, not because it is the only one legal.
|
|
67
|
+
*
|
|
68
|
+
* **`termsUrlField` is deliberately OMITTED.** The terms URL rides `links[type=terms_of_service].url` — a
|
|
69
|
+
* tagged-array locator that a dotted-path parser cannot resolve. Declaring it as `termsUrlField` would
|
|
70
|
+
* repeat the defect S7 fixed for `field`: a declared property that is not the declared thing. The discovery
|
|
71
|
+
* alias states the same fact WITH its machine-readable container, and the `PlacementManifest` contract says
|
|
72
|
+
* an absent `termsUrlField` means a parser must not demand one.
|
|
73
|
+
*
|
|
74
|
+
* **`carrierTypes` permits `sha256` and `url`, and `url` is load-bearing.** extract checks every decoded
|
|
75
|
+
* reference against this list, so the discovery alias's url-typed hits would refuse
|
|
76
|
+
* `carrier-type-not-permitted` without it. The capability's own schema (ours, published at the namespace
|
|
77
|
+
* authority when advertised) pins `sha256`; a url-typed reference in the capability is legal but adds
|
|
78
|
+
* nothing over the links entry. `ipfs`/`ar` are excluded: §C.3's example carries a sha256 and our schema
|
|
79
|
+
* should not advertise carrier forms no UCP counterparty has ever seen.
|
|
80
|
+
*
|
|
81
|
+
* UCP settles through whatever payment method the checkout selects, and that settlement is NOT this
|
|
82
|
+
* package's business — the same division ACP draws: a bound rail welds the record; otherwise this
|
|
83
|
+
* placement is the record's whole protocol reach and reads with an honest `not-attempted` at
|
|
84
|
+
* settlement-enumeration.
|
|
85
|
+
*/
|
|
86
|
+
export const UCP_PLACEMENT = {
|
|
87
|
+
protocol: "ucp",
|
|
88
|
+
pattern: "http-advisory",
|
|
89
|
+
tier: "A",
|
|
90
|
+
encoding: "reference-object",
|
|
91
|
+
container: {
|
|
92
|
+
kind: "tagged-array",
|
|
93
|
+
at: "policies",
|
|
94
|
+
tagField: "type",
|
|
95
|
+
tag: "com.integraledger.policy.legal_context",
|
|
96
|
+
valueField: "com.integraledger.legal_context",
|
|
97
|
+
// `description` is REQUIRED by UCP's policy schema alongside `type`, so an entry without one is an
|
|
98
|
+
// invalid document. Verified at UCP HEAD 2026-08-08 (source/schemas/shopping/types/policy.json):
|
|
99
|
+
// `required: ["type","description"]`, and `description` is a Description OBJECT — {plain|html|markdown},
|
|
100
|
+
// minProperties 1 — not a bare string.
|
|
101
|
+
constants: {
|
|
102
|
+
description: {
|
|
103
|
+
plain: "Terms of sale for this order, identified by a Legal Context Protocol reference. The reference identifies the exact terms document; it is not itself the terms.",
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
field: "policies[type=com.integraledger.policy.legal_context]",
|
|
108
|
+
readAlso: [
|
|
109
|
+
{
|
|
110
|
+
path: "links[type=terms_of_service].url",
|
|
111
|
+
encoding: "bare-value",
|
|
112
|
+
bareType: "url",
|
|
113
|
+
carrierClass: "discovery",
|
|
114
|
+
container: {
|
|
115
|
+
kind: "tagged-array",
|
|
116
|
+
at: "links",
|
|
117
|
+
tagField: "type",
|
|
118
|
+
tag: "terms_of_service",
|
|
119
|
+
valueField: "url",
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
carrierTypes: ["sha256", "url"],
|
|
124
|
+
specRef: "UCP checkout — policies[] entry under a reverse-DNS custom type (source/schemas/shopping/types/policy.json: base schema, required [type, description], additionalProperties true, type an open reverse-DNS vocabulary whose unknown values platforms MUST tolerate); checkout links[] entry typed terms_of_service (both re-verified at HEAD 2026-08-08: see README)",
|
|
125
|
+
};
|
|
126
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AACH,MAAM,CAAC,MAAM,aAAa,GAAsB;IAC9C,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,eAAe;IACxB,IAAI,EAAE,GAAG;IACT,QAAQ,EAAE,kBAAkB;IAC5B,SAAS,EAAE;QACT,IAAI,EAAE,cAAc;QACpB,EAAE,EAAE,UAAU;QACd,QAAQ,EAAE,MAAM;QAChB,GAAG,EAAE,wCAAwC;QAC7C,UAAU,EAAE,iCAAiC;QAC7C,mGAAmG;QACnG,iGAAiG;QACjG,yGAAyG;QACzG,uCAAuC;QACvC,SAAS,EAAE;YACT,WAAW,EAAE;gBACX,KAAK,EACH,gKAAgK;aACnK;SACF;KACF;IACD,KAAK,EAAE,uDAAuD;IAC9D,QAAQ,EAAE;QACR;YACE,IAAI,EAAE,kCAAkC;YACxC,QAAQ,EAAE,YAAY;YACtB,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,WAAW;YACzB,SAAS,EAAE;gBACT,IAAI,EAAE,cAAc;gBACpB,EAAE,EAAE,OAAO;gBACX,QAAQ,EAAE,MAAM;gBAChB,GAAG,EAAE,kBAAkB;gBACvB,UAAU,EAAE,KAAK;aAClB;SACF;KACF;IACD,YAAY,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC;IAC/B,OAAO,EACL,sWAAsW;CACzW,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ReferencePlacementAdapter } from "@integraledger/lcp-binding-core";
|
|
2
|
+
/**
|
|
3
|
+
* The UCP reference placement — the kit plus ONE protocol rule the kit cannot know.
|
|
4
|
+
*
|
|
5
|
+
* `makePlacement(UCP_PLACEMENT)` supplies everything structural: the dotted-key capability write (the
|
|
6
|
+
* container's `segments` make `com.integraledger.legal-context` ONE key, not four), the tagged-array read of
|
|
7
|
+
* the `links` discovery alias, strength-ordered extraction, purity, and every refusal the vectors pin. This
|
|
8
|
+
* file adds only the rule that is UCP's semantics rather than any container's mechanics: **a terms link must
|
|
9
|
+
* be HTTPS.** An `http:` URL is rewritable in transit, so accepting one would put an unauthenticated document
|
|
10
|
+
* behind a reference the record cites.
|
|
11
|
+
*
|
|
12
|
+
* This is the composition S7 anticipates — generic mechanics, protocol-specific semantics layered on top —
|
|
13
|
+
* and it wraps `extract`, not `place`: `place` never writes the links alias (the terms URL is the
|
|
14
|
+
* DEPLOYMENT's datum, not the reference — see the manifest), so the write side has no URL to police.
|
|
15
|
+
*
|
|
16
|
+
* **Scoped to url-typed results, deliberately.** A sha256 answer must never be blocked by a bad link sitting
|
|
17
|
+
* beside it — the capability WINS over links, and refusing the winner for the loser's defect would invert the
|
|
18
|
+
* strength order. The vector "the capability WINS over links when both are present — even when the link is
|
|
19
|
+
* http:" pins exactly this. The scope is by TYPE, not by which carrier answered: a url-typed reference is
|
|
20
|
+
* legal in the capability too, and an http: URL there is exactly as rewritable as one in `links`.
|
|
21
|
+
*/
|
|
22
|
+
export declare const ucpPlacement: ReferencePlacementAdapter;
|
|
23
|
+
//# sourceMappingURL=placement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"placement.d.ts","sourceRoot":"","sources":["../src/placement.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,iCAAiC,CAAC;AAKzC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,YAAY,EAAE,yBAc1B,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { makePlacement, } from "@integraledger/lcp-binding-core";
|
|
2
|
+
import { UCP_PLACEMENT } from "./manifest.js";
|
|
3
|
+
const base = makePlacement(UCP_PLACEMENT);
|
|
4
|
+
/**
|
|
5
|
+
* The UCP reference placement — the kit plus ONE protocol rule the kit cannot know.
|
|
6
|
+
*
|
|
7
|
+
* `makePlacement(UCP_PLACEMENT)` supplies everything structural: the dotted-key capability write (the
|
|
8
|
+
* container's `segments` make `com.integraledger.legal-context` ONE key, not four), the tagged-array read of
|
|
9
|
+
* the `links` discovery alias, strength-ordered extraction, purity, and every refusal the vectors pin. This
|
|
10
|
+
* file adds only the rule that is UCP's semantics rather than any container's mechanics: **a terms link must
|
|
11
|
+
* be HTTPS.** An `http:` URL is rewritable in transit, so accepting one would put an unauthenticated document
|
|
12
|
+
* behind a reference the record cites.
|
|
13
|
+
*
|
|
14
|
+
* This is the composition S7 anticipates — generic mechanics, protocol-specific semantics layered on top —
|
|
15
|
+
* and it wraps `extract`, not `place`: `place` never writes the links alias (the terms URL is the
|
|
16
|
+
* DEPLOYMENT's datum, not the reference — see the manifest), so the write side has no URL to police.
|
|
17
|
+
*
|
|
18
|
+
* **Scoped to url-typed results, deliberately.** A sha256 answer must never be blocked by a bad link sitting
|
|
19
|
+
* beside it — the capability WINS over links, and refusing the winner for the loser's defect would invert the
|
|
20
|
+
* strength order. The vector "the capability WINS over links when both are present — even when the link is
|
|
21
|
+
* http:" pins exactly this. The scope is by TYPE, not by which carrier answered: a url-typed reference is
|
|
22
|
+
* legal in the capability too, and an http: URL there is exactly as rewritable as one in `links`.
|
|
23
|
+
*/
|
|
24
|
+
export const ucpPlacement = {
|
|
25
|
+
...base,
|
|
26
|
+
extract(doc) {
|
|
27
|
+
const out = base.extract(doc);
|
|
28
|
+
if ("refused" in out)
|
|
29
|
+
return out;
|
|
30
|
+
if (out.value.type === "url" && !out.value.value.startsWith("https://"))
|
|
31
|
+
return {
|
|
32
|
+
refused: true,
|
|
33
|
+
haltClass: "verification-failure",
|
|
34
|
+
code: "ucp/insecure-terms-url",
|
|
35
|
+
detail: `a terms link must be HTTPS — an http: reference is rewritable in transit: ${out.value.value}`,
|
|
36
|
+
};
|
|
37
|
+
return out;
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=placement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"placement.js","sourceRoot":"","sources":["../src/placement.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,GAEd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,IAAI,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,YAAY,GAA8B;IACrD,GAAG,IAAI;IACP,OAAO,CAAC,GAAY;QAClB,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC9B,IAAI,SAAS,IAAI,GAAG;YAAE,OAAO,GAAG,CAAC;QACjC,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC;YACrE,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,sBAAsB;gBACjC,IAAI,EAAE,wBAAwB;gBAC9B,MAAM,EAAE,6EAA6E,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE;aACvG,CAAC;QACJ,OAAO,GAAG,CAAC;IACb,CAAC;CACF,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@integraledger/lcp-placement-ucp",
|
|
3
|
+
"version": "0.9.0",
|
|
4
|
+
"description": "Places an LCP reference into a UCP (Universal Commerce Protocol) checkout, and reads it back.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"lcp",
|
|
7
|
+
"legal-context-protocol",
|
|
8
|
+
"legal-terms",
|
|
9
|
+
"agentic-commerce",
|
|
10
|
+
"placement",
|
|
11
|
+
"ucp"
|
|
12
|
+
],
|
|
13
|
+
"type": "module",
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./package.json": "./package.json"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"src",
|
|
25
|
+
"CHANGELOG.md",
|
|
26
|
+
"LICENSE",
|
|
27
|
+
"NOTICE"
|
|
28
|
+
],
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"registry": "https://registry.npmjs.org",
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/IntegraLedger/integra-protocol.git",
|
|
36
|
+
"directory": "packages/placement-ucp"
|
|
37
|
+
},
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/IntegraLedger/integra-protocol/issues"
|
|
40
|
+
},
|
|
41
|
+
"homepage": "https://github.com/IntegraLedger/integra-protocol/tree/main/packages/placement-ucp#readme",
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@integraledger/lcp-binding-core": "0.9.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@cfworker/json-schema": "4.1.1",
|
|
47
|
+
"@types/node": "24.13.3",
|
|
48
|
+
"vitest": "4.1.10"
|
|
49
|
+
},
|
|
50
|
+
"license": "Apache-2.0",
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=24"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "tsc -p tsconfig.build.json",
|
|
56
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
57
|
+
"test": "vitest run"
|
|
58
|
+
}
|
|
59
|
+
}
|
package/src/index.ts
ADDED
package/src/manifest.ts
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { PlacementManifest } from "@integraledger/lcp-binding-core";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* UCP (Universal Commerce Protocol) reference placement, cut against the live spec (2026-04-08, ucp.dev —
|
|
5
|
+
* overview §capabilities, §namespace-governance, §intersection-algorithm, and the checkout capability's
|
|
6
|
+
* response schema), gate discharged 2026-07-29 against LCP v1.37 §C.3, and re-cut against the live UCP schemas and v1.38 §C.3
|
|
7
|
+
* on 2026-08-08 when the canonical carrier moved.
|
|
8
|
+
*
|
|
9
|
+
* **THE CANONICAL CARRIER IS A `policies[]` ENTRY, AND UCP HAS NO `extensions` MAP TO WRITE INTO.** A
|
|
10
|
+
* vendor capability under an authority-bound reverse-domain namespace is a real UCP surface — it is what
|
|
11
|
+
* `/.well-known/ucp` advertisement uses — but a checkout RESPONSE carries no map to read one back out of.
|
|
12
|
+
* Verified at
|
|
13
|
+
* `universal-commerce-protocol/ucp` HEAD 2026-08-08, `source/schemas/shopping/checkout.json` has eighteen
|
|
14
|
+
* properties — actions, attribution, buyer, context, continue_url, currency, expires_at, id, line_items,
|
|
15
|
+
* links, messages, order, payment, policies, signals, status, totals, ucp — and `extensions` is not among
|
|
16
|
+
* them. Its own description reads "Base checkout schema. Extensions compose onto this using allOf": UCP
|
|
17
|
+
* extensions surface as top-level fields via schema composition, not as entries in a map.
|
|
18
|
+
*
|
|
19
|
+
* **The failure mode was SILENCE, which is worse than rejection.** `checkout.json` is
|
|
20
|
+
* `additionalProperties: true`, so the write landed on every document and was read by nothing. A refused
|
|
21
|
+
* write is a bug report; an accepted write nobody reads is a placement that reports success forever while
|
|
22
|
+
* carrying no legal context at all.
|
|
23
|
+
*
|
|
24
|
+
* **`policies[]` is in the base schema and needs nothing negotiated.** Verified at HEAD
|
|
25
|
+
* (`source/schemas/shopping/types/policy.json`): `required: ["type", "description"]`,
|
|
26
|
+
* `additionalProperties: true`, and `type` is an open reverse-DNS vocabulary — "Businesses MAY define
|
|
27
|
+
* custom types in their own domain (e.g., `com.example.policy.price_match`). Platforms MUST tolerate
|
|
28
|
+
* unknown values." It is also per-transaction by the schema's own words: "A durable business rule about
|
|
29
|
+
* the items in a response … at the time of purchase." So the reference travels with the checkout it
|
|
30
|
+
* governs, with no negotiated intersection, no hosted schema at the namespace authority, and no
|
|
31
|
+
* capability the counterparty can silently prune.
|
|
32
|
+
*
|
|
33
|
+
* **`description` is REQUIRED, and it is an OBJECT.** An entry carrying only `type` and our reference
|
|
34
|
+
* fails UCP's own schema, so the container declares `constants` and the writer emits them — otherwise
|
|
35
|
+
* this placement would put an invalid document on the wire, which is the shape-assertion this seam
|
|
36
|
+
* refuses. `description` is a Description (`{plain|html|markdown}`, `minProperties: 1`), NOT a bare
|
|
37
|
+
* string. The constants are written only when the entry is CREATED: a counterparty that already declared
|
|
38
|
+
* this policy type wrote its own prose, and overwriting it to place our reference would be an edit to
|
|
39
|
+
* their document nobody asked for.
|
|
40
|
+
*
|
|
41
|
+
* **The reference field is reverse-DNS namespaced**, `com.integraledger.legal_context`, because
|
|
42
|
+
* `additionalProperties: true` tolerates an added key but UCP's own convention namespaces
|
|
43
|
+
* extension-contributed keys — `reverse_domain_name.json` names exactly that use. A bare `value` would be
|
|
44
|
+
* an unnamespaced claim on a shared object.
|
|
45
|
+
*
|
|
46
|
+
* **pattern is `http-advisory`, NOT `protocol-extension`, on the same reasoning applied to ACP.** UCP
|
|
47
|
+
* does nothing atrHash-aware with the entry — §8.3.6 means the HOST protocol's own verification and
|
|
48
|
+
* settlement procedure understands the hash, which no UCP implementation does. §8.3.6 is also Tier B by
|
|
49
|
+
* definition, which would misdescribe a carrier that works today against stock UCP. The schema rejects
|
|
50
|
+
* the protocol-extension/Tier-A pairing outright.
|
|
51
|
+
*
|
|
52
|
+
* **The vendor capability is not gone, it is just not the carrier.** `/.well-known/ucp` advertisement
|
|
53
|
+
* remains a real UCP surface and `discovery` implements it — that is where the authority-bound namespace
|
|
54
|
+
* reasoning belongs, and it is correct there. What was wrong was believing a checkout RESPONSE carries an
|
|
55
|
+
* `extensions` map to read it back out of.
|
|
56
|
+
*
|
|
57
|
+
* **The links entry is the declared DISCOVERY alias, and it has no `write` flag — deliberately.** §C.3's
|
|
58
|
+
* limitation is real: a vendor capability the counterparty did not declare is SILENTLY pruned from the
|
|
59
|
+
* negotiated intersection, so the deployment SHOULD publish terms at the `links` level too, where discovery
|
|
60
|
+
* does not depend on negotiation. But the links entry carries the terms URL — a DIFFERENT datum than the
|
|
61
|
+
* atrHash — and `place(ref, doc)` holds one reference, not two data: writing `ref.value` into `links[].url`
|
|
62
|
+
* would put a bare hash where every UCP client expects a URL. Publishing the links entry is the
|
|
63
|
+
* DEPLOYMENT's act (UCP already makes `links[]` REQUIRED on checkout responses with `terms_of_service` a
|
|
64
|
+
* recommended type — a conformant merchant publishes it as part of being a UCP merchant at all), and this
|
|
65
|
+
* placement READS it: extract falls to the alias when the capability was pruned, the `url` carrier type
|
|
66
|
+
* itself signalling discovery-not-integrity. The gate also found the "closed enum" claim false —
|
|
67
|
+
* `links[].type` is an OPEN set ("Businesses MAY define custom types"); the well-known `terms_of_service`
|
|
68
|
+
* tag is used because it is the spelling counterparties already read, not because it is the only one legal.
|
|
69
|
+
*
|
|
70
|
+
* **`termsUrlField` is deliberately OMITTED.** The terms URL rides `links[type=terms_of_service].url` — a
|
|
71
|
+
* tagged-array locator that a dotted-path parser cannot resolve. Declaring it as `termsUrlField` would
|
|
72
|
+
* repeat the defect S7 fixed for `field`: a declared property that is not the declared thing. The discovery
|
|
73
|
+
* alias states the same fact WITH its machine-readable container, and the `PlacementManifest` contract says
|
|
74
|
+
* an absent `termsUrlField` means a parser must not demand one.
|
|
75
|
+
*
|
|
76
|
+
* **`carrierTypes` permits `sha256` and `url`, and `url` is load-bearing.** extract checks every decoded
|
|
77
|
+
* reference against this list, so the discovery alias's url-typed hits would refuse
|
|
78
|
+
* `carrier-type-not-permitted` without it. The capability's own schema (ours, published at the namespace
|
|
79
|
+
* authority when advertised) pins `sha256`; a url-typed reference in the capability is legal but adds
|
|
80
|
+
* nothing over the links entry. `ipfs`/`ar` are excluded: §C.3's example carries a sha256 and our schema
|
|
81
|
+
* should not advertise carrier forms no UCP counterparty has ever seen.
|
|
82
|
+
*
|
|
83
|
+
* UCP settles through whatever payment method the checkout selects, and that settlement is NOT this
|
|
84
|
+
* package's business — the same division ACP draws: a bound rail welds the record; otherwise this
|
|
85
|
+
* placement is the record's whole protocol reach and reads with an honest `not-attempted` at
|
|
86
|
+
* settlement-enumeration.
|
|
87
|
+
*/
|
|
88
|
+
export const UCP_PLACEMENT: PlacementManifest = {
|
|
89
|
+
protocol: "ucp",
|
|
90
|
+
pattern: "http-advisory",
|
|
91
|
+
tier: "A",
|
|
92
|
+
encoding: "reference-object",
|
|
93
|
+
container: {
|
|
94
|
+
kind: "tagged-array",
|
|
95
|
+
at: "policies",
|
|
96
|
+
tagField: "type",
|
|
97
|
+
tag: "com.integraledger.policy.legal_context",
|
|
98
|
+
valueField: "com.integraledger.legal_context",
|
|
99
|
+
// `description` is REQUIRED by UCP's policy schema alongside `type`, so an entry without one is an
|
|
100
|
+
// invalid document. Verified at UCP HEAD 2026-08-08 (source/schemas/shopping/types/policy.json):
|
|
101
|
+
// `required: ["type","description"]`, and `description` is a Description OBJECT — {plain|html|markdown},
|
|
102
|
+
// minProperties 1 — not a bare string.
|
|
103
|
+
constants: {
|
|
104
|
+
description: {
|
|
105
|
+
plain:
|
|
106
|
+
"Terms of sale for this order, identified by a Legal Context Protocol reference. The reference identifies the exact terms document; it is not itself the terms.",
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
field: "policies[type=com.integraledger.policy.legal_context]",
|
|
111
|
+
readAlso: [
|
|
112
|
+
{
|
|
113
|
+
path: "links[type=terms_of_service].url",
|
|
114
|
+
encoding: "bare-value",
|
|
115
|
+
bareType: "url",
|
|
116
|
+
carrierClass: "discovery",
|
|
117
|
+
container: {
|
|
118
|
+
kind: "tagged-array",
|
|
119
|
+
at: "links",
|
|
120
|
+
tagField: "type",
|
|
121
|
+
tag: "terms_of_service",
|
|
122
|
+
valueField: "url",
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
carrierTypes: ["sha256", "url"],
|
|
127
|
+
specRef:
|
|
128
|
+
"UCP checkout — policies[] entry under a reverse-DNS custom type (source/schemas/shopping/types/policy.json: base schema, required [type, description], additionalProperties true, type an open reverse-DNS vocabulary whose unknown values platforms MUST tolerate); checkout links[] entry typed terms_of_service (both re-verified at HEAD 2026-08-08: see README)",
|
|
129
|
+
};
|
package/src/placement.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
makePlacement,
|
|
3
|
+
type ReferencePlacementAdapter,
|
|
4
|
+
} from "@integraledger/lcp-binding-core";
|
|
5
|
+
import { UCP_PLACEMENT } from "./manifest.js";
|
|
6
|
+
|
|
7
|
+
const base = makePlacement(UCP_PLACEMENT);
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The UCP reference placement — the kit plus ONE protocol rule the kit cannot know.
|
|
11
|
+
*
|
|
12
|
+
* `makePlacement(UCP_PLACEMENT)` supplies everything structural: the dotted-key capability write (the
|
|
13
|
+
* container's `segments` make `com.integraledger.legal-context` ONE key, not four), the tagged-array read of
|
|
14
|
+
* the `links` discovery alias, strength-ordered extraction, purity, and every refusal the vectors pin. This
|
|
15
|
+
* file adds only the rule that is UCP's semantics rather than any container's mechanics: **a terms link must
|
|
16
|
+
* be HTTPS.** An `http:` URL is rewritable in transit, so accepting one would put an unauthenticated document
|
|
17
|
+
* behind a reference the record cites.
|
|
18
|
+
*
|
|
19
|
+
* This is the composition S7 anticipates — generic mechanics, protocol-specific semantics layered on top —
|
|
20
|
+
* and it wraps `extract`, not `place`: `place` never writes the links alias (the terms URL is the
|
|
21
|
+
* DEPLOYMENT's datum, not the reference — see the manifest), so the write side has no URL to police.
|
|
22
|
+
*
|
|
23
|
+
* **Scoped to url-typed results, deliberately.** A sha256 answer must never be blocked by a bad link sitting
|
|
24
|
+
* beside it — the capability WINS over links, and refusing the winner for the loser's defect would invert the
|
|
25
|
+
* strength order. The vector "the capability WINS over links when both are present — even when the link is
|
|
26
|
+
* http:" pins exactly this. The scope is by TYPE, not by which carrier answered: a url-typed reference is
|
|
27
|
+
* legal in the capability too, and an http: URL there is exactly as rewritable as one in `links`.
|
|
28
|
+
*/
|
|
29
|
+
export const ucpPlacement: ReferencePlacementAdapter = {
|
|
30
|
+
...base,
|
|
31
|
+
extract(doc: unknown) {
|
|
32
|
+
const out = base.extract(doc);
|
|
33
|
+
if ("refused" in out) return out;
|
|
34
|
+
if (out.value.type === "url" && !out.value.value.startsWith("https://"))
|
|
35
|
+
return {
|
|
36
|
+
refused: true,
|
|
37
|
+
haltClass: "verification-failure",
|
|
38
|
+
code: "ucp/insecure-terms-url",
|
|
39
|
+
detail: `a terms link must be HTTPS — an http: reference is rewritable in transit: ${out.value.value}`,
|
|
40
|
+
};
|
|
41
|
+
return out;
|
|
42
|
+
},
|
|
43
|
+
};
|