Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf5fa54f44 | ||
|
|
c6528c2887 | ||
|
|
b196047b57 | ||
|
|
ea49cb0586 | ||
|
|
da559de912 | ||
|
|
193ca89d93 |
@@ -0,0 +1,16 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to the published WIP Rust crates are documented here.
|
||||
|
||||
## 0.1.0
|
||||
|
||||
Initial public release of:
|
||||
|
||||
- `wip-protocol`: transport-independent WIP logical model and validation.
|
||||
- `wip-interface-macros`: procedural-macro implementation for interface and DTO declarations.
|
||||
- `wip-interface`: public Rust interface-authoring facade and typed value codecs.
|
||||
- `wip-host`: request-scoped publication, precondition validation, and qualified operation dispatch.
|
||||
- `wip-http`: framework-independent WIP over HTTP v1 routes, strict JSON codecs, and failure classification.
|
||||
- `wip-client`: stateful Known Space, interest-driven acquisition, request ownership, and operation lifecycle.
|
||||
|
||||
The repository also contains non-published filesystem server, terminal client, and public-API conformance packages.
|
||||
Generated
+2
-2
@@ -1341,9 +1341,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "yoke-derive"
|
||||
version = "0.8.3"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33811428bee40dbceb6d545e95754741d17a6aef9a4849f0fd62e2ba4f412a78"
|
||||
checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
||||
+16
@@ -1,3 +1,19 @@
|
||||
[workspace]
|
||||
members = ["crates/*"]
|
||||
resolver = "3"
|
||||
|
||||
[workspace.package]
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
rust-version = "1.88"
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://gitea.hareworks.net/Hare/wip-rs"
|
||||
|
||||
[workspace.dependencies]
|
||||
wip-client = { version = "0.1.0", path = "crates/wip-client" }
|
||||
wip-fs-server = { version = "0.1.0", path = "crates/wip-fs-server" }
|
||||
wip-host = { version = "0.1.0", path = "crates/wip-host" }
|
||||
wip-http = { version = "0.1.0", path = "crates/wip-http" }
|
||||
wip-interface = { version = "0.1.0", path = "crates/wip-interface" }
|
||||
wip-interface-macros = { version = "0.1.0", path = "crates/wip-interface-macros" }
|
||||
wip-protocol = { version = "0.1.0", path = "crates/wip-protocol" }
|
||||
|
||||
+202
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Hare
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -13,29 +13,36 @@ repository root is not itself a package.
|
||||
## Crate graph and responsibilities
|
||||
|
||||
```text
|
||||
wip-tui (interactive Worldspace explorer and operation editor)
|
||||
├── wip-client Known Space, request identity, validators, and calls
|
||||
├── wip-http framework-neutral HTTP request/response messages
|
||||
└── wip-protocol descriptors and logical values
|
||||
Published libraries
|
||||
|
||||
wip-fs-server (request-time filesystem projection and loopback listener)
|
||||
├── wip-http standard routes/codecs/envelopes
|
||||
├── wip-host request-scoped publication and dispatch
|
||||
└── wip-interface macro-generated filesystem capabilities
|
||||
wip-client
|
||||
├── wip-http
|
||||
│ └── wip-protocol
|
||||
└── wip-protocol
|
||||
|
||||
wip-public-api-example (workspace-only executable, integration tests, doctest)
|
||||
├── wip-protocol logical declarations, values, calls, and validation
|
||||
├── wip-http standard HTTP v1 routes, JSON codecs, and envelopes
|
||||
wip-host
|
||||
├── wip-interface
|
||||
│ ├── wip-interface-macros
|
||||
│ └── wip-protocol
|
||||
├── wip-client stateful Known Space, lazy tree, observation, and call runtime
|
||||
│ ├── wip-http
|
||||
│ └── wip-protocol
|
||||
├── wip-interface application DTO codecs and interface authoring facade
|
||||
│ ├── wip-protocol
|
||||
│ └── wip-interface-macros proc-macro implementation detail
|
||||
└── wip-host descriptor registry, publication, and qualified dispatch
|
||||
├── wip-interface
|
||||
└── wip-protocol
|
||||
└── wip-protocol
|
||||
|
||||
Workspace-only applications and conformance consumers
|
||||
|
||||
wip-tui
|
||||
├── wip-client
|
||||
├── wip-http
|
||||
└── wip-protocol
|
||||
|
||||
wip-fs-server
|
||||
├── wip-host
|
||||
├── wip-http
|
||||
├── wip-interface
|
||||
└── wip-protocol
|
||||
|
||||
wip-public-api-example
|
||||
├── wip-host
|
||||
├── wip-interface
|
||||
└── wip-protocol
|
||||
```
|
||||
|
||||
| Crate | Responsibility | Does not own |
|
||||
@@ -50,6 +57,21 @@ wip-public-api-example (workspace-only executable, integration tests, doctest)
|
||||
| `wip-fs-server` | Linux directory-handle-confined request-time projection, complete depth-bounded observations and bounded file operations, standard `wip-http` dispatch, and a loopback HTTP binary. | A new wire profile, implicit symlink following, non-loopback cleartext, authentication policy, TLS termination, or filesystem-wide preregistration. |
|
||||
| `wip-public-api-example` | An independently compiled consumer of the protocol, authoring, and host public crates. Its DTOs and traits are application-owned; its implementation and backend handle remain host-private. | Reusable library API or a production server. |
|
||||
|
||||
## Published crates
|
||||
|
||||
The `0.1.0` release consists of these six crates:
|
||||
|
||||
- `wip-protocol`
|
||||
- `wip-interface-macros` — implementation dependency re-exported by `wip-interface`
|
||||
- `wip-interface`
|
||||
- `wip-host`
|
||||
- `wip-http`
|
||||
- `wip-client`
|
||||
|
||||
The filesystem server, terminal client, and public-API example are workspace-only packages and set `publish = false`. All workspace packages require Rust 1.88 or newer and are licensed under either Apache-2.0 or MIT at your option.
|
||||
|
||||
See [RELEASING.md](RELEASING.md) for the dependency-ordered crates.io procedure and [CHANGELOG.md](CHANGELOG.md) for release contents.
|
||||
|
||||
The boundary is intentional: protocol types describe what can cross a
|
||||
transport; application DTOs opt into that model with `WipType`; a host-private
|
||||
implementation owns credentials, handles, and backend state; and `wip-http`
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
# Releasing
|
||||
|
||||
The six crates published from this workspace use one version and must be released in dependency order. The filesystem server, terminal client, and public-API example set `publish = false` and are never uploaded.
|
||||
|
||||
## Preconditions
|
||||
|
||||
1. Work from a clean `master` whose `HEAD` matches `origin/master`.
|
||||
2. Confirm the intended version in `[workspace.package]` and every internal requirement in `[workspace.dependencies]`.
|
||||
3. Confirm ownership of all six names on crates.io.
|
||||
4. Run the complete repository validation suite:
|
||||
|
||||
```console
|
||||
cargo fmt --all -- --check
|
||||
cargo check --workspace --all-targets
|
||||
cargo test --workspace --all-targets
|
||||
cargo test --workspace --doc
|
||||
cargo clippy --workspace --all-targets -- -D warnings
|
||||
RUSTDOCFLAGS='-D warnings' cargo doc --workspace --no-deps
|
||||
cargo run --package wip-public-api-example
|
||||
git diff --check
|
||||
```
|
||||
|
||||
## Publish order
|
||||
|
||||
Before uploading anything, dry-run the exact public package set together. Cargo uses a temporary local registry for unpublished workspace dependencies during this check:
|
||||
|
||||
```console
|
||||
cargo publish --dry-run --workspace \
|
||||
--exclude wip-fs-server \
|
||||
--exclude wip-public-api-example \
|
||||
--exclude wip-tui
|
||||
```
|
||||
|
||||
Then dry-run and publish each layer before moving to a crate that depends on it:
|
||||
|
||||
```console
|
||||
cargo publish --dry-run --package wip-protocol
|
||||
cargo publish --package wip-protocol
|
||||
|
||||
cargo publish --dry-run --package wip-interface-macros
|
||||
cargo publish --package wip-interface-macros
|
||||
```
|
||||
|
||||
Wait until both versions are available from the crates.io index, then continue:
|
||||
|
||||
```console
|
||||
cargo publish --dry-run --package wip-interface
|
||||
cargo publish --package wip-interface
|
||||
|
||||
cargo publish --dry-run --package wip-http
|
||||
cargo publish --package wip-http
|
||||
```
|
||||
|
||||
After those versions are available from the index:
|
||||
|
||||
```console
|
||||
cargo publish --dry-run --package wip-host
|
||||
cargo publish --package wip-host
|
||||
|
||||
cargo publish --dry-run --package wip-client
|
||||
cargo publish --package wip-client
|
||||
```
|
||||
|
||||
Registry propagation can take time. A dependent dry-run reporting that a WIP crate is unavailable means the previous publish is not visible in the selected registry yet; do not bypass verification.
|
||||
|
||||
## Tag
|
||||
|
||||
After all six uploads resolve successfully, tag the exact published commit and push the tag:
|
||||
|
||||
```console
|
||||
git tag -a v0.1.0 -m "release: 0.1.0"
|
||||
git push origin v0.1.0
|
||||
```
|
||||
|
||||
Do not move or recreate a published version or its tag. Prepare a new version for any subsequent correction.
|
||||
@@ -1,10 +1,14 @@
|
||||
[package]
|
||||
name = "wip-client"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
description = "Presentation-independent stateful WIP client runtime"
|
||||
license = "MIT OR Apache-2.0"
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
readme = "README.md"
|
||||
documentation = "https://docs.rs/wip-client"
|
||||
|
||||
[dependencies]
|
||||
wip-http = { path = "../wip-http" }
|
||||
wip-protocol = { path = "../wip-protocol" }
|
||||
wip-http.workspace = true
|
||||
wip-protocol.workspace = true
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Hare
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,16 @@
|
||||
# wip-client
|
||||
|
||||
Presentation-independent stateful runtime for Web Interface Protocol (WIP) clients.
|
||||
|
||||
`wip-client` manages endpoint- and security-context-isolated Known Space, object and Interface Descriptor observations, bounded request ownership, supersession, out-of-order response suppression, validator recovery, and operation call contexts. It produces and consumes framework-neutral `wip-http` messages but performs no network I/O and contains no UI types.
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
wip-client = "0.1.0"
|
||||
```
|
||||
|
||||
Applications provide the HTTP adapter and presentation layer, send each prepared request exactly as owned by the runtime, then return the corresponding response for completion.
|
||||
|
||||
See the [API documentation](https://docs.rs/wip-client) for session, acquisition, cache, and call APIs.
|
||||
|
||||
Licensed under either of Apache-2.0 or MIT at your option.
|
||||
@@ -1,19 +1,21 @@
|
||||
[package]
|
||||
name = "wip-fs-server"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
description = "Request-time filesystem projection server for WIP over HTTP"
|
||||
license = "MIT OR Apache-2.0"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
description = "Extensible request-time filesystem projection library and WIP over HTTP server"
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
readme = "README.md"
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
http = "1"
|
||||
rustix = { version = "1.1", features = ["fs"] }
|
||||
wip-host = { path = "../wip-host" }
|
||||
wip-http = { path = "../wip-http" }
|
||||
wip-interface = { path = "../wip-interface" }
|
||||
wip-protocol = { path = "../wip-protocol" }
|
||||
wip-host.workspace = true
|
||||
wip-http.workspace = true
|
||||
wip-interface.workspace = true
|
||||
wip-protocol.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3"
|
||||
|
||||
@@ -6,6 +6,119 @@ keep one object instance per entry. It uses `wip-host` for publication and typed
|
||||
operation dispatch and uses the standard `wip-http` routes, JSON codecs,
|
||||
envelopes, and HTTP status mapping.
|
||||
|
||||
## Library assembly and migration
|
||||
|
||||
The existing `ServerConfig`, `WipFsServer::new`, `handle_http`, CLI flags and wire
|
||||
representation remain compatible. The formerly private projection has become a
|
||||
public, generic library engine. No package version or publication policy changes
|
||||
are required.
|
||||
|
||||
Use `default_projection(root, access, limits)` to obtain the default Linux engine
|
||||
without starting a listener. `projection.view(&principal)` is the effective view;
|
||||
it owns canonical `observe` and `fetch_interface` and implements the standard
|
||||
`wip_host::ObjectProvider` typed `call_operation` API. `DefaultPolicy` has the unit
|
||||
principal `()`; default engines also offer unit-principal convenience methods.
|
||||
|
||||
For an external backend/composition:
|
||||
|
||||
1. Implement `BackendEntry` on a local, cloneable, root-confined stable capability.
|
||||
Its `WipObject` metadata is public-only; its validator binds identity and the
|
||||
protected state. Implement `FilesystemBackend` to resolve one connected
|
||||
`ResolvedEntry<Entry>` (root-to-parent ancestry plus pinned target), enumerate
|
||||
bounded children, and execute against that already-resolved lineage.
|
||||
2. Register generated `#[wip_interface::interface]` definitions using the existing
|
||||
`wip_host::InterfaceRegistry`. `DefaultInterfaces::register` optionally supplies
|
||||
reusable built-in tokens; using those tokens does not force their publication.
|
||||
3. Implement `Composition<Entry>` on a local type. Its local Object wraps the entry
|
||||
and implements both `WipObject` and the chosen generated traits, avoiding orphan
|
||||
rules. `PublishedObject::expose` proves each implementation at compile time.
|
||||
Publication can add, replace, reorder or omit built-ins based on entry metadata
|
||||
and actual backend capabilities, not just entry kind. `LinuxEntry` implements
|
||||
bounded `FileRead`, `FileWrite` and `SymlinkInspect` for safe delegation; never
|
||||
advertise write in read-only mode or link operations on a non-link capability.
|
||||
4. Assemble `Projection::new(backend, registry, composition, policy, limits)`.
|
||||
`ProjectionPolicy` supplies an opaque associated `Principal`, hides Objects and
|
||||
entire hidden subtrees, selects an ordered subset of implemented interfaces,
|
||||
controls descriptor/operation visibility, and permits or denies execution.
|
||||
5. An authenticated deployment chooses the principal and `ExecutionContext`. To
|
||||
use HTTP, construct `HttpAdapter::new(&view, &endpoint, limits)` and invoke
|
||||
`handle_http_with_context`. This uses the standard `wip-http` binding, not a
|
||||
filesystem wire profile. Enforce body collection, header, concurrency and
|
||||
deadline bounds in the deployment's listener; the adapter owns none of these
|
||||
intake resources. The bundled loopback listener remains a thin default user.
|
||||
|
||||
A complete external-style memory backend, local Object with multiple custom
|
||||
Operations, typed registration, principal policy and HTTP flow is exercised in
|
||||
[`tests/extensions.rs`](tests/extensions.rs). It uses no Linux filesystem for its
|
||||
backend. The public library APIs do not require private types, a fork, an HTTP
|
||||
listener, a global object registry, or dynamic plugin loading.
|
||||
|
||||
### Extension security contract
|
||||
|
||||
Backend implementations and Operation authors are trusted code, not sandboxed
|
||||
plugins. `FilesystemBackend::resolve` returns `ResolvedEntry::new(ancestors, target)`
|
||||
from one connected backend traversal/snapshot, not independent path-prefix
|
||||
resolutions. A root target has no ancestors; other targets retain the root first,
|
||||
then intermediate parent containers. This is backend-private context, never wire
|
||||
metadata. Backend `resolve` and `execute` signatures both carry this type;
|
||||
compositions still receive only the exact scoped target `Entry`.
|
||||
|
||||
`FilesystemBackend::execute` must validate ancestor membership/identity and
|
||||
refresh **all** lineage state/validators inside its transaction or lock before
|
||||
calling the engine callback, retaining the same target and connected ancestry
|
||||
through validation and dispatch. Replaced/detached ancestors must return
|
||||
`NotFound` without callback invocation, even when the replacement is visible.
|
||||
The engine evaluates Object visibility for every refreshed ancestor and target
|
||||
inside that same boundary; a hidden ancestor rejects the entire subtree before
|
||||
publication/typed dispatch. Never fix a changed lineage by resolving the raw path
|
||||
again and substituting capabilities. Participating policy-relevant backend state
|
||||
changes must be serialized by this boundary, not just target-content writes.
|
||||
Return the committed post-operation validator. Retained ancestry is subject to
|
||||
handle/work ceilings; resource exhaustion is an error, not missing ancestry.
|
||||
Confirm rollback only after rollback succeeds. Pre-dispatch failures
|
||||
must never commit; failed started operations without a non-commit guarantee remain
|
||||
`OperationOutcomeUnknown`. Object implementations must delegate validators to
|
||||
that entry and declare requirements per `(InterfaceRef, operation)`, rather than
|
||||
classify all operations by a read/write name. Operations use the scoped entry and
|
||||
propagated context, not a fresh raw-path resolution; they must check deadlines,
|
||||
cancellation and resource budgets throughout backend work and report effects
|
||||
truthfully. POSIX symlinks, identity, atomic mutations and locking cannot be assumed
|
||||
for other backends.
|
||||
|
||||
The default Linux backend acquires advisory exclusive locks in root-to-parent
|
||||
order and then on the lockable target (directory or regular file). It compares
|
||||
retained ancestor identity to no-follow descriptor-relative lookup results,
|
||||
refreshes lineage snapshots after acquiring the locks, and holds the guards
|
||||
through post-dispatch state observation. The configured root remains its pinned
|
||||
capability even if its textual path is renamed; replaced intermediate ancestors
|
||||
are rejected. Leaf path replacement never redirects execution to a new inode.
|
||||
This serializes cooperating library calls; it does **not** promise transactional
|
||||
isolation from unrelated processes ignoring `flock`. Linux capabilities only
|
||||
expose bounded methods, not raw descriptors or backend paths.
|
||||
|
||||
A policy must be stable/deterministic within one effective Worldspace view.
|
||||
Interface/operation visibility is uniform per registered reference within that
|
||||
view, so observation, fetch and dispatch use the identical filtered descriptor.
|
||||
For entry-specific operation sets, register distinct interface definitions and
|
||||
select them by entry. Different principals may have different effective views.
|
||||
Changing a policy must establish a new view/reference lifetime (e.g. rebuild the
|
||||
registry/engine); do not keep validator-free references while changing their
|
||||
meaning. Execution permission may deny a visible Operation without hiding it.
|
||||
A published interface is always fetchable by that principal; hidden operations
|
||||
are omitted (along with their unreachable named types and interface-wide docs)
|
||||
and guessed calls return `OperationNotFound`, whereas visible denied
|
||||
operations return `PermissionDenied`. Hidden Objects and descendants return
|
||||
`NotFound` and are absent from parent observations. Work spent scanning hidden
|
||||
entries still counts against traversal bounds; resource limits are not a
|
||||
constant-time/side-channel guarantee.
|
||||
|
||||
Never put absolute paths, hidden metadata, credentials or policy internals in
|
||||
public `WipObject` metadata, descriptions, validators or normal logs. Validators
|
||||
must be opaque public tokens, not confidential content. Engine/HTTP failures use
|
||||
bounded generic diagnostics; arbitrary trusted implementation metadata/logging
|
||||
cannot be sanitized automatically. Do not log credentials or sensitive panic
|
||||
payloads from extensions.
|
||||
|
||||
## Security model
|
||||
|
||||
- The effective root is opened once as a directory capability. Root path
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
//! Reusable default Linux composition; no listener or authentication dependency.
|
||||
use crate::engine::{BackendEntry, Composition, DefaultPolicy, EntryKind, Projection};
|
||||
use crate::interfaces::{
|
||||
FileRead, FileReadDefinition, FileWrite, FileWriteDefinition, SymlinkInspect,
|
||||
SymlinkInspectDefinition,
|
||||
};
|
||||
use crate::projection::{LinuxBackend, LinuxEntry};
|
||||
use crate::{AccessMode, ResourceLimits};
|
||||
use wip_host::{
|
||||
ExecutionContext, HostError, InterfaceRef, InterfaceRegistry, PublishedObject,
|
||||
RegisteredInterface, RegistrationError, Validator, WipObject,
|
||||
};
|
||||
use wip_interface as wip;
|
||||
|
||||
/// Registered built-in interfaces, usable by external compositions and Objects.
|
||||
pub struct DefaultInterfaces {
|
||||
/// Bounded regular-file reads.
|
||||
pub read: RegisteredInterface<FileReadDefinition>,
|
||||
/// No-follow link inspection.
|
||||
pub symlink: RegisteredInterface<SymlinkInspectDefinition>,
|
||||
/// Validator-protected replacement.
|
||||
pub write: RegisteredInterface<FileWriteDefinition>,
|
||||
}
|
||||
impl DefaultInterfaces {
|
||||
/// Register reusable default descriptors without publishing any objects.
|
||||
pub fn register(registry: &mut InterfaceRegistry) -> Result<Self, RegistrationError> {
|
||||
Ok(Self {
|
||||
read: registry.register(FileReadDefinition, None)?,
|
||||
symlink: registry.register(SymlinkInspectDefinition, None)?,
|
||||
write: registry.register(FileWriteDefinition, None)?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// Default capability-aware Linux publication, independent of HTTP.
|
||||
pub struct DefaultComposition {
|
||||
interfaces: DefaultInterfaces,
|
||||
}
|
||||
impl DefaultComposition {
|
||||
/// Use previously registered built-in interface tokens.
|
||||
pub fn new(interfaces: DefaultInterfaces) -> Self {
|
||||
Self { interfaces }
|
||||
}
|
||||
}
|
||||
|
||||
/// Request-scoped default Object; external Objects may instead wrap `LinuxEntry`.
|
||||
pub struct DefaultObject {
|
||||
entry: LinuxEntry,
|
||||
write: InterfaceRef,
|
||||
}
|
||||
impl DefaultObject {
|
||||
/// The pinned, bounded capability used by every operation on this Object.
|
||||
pub fn entry(&self) -> &LinuxEntry {
|
||||
&self.entry
|
||||
}
|
||||
}
|
||||
impl WipObject for DefaultObject {
|
||||
fn name(&self) -> &str {
|
||||
self.entry.name()
|
||||
}
|
||||
fn description(&self) -> Option<&str> {
|
||||
self.entry.description()
|
||||
}
|
||||
fn reference(&self) -> Option<&str> {
|
||||
self.entry.reference()
|
||||
}
|
||||
fn validator(&self) -> Option<&Validator> {
|
||||
self.entry.validator()
|
||||
}
|
||||
fn requires_validator(&self, interface: &InterfaceRef, operation: &str) -> bool {
|
||||
interface == &self.write && operation == "replace"
|
||||
}
|
||||
}
|
||||
impl FileRead for DefaultObject {
|
||||
fn read(&self, offset: Option<u64>, length: Option<u64>) -> wip::OperationResult<wip::Bytes> {
|
||||
self.entry.read(offset, length)
|
||||
}
|
||||
}
|
||||
impl SymlinkInspect for DefaultObject {
|
||||
fn read_link(&self) -> wip::OperationResult<wip::Bytes> {
|
||||
self.entry.read_link()
|
||||
}
|
||||
}
|
||||
impl FileWrite for DefaultObject {
|
||||
fn replace(&self, contents: wip::Bytes) -> wip::OperationResult<()> {
|
||||
self.entry.replace(contents)
|
||||
}
|
||||
}
|
||||
impl Composition<LinuxEntry> for DefaultComposition {
|
||||
type Object = DefaultObject;
|
||||
fn publish(
|
||||
&self,
|
||||
entry: LinuxEntry,
|
||||
_: &ExecutionContext,
|
||||
) -> Result<PublishedObject<Self::Object>, HostError> {
|
||||
let kind = entry.kind();
|
||||
let writable = entry.access_mode() == AccessMode::ReadWrite;
|
||||
let mut publication = PublishedObject::new(DefaultObject {
|
||||
entry,
|
||||
write: self.interfaces.write.reference().clone(),
|
||||
});
|
||||
match kind {
|
||||
EntryKind::Regular => {
|
||||
publication = publication
|
||||
.expose(&self.interfaces.read)
|
||||
.map_err(publication_error)?;
|
||||
if writable {
|
||||
publication = publication
|
||||
.expose(&self.interfaces.write)
|
||||
.map_err(publication_error)?;
|
||||
}
|
||||
}
|
||||
EntryKind::Symlink => {
|
||||
publication = publication
|
||||
.expose(&self.interfaces.symlink)
|
||||
.map_err(publication_error)?;
|
||||
}
|
||||
EntryKind::Directory | EntryKind::Unsupported => {}
|
||||
}
|
||||
Ok(publication)
|
||||
}
|
||||
}
|
||||
fn publication_error(_: wip_host::PublicationError) -> HostError {
|
||||
HostError::internal(
|
||||
"default publication failed",
|
||||
wip_host::EffectGuarantee::NotCommitted,
|
||||
)
|
||||
}
|
||||
|
||||
/// Construct the secure-by-default Linux engine without binding a listener.
|
||||
pub fn default_projection(
|
||||
root: &std::path::Path,
|
||||
access: AccessMode,
|
||||
limits: ResourceLimits,
|
||||
) -> Result<Projection<LinuxBackend, DefaultComposition, DefaultPolicy>, std::io::Error> {
|
||||
let backend = LinuxBackend::open(root, access, limits)?;
|
||||
let mut registry = InterfaceRegistry::new();
|
||||
let interfaces = DefaultInterfaces::register(&mut registry).map_err(std::io::Error::other)?;
|
||||
Ok(Projection::new(
|
||||
backend,
|
||||
registry,
|
||||
DefaultComposition::new(interfaces),
|
||||
DefaultPolicy,
|
||||
limits,
|
||||
))
|
||||
}
|
||||
@@ -0,0 +1,661 @@
|
||||
//! Transport-independent projection, publication, and principal view boundaries.
|
||||
|
||||
use crate::ResourceLimits;
|
||||
use wip_host::{
|
||||
EffectGuarantee, ExecutionContext, HostError, InterfaceRef, InterfaceRegistry, ObjectProvider,
|
||||
OperationAttempt, ProviderResult, PublishedObject, WipObject,
|
||||
};
|
||||
use wip_protocol::{
|
||||
FetchInterfaceRequest, FetchInterfaceResponse, ObjectObservation, ObserveRequest,
|
||||
ObserveResponse, ProtocolError, ProtocolErrorCode,
|
||||
};
|
||||
|
||||
/// Portable entry classification; capabilities must not be inferred from kind alone.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum EntryKind {
|
||||
/// Container whose children can be enumerated.
|
||||
Directory,
|
||||
/// Regular data entry.
|
||||
Regular,
|
||||
/// Link itself, never implicitly followed.
|
||||
Symlink,
|
||||
/// Metadata-only entry unless the composition supplies a capability.
|
||||
Unsupported,
|
||||
}
|
||||
|
||||
/// A root-confined, request-time capability, not a path to resolve again.
|
||||
///
|
||||
/// Metadata must be safe for public exposure. Validators bind both identity and
|
||||
/// protected state. Cloning must retain the same target rather than re-resolve it.
|
||||
pub trait BackendEntry: WipObject + Clone {
|
||||
/// Classification for observation and publication selection.
|
||||
fn kind(&self) -> EntryKind;
|
||||
}
|
||||
|
||||
/// A single resolved target together with its retained root-to-parent lineage.
|
||||
///
|
||||
/// The backend must resolve a connected lineage, never independent raw-path
|
||||
/// prefixes. At execution it validates ancestor membership/identity, refreshes
|
||||
/// their policy metadata, and pins that snapshot through dispatch. Target
|
||||
/// replacement must not redirect the original capability. This value is private
|
||||
/// backend context, not protocol metadata.
|
||||
#[derive(Clone)]
|
||||
pub struct ResolvedEntry<E> {
|
||||
ancestors: Vec<E>,
|
||||
target: E,
|
||||
}
|
||||
|
||||
impl<E> ResolvedEntry<E> {
|
||||
/// Create backend resolution context. `/` has no ancestors; a non-root target
|
||||
/// has the pinned root first, followed by its intermediate parent containers.
|
||||
pub fn new(ancestors: Vec<E>, target: E) -> Self {
|
||||
Self { ancestors, target }
|
||||
}
|
||||
/// Pinned ancestor capabilities, ordered from the root to the direct parent.
|
||||
pub fn ancestors(&self) -> &[E] {
|
||||
&self.ancestors
|
||||
}
|
||||
/// The original resolved target capability, never a redirected replacement.
|
||||
pub fn target(&self) -> &E {
|
||||
&self.target
|
||||
}
|
||||
/// Consume this snapshot for refresh or request-time publication.
|
||||
pub fn into_parts(self) -> (Vec<E>, E) {
|
||||
(self.ancestors, self.target)
|
||||
}
|
||||
}
|
||||
|
||||
/// Trusted backend boundary. Implementations need not use POSIX semantics.
|
||||
///
|
||||
/// Resolve and enumerate pinned capabilities within the configured root. Enforce
|
||||
/// context cancellation, deadlines and work budgets during backend work. Do not
|
||||
/// advertise capabilities the backend cannot guarantee. Errors must not include
|
||||
/// backend paths, credentials or hidden metadata.
|
||||
///
|
||||
/// `execute` must retain the same target and complete lineage and serialize
|
||||
/// ancestor identity/membership checks, policy metadata, validator observation,
|
||||
/// publication, validation, typed dispatch and commit/rollback. Changed/detached
|
||||
/// ancestors must return `NotFound` before the callback; never substitute a new
|
||||
/// ancestor or redirect the target by re-resolving its raw path. Refresh *all*
|
||||
/// lineage metadata/validators inside the boundary and retain that snapshot
|
||||
/// through dispatch, then return the committed post-operation validator. Never
|
||||
/// upgrade an unknown outcome except after confirmed rollback. Locks only protect
|
||||
/// actors participating in the protocol; document any external-writer limits.
|
||||
pub trait FilesystemBackend {
|
||||
/// Stable capability supplied to the composition.
|
||||
type Entry: BackendEntry;
|
||||
/// Resolve a canonical WIP path and retain its connected ancestry.
|
||||
///
|
||||
/// Obtain the target and lineage in one backend traversal/snapshot. Enforce
|
||||
/// configured handle/work budgets while retaining ancestors; do not silently
|
||||
/// omit ancestry on resource exhaustion.
|
||||
fn resolve(
|
||||
&self,
|
||||
context: &ExecutionContext,
|
||||
path: &str,
|
||||
) -> ProviderResult<ResolvedEntry<Self::Entry>>;
|
||||
/// Enumerate direct children, at most `maximum`; excess must fail, not truncate.
|
||||
fn children(
|
||||
&self,
|
||||
context: &ExecutionContext,
|
||||
entry: &Self::Entry,
|
||||
maximum: usize,
|
||||
) -> Result<Vec<Self::Entry>, HostError>;
|
||||
/// Execute against this already-resolved target within an atomic boundary.
|
||||
fn execute(
|
||||
&self,
|
||||
context: &ExecutionContext,
|
||||
entry: ResolvedEntry<Self::Entry>,
|
||||
operation: impl FnOnce(ResolvedEntry<Self::Entry>) -> OperationAttempt,
|
||||
) -> ProviderResult<OperationAttempt>;
|
||||
}
|
||||
|
||||
/// Typed publication extension point, implementable on an external crate's type.
|
||||
///
|
||||
/// Use `InterfaceRegistry::register` and `PublishedObject::expose` with generated
|
||||
/// definitions. An external local Object can wrap the entry and implement any
|
||||
/// number of interfaces, avoiding orphan rules. Its `WipObject` implementation
|
||||
/// declares validator requirements per qualified operation. Operation failures
|
||||
/// declare their own `EffectGuarantee`, not a fixed read/write classification.
|
||||
pub trait Composition<E: BackendEntry> {
|
||||
/// Local typed operation implementation and safe public metadata.
|
||||
type Object: WipObject;
|
||||
/// Build a request-scoped publication using this exact capability/context.
|
||||
///
|
||||
/// Publication and policy hooks must be side-effect-free with respect to the
|
||||
/// backend. A publication failure is a pre-dispatch rejection, never a
|
||||
/// started Operation. Delegate metadata/validators to the boundary snapshot.
|
||||
fn publish(
|
||||
&self,
|
||||
entry: E,
|
||||
context: &ExecutionContext,
|
||||
) -> Result<PublishedObject<Self::Object>, HostError>;
|
||||
}
|
||||
|
||||
/// Principal-specific view policy, independent of authentication transport.
|
||||
///
|
||||
/// Keep decisions deterministic and stable within an effective Worldspace view.
|
||||
/// A changed policy requires a new view/reference lifetime (or interface
|
||||
/// validators). Operation visibility is interface-wide within a view so every
|
||||
/// published reference has exactly the descriptor returned by fetch. Entry-
|
||||
/// specific differences should select different registered interfaces. Hooks
|
||||
/// cannot add implementations, metadata, or raw paths to a publication.
|
||||
pub trait ProjectionPolicy<E: BackendEntry, O: WipObject> {
|
||||
/// Opaque deployment-established principal/request identity.
|
||||
type Principal;
|
||||
/// Whether the entry is visible. Invisible ancestors hide their whole subtree.
|
||||
fn object_visible(&self, principal: &Self::Principal, entry: &E) -> bool;
|
||||
/// Whether an interface descriptor may be fetched in this view.
|
||||
fn interface_visible(&self, _principal: &Self::Principal, _interface: &InterfaceRef) -> bool {
|
||||
true
|
||||
}
|
||||
/// Select/order a subset of implemented interfaces; defaults to all.
|
||||
fn interfaces(
|
||||
&self,
|
||||
_principal: &Self::Principal,
|
||||
_entry: &E,
|
||||
available: &[InterfaceRef],
|
||||
) -> Vec<InterfaceRef> {
|
||||
available.to_vec()
|
||||
}
|
||||
/// Whether an operation is present in this view's descriptor and dispatch.
|
||||
fn operation_visible(
|
||||
&self,
|
||||
_principal: &Self::Principal,
|
||||
_interface: &InterfaceRef,
|
||||
_operation: &str,
|
||||
) -> bool {
|
||||
true
|
||||
}
|
||||
/// Execution permission for a visible operation, after canonical preconditions.
|
||||
fn authorize(
|
||||
&self,
|
||||
_principal: &Self::Principal,
|
||||
_object: &O,
|
||||
_interface: &InterfaceRef,
|
||||
_operation: &str,
|
||||
) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
/// No authentication assumption: all configured objects/operations are visible.
|
||||
pub struct DefaultPolicy;
|
||||
impl<E: BackendEntry, O: WipObject> ProjectionPolicy<E, O> for DefaultPolicy {
|
||||
type Principal = ();
|
||||
fn object_visible(&self, _: &(), _: &E) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
/// Canonical request-time engine, independent of HTTP and Linux.
|
||||
pub struct Projection<B, C, P> {
|
||||
backend: B,
|
||||
registry: InterfaceRegistry,
|
||||
composition: C,
|
||||
policy: P,
|
||||
limits: ResourceLimits,
|
||||
}
|
||||
|
||||
impl<B, C, P> Projection<B, C, P>
|
||||
where
|
||||
B: FilesystemBackend,
|
||||
C: Composition<B::Entry>,
|
||||
P: ProjectionPolicy<B::Entry, C::Object>,
|
||||
{
|
||||
/// Assemble trusted components. The registry must contain all exposed tokens.
|
||||
pub fn new(
|
||||
backend: B,
|
||||
registry: InterfaceRegistry,
|
||||
composition: C,
|
||||
policy: P,
|
||||
limits: ResourceLimits,
|
||||
) -> Self {
|
||||
Self {
|
||||
backend,
|
||||
registry,
|
||||
composition,
|
||||
policy,
|
||||
limits,
|
||||
}
|
||||
}
|
||||
/// Backend access for trusted composition/configuration, never serialized.
|
||||
pub fn backend(&self) -> &B {
|
||||
&self.backend
|
||||
}
|
||||
/// Borrow one effective principal view for observation, fetch and dispatch.
|
||||
pub fn view<'a>(&'a self, principal: &'a P::Principal) -> ProjectionView<'a, B, C, P> {
|
||||
ProjectionView {
|
||||
projection: self,
|
||||
principal,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A coherent principal view implementing canonical typed host dispatch.
|
||||
pub struct ProjectionView<'a, B, C, P>
|
||||
where
|
||||
B: FilesystemBackend,
|
||||
C: Composition<B::Entry>,
|
||||
P: ProjectionPolicy<B::Entry, C::Object>,
|
||||
{
|
||||
projection: &'a Projection<B, C, P>,
|
||||
principal: &'a P::Principal,
|
||||
}
|
||||
|
||||
impl<B, C, P> ProjectionView<'_, B, C, P>
|
||||
where
|
||||
B: FilesystemBackend,
|
||||
C: Composition<B::Entry>,
|
||||
P: ProjectionPolicy<B::Entry, C::Object>,
|
||||
{
|
||||
fn resolve(
|
||||
&self,
|
||||
context: &ExecutionContext,
|
||||
path: &str,
|
||||
) -> ProviderResult<ResolvedEntry<B::Entry>> {
|
||||
if let Err(error) = preflight(context) {
|
||||
return ProviderResult::Failure(error);
|
||||
}
|
||||
if wip_protocol::validate_path(path).is_err() {
|
||||
return ProviderResult::NotFound;
|
||||
}
|
||||
match self.projection.backend.resolve(context, path) {
|
||||
ProviderResult::Found(resolved) => {
|
||||
if !lineage_matches_path(&resolved, path) {
|
||||
return ProviderResult::Failure(internal());
|
||||
}
|
||||
if !self.lineage_visible(&resolved) {
|
||||
return ProviderResult::NotFound;
|
||||
}
|
||||
ProviderResult::Found(resolved)
|
||||
}
|
||||
ProviderResult::NotFound => ProviderResult::NotFound,
|
||||
ProviderResult::Failure(error) => ProviderResult::Failure(error),
|
||||
}
|
||||
}
|
||||
|
||||
fn lineage_visible(&self, resolved: &ResolvedEntry<B::Entry>) -> bool {
|
||||
resolved
|
||||
.ancestors()
|
||||
.iter()
|
||||
.chain(std::iter::once(resolved.target()))
|
||||
.all(|entry| self.projection.policy.object_visible(self.principal, entry))
|
||||
}
|
||||
|
||||
fn publication(
|
||||
&self,
|
||||
entry: B::Entry,
|
||||
context: &ExecutionContext,
|
||||
) -> Result<PublishedObject<C::Object>, HostError> {
|
||||
let publication = self
|
||||
.projection
|
||||
.composition
|
||||
.publish(entry.clone(), context)?;
|
||||
let available = publication
|
||||
.protocol_object()
|
||||
.interfaces
|
||||
.iter()
|
||||
.map(|reference| {
|
||||
self.projection
|
||||
.registry
|
||||
.resolve(reference)
|
||||
.ok_or_else(internal)
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
let mut selected = self
|
||||
.projection
|
||||
.policy
|
||||
.interfaces(self.principal, &entry, &available);
|
||||
selected.retain(|reference| {
|
||||
self.projection
|
||||
.policy
|
||||
.interface_visible(self.principal, reference)
|
||||
});
|
||||
publication
|
||||
.project(&selected, |reference, operation| {
|
||||
self.projection
|
||||
.policy
|
||||
.operation_visible(self.principal, reference, operation)
|
||||
})
|
||||
.map_err(|_| internal())
|
||||
}
|
||||
|
||||
/// Retrieve the descriptor with precisely this principal's visible operations.
|
||||
pub fn fetch_interface(
|
||||
&self,
|
||||
request: &FetchInterfaceRequest,
|
||||
) -> Result<FetchInterfaceResponse, ProtocolError> {
|
||||
read_boundary(|| self.fetch_interface_inner(request))
|
||||
}
|
||||
|
||||
fn fetch_interface_inner(
|
||||
&self,
|
||||
request: &FetchInterfaceRequest,
|
||||
) -> Result<FetchInterfaceResponse, ProtocolError> {
|
||||
let observation = self
|
||||
.projection
|
||||
.registry
|
||||
.fetch_interface(&request.interface)?;
|
||||
if !self
|
||||
.projection
|
||||
.policy
|
||||
.interface_visible(self.principal, &observation.reference)
|
||||
{
|
||||
return Err(protocol(
|
||||
ProtocolErrorCode::InterfaceNotFound,
|
||||
"interface is not published",
|
||||
));
|
||||
}
|
||||
let reference = observation.reference.clone();
|
||||
observation
|
||||
.project_operations(|operation| {
|
||||
self.projection
|
||||
.policy
|
||||
.operation_visible(self.principal, &reference, operation)
|
||||
})
|
||||
.protocol_response()
|
||||
}
|
||||
|
||||
/// Observe a complete bounded tree, omitting invisible children and subtrees.
|
||||
pub fn observe(
|
||||
&self,
|
||||
context: &ExecutionContext,
|
||||
request: &ObserveRequest,
|
||||
) -> Result<ObserveResponse, ProtocolError> {
|
||||
read_boundary(|| self.observe_inner(context, request))
|
||||
}
|
||||
|
||||
fn observe_inner(
|
||||
&self,
|
||||
context: &ExecutionContext,
|
||||
request: &ObserveRequest,
|
||||
) -> Result<ObserveResponse, ProtocolError> {
|
||||
request
|
||||
.validate()
|
||||
.map_err(|_| protocol(ProtocolErrorCode::InvalidRequest, "invalid observe request"))?;
|
||||
if request.depth > self.projection.limits.max_observation_depth {
|
||||
return Err(resource_protocol());
|
||||
}
|
||||
let entry = match self.resolve(context, &request.path) {
|
||||
ProviderResult::Found(entry) => entry,
|
||||
ProviderResult::NotFound => {
|
||||
return Err(protocol(
|
||||
ProtocolErrorCode::NotFound,
|
||||
"target path is not published",
|
||||
));
|
||||
}
|
||||
ProviderResult::Failure(error) => return Err(read_error(error)),
|
||||
};
|
||||
let (_ancestors, entry) = entry.into_parts();
|
||||
let mut remaining = u64::from(self.projection.limits.max_observation_nodes)
|
||||
.min(context.resource_budget().unwrap_or(u64::MAX));
|
||||
let response = self.observe_entry(context, entry, request.depth, &mut remaining)?;
|
||||
request.validate_response(&response).map_err(|_| {
|
||||
protocol(
|
||||
ProtocolErrorCode::Internal,
|
||||
"invalid projection observation",
|
||||
)
|
||||
})?;
|
||||
Ok(response)
|
||||
}
|
||||
|
||||
fn observe_entry(
|
||||
&self,
|
||||
context: &ExecutionContext,
|
||||
entry: B::Entry,
|
||||
depth: u32,
|
||||
remaining: &mut u64,
|
||||
) -> Result<ObjectObservation, ProtocolError> {
|
||||
preflight(context).map_err(read_error)?;
|
||||
if *remaining == 0 {
|
||||
return Err(resource_protocol());
|
||||
}
|
||||
*remaining -= 1;
|
||||
let object = self
|
||||
.publication(entry.clone(), context)
|
||||
.map_err(read_error)?
|
||||
.protocol_object();
|
||||
if depth == 0 {
|
||||
return Ok(ObjectObservation {
|
||||
object,
|
||||
children: None,
|
||||
});
|
||||
}
|
||||
let mut children = Vec::new();
|
||||
if entry.kind() == EntryKind::Directory {
|
||||
let entries = self
|
||||
.projection
|
||||
.backend
|
||||
.children(
|
||||
context,
|
||||
&entry,
|
||||
usize::try_from(*remaining).unwrap_or(usize::MAX),
|
||||
)
|
||||
.map_err(read_error)?;
|
||||
if entries.len() as u64 > *remaining {
|
||||
return Err(resource_protocol());
|
||||
}
|
||||
for child in entries {
|
||||
if self
|
||||
.projection
|
||||
.policy
|
||||
.object_visible(self.principal, &child)
|
||||
{
|
||||
children.push(self.observe_entry(context, child, depth - 1, remaining)?);
|
||||
} else {
|
||||
if *remaining == 0 {
|
||||
return Err(resource_protocol());
|
||||
}
|
||||
*remaining -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(ObjectObservation {
|
||||
object,
|
||||
children: Some(children),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl<B, C, P> ObjectProvider for ProjectionView<'_, B, C, P>
|
||||
where
|
||||
B: FilesystemBackend,
|
||||
C: Composition<B::Entry>,
|
||||
P: ProjectionPolicy<B::Entry, C::Object>,
|
||||
{
|
||||
type Object = C::Object;
|
||||
fn with_object<R>(
|
||||
&self,
|
||||
context: &ExecutionContext,
|
||||
path: &str,
|
||||
operation: impl FnOnce(&PublishedObject<Self::Object>) -> R,
|
||||
) -> ProviderResult<R> {
|
||||
match self.resolve(context, path) {
|
||||
ProviderResult::Found(resolved) => {
|
||||
let (_ancestors, entry) = resolved.into_parts();
|
||||
match self.publication(entry, context) {
|
||||
Ok(publication) => ProviderResult::Found(operation(&publication)),
|
||||
Err(error) => ProviderResult::Failure(error),
|
||||
}
|
||||
}
|
||||
ProviderResult::NotFound => ProviderResult::NotFound,
|
||||
ProviderResult::Failure(error) => ProviderResult::Failure(error),
|
||||
}
|
||||
}
|
||||
fn execute_operation(
|
||||
&self,
|
||||
context: &ExecutionContext,
|
||||
path: &str,
|
||||
operation: impl FnOnce(&PublishedObject<Self::Object>) -> OperationAttempt,
|
||||
) -> ProviderResult<OperationAttempt> {
|
||||
let entry = match self.resolve(context, path) {
|
||||
ProviderResult::Found(entry) => entry,
|
||||
ProviderResult::NotFound => return ProviderResult::NotFound,
|
||||
ProviderResult::Failure(error) => return ProviderResult::Failure(error),
|
||||
};
|
||||
self.projection.backend.execute(context, entry, |resolved| {
|
||||
// Backend validates retained lineage membership/identity and refreshes
|
||||
// all metadata before this callback under the same boundary as dispatch.
|
||||
if !lineage_matches_path(&resolved, path) {
|
||||
return OperationAttempt::reject(wip_host::CallErrorKind::Internal);
|
||||
}
|
||||
if !self.lineage_visible(&resolved) {
|
||||
return OperationAttempt::reject(wip_host::CallErrorKind::NotFound);
|
||||
}
|
||||
let (_ancestors, entry) = resolved.into_parts();
|
||||
if let Err(error) = preflight(context) {
|
||||
return OperationAttempt::reject(match error.kind() {
|
||||
wip_host::HostErrorKind::Internal => wip_host::CallErrorKind::Internal,
|
||||
wip_host::HostErrorKind::ResourceLimitExceeded => {
|
||||
wip_host::CallErrorKind::ResourceLimitExceeded
|
||||
}
|
||||
});
|
||||
}
|
||||
match self.publication(entry, context) {
|
||||
Ok(publication) => operation(&publication),
|
||||
Err(error) => OperationAttempt::reject(match error.kind() {
|
||||
wip_host::HostErrorKind::Internal => wip_host::CallErrorKind::Internal,
|
||||
wip_host::HostErrorKind::ResourceLimitExceeded => {
|
||||
wip_host::CallErrorKind::ResourceLimitExceeded
|
||||
}
|
||||
}),
|
||||
}
|
||||
})
|
||||
}
|
||||
fn authorize(
|
||||
&self,
|
||||
_: &str,
|
||||
object: &Self::Object,
|
||||
interface: &InterfaceRef,
|
||||
operation: &str,
|
||||
) -> bool {
|
||||
self.projection
|
||||
.policy
|
||||
.authorize(self.principal, object, interface, operation)
|
||||
}
|
||||
}
|
||||
|
||||
impl<B, C, P> ObjectProvider for Projection<B, C, P>
|
||||
where
|
||||
B: FilesystemBackend,
|
||||
C: Composition<B::Entry>,
|
||||
P: ProjectionPolicy<B::Entry, C::Object, Principal = ()>,
|
||||
{
|
||||
type Object = C::Object;
|
||||
fn with_object<R>(
|
||||
&self,
|
||||
context: &ExecutionContext,
|
||||
path: &str,
|
||||
operation: impl FnOnce(&PublishedObject<Self::Object>) -> R,
|
||||
) -> ProviderResult<R> {
|
||||
self.view(&()).with_object(context, path, operation)
|
||||
}
|
||||
fn execute_operation(
|
||||
&self,
|
||||
context: &ExecutionContext,
|
||||
path: &str,
|
||||
operation: impl FnOnce(&PublishedObject<Self::Object>) -> OperationAttempt,
|
||||
) -> ProviderResult<OperationAttempt> {
|
||||
self.view(&()).execute_operation(context, path, operation)
|
||||
}
|
||||
fn authorize(
|
||||
&self,
|
||||
path: &str,
|
||||
object: &Self::Object,
|
||||
interface: &InterfaceRef,
|
||||
operation: &str,
|
||||
) -> bool {
|
||||
self.view(&()).authorize(path, object, interface, operation)
|
||||
}
|
||||
}
|
||||
|
||||
impl<B, C, P> Projection<B, C, P>
|
||||
where
|
||||
B: FilesystemBackend,
|
||||
C: Composition<B::Entry>,
|
||||
P: ProjectionPolicy<B::Entry, C::Object, Principal = ()>,
|
||||
{
|
||||
/// Observe the default unit-principal view.
|
||||
pub fn observe(
|
||||
&self,
|
||||
context: &ExecutionContext,
|
||||
request: &ObserveRequest,
|
||||
) -> Result<ObserveResponse, ProtocolError> {
|
||||
self.view(&()).observe(context, request)
|
||||
}
|
||||
/// Fetch in the default unit-principal view.
|
||||
pub fn fetch_interface(
|
||||
&self,
|
||||
request: &FetchInterfaceRequest,
|
||||
) -> Result<FetchInterfaceResponse, ProtocolError> {
|
||||
self.view(&()).fetch_interface(request)
|
||||
}
|
||||
}
|
||||
|
||||
fn lineage_matches_path<E: BackendEntry>(resolved: &ResolvedEntry<E>, path: &str) -> bool {
|
||||
let names: Vec<_> = if path == "/" {
|
||||
vec![""]
|
||||
} else {
|
||||
std::iter::once("").chain(path[1..].split('/')).collect()
|
||||
};
|
||||
if resolved.ancestors().len() + 1 != names.len()
|
||||
|| resolved.target().name() != names[names.len() - 1]
|
||||
{
|
||||
return false;
|
||||
}
|
||||
resolved
|
||||
.ancestors()
|
||||
.iter()
|
||||
.zip(names)
|
||||
.all(|(entry, name)| entry.kind() == EntryKind::Directory && entry.name() == name)
|
||||
}
|
||||
|
||||
fn read_boundary<T>(
|
||||
operation: impl FnOnce() -> Result<T, ProtocolError>,
|
||||
) -> Result<T, ProtocolError> {
|
||||
std::panic::catch_unwind(std::panic::AssertUnwindSafe(operation))
|
||||
.unwrap_or_else(|_| Err(protocol(ProtocolErrorCode::Internal, "projection failed")))
|
||||
}
|
||||
|
||||
fn internal() -> HostError {
|
||||
HostError::internal(
|
||||
"projection publication failed",
|
||||
EffectGuarantee::NotCommitted,
|
||||
)
|
||||
}
|
||||
fn protocol(code: ProtocolErrorCode, message: &str) -> ProtocolError {
|
||||
ProtocolError {
|
||||
code,
|
||||
message: message.into(),
|
||||
}
|
||||
}
|
||||
fn resource_protocol() -> ProtocolError {
|
||||
protocol(
|
||||
ProtocolErrorCode::ResourceLimitExceeded,
|
||||
"projection resource limit exceeded",
|
||||
)
|
||||
}
|
||||
fn read_error(error: HostError) -> ProtocolError {
|
||||
match error.kind() {
|
||||
wip_host::HostErrorKind::ResourceLimitExceeded => resource_protocol(),
|
||||
wip_host::HostErrorKind::Internal => {
|
||||
protocol(ProtocolErrorCode::Internal, "projection failed")
|
||||
}
|
||||
}
|
||||
}
|
||||
fn preflight(context: &ExecutionContext) -> Result<(), HostError> {
|
||||
if context.cancellation().is_cancelled()
|
||||
|| context
|
||||
.deadline()
|
||||
.is_some_and(|deadline| std::time::Instant::now() >= deadline)
|
||||
|| context.resource_budget() == Some(0)
|
||||
{
|
||||
Err(HostError::resource_limit(
|
||||
"projection work limit exceeded",
|
||||
EffectGuarantee::NotCommitted,
|
||||
))
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,435 @@
|
||||
//! Framework-neutral standard WIP over HTTP mapping for a projection view.
|
||||
|
||||
use std::time::Instant;
|
||||
|
||||
use http::header::ALLOW;
|
||||
use http::{Request, Response, StatusCode};
|
||||
use wip_host::{ExecutionContext, ObjectProvider};
|
||||
use wip_http::{
|
||||
CodecError, EncodeHttpError, Endpoint, RequestMetadataError, Route,
|
||||
decode_call_operation_metadata, decode_fetch_interface_request, decode_observe_request,
|
||||
encode_call_operation_response, encode_fetch_interface_response, encode_observe_response,
|
||||
encode_protocol_error_response, validate_http_request,
|
||||
};
|
||||
use wip_protocol::{ProtocolError, ProtocolErrorCode, ProtocolInteraction};
|
||||
|
||||
use crate::engine::ProjectionView;
|
||||
use crate::{Composition, FilesystemBackend, ProjectionPolicy, ResourceLimits};
|
||||
|
||||
/// Standard HTTP routes and codecs over a caller-scoped projection view.
|
||||
///
|
||||
/// The adapter borrows the view and endpoint without owning a listener, selecting
|
||||
/// a principal, or imposing a new execution context. Integrations must enforce
|
||||
/// the request body limit while collecting bytes, before calling this adapter.
|
||||
pub struct HttpAdapter<'a, 'view, B, C, P>
|
||||
where
|
||||
B: FilesystemBackend,
|
||||
C: Composition<B::Entry>,
|
||||
P: ProjectionPolicy<B::Entry, C::Object>,
|
||||
{
|
||||
view: &'a ProjectionView<'view, B, C, P>,
|
||||
endpoint: &'a Endpoint,
|
||||
limits: ResourceLimits,
|
||||
}
|
||||
|
||||
impl<'a, 'view, B, C, P> HttpAdapter<'a, 'view, B, C, P>
|
||||
where
|
||||
B: FilesystemBackend,
|
||||
C: Composition<B::Entry>,
|
||||
P: ProjectionPolicy<B::Entry, C::Object>,
|
||||
{
|
||||
/// Creates an adapter for an already-selected principal's projection view.
|
||||
#[must_use]
|
||||
pub fn new(
|
||||
view: &'a ProjectionView<'view, B, C, P>,
|
||||
endpoint: &'a Endpoint,
|
||||
limits: ResourceLimits,
|
||||
) -> Self {
|
||||
Self {
|
||||
view,
|
||||
endpoint,
|
||||
limits,
|
||||
}
|
||||
}
|
||||
|
||||
/// Handles one buffered request using the supplied execution controls.
|
||||
///
|
||||
/// Observation and operation dispatch receive the original context, including
|
||||
/// cancellation and resource budget. An elapsed deadline after dispatch keeps
|
||||
/// the listener's existing empty HTTP 504 transport-failure behavior.
|
||||
#[must_use]
|
||||
pub fn handle_http_with_context(
|
||||
&self,
|
||||
request: Request<Vec<u8>>,
|
||||
context: &ExecutionContext,
|
||||
) -> Response<Vec<u8>> {
|
||||
let Some(route) = self.route(request.uri()) else {
|
||||
return empty_response(StatusCode::NOT_FOUND);
|
||||
};
|
||||
if let Err(error) = validate_http_request(self.endpoint, route, &request) {
|
||||
return self.metadata_error(error);
|
||||
}
|
||||
let response = match route {
|
||||
Route::Observe => self.observe(request.body(), context),
|
||||
Route::FetchInterface => self.fetch_interface(request.body()),
|
||||
Route::CallOperation => self.call_operation(request.body(), context),
|
||||
};
|
||||
if context
|
||||
.deadline()
|
||||
.is_some_and(|deadline| Instant::now() >= deadline)
|
||||
{
|
||||
empty_response(StatusCode::GATEWAY_TIMEOUT)
|
||||
} else {
|
||||
response
|
||||
}
|
||||
}
|
||||
|
||||
fn route(&self, uri: &http::Uri) -> Option<Route> {
|
||||
if uri.query().is_some() {
|
||||
return None;
|
||||
}
|
||||
[Route::Observe, Route::FetchInterface, Route::CallOperation]
|
||||
.into_iter()
|
||||
.find(|route| self.endpoint.route(*route).path() == uri.path())
|
||||
}
|
||||
|
||||
fn observe(&self, body: &[u8], context: &ExecutionContext) -> Response<Vec<u8>> {
|
||||
let request = match decode_observe_request(body, self.limits.wire) {
|
||||
Ok(request) => request,
|
||||
Err(error) => return self.codec_error(ProtocolInteraction::Observe, error),
|
||||
};
|
||||
match self.view.observe(context, &request) {
|
||||
Ok(tree) => {
|
||||
encode_observe_response(&request, &tree, self.limits.wire).unwrap_or_else(|error| {
|
||||
self.read_encode_error(ProtocolInteraction::Observe, error)
|
||||
})
|
||||
}
|
||||
Err(error) => self.protocol_error(ProtocolInteraction::Observe, &error),
|
||||
}
|
||||
}
|
||||
|
||||
fn fetch_interface(&self, body: &[u8]) -> Response<Vec<u8>> {
|
||||
let request = match decode_fetch_interface_request(body, self.limits.wire) {
|
||||
Ok(request) => request,
|
||||
Err(error) => return self.codec_error(ProtocolInteraction::FetchInterface, error),
|
||||
};
|
||||
match self.view.fetch_interface(&request) {
|
||||
Ok(interface) => {
|
||||
encode_fetch_interface_response(&request, &interface, self.limits.wire)
|
||||
.unwrap_or_else(|error| {
|
||||
self.read_encode_error(ProtocolInteraction::FetchInterface, error)
|
||||
})
|
||||
}
|
||||
Err(error) => self.protocol_error(ProtocolInteraction::FetchInterface, &error),
|
||||
}
|
||||
}
|
||||
|
||||
fn call_operation(&self, body: &[u8], context: &ExecutionContext) -> Response<Vec<u8>> {
|
||||
let metadata = match decode_call_operation_metadata(body, self.limits.wire) {
|
||||
Ok(metadata) => metadata,
|
||||
Err(error) => return self.codec_error(ProtocolInteraction::CallOperation, error),
|
||||
};
|
||||
let decoded = std::sync::Mutex::new(None);
|
||||
let execution = self.view.call_operation_with_context_and_decoder(
|
||||
context,
|
||||
metadata.target.clone(),
|
||||
metadata.interface.clone(),
|
||||
metadata.operation.clone(),
|
||||
|descriptor| {
|
||||
let request = metadata.decode_request(body, descriptor, self.limits.wire)?;
|
||||
let arguments = request.arguments.clone();
|
||||
*decoded.lock().unwrap_or_else(|error| error.into_inner()) =
|
||||
Some((request, descriptor.clone()));
|
||||
Ok::<_, CodecError>(arguments)
|
||||
},
|
||||
);
|
||||
match execution.map_err(|error| error.protocol_error()) {
|
||||
Ok(result) => {
|
||||
let Some((request, descriptor)) = decoded
|
||||
.into_inner()
|
||||
.unwrap_or_else(|error| error.into_inner())
|
||||
else {
|
||||
return self.protocol_error(
|
||||
ProtocolInteraction::CallOperation,
|
||||
&operation_outcome_unknown(),
|
||||
);
|
||||
};
|
||||
encode_call_operation_response(&request, &descriptor, &result, self.limits.wire)
|
||||
.unwrap_or_else(|error| self.operation_encode_error(error))
|
||||
}
|
||||
Err(error) => self.protocol_error(ProtocolInteraction::CallOperation, &error),
|
||||
}
|
||||
}
|
||||
|
||||
fn operation_encode_error(&self, error: EncodeHttpError) -> Response<Vec<u8>> {
|
||||
if matches!(&error, EncodeHttpError::Codec(codec) if is_transport_limit(codec)) {
|
||||
return empty_response(StatusCode::INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
// Any successfully executed operation may have committed effects. Its
|
||||
// name cannot establish a non-commit guarantee after response failure.
|
||||
self.protocol_error(
|
||||
ProtocolInteraction::CallOperation,
|
||||
&operation_outcome_unknown(),
|
||||
)
|
||||
}
|
||||
|
||||
fn metadata_error(&self, error: RequestMetadataError) -> Response<Vec<u8>> {
|
||||
match error {
|
||||
RequestMetadataError::NotFound => empty_response(StatusCode::NOT_FOUND),
|
||||
error @ RequestMetadataError::MethodNotAllowed => Response::builder()
|
||||
.status(error.status())
|
||||
.header(
|
||||
ALLOW,
|
||||
error
|
||||
.allow()
|
||||
.expect("method-not-allowed metadata has an Allow value"),
|
||||
)
|
||||
.body(Vec::new())
|
||||
.expect("static method response is valid"),
|
||||
RequestMetadataError::UnsupportedMediaType => {
|
||||
empty_response(StatusCode::UNSUPPORTED_MEDIA_TYPE)
|
||||
}
|
||||
RequestMetadataError::NotAcceptable => empty_response(StatusCode::NOT_ACCEPTABLE),
|
||||
}
|
||||
}
|
||||
|
||||
fn codec_error(
|
||||
&self,
|
||||
interaction: ProtocolInteraction,
|
||||
error: CodecError,
|
||||
) -> Response<Vec<u8>> {
|
||||
if is_transport_limit(&error) {
|
||||
empty_response(StatusCode::PAYLOAD_TOO_LARGE)
|
||||
} else {
|
||||
self.protocol_error(
|
||||
interaction,
|
||||
&ProtocolError {
|
||||
code: ProtocolErrorCode::InvalidRequest,
|
||||
message: "malformed WIP request".into(),
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn read_encode_error(
|
||||
&self,
|
||||
interaction: ProtocolInteraction,
|
||||
error: EncodeHttpError,
|
||||
) -> Response<Vec<u8>> {
|
||||
match error {
|
||||
EncodeHttpError::Codec(codec) if is_transport_limit(&codec) => {
|
||||
empty_response(StatusCode::INTERNAL_SERVER_ERROR)
|
||||
}
|
||||
_ => self.protocol_error(
|
||||
interaction,
|
||||
&ProtocolError {
|
||||
code: ProtocolErrorCode::Internal,
|
||||
message: "HTTP adapter failed".into(),
|
||||
},
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
fn protocol_error(
|
||||
&self,
|
||||
interaction: ProtocolInteraction,
|
||||
error: &ProtocolError,
|
||||
) -> Response<Vec<u8>> {
|
||||
// Engine and policy diagnostics may contain paths, argument values, or
|
||||
// backend details. Emit only fixed, bounded diagnostics on the wire.
|
||||
let sanitized = ProtocolError {
|
||||
code: error.code,
|
||||
message: sanitized_message(error.code).into(),
|
||||
};
|
||||
encode_protocol_error_response(interaction, &sanitized, self.limits.wire)
|
||||
.unwrap_or_else(|_| empty_response(StatusCode::INTERNAL_SERVER_ERROR))
|
||||
}
|
||||
}
|
||||
|
||||
fn operation_outcome_unknown() -> ProtocolError {
|
||||
ProtocolError {
|
||||
code: ProtocolErrorCode::OperationOutcomeUnknown,
|
||||
message: "operation completed but its response could not be encoded".into(),
|
||||
}
|
||||
}
|
||||
|
||||
fn sanitized_message(code: ProtocolErrorCode) -> &'static str {
|
||||
match code {
|
||||
ProtocolErrorCode::InvalidRequest => "malformed WIP request",
|
||||
ProtocolErrorCode::NotFound => "target path is not published",
|
||||
ProtocolErrorCode::InterfaceNotFound => "interface is not published",
|
||||
ProtocolErrorCode::InterfaceMismatch => "interface is not published on the target",
|
||||
ProtocolErrorCode::OperationNotFound => "operation is not published",
|
||||
ProtocolErrorCode::InvalidArguments => "arguments do not match the operation",
|
||||
ProtocolErrorCode::ValidatorRequired => "object validator is required",
|
||||
ProtocolErrorCode::ValidatorMismatch => "object validator does not match",
|
||||
ProtocolErrorCode::InterfaceValidatorRequired => "interface validator is required",
|
||||
ProtocolErrorCode::InterfaceValidatorMismatch => "interface validator does not match",
|
||||
ProtocolErrorCode::PermissionDenied => "operation is not permitted",
|
||||
ProtocolErrorCode::ResourceLimitExceeded => "projection resource limit exceeded",
|
||||
ProtocolErrorCode::Internal => "HTTP adapter failed",
|
||||
ProtocolErrorCode::OperationOutcomeUnknown => "operation outcome is unknown",
|
||||
}
|
||||
}
|
||||
|
||||
fn is_transport_limit(error: &CodecError) -> bool {
|
||||
matches!(
|
||||
error,
|
||||
CodecError::BodyTooLarge { .. } | CodecError::NestingTooDeep { .. }
|
||||
)
|
||||
}
|
||||
|
||||
fn empty_response(status: StatusCode) -> Response<Vec<u8>> {
|
||||
Response::builder()
|
||||
.status(status)
|
||||
.body(Vec::new())
|
||||
.expect("static status builds an HTTP response")
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use tempfile::tempdir;
|
||||
use wip_http::{
|
||||
DecodedResponse, Limits, decode_fetch_interface_response, decode_observe_response,
|
||||
encode_fetch_interface_request, encode_observe_request,
|
||||
};
|
||||
use wip_protocol::{FetchInterfaceRequest, ObserveRequest};
|
||||
|
||||
#[test]
|
||||
fn adapter_serves_observation_and_interface_fetch_without_server() {
|
||||
let root = tempdir().unwrap();
|
||||
std::fs::write(root.path().join("file"), b"contents").unwrap();
|
||||
let limits = ResourceLimits::default();
|
||||
let projection =
|
||||
crate::default_projection(root.path(), crate::AccessMode::ReadOnly, limits).unwrap();
|
||||
let view = projection.view(&());
|
||||
let endpoint = Endpoint::parse("http://localhost/custom").unwrap();
|
||||
let adapter = HttpAdapter::new(&view, &endpoint, limits);
|
||||
let context = ExecutionContext::new();
|
||||
let request = ObserveRequest {
|
||||
path: "/file".into(),
|
||||
depth: 0,
|
||||
};
|
||||
let response = adapter.handle_http_with_context(
|
||||
encode_observe_request(&endpoint, &request, limits.wire).unwrap(),
|
||||
&context,
|
||||
);
|
||||
let DecodedResponse::Success(observation) =
|
||||
decode_observe_response(&request, &response, limits.wire).unwrap()
|
||||
else {
|
||||
panic!("expected observation success")
|
||||
};
|
||||
let request = FetchInterfaceRequest {
|
||||
interface: observation.object.interfaces[0].clone(),
|
||||
};
|
||||
let response = adapter.handle_http_with_context(
|
||||
encode_fetch_interface_request(&endpoint, &request, limits.wire).unwrap(),
|
||||
&context,
|
||||
);
|
||||
assert!(matches!(
|
||||
decode_fetch_interface_response(&request, &response, limits.wire).unwrap(),
|
||||
DecodedResponse::Success(_)
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn adapter_preserves_transport_boundaries_and_execution_context() {
|
||||
let root = tempdir().unwrap();
|
||||
let limits = ResourceLimits::default();
|
||||
let projection =
|
||||
crate::default_projection(root.path(), crate::AccessMode::ReadOnly, limits).unwrap();
|
||||
let view = projection.view(&());
|
||||
let endpoint = Endpoint::parse("http://localhost/wip").unwrap();
|
||||
let adapter = HttpAdapter::new(&view, &endpoint, limits);
|
||||
let context = ExecutionContext::new();
|
||||
for uri in [
|
||||
"/wip/v1/observe?query=1",
|
||||
"/wip/v1/unknown",
|
||||
"/wip/v1/observe/extra",
|
||||
] {
|
||||
let response = adapter.handle_http_with_context(
|
||||
Request::builder().uri(uri).body(Vec::new()).unwrap(),
|
||||
&context,
|
||||
);
|
||||
assert_eq!(response.status(), StatusCode::NOT_FOUND);
|
||||
assert!(response.body().is_empty());
|
||||
}
|
||||
let response = adapter.handle_http_with_context(
|
||||
Request::builder()
|
||||
.uri("/wip/v1/observe")
|
||||
.body(Vec::new())
|
||||
.unwrap(),
|
||||
&context,
|
||||
);
|
||||
assert_eq!(response.status(), StatusCode::METHOD_NOT_ALLOWED);
|
||||
assert_eq!(response.headers()[ALLOW], "POST");
|
||||
assert!(response.body().is_empty());
|
||||
let request = ObserveRequest {
|
||||
path: "/".into(),
|
||||
depth: 0,
|
||||
};
|
||||
let response = adapter.handle_http_with_context(
|
||||
encode_observe_request(&endpoint, &request, limits.wire).unwrap(),
|
||||
&ExecutionContext::new().with_resource_budget(0),
|
||||
);
|
||||
let text = std::str::from_utf8(response.body()).unwrap();
|
||||
assert!(text.contains("resource_limit_exceeded"));
|
||||
let response = adapter.handle_http_with_context(
|
||||
encode_observe_request(&endpoint, &request, limits.wire).unwrap(),
|
||||
&ExecutionContext::new().with_deadline(Instant::now()),
|
||||
);
|
||||
assert_eq!(response.status(), StatusCode::GATEWAY_TIMEOUT);
|
||||
assert!(response.body().is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn post_success_encoding_is_unknown_except_empty_transport_limit_failure() {
|
||||
let root = tempdir().unwrap();
|
||||
let limits = ResourceLimits::default();
|
||||
let projection =
|
||||
crate::default_projection(root.path(), crate::AccessMode::ReadOnly, limits).unwrap();
|
||||
let view = projection.view(&());
|
||||
let endpoint = Endpoint::parse("http://localhost/wip").unwrap();
|
||||
let adapter = HttpAdapter::new(&view, &endpoint, limits);
|
||||
let error = decode_observe_request(b"{", limits.wire).unwrap_err();
|
||||
let response = adapter.operation_encode_error(EncodeHttpError::Codec(error));
|
||||
assert!(
|
||||
std::str::from_utf8(response.body())
|
||||
.unwrap()
|
||||
.contains("operation_outcome_unknown")
|
||||
);
|
||||
let tiny_limits = Limits::new(1, 1, 1).unwrap();
|
||||
let error = decode_observe_request(b"{}", tiny_limits).unwrap_err();
|
||||
assert!(is_transport_limit(&error));
|
||||
let response = adapter.operation_encode_error(EncodeHttpError::Codec(error));
|
||||
assert_eq!(response.status(), StatusCode::INTERNAL_SERVER_ERROR);
|
||||
assert!(response.body().is_empty());
|
||||
assert!(!response.headers().contains_key(http::header::CONTENT_TYPE));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn engine_error_diagnostics_are_sanitized_and_bounded() {
|
||||
let root = tempdir().unwrap();
|
||||
let limits = ResourceLimits::default();
|
||||
let projection =
|
||||
crate::default_projection(root.path(), crate::AccessMode::ReadOnly, limits).unwrap();
|
||||
let view = projection.view(&());
|
||||
let endpoint = Endpoint::parse("http://localhost/wip").unwrap();
|
||||
let adapter = HttpAdapter::new(&view, &endpoint, limits);
|
||||
let response = adapter.protocol_error(
|
||||
ProtocolInteraction::Observe,
|
||||
&ProtocolError {
|
||||
code: ProtocolErrorCode::Internal,
|
||||
message: "/private/backend/secret".repeat(1000),
|
||||
},
|
||||
);
|
||||
assert!(response.body().len() < 512);
|
||||
assert!(
|
||||
!std::str::from_utf8(response.body())
|
||||
.unwrap()
|
||||
.contains("secret")
|
||||
);
|
||||
assert_eq!(response.status(), StatusCode::INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
@@ -7,12 +7,46 @@
|
||||
//! - [`wip_http`] owns routes, JSON, envelopes, and status mapping;
|
||||
//! - this crate owns the filesystem capability boundary and the real HTTP listener.
|
||||
//!
|
||||
//! # Extension boundary
|
||||
//!
|
||||
//! [`Projection`] composes a [`FilesystemBackend`], typed [`Composition`] and
|
||||
//! [`ProjectionPolicy`]. External local Objects can wrap a [`BackendEntry`] and
|
||||
//! implement generated interfaces without orphan-rule workarounds. The backend
|
||||
//! retains a root-confined target and atomic validator/dispatch boundary; the
|
||||
//! engine owns recursive observation and standard host typed validation. No
|
||||
//! listener is needed to use [`ProjectionView`]. [`HttpAdapter`] applies the
|
||||
//! existing standard HTTP binding to a deployment-established principal view.
|
||||
//!
|
||||
//! Backends and Operations are trusted code, responsible for truthful effects,
|
||||
//! public-only metadata and ongoing execution-context bounds. Policies must be
|
||||
//! stable within a view; changing descriptor visibility requires new reference
|
||||
//! lifetimes. See the crate README for implementer security and migration details.
|
||||
//!
|
||||
//! ```no_run
|
||||
//! use wip_fs_server::{default_projection, AccessMode, ResourceLimits};
|
||||
//! use wip_host::{ExecutionContext, ObjectProvider};
|
||||
//! use wip_protocol::ObserveRequest;
|
||||
//!
|
||||
//! let engine = default_projection(std::path::Path::new("./public"),
|
||||
//! AccessMode::ReadOnly, ResourceLimits::default())?;
|
||||
//! let view = engine.view(&());
|
||||
//! let context = ExecutionContext::new().with_resource_budget(128);
|
||||
//! let tree = view.observe(&context, &ObserveRequest { path: "/".into(), depth: 1 })?;
|
||||
//! assert_eq!(tree.object.name, "");
|
||||
//! let object = view.observe_object_with_context(&context, "/")?;
|
||||
//! assert!(object.interfaces.is_empty());
|
||||
//! # Ok::<(), Box<dyn std::error::Error>>(())
|
||||
//! ```
|
||||
//!
|
||||
//! The built-in HTTP listener is intentionally loopback-only. TLS termination,
|
||||
//! certificates, authentication, and externally visible schemes are independent
|
||||
//! deployment concerns rather than WIP transport profiles.
|
||||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
mod defaults;
|
||||
mod engine;
|
||||
mod http_adapter;
|
||||
mod interfaces;
|
||||
mod projection;
|
||||
mod server;
|
||||
@@ -21,7 +55,17 @@ use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
||||
use std::path::PathBuf;
|
||||
use std::time::Duration;
|
||||
|
||||
pub use interfaces::{FileRead, FileWrite, SymlinkInspect};
|
||||
pub use defaults::{DefaultComposition, DefaultInterfaces, DefaultObject, default_projection};
|
||||
pub use engine::{
|
||||
BackendEntry, Composition, DefaultPolicy, EntryKind, FilesystemBackend, Projection,
|
||||
ProjectionPolicy, ProjectionView, ResolvedEntry,
|
||||
};
|
||||
pub use http_adapter::HttpAdapter;
|
||||
pub use interfaces::{
|
||||
FileRead, FileReadDefinition, FileWrite, FileWriteDefinition, SymlinkInspect,
|
||||
SymlinkInspectDefinition,
|
||||
};
|
||||
pub use projection::{LinuxBackend, LinuxEntry};
|
||||
pub use server::{BoundServer, ServerBuildError, WipFsServer};
|
||||
|
||||
/// Filesystem capabilities published by regular files.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,26 +5,20 @@ use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::thread;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use http::header::ALLOW;
|
||||
use http::{Request, Response, StatusCode};
|
||||
use wip_host::{ExecutionContext, ObjectProvider};
|
||||
use wip_http::{
|
||||
CodecError, EncodeHttpError, Endpoint, RequestMetadataError, Route,
|
||||
decode_call_operation_metadata, decode_fetch_interface_request, decode_observe_request,
|
||||
encode_call_operation_response, encode_fetch_interface_response, encode_observe_response,
|
||||
encode_protocol_error_response, validate_http_request,
|
||||
};
|
||||
use wip_protocol::{ProtocolError, ProtocolErrorCode, ProtocolInteraction};
|
||||
use wip_host::ExecutionContext;
|
||||
use wip_http::Endpoint;
|
||||
|
||||
use crate::projection::Projection;
|
||||
use crate::{ConfigError, ServerConfig};
|
||||
use crate::engine::Projection;
|
||||
use crate::http_adapter::HttpAdapter;
|
||||
use crate::{ConfigError, DefaultComposition, DefaultPolicy, LinuxBackend, ServerConfig};
|
||||
|
||||
/// Filesystem projection and framework-neutral standard WIP request adapter.
|
||||
/// Default Linux filesystem projection and bounded loopback HTTP listener.
|
||||
pub struct WipFsServer {
|
||||
config: ServerConfig,
|
||||
endpoint: Endpoint,
|
||||
effective_root: std::path::PathBuf,
|
||||
projection: Arc<Projection>,
|
||||
projection: Arc<Projection<LinuxBackend, DefaultComposition, DefaultPolicy>>,
|
||||
}
|
||||
|
||||
impl WipFsServer {
|
||||
@@ -32,8 +26,8 @@ impl WipFsServer {
|
||||
pub fn new(config: ServerConfig) -> Result<Self, ServerBuildError> {
|
||||
config.validate()?;
|
||||
let endpoint = config.endpoint()?;
|
||||
let projection = Projection::open(&config.root, config.access, config.limits)?;
|
||||
let effective_root = projection.effective_root()?;
|
||||
let projection = crate::default_projection(&config.root, config.access, config.limits)?;
|
||||
let effective_root = projection.backend().effective_root()?;
|
||||
Ok(Self {
|
||||
config,
|
||||
endpoint,
|
||||
@@ -67,25 +61,12 @@ impl WipFsServer {
|
||||
request: Request<Vec<u8>>,
|
||||
deadline: Instant,
|
||||
) -> Response<Vec<u8>> {
|
||||
let Some(route) = self.route(request.uri()) else {
|
||||
return empty_response(StatusCode::NOT_FOUND);
|
||||
};
|
||||
if let Err(error) = validate_http_request(&self.endpoint, route, &request) {
|
||||
return self.metadata_error(error);
|
||||
}
|
||||
let context = ExecutionContext::new()
|
||||
.with_deadline(deadline)
|
||||
.with_resource_budget(u64::from(self.config.limits.max_observation_nodes));
|
||||
let response = match route {
|
||||
Route::Observe => self.observe(request.body(), &context),
|
||||
Route::FetchInterface => self.fetch_interface(request.body()),
|
||||
Route::CallOperation => self.call_operation(request.body(), &context),
|
||||
};
|
||||
if Instant::now() >= deadline {
|
||||
empty_response(StatusCode::GATEWAY_TIMEOUT)
|
||||
} else {
|
||||
response
|
||||
}
|
||||
let view = self.projection.view(&());
|
||||
HttpAdapter::new(&view, &self.endpoint, self.config.limits)
|
||||
.handle_http_with_context(request, &context)
|
||||
}
|
||||
|
||||
/// Binds the built-in bounded loopback HTTP listener.
|
||||
@@ -108,171 +89,6 @@ impl WipFsServer {
|
||||
listener: Arc::new(listener),
|
||||
})
|
||||
}
|
||||
|
||||
fn route(&self, uri: &http::Uri) -> Option<Route> {
|
||||
if uri.query().is_some() {
|
||||
return None;
|
||||
}
|
||||
[Route::Observe, Route::FetchInterface, Route::CallOperation]
|
||||
.into_iter()
|
||||
.find(|route| self.endpoint.route(*route).path() == uri.path())
|
||||
}
|
||||
|
||||
fn observe(&self, body: &[u8], context: &ExecutionContext) -> Response<Vec<u8>> {
|
||||
let request = match decode_observe_request(body, self.config.limits.wire) {
|
||||
Ok(request) => request,
|
||||
Err(error) => return self.codec_error(ProtocolInteraction::Observe, error),
|
||||
};
|
||||
match self.projection.observe(context, &request) {
|
||||
Ok(tree) => encode_observe_response(&request, &tree, self.config.limits.wire)
|
||||
.unwrap_or_else(|error| {
|
||||
self.read_encode_error(ProtocolInteraction::Observe, error)
|
||||
}),
|
||||
Err(error) => self.protocol_error(ProtocolInteraction::Observe, &error),
|
||||
}
|
||||
}
|
||||
|
||||
fn fetch_interface(&self, body: &[u8]) -> Response<Vec<u8>> {
|
||||
let request = match decode_fetch_interface_request(body, self.config.limits.wire) {
|
||||
Ok(request) => request,
|
||||
Err(error) => return self.codec_error(ProtocolInteraction::FetchInterface, error),
|
||||
};
|
||||
match self.projection.fetch_interface(&request) {
|
||||
Ok(interface) => {
|
||||
encode_fetch_interface_response(&request, &interface, self.config.limits.wire)
|
||||
.unwrap_or_else(|error| {
|
||||
self.read_encode_error(ProtocolInteraction::FetchInterface, error)
|
||||
})
|
||||
}
|
||||
Err(error) => self.protocol_error(ProtocolInteraction::FetchInterface, &error),
|
||||
}
|
||||
}
|
||||
|
||||
fn call_operation(&self, body: &[u8], context: &ExecutionContext) -> Response<Vec<u8>> {
|
||||
let metadata = match decode_call_operation_metadata(body, self.config.limits.wire) {
|
||||
Ok(metadata) => metadata,
|
||||
Err(error) => return self.codec_error(ProtocolInteraction::CallOperation, error),
|
||||
};
|
||||
let may_commit = metadata.operation == "replace";
|
||||
let decoded = std::sync::Mutex::new(None);
|
||||
let execution = self.projection.call_operation_with_context_and_decoder(
|
||||
context,
|
||||
metadata.target.clone(),
|
||||
metadata.interface.clone(),
|
||||
metadata.operation.clone(),
|
||||
|descriptor| {
|
||||
let request = metadata.decode_request(body, descriptor, self.config.limits.wire)?;
|
||||
let arguments = request.arguments.clone();
|
||||
*decoded.lock().unwrap_or_else(|error| error.into_inner()) =
|
||||
Some((request, descriptor.clone()));
|
||||
Ok::<_, CodecError>(arguments)
|
||||
},
|
||||
);
|
||||
match execution.map_err(|error| error.protocol_error()) {
|
||||
Ok(result) => {
|
||||
let Some((request, descriptor)) = decoded
|
||||
.into_inner()
|
||||
.unwrap_or_else(|error| error.into_inner())
|
||||
else {
|
||||
let error = ProtocolError {
|
||||
code: if may_commit {
|
||||
ProtocolErrorCode::OperationOutcomeUnknown
|
||||
} else {
|
||||
ProtocolErrorCode::Internal
|
||||
},
|
||||
message: "operation completed without response metadata".into(),
|
||||
};
|
||||
return self.protocol_error(ProtocolInteraction::CallOperation, &error);
|
||||
};
|
||||
encode_call_operation_response(
|
||||
&request,
|
||||
&descriptor,
|
||||
&result,
|
||||
self.config.limits.wire,
|
||||
)
|
||||
.unwrap_or_else(|encode_error| {
|
||||
if matches!(
|
||||
&encode_error,
|
||||
EncodeHttpError::Codec(codec) if is_transport_limit(codec)
|
||||
) {
|
||||
return empty_response(StatusCode::INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
if !may_commit {
|
||||
return self
|
||||
.read_encode_error(ProtocolInteraction::CallOperation, encode_error);
|
||||
}
|
||||
// Replacement may already be committed, so a response
|
||||
// encoding failure cannot carry a non-commit guarantee.
|
||||
let error = ProtocolError {
|
||||
code: ProtocolErrorCode::OperationOutcomeUnknown,
|
||||
message: "operation completed but its response could not be encoded".into(),
|
||||
};
|
||||
self.protocol_error(ProtocolInteraction::CallOperation, &error)
|
||||
})
|
||||
}
|
||||
Err(error) => self.protocol_error(ProtocolInteraction::CallOperation, &error),
|
||||
}
|
||||
}
|
||||
|
||||
fn metadata_error(&self, error: RequestMetadataError) -> Response<Vec<u8>> {
|
||||
match error {
|
||||
RequestMetadataError::NotFound => empty_response(StatusCode::NOT_FOUND),
|
||||
error @ RequestMetadataError::MethodNotAllowed => Response::builder()
|
||||
.status(error.status())
|
||||
.header(
|
||||
ALLOW,
|
||||
error
|
||||
.allow()
|
||||
.expect("method-not-allowed metadata has an Allow value"),
|
||||
)
|
||||
.body(Vec::new())
|
||||
.expect("static method response is valid"),
|
||||
RequestMetadataError::UnsupportedMediaType => {
|
||||
empty_response(StatusCode::UNSUPPORTED_MEDIA_TYPE)
|
||||
}
|
||||
RequestMetadataError::NotAcceptable => empty_response(StatusCode::NOT_ACCEPTABLE),
|
||||
}
|
||||
}
|
||||
|
||||
fn codec_error(
|
||||
&self,
|
||||
interaction: ProtocolInteraction,
|
||||
error: CodecError,
|
||||
) -> Response<Vec<u8>> {
|
||||
if is_transport_limit(&error) {
|
||||
empty_response(StatusCode::PAYLOAD_TOO_LARGE)
|
||||
} else {
|
||||
self.protocol_error(
|
||||
interaction,
|
||||
&ProtocolError {
|
||||
code: ProtocolErrorCode::InvalidRequest,
|
||||
message: "malformed WIP request".into(),
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn read_encode_error(
|
||||
&self,
|
||||
interaction: ProtocolInteraction,
|
||||
error: EncodeHttpError,
|
||||
) -> Response<Vec<u8>> {
|
||||
match error {
|
||||
EncodeHttpError::Codec(codec) if is_transport_limit(&codec) => {
|
||||
empty_response(StatusCode::INTERNAL_SERVER_ERROR)
|
||||
}
|
||||
_ => self.protocol_error(interaction, &internal_error()),
|
||||
}
|
||||
}
|
||||
|
||||
fn protocol_error(
|
||||
&self,
|
||||
interaction: ProtocolInteraction,
|
||||
error: &ProtocolError,
|
||||
) -> Response<Vec<u8>> {
|
||||
encode_protocol_error_response(interaction, error, self.config.limits.wire)
|
||||
.unwrap_or_else(|_| empty_response(StatusCode::INTERNAL_SERVER_ERROR))
|
||||
}
|
||||
}
|
||||
|
||||
/// Bound real HTTP listener for a [`WipFsServer`].
|
||||
@@ -560,20 +376,6 @@ fn write_all_with_deadline(
|
||||
stream.flush()
|
||||
}
|
||||
|
||||
fn is_transport_limit(error: &CodecError) -> bool {
|
||||
matches!(
|
||||
error,
|
||||
CodecError::BodyTooLarge { .. } | CodecError::NestingTooDeep { .. }
|
||||
)
|
||||
}
|
||||
|
||||
fn internal_error() -> ProtocolError {
|
||||
ProtocolError {
|
||||
code: ProtocolErrorCode::Internal,
|
||||
message: "filesystem server failed".into(),
|
||||
}
|
||||
}
|
||||
|
||||
fn empty_response(status: StatusCode) -> Response<Vec<u8>> {
|
||||
Response::builder()
|
||||
.status(status)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,17 @@
|
||||
[package]
|
||||
name = "wip-host"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
description = "Host-side object publication and operation dispatch for WIP"
|
||||
license = "MIT OR Apache-2.0"
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
readme = "README.md"
|
||||
documentation = "https://docs.rs/wip-host"
|
||||
|
||||
[dependencies]
|
||||
wip-interface = { path = "../wip-interface" }
|
||||
wip-protocol = { path = "../wip-protocol" }
|
||||
wip-interface.workspace = true
|
||||
wip-protocol.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
trybuild = "1"
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Hare
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,15 @@
|
||||
# wip-host
|
||||
|
||||
Framework-independent Host publication and operation dispatch for the Web Interface Protocol (WIP).
|
||||
|
||||
`wip-host` registers generated interfaces, explicitly publishes them on request-scoped objects, validates object and interface preconditions, and performs interface-qualified operation dispatch against one host-owned instance. Backend transactions, persistence, and network serving remain application responsibilities.
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
wip-host = "0.1.0"
|
||||
wip-interface = "0.1.0"
|
||||
```
|
||||
|
||||
See the [API documentation](https://docs.rs/wip-host) for publication, provider, execution-context, and effect-guarantee boundaries.
|
||||
|
||||
Licensed under either of Apache-2.0 or MIT at your option.
|
||||
@@ -211,6 +211,17 @@ pub struct InterfaceObservation {
|
||||
}
|
||||
|
||||
impl InterfaceObservation {
|
||||
/// Restricts this effective view to visible operations and reachable types.
|
||||
///
|
||||
/// Registry artifacts are unchanged. When operations are removed, interface-
|
||||
/// wide documentation is omitted because it may describe hidden operations.
|
||||
/// Providers must use the same predicate for publication and fetch.
|
||||
#[must_use]
|
||||
pub fn project_operations(mut self, visible: impl Fn(&str) -> bool) -> Self {
|
||||
restrict_descriptor(&mut self.descriptor, visible);
|
||||
self
|
||||
}
|
||||
|
||||
/// Converts this host observation to a validated canonical protocol response.
|
||||
///
|
||||
/// A Host-side response construction failure is returned as `Internal`; it is
|
||||
@@ -449,6 +460,60 @@ pub trait WipObject {
|
||||
}
|
||||
}
|
||||
|
||||
fn restrict_descriptor(descriptor: &mut InterfaceDescriptor, visible: impl Fn(&str) -> bool) {
|
||||
let count = descriptor.operations.len();
|
||||
descriptor
|
||||
.operations
|
||||
.retain(|operation| visible(&operation.name));
|
||||
if descriptor.operations.len() == count {
|
||||
return;
|
||||
}
|
||||
descriptor.documentation = None;
|
||||
let mut used = HashSet::new();
|
||||
fn references(expression: &wip_protocol::TypeExpr, used: &mut HashSet<String>) {
|
||||
use wip_protocol::TypeExpr;
|
||||
match expression {
|
||||
TypeExpr::Named { name } => {
|
||||
used.insert(name.clone());
|
||||
}
|
||||
TypeExpr::Record { fields } => {
|
||||
for field in fields {
|
||||
references(&field.r#type, used);
|
||||
}
|
||||
}
|
||||
TypeExpr::List { items } => references(items, used),
|
||||
TypeExpr::Union { cases } => {
|
||||
for case in cases {
|
||||
if let Some(payload) = &case.payload {
|
||||
references(payload, used);
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
for operation in &descriptor.operations {
|
||||
for parameter in &operation.parameters {
|
||||
references(¶meter.r#type, &mut used);
|
||||
}
|
||||
references(&operation.returns.r#type, &mut used);
|
||||
}
|
||||
loop {
|
||||
let before = used.len();
|
||||
for declaration in &descriptor.types {
|
||||
if used.contains(&declaration.name) {
|
||||
references(&declaration.definition, &mut used);
|
||||
}
|
||||
}
|
||||
if before == used.len() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
descriptor
|
||||
.types
|
||||
.retain(|declaration| used.contains(&declaration.name));
|
||||
}
|
||||
|
||||
type DispatchFn<T> = fn(&T, &str, BTreeMap<String, Value>) -> Result<Value, DispatchError>;
|
||||
|
||||
struct BoundInterface<T> {
|
||||
@@ -502,6 +567,46 @@ impl<T: WipObject> PublishedObject<T> {
|
||||
Ok(self)
|
||||
}
|
||||
|
||||
/// Restricts a publication to an ordered interface/operation view.
|
||||
///
|
||||
/// This never adds implementations or changes codecs. The provider must use
|
||||
/// the identical operation predicate for `fetch_interface`, and keep the
|
||||
/// effective view stable for the lifetime of its references. Filtered
|
||||
/// descriptors are scoped to that view, not mutations of registry artifacts.
|
||||
pub fn project(
|
||||
mut self,
|
||||
interfaces: &[InterfaceRef],
|
||||
visible: impl Fn(&InterfaceRef, &str) -> bool,
|
||||
) -> Result<Self, PublicationError> {
|
||||
let mut projected = Vec::with_capacity(interfaces.len());
|
||||
for reference in interfaces {
|
||||
if projected
|
||||
.iter()
|
||||
.any(|bound: &BoundInterface<T>| &bound.artifact.reference == reference)
|
||||
{
|
||||
return Err(PublicationError::DuplicateInterface(reference.clone()));
|
||||
}
|
||||
let Some(index) = self
|
||||
.interfaces
|
||||
.iter()
|
||||
.position(|bound| &bound.artifact.reference == reference)
|
||||
else {
|
||||
return Err(PublicationError::UnexposedInterface(reference.clone()));
|
||||
};
|
||||
let mut bound = self.interfaces.remove(index);
|
||||
let mut descriptor = bound.artifact.descriptor.clone();
|
||||
restrict_descriptor(&mut descriptor, |operation| visible(reference, operation));
|
||||
bound.artifact = Arc::new(InterfaceArtifact {
|
||||
reference: reference.clone(),
|
||||
descriptor,
|
||||
validator: bound.artifact.validator.clone(),
|
||||
});
|
||||
projected.push(bound);
|
||||
}
|
||||
self.interfaces = projected;
|
||||
Ok(self)
|
||||
}
|
||||
|
||||
/// Returns the host-private implementation without projecting its fields.
|
||||
#[must_use]
|
||||
pub fn implementation(&self) -> &T {
|
||||
@@ -782,6 +887,15 @@ pub enum OperationAttempt {
|
||||
}
|
||||
|
||||
impl OperationAttempt {
|
||||
/// Rejects a provider precondition before typed implementation invocation.
|
||||
///
|
||||
/// Only use this before dispatch starts; post-invocation failures require
|
||||
/// an explicit effect disposition. The diagnostic is intentionally generic.
|
||||
#[must_use]
|
||||
pub fn reject(kind: CallErrorKind) -> Self {
|
||||
Self::NotStarted(CallError::new(kind, "provider precondition failed"))
|
||||
}
|
||||
|
||||
/// Marks a post-invocation failure as fully rolled back.
|
||||
///
|
||||
/// Successful attempts and pre-dispatch failures are returned unchanged.
|
||||
@@ -1016,11 +1130,18 @@ pub trait ObjectProvider {
|
||||
pub enum PublicationError {
|
||||
/// The same opaque interface reference was exposed more than once.
|
||||
DuplicateInterface(InterfaceRef),
|
||||
/// Projection attempted to add an interface without an implementation.
|
||||
UnexposedInterface(InterfaceRef),
|
||||
}
|
||||
|
||||
impl Display for PublicationError {
|
||||
fn fmt(&self, formatter: &mut Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::UnexposedInterface(reference) => write!(
|
||||
formatter,
|
||||
"interface `{}` has no implementation",
|
||||
reference.as_str()
|
||||
),
|
||||
Self::DuplicateInterface(reference) => write!(
|
||||
formatter,
|
||||
"interface `{}` is already exposed by this object",
|
||||
@@ -1032,6 +1153,70 @@ impl Display for PublicationError {
|
||||
|
||||
impl Error for PublicationError {}
|
||||
|
||||
#[cfg(test)]
|
||||
mod projection_tests {
|
||||
use super::*;
|
||||
use wip_protocol::{
|
||||
Documentation, OperationDeclaration, ReturnDeclaration, TypeDeclaration, TypeExpr,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn operation_views_prune_hidden_types_and_documentation_without_mutating_registry() {
|
||||
let named = |name: &str| TypeExpr::Named { name: name.into() };
|
||||
let operation = |name: &str, returns| OperationDeclaration {
|
||||
name: name.into(),
|
||||
documentation: None,
|
||||
parameters: Vec::new(),
|
||||
returns: ReturnDeclaration {
|
||||
documentation: None,
|
||||
r#type: returns,
|
||||
},
|
||||
};
|
||||
let declaration = |name: &str, definition| TypeDeclaration {
|
||||
name: name.into(),
|
||||
documentation: None,
|
||||
definition,
|
||||
};
|
||||
let descriptor = InterfaceDescriptor {
|
||||
format: "wip/1".into(),
|
||||
documentation: Some(Documentation {
|
||||
summary: "contains hidden operation details".into(),
|
||||
details: None,
|
||||
}),
|
||||
operations: vec![
|
||||
operation("visible", named("Public")),
|
||||
operation("secret", named("Secret")),
|
||||
],
|
||||
types: vec![
|
||||
declaration(
|
||||
"Public",
|
||||
TypeExpr::List {
|
||||
items: Box::new(named("Shared")),
|
||||
},
|
||||
),
|
||||
declaration("Shared", TypeExpr::String),
|
||||
declaration("Secret", TypeExpr::Bytes),
|
||||
],
|
||||
};
|
||||
let mut projected = descriptor.clone();
|
||||
restrict_descriptor(&mut projected, |operation| operation == "visible");
|
||||
assert_eq!(projected.operations.len(), 1);
|
||||
assert!(projected.documentation.is_none());
|
||||
assert_eq!(
|
||||
projected
|
||||
.types
|
||||
.iter()
|
||||
.map(|declaration| declaration.name.as_str())
|
||||
.collect::<Vec<_>>(),
|
||||
vec!["Public", "Shared"]
|
||||
);
|
||||
assert_eq!(descriptor.types.len(), 3);
|
||||
restrict_descriptor(&mut projected, |_| false);
|
||||
assert!(projected.types.is_empty());
|
||||
assert!(projected.operations.is_empty());
|
||||
}
|
||||
}
|
||||
|
||||
/// Stable Host dispatch failure kind.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum CallErrorKind {
|
||||
|
||||
@@ -14,6 +14,62 @@ use wip_interface::{
|
||||
};
|
||||
use wip_protocol::ProtocolErrorCode;
|
||||
|
||||
#[test]
|
||||
fn principal_projection_orders_subsets_and_rejects_unimplemented_or_duplicate_tokens() {
|
||||
let mut registry = InterfaceRegistry::new();
|
||||
let read = registry.register(ReaderDefinition, None).unwrap();
|
||||
let write = registry.register(WriterDefinition, None).unwrap();
|
||||
let hidden = registry.register(HiddenDefinition, None).unwrap();
|
||||
let publication = || {
|
||||
PublishedObject::new(Document::open("document", None, Rc::new(Cell::new(0))))
|
||||
.expose(&read)
|
||||
.unwrap()
|
||||
.expose(&write)
|
||||
.unwrap()
|
||||
};
|
||||
let projected = publication()
|
||||
.project(
|
||||
&[write.reference().clone(), read.reference().clone()],
|
||||
|_, operation| operation == "label",
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
projected.protocol_object().interfaces,
|
||||
vec![write.reference().as_str(), read.reference().as_str()]
|
||||
);
|
||||
assert!(
|
||||
publication()
|
||||
.project(&[hidden.reference().clone()], |_, _| true)
|
||||
.is_err()
|
||||
);
|
||||
assert!(
|
||||
publication()
|
||||
.project(
|
||||
&[read.reference().clone(), read.reference().clone()],
|
||||
|_, _| true
|
||||
)
|
||||
.is_err()
|
||||
);
|
||||
assert!(
|
||||
publication()
|
||||
.project(&[], |_, _| true)
|
||||
.unwrap()
|
||||
.protocol_object()
|
||||
.interfaces
|
||||
.is_empty()
|
||||
);
|
||||
let full = registry.fetch_interface(read.reference().as_str()).unwrap();
|
||||
let filtered = full
|
||||
.clone()
|
||||
.project_operations(|operation| operation == "label");
|
||||
assert_eq!(filtered.descriptor.operations.len(), 1);
|
||||
assert_eq!(full.descriptor.operations.len(), 3);
|
||||
assert_eq!(
|
||||
registry.fetch_interface(read.reference().as_str()).unwrap(),
|
||||
full
|
||||
);
|
||||
}
|
||||
|
||||
#[interface]
|
||||
pub trait Reader {
|
||||
/// Returns the reader-qualified label.
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
[package]
|
||||
name = "wip-http"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
description = "Framework-independent standard WIP over HTTP v1 binding"
|
||||
license = "MIT OR Apache-2.0"
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
readme = "README.md"
|
||||
documentation = "https://docs.rs/wip-http"
|
||||
|
||||
[dependencies]
|
||||
base64 = "0.22"
|
||||
@@ -11,4 +15,4 @@ http = "1"
|
||||
serde = "1"
|
||||
serde_json = "1"
|
||||
url = "2"
|
||||
wip-protocol = { path = "../wip-protocol" }
|
||||
wip-protocol.workspace = true
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Hare
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,31 @@
|
||||
# wip-http
|
||||
|
||||
Framework-independent WIP over HTTP v1 endpoint, route, JSON codec, and response-classification support.
|
||||
|
||||
The crate maps the three WIP Core interactions to fixed HTTP routes and strict UTF-8 JSON representations. It constructs and validates `http` request and response values but deliberately performs no network I/O and does not define TLS, authentication, proxy, or connection policy.
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
wip-http = "0.1.0"
|
||||
```
|
||||
|
||||
```rust
|
||||
use wip_http::wip_protocol::ObserveRequest;
|
||||
use wip_http::{Endpoint, Limits, encode_observe_request};
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let endpoint = Endpoint::parse("https://example.test/wip")?;
|
||||
let limits = Limits::new(64 * 1024, 1024 * 1024, 64)?;
|
||||
let request = encode_observe_request(
|
||||
&endpoint,
|
||||
&ObserveRequest { path: "/".into(), depth: 0 },
|
||||
limits,
|
||||
)?;
|
||||
assert_eq!(request.uri(), "https://example.test/wip/v1/observe");
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
|
||||
See the [API documentation](https://docs.rs/wip-http) for codec and failure-boundary details.
|
||||
|
||||
Licensed under either of Apache-2.0 or MIT at your option.
|
||||
@@ -1,9 +1,13 @@
|
||||
[package]
|
||||
name = "wip-interface-macros"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
description = "Procedural macros for WIP interface declarations and DTO codecs"
|
||||
license = "MIT OR Apache-2.0"
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
readme = "README.md"
|
||||
documentation = "https://docs.rs/wip-interface-macros"
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Hare
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,9 @@
|
||||
# wip-interface-macros
|
||||
|
||||
Procedural-macro implementation used by [`wip-interface`](https://crates.io/crates/wip-interface).
|
||||
|
||||
Applications should depend on `wip-interface`, which re-exports `#[interface]` and `#[derive(WipType)]` together with the traits and types required by generated code. Direct use of this implementation crate is not a supported application API.
|
||||
|
||||
See the [API documentation](https://docs.rs/wip-interface-macros) for the exported macro entry points.
|
||||
|
||||
Licensed under either of Apache-2.0 or MIT at your option.
|
||||
@@ -1,13 +1,17 @@
|
||||
[package]
|
||||
name = "wip-interface"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
description = "Public Rust authoring API for WIP interfaces and operation value codecs"
|
||||
license = "MIT OR Apache-2.0"
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
readme = "README.md"
|
||||
documentation = "https://docs.rs/wip-interface"
|
||||
|
||||
[dependencies]
|
||||
wip-interface-macros = { path = "../wip-interface-macros" }
|
||||
wip-protocol = { path = "../wip-protocol" }
|
||||
wip-interface-macros.workspace = true
|
||||
wip-protocol.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
trybuild = "1"
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Hare
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,32 @@
|
||||
# wip-interface
|
||||
|
||||
Public Rust authoring API for Web Interface Protocol (WIP) interfaces and application DTO codecs.
|
||||
|
||||
The crate re-exports `#[interface]` and `#[derive(WipType)]`, generates Interface Descriptors and typed dispatch companions, and converts application-owned Rust values to and from the transport-independent value model.
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
wip-interface = "0.1.0"
|
||||
```
|
||||
|
||||
```rust
|
||||
use wip_interface as wip;
|
||||
|
||||
#[derive(wip::WipType)]
|
||||
struct Greeting {
|
||||
message: String,
|
||||
}
|
||||
|
||||
#[wip::interface]
|
||||
pub trait Greeter {
|
||||
/// Builds a greeting.
|
||||
///
|
||||
/// # Returns
|
||||
/// The generated greeting.
|
||||
fn greet(&self, name: String) -> wip::OperationResult<Greeting>;
|
||||
}
|
||||
```
|
||||
|
||||
See the [API documentation](https://docs.rs/wip-interface) for supported interface syntax, DTO shapes, and failure semantics.
|
||||
|
||||
Licensed under either of Apache-2.0 or MIT at your option.
|
||||
@@ -1,8 +1,12 @@
|
||||
[package]
|
||||
name = "wip-protocol"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
description = "Transport-independent logical model and validation for WIP"
|
||||
license = "MIT OR Apache-2.0"
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
readme = "README.md"
|
||||
documentation = "https://docs.rs/wip-protocol"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Hare
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,14 @@
|
||||
# wip-protocol
|
||||
|
||||
Transport-independent logical types and validation for the Web Interface Protocol (WIP).
|
||||
|
||||
This crate defines the canonical Object and Interface Descriptor models, the three Core interaction request and response types, schema-neutral operation `Value`s, validators, protocol errors, and structural validation. It does not define an HTTP mapping, application DTOs, persistence, or network I/O.
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
wip-protocol = "0.1.0"
|
||||
```
|
||||
|
||||
See the [API documentation](https://docs.rs/wip-protocol) for the complete model and validation rules.
|
||||
|
||||
Licensed under either of Apache-2.0 or MIT at your option.
|
||||
@@ -1,12 +1,14 @@
|
||||
[package]
|
||||
name = "wip-public-api-example"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
description = "Public-only end-to-end conformance consumer for the WIP Rust APIs"
|
||||
license = "MIT OR Apache-2.0"
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
wip-host = { path = "../wip-host" }
|
||||
wip-interface = { path = "../wip-interface" }
|
||||
wip-protocol = { path = "../wip-protocol" }
|
||||
wip-host.workspace = true
|
||||
wip-interface.workspace = true
|
||||
wip-protocol.workspace = true
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
[package]
|
||||
name = "wip-tui"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
description = "Interactive terminal client for exploring and operating WIP Worldspaces"
|
||||
license = "MIT OR Apache-2.0"
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
readme = "README.md"
|
||||
publish = false
|
||||
|
||||
@@ -13,10 +15,10 @@ crossterm = "0.28.1"
|
||||
ratatui = "0.29.0"
|
||||
serde_json = "1"
|
||||
ureq = "3.1.2"
|
||||
wip-client = { path = "../wip-client" }
|
||||
wip-http = { path = "../wip-http" }
|
||||
wip-protocol = { path = "../wip-protocol" }
|
||||
wip-client.workspace = true
|
||||
wip-http.workspace = true
|
||||
wip-protocol.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3"
|
||||
wip-fs-server = { path = "../wip-fs-server" }
|
||||
wip-fs-server.workspace = true
|
||||
|
||||
Reference in New Issue
Block a user