mirror of
https://github.com/anomalyco/opencode-sdk-python.git
synced 2026-05-18 15:02:47 +00:00
Compare commits
91 commits
v0.1.0-alp
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
817f1a0816 | ||
|
|
7a6b7d16c4 | ||
|
|
6eae86427a | ||
|
|
c11a24e28e | ||
|
|
a1b54afef1 | ||
|
|
5f8681cf63 | ||
|
|
ec855544b2 | ||
|
|
bdbeff638a | ||
|
|
63af9064ec | ||
|
|
34ccc7f7d7 | ||
|
|
a4212485db | ||
|
|
1c6a3700f1 | ||
|
|
17f9c65321 | ||
|
|
206f54ea71 | ||
|
|
1de4987d50 | ||
|
|
4e7027e1d9 | ||
|
|
4d13992ad1 | ||
|
|
145229a92b | ||
|
|
45b4e60154 | ||
|
|
c75867efe7 | ||
|
|
10a8dac1d7 | ||
|
|
4c0117a6c5 | ||
|
|
8b4a7b17fc | ||
|
|
0a269c0379 | ||
|
|
646b99cd24 | ||
|
|
5f9e3cd004 | ||
|
|
f2d28d2990 | ||
|
|
1bddb4b6c3 | ||
|
|
6e577d0bde | ||
|
|
60df30faf5 | ||
|
|
d0c8c5bb87 | ||
|
|
ff6b72a6da | ||
|
|
c75c9633c9 | ||
|
|
be1f9d88f0 | ||
|
|
e27c59a26c | ||
|
|
8ea99fb27b | ||
|
|
98315648f7 | ||
|
|
c9d0f6daa1 | ||
|
|
4c406aa027 | ||
|
|
05859cbd01 | ||
|
|
e2e1f1d384 | ||
|
|
06577e9685 | ||
|
|
5f542aa68e | ||
|
|
002bf2d57f | ||
|
|
d19014d391 | ||
|
|
5ae45651bd | ||
|
|
5e3dae765d | ||
|
|
a617d3359f | ||
|
|
23ee4bb279 | ||
|
|
e9bdc09f73 | ||
|
|
6fc2509c19 | ||
|
|
731f553f04 | ||
|
|
3214ae78d3 | ||
|
|
d899ee8369 | ||
|
|
36382a289b | ||
|
|
fad149a84b | ||
|
|
f1d9d8f9ec | ||
|
|
94575f6882 | ||
|
|
7a9790fae8 | ||
|
|
6e129bc0a3 | ||
|
|
4db7199701 | ||
|
|
6927a1bfda | ||
|
|
eaaed9e5e1 | ||
|
|
ada52aedd4 | ||
|
|
b63951b009 | ||
|
|
d63c6f6f73 | ||
|
|
730f1be142 | ||
|
|
54b122ff18 | ||
|
|
63b90c4351 | ||
|
|
e9ff5885ed | ||
|
|
693c53b857 | ||
|
|
88921d3d34 | ||
|
|
5f3bb83f14 | ||
|
|
fb693059ce | ||
|
|
64c9b57dda | ||
|
|
d4ab769b98 | ||
|
|
62907fbcaa | ||
|
|
61755a666d | ||
|
|
da3bead6d8 | ||
|
|
310eaa7310 | ||
|
|
ce2269062c | ||
|
|
3afcacf5f9 | ||
|
|
8b23bb2bb1 | ||
|
|
3a7e0bcd7f | ||
|
|
d70071b1fc | ||
|
|
6d8571b73d | ||
|
|
6c3c0fb2c5 | ||
|
|
434c81c826 | ||
|
|
7560864570 | ||
|
|
232030ee11 | ||
|
|
e6d81611bf |
114 changed files with 4165 additions and 1245 deletions
26
.github/workflows/ci.yml
vendored
26
.github/workflows/ci.yml
vendored
|
|
@ -17,6 +17,7 @@ jobs:
|
|||
timeout-minutes: 10
|
||||
name: lint
|
||||
runs-on: ${{ github.repository == 'stainless-sdks/opencode-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
|
||||
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
|
|
@ -34,24 +35,40 @@ jobs:
|
|||
- name: Run lints
|
||||
run: ./scripts/lint
|
||||
|
||||
upload:
|
||||
if: github.repository == 'stainless-sdks/opencode-python'
|
||||
build:
|
||||
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
|
||||
timeout-minutes: 10
|
||||
name: upload
|
||||
name: build
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
runs-on: depot-ubuntu-24.04
|
||||
runs-on: ${{ github.repository == 'stainless-sdks/opencode-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rye
|
||||
run: |
|
||||
curl -sSf https://rye.astral.sh/get | bash
|
||||
echo "$HOME/.rye/shims" >> $GITHUB_PATH
|
||||
env:
|
||||
RYE_VERSION: '0.44.0'
|
||||
RYE_INSTALL_OPTION: '--yes'
|
||||
|
||||
- name: Install dependencies
|
||||
run: rye sync --all-features
|
||||
|
||||
- name: Run build
|
||||
run: rye build
|
||||
|
||||
- name: Get GitHub OIDC Token
|
||||
if: github.repository == 'stainless-sdks/opencode-python'
|
||||
id: github-oidc
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: core.setOutput('github_token', await core.getIDToken());
|
||||
|
||||
- name: Upload tarball
|
||||
if: github.repository == 'stainless-sdks/opencode-python'
|
||||
env:
|
||||
URL: https://pkg.stainless.com/s
|
||||
AUTH: ${{ steps.github-oidc.outputs.github_token }}
|
||||
|
|
@ -62,6 +79,7 @@ jobs:
|
|||
timeout-minutes: 10
|
||||
name: test
|
||||
runs-on: ${{ github.repository == 'stainless-sdks/opencode-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
|
||||
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
|
|
|
|||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,5 +1,4 @@
|
|||
.prism.log
|
||||
.vscode
|
||||
_dev
|
||||
|
||||
__pycache__
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
".": "0.1.0-alpha.3"
|
||||
".": "0.1.0-alpha.36"
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
configured_endpoints: 16
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-42c787cc277f295f28cd81a67f7b746cb4d47c3cd4c8a3fb521b03407649ebdd.yml
|
||||
openapi_spec_hash: 8f514f7881cf54e0aa65a23366df1af0
|
||||
config_hash: 61e8ad6b1bd35aec38a7b20a2570b967
|
||||
configured_endpoints: 26
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-62d8fccba4eb8dc3a80434e0849eab3352e49fb96a718bb7b6d17ed8e582b716.yml
|
||||
openapi_spec_hash: 4ff9376cf9634e91731e63fe482ea532
|
||||
config_hash: 1ae82c93499b9f0b9ba828b8919f9cb3
|
||||
|
|
|
|||
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"python.analysis.importFormat": "relative",
|
||||
}
|
||||
313
CHANGELOG.md
313
CHANGELOG.md
|
|
@ -1,5 +1,318 @@
|
|||
# Changelog
|
||||
|
||||
## 0.1.0-alpha.36 (2025-08-27)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.35...v0.1.0-alpha.36](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.35...v0.1.0-alpha.36)
|
||||
|
||||
### Features
|
||||
|
||||
* **client:** support file upload requests ([c2e1522](https://github.com/sst/opencode-sdk-python/commit/c2e1522ffba596910098e1e58eef7b4d00548e18))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* avoid newer type syntax ([42779eb](https://github.com/sst/opencode-sdk-python/commit/42779eb3d7035b677ef213d6508658dbd56b50bf))
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* **internal:** change ci workflow machines ([14c918e](https://github.com/sst/opencode-sdk-python/commit/14c918ee18edc797d2d8dd1f1d462ffb004a7e89))
|
||||
* **internal:** codegen related update ([477ff58](https://github.com/sst/opencode-sdk-python/commit/477ff58aa920fd0c02378ff33c041d061923dee4))
|
||||
* **internal:** fix ruff target version ([359b956](https://github.com/sst/opencode-sdk-python/commit/359b95615445c2f675aa3520cb233c19b50dfe31))
|
||||
* **internal:** update comment in script ([9ac7cbb](https://github.com/sst/opencode-sdk-python/commit/9ac7cbb6dba85d18d18bd37f95dffc0eea3d2605))
|
||||
* **internal:** update pyright exclude list ([5d96f63](https://github.com/sst/opencode-sdk-python/commit/5d96f63f7a9aaebb2e85fcd11b380bbeca3b7310))
|
||||
* update @stainless-api/prism-cli to v5.15.0 ([88487ee](https://github.com/sst/opencode-sdk-python/commit/88487ee6dbc8ac60e9d26573c8f08ae3f1389e83))
|
||||
* update github action ([fe98742](https://github.com/sst/opencode-sdk-python/commit/fe98742cd53b1e8783f600879164dd16fea610d3))
|
||||
|
||||
## 0.1.0-alpha.35 (2025-07-29)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.34...v0.1.0-alpha.35](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.34...v0.1.0-alpha.35)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([06ebf15](https://github.com/sst/opencode-sdk-python/commit/06ebf15e7ed0f782dbf51352a71fc5edb948a93c))
|
||||
|
||||
## 0.1.0-alpha.34 (2025-07-28)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.33...v0.1.0-alpha.34](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.33...v0.1.0-alpha.34)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([0bc9251](https://github.com/sst/opencode-sdk-python/commit/0bc92517109d280c22e22639ee4ffa58d63d837b))
|
||||
* **api:** api update ([14ada9d](https://github.com/sst/opencode-sdk-python/commit/14ada9d7d1e93d85f357f417633b691b116c8ad5))
|
||||
|
||||
## 0.1.0-alpha.33 (2025-07-25)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.32...v0.1.0-alpha.33](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.32...v0.1.0-alpha.33)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([9002768](https://github.com/sst/opencode-sdk-python/commit/9002768edd617a44d4d686dd9e88f41fe6a56f2f))
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* **project:** add settings file for vscode ([7fff9af](https://github.com/sst/opencode-sdk-python/commit/7fff9af8fd66865dc933dce74f0385250377af87))
|
||||
|
||||
## 0.1.0-alpha.32 (2025-07-24)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.31...v0.1.0-alpha.32](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.31...v0.1.0-alpha.32)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([988b38c](https://github.com/sst/opencode-sdk-python/commit/988b38ce1d4b7694083abe26f2198463d4555012))
|
||||
|
||||
## 0.1.0-alpha.31 (2025-07-24)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.30...v0.1.0-alpha.31](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.30...v0.1.0-alpha.31)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([35553a6](https://github.com/sst/opencode-sdk-python/commit/35553a6e3b3472562cdc38f0399fcd37af1b52e9))
|
||||
|
||||
## 0.1.0-alpha.30 (2025-07-23)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.29...v0.1.0-alpha.30](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.29...v0.1.0-alpha.30)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **parsing:** parse extra field types ([6817656](https://github.com/sst/opencode-sdk-python/commit/6817656ba347e8074960af1526763c134d75cf7d))
|
||||
|
||||
## 0.1.0-alpha.29 (2025-07-22)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.28...v0.1.0-alpha.29](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.28...v0.1.0-alpha.29)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([08130f0](https://github.com/sst/opencode-sdk-python/commit/08130f0c068f4008ffda297c68a68a44dec34d95))
|
||||
|
||||
## 0.1.0-alpha.28 (2025-07-22)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.27...v0.1.0-alpha.28](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.27...v0.1.0-alpha.28)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([e8022cd](https://github.com/sst/opencode-sdk-python/commit/e8022cd6d313c1c710dc2721f7e962285d48b02e))
|
||||
|
||||
## 0.1.0-alpha.27 (2025-07-22)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.26...v0.1.0-alpha.27](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.26...v0.1.0-alpha.27)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([50c887c](https://github.com/sst/opencode-sdk-python/commit/50c887c4202f587317afecb8998181c6de78b7b4))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **parsing:** ignore empty metadata ([8ee35ae](https://github.com/sst/opencode-sdk-python/commit/8ee35ae762cb0ade81b08cc41a9f496afe9fd484))
|
||||
|
||||
## 0.1.0-alpha.26 (2025-07-21)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.25...v0.1.0-alpha.26](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.25...v0.1.0-alpha.26)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([827dc0c](https://github.com/sst/opencode-sdk-python/commit/827dc0c780afd217f981cdd31d371fe96327aeec))
|
||||
|
||||
## 0.1.0-alpha.25 (2025-07-21)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.24...v0.1.0-alpha.25](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.24...v0.1.0-alpha.25)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([a85f832](https://github.com/sst/opencode-sdk-python/commit/a85f832a942075091b9ca3f7e6399ba00239f354))
|
||||
|
||||
## 0.1.0-alpha.24 (2025-07-21)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.23...v0.1.0-alpha.24](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.23...v0.1.0-alpha.24)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([bd6dd48](https://github.com/sst/opencode-sdk-python/commit/bd6dd48f11b23c77802e0a36af94c1a92c0326c7))
|
||||
|
||||
## 0.1.0-alpha.23 (2025-07-18)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.22...v0.1.0-alpha.23](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.22...v0.1.0-alpha.23)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([d8c9fc9](https://github.com/sst/opencode-sdk-python/commit/d8c9fc984c48b7dadce8840c5c1e010a508d58b4))
|
||||
|
||||
## 0.1.0-alpha.22 (2025-07-17)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.21...v0.1.0-alpha.22](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.21...v0.1.0-alpha.22)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([582070a](https://github.com/sst/opencode-sdk-python/commit/582070ae69b0ae1088271038b0fcb818c30c74cf))
|
||||
|
||||
## 0.1.0-alpha.21 (2025-07-17)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.20...v0.1.0-alpha.21](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.20...v0.1.0-alpha.21)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([71211e8](https://github.com/sst/opencode-sdk-python/commit/71211e888ecd5e848ac4de5ed058e4756025f694))
|
||||
|
||||
## 0.1.0-alpha.20 (2025-07-17)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.19...v0.1.0-alpha.20](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.19...v0.1.0-alpha.20)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([f48c0d6](https://github.com/sst/opencode-sdk-python/commit/f48c0d6bb1943df3e3758d19b83c70fd1c15e2c2))
|
||||
|
||||
## 0.1.0-alpha.19 (2025-07-16)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.18...v0.1.0-alpha.19](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.18...v0.1.0-alpha.19)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([07b8550](https://github.com/sst/opencode-sdk-python/commit/07b8550e658373298ac5d64eed102f21d03a29fa))
|
||||
|
||||
## 0.1.0-alpha.18 (2025-07-16)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.17...v0.1.0-alpha.18](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.17...v0.1.0-alpha.18)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([02c3399](https://github.com/sst/opencode-sdk-python/commit/02c3399fb52fa96d50e6dd9c74f3106d1107308e))
|
||||
|
||||
## 0.1.0-alpha.17 (2025-07-16)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.16...v0.1.0-alpha.17](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.16...v0.1.0-alpha.17)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([e76b574](https://github.com/sst/opencode-sdk-python/commit/e76b57439c37c0d3514e1497a4d1a78279844bdc))
|
||||
|
||||
## 0.1.0-alpha.16 (2025-07-15)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.15...v0.1.0-alpha.16](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.15...v0.1.0-alpha.16)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([670fa88](https://github.com/sst/opencode-sdk-python/commit/670fa889512f9000e6fee8c9f5c2b49434224592))
|
||||
|
||||
## 0.1.0-alpha.15 (2025-07-15)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.14...v0.1.0-alpha.15](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.14...v0.1.0-alpha.15)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([88bbf66](https://github.com/sst/opencode-sdk-python/commit/88bbf66c1f6ec7266fccb7f8e3265bb074afd5e6))
|
||||
|
||||
## 0.1.0-alpha.14 (2025-07-15)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.13...v0.1.0-alpha.14](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.13...v0.1.0-alpha.14)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([80d8572](https://github.com/sst/opencode-sdk-python/commit/80d85724c6b17b867ac3d19b0741bb88bb604798))
|
||||
|
||||
## 0.1.0-alpha.13 (2025-07-15)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.12...v0.1.0-alpha.13](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.12...v0.1.0-alpha.13)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([a51d627](https://github.com/sst/opencode-sdk-python/commit/a51d627f3a39324ca769a688b63c95dc8f5eba35))
|
||||
|
||||
## 0.1.0-alpha.12 (2025-07-12)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.11...v0.1.0-alpha.12](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.11...v0.1.0-alpha.12)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **client:** don't send Content-Type header on GET requests ([d52fbac](https://github.com/sst/opencode-sdk-python/commit/d52fbac0f4e2ae7f3338272eb7075f1401912fe4))
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* **readme:** fix version rendering on pypi ([d7ae516](https://github.com/sst/opencode-sdk-python/commit/d7ae5162cc2346314e69fd7609050d0e97eecf6c))
|
||||
|
||||
## 0.1.0-alpha.11 (2025-07-09)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.10...v0.1.0-alpha.11](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.10...v0.1.0-alpha.11)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **parsing:** correctly handle nested discriminated unions ([ff5c4a1](https://github.com/sst/opencode-sdk-python/commit/ff5c4a14337714858bd0c193a453fc28f011b263))
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* **internal:** bump pinned h11 dep ([6faa22e](https://github.com/sst/opencode-sdk-python/commit/6faa22e132534a89f10a872ead9ce78fd4ab553c))
|
||||
* **package:** mark python 3.13 as supported ([5f2edbe](https://github.com/sst/opencode-sdk-python/commit/5f2edbe52d0450a205d69d57e75ee571cabe4b10))
|
||||
|
||||
## 0.1.0-alpha.10 (2025-07-06)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.9...v0.1.0-alpha.10](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.9...v0.1.0-alpha.10)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** manual updates ([fdab2a9](https://github.com/sst/opencode-sdk-python/commit/fdab2a9ee5b71d90b1c18c00f67e40247efae0e4))
|
||||
|
||||
## 0.1.0-alpha.9 (2025-07-05)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.8...v0.1.0-alpha.9](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.8...v0.1.0-alpha.9)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** manual updates ([27a53d3](https://github.com/sst/opencode-sdk-python/commit/27a53d3f43455c8420c1501f3995c140f0bf777d))
|
||||
|
||||
## 0.1.0-alpha.8 (2025-07-03)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.7...v0.1.0-alpha.8](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.7...v0.1.0-alpha.8)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** api update ([6f7ea7f](https://github.com/sst/opencode-sdk-python/commit/6f7ea7f1f813c31e513fbe33d8653fe3e07f7831))
|
||||
|
||||
## 0.1.0-alpha.7 (2025-07-02)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.6...v0.1.0-alpha.7](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.6...v0.1.0-alpha.7)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** update via SDK Studio ([84628c0](https://github.com/sst/opencode-sdk-python/commit/84628c0bd3cd508832f04db0fd8a6cd5367dddf3))
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* **ci:** change upload type ([f3019c9](https://github.com/sst/opencode-sdk-python/commit/f3019c94cb548e436b2d7d884969a90db4649f80))
|
||||
|
||||
## 0.1.0-alpha.6 (2025-06-30)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.5...v0.1.0-alpha.6](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.5...v0.1.0-alpha.6)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** update via SDK Studio ([e1cb382](https://github.com/sst/opencode-sdk-python/commit/e1cb382c5391eb135a31ad98c7301c061191c563))
|
||||
* **api:** update via SDK Studio ([0985851](https://github.com/sst/opencode-sdk-python/commit/09858518e9312ca72238efd596cc0313927c26e3))
|
||||
|
||||
## 0.1.0-alpha.5 (2025-06-30)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.4...v0.1.0-alpha.5](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.4...v0.1.0-alpha.5)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **ci:** correct conditional ([6a748da](https://github.com/sst/opencode-sdk-python/commit/6a748dadf9df2b27b9c1123dc3ef989213f75090))
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* **ci:** only run for pushes and fork pull requests ([493f7d2](https://github.com/sst/opencode-sdk-python/commit/493f7d2131e0e17fc2128dad40b327e708f64366))
|
||||
|
||||
## 0.1.0-alpha.4 (2025-06-27)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.3...v0.1.0-alpha.4](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.3...v0.1.0-alpha.4)
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** update via SDK Studio ([6a793f7](https://github.com/sst/opencode-sdk-python/commit/6a793f7fd33a34f19656a3e723b61a32b0068a88))
|
||||
|
||||
## 0.1.0-alpha.3 (2025-06-27)
|
||||
|
||||
Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.2...v0.1.0-alpha.3)
|
||||
|
|
|
|||
202
LICENSE
202
LICENSE
|
|
@ -1,201 +1,7 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
Copyright 2025 opencode
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
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:
|
||||
|
||||
1. Definitions.
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
"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 2025 Opencode
|
||||
|
||||
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.
|
||||
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.
|
||||
|
|
|
|||
49
README.md
49
README.md
|
|
@ -1,6 +1,7 @@
|
|||
# Opencode Python API library
|
||||
|
||||
[>)](https://pypi.org/project/opencode-ai/)
|
||||
<!-- prettier-ignore -->
|
||||
[)](https://pypi.org/project/opencode-ai/)
|
||||
|
||||
The Opencode Python library provides convenient access to the Opencode REST API from any Python 3.8+
|
||||
application. The library includes type definitions for all request params and response fields,
|
||||
|
|
@ -28,7 +29,7 @@ from opencode_ai import Opencode
|
|||
|
||||
client = Opencode()
|
||||
|
||||
events = client.event.list()
|
||||
sessions = client.session.list()
|
||||
```
|
||||
|
||||
## Async usage
|
||||
|
|
@ -43,7 +44,7 @@ client = AsyncOpencode()
|
|||
|
||||
|
||||
async def main() -> None:
|
||||
events = await client.event.list()
|
||||
sessions = await client.session.list()
|
||||
|
||||
|
||||
asyncio.run(main())
|
||||
|
|
@ -74,12 +75,38 @@ async def main() -> None:
|
|||
async with AsyncOpencode(
|
||||
http_client=DefaultAioHttpClient(),
|
||||
) as client:
|
||||
events = await client.event.list()
|
||||
sessions = await client.session.list()
|
||||
|
||||
|
||||
asyncio.run(main())
|
||||
```
|
||||
|
||||
## Streaming responses
|
||||
|
||||
We provide support for streaming responses using Server Side Events (SSE).
|
||||
|
||||
```python
|
||||
from opencode_ai import Opencode
|
||||
|
||||
client = Opencode()
|
||||
|
||||
stream = client.event.list()
|
||||
for events in stream:
|
||||
print(events)
|
||||
```
|
||||
|
||||
The async client uses the exact same interface.
|
||||
|
||||
```python
|
||||
from opencode_ai import AsyncOpencode
|
||||
|
||||
client = AsyncOpencode()
|
||||
|
||||
stream = await client.event.list()
|
||||
async for events in stream:
|
||||
print(events)
|
||||
```
|
||||
|
||||
## Using types
|
||||
|
||||
Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
|
||||
|
|
@ -105,7 +132,7 @@ from opencode_ai import Opencode
|
|||
client = Opencode()
|
||||
|
||||
try:
|
||||
client.event.list()
|
||||
client.session.list()
|
||||
except opencode_ai.APIConnectionError as e:
|
||||
print("The server could not be reached")
|
||||
print(e.__cause__) # an underlying Exception, likely raised within httpx.
|
||||
|
|
@ -148,7 +175,7 @@ client = Opencode(
|
|||
)
|
||||
|
||||
# Or, configure per-request:
|
||||
client.with_options(max_retries=5).event.list()
|
||||
client.with_options(max_retries=5).session.list()
|
||||
```
|
||||
|
||||
### Timeouts
|
||||
|
|
@ -171,7 +198,7 @@ client = Opencode(
|
|||
)
|
||||
|
||||
# Override per-request:
|
||||
client.with_options(timeout=5.0).event.list()
|
||||
client.with_options(timeout=5.0).session.list()
|
||||
```
|
||||
|
||||
On timeout, an `APITimeoutError` is thrown.
|
||||
|
|
@ -212,11 +239,11 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
|
|||
from opencode_ai import Opencode
|
||||
|
||||
client = Opencode()
|
||||
response = client.event.with_raw_response.list()
|
||||
response = client.session.with_raw_response.list()
|
||||
print(response.headers.get('X-My-Header'))
|
||||
|
||||
event = response.parse() # get the object that `event.list()` would have returned
|
||||
print(event)
|
||||
session = response.parse() # get the object that `session.list()` would have returned
|
||||
print(session)
|
||||
```
|
||||
|
||||
These methods return an [`APIResponse`](https://github.com/sst/opencode-sdk-python/tree/main/src/opencode_ai/_response.py) object.
|
||||
|
|
@ -230,7 +257,7 @@ The above interface eagerly reads the full response body when you make the reque
|
|||
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
|
||||
|
||||
```python
|
||||
with client.event.with_streaming_response.list() as response:
|
||||
with client.session.with_streaming_response.list() as response:
|
||||
print(response.headers.get("X-My-Header"))
|
||||
|
||||
for line in response.iter_lines():
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ or products provided by Opencode, please follow the respective company's securit
|
|||
|
||||
### Opencode Terms and Policies
|
||||
|
||||
Please contact hello@sst.dev for any questions or concerns regarding the security of our services.
|
||||
Please contact support@sst.dev for any questions or concerns regarding the security of our services.
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
86
api.md
86
api.md
|
|
@ -1,7 +1,7 @@
|
|||
# Shared Types
|
||||
|
||||
```python
|
||||
from opencode_ai.types import ProviderAuthError, UnknownError
|
||||
from opencode_ai.types import MessageAbortedError, ProviderAuthError, UnknownError
|
||||
```
|
||||
|
||||
# Event
|
||||
|
|
@ -21,46 +21,64 @@ Methods:
|
|||
Types:
|
||||
|
||||
```python
|
||||
from opencode_ai.types import App, AppInitResponse
|
||||
from opencode_ai.types import (
|
||||
App,
|
||||
Mode,
|
||||
Model,
|
||||
Provider,
|
||||
AppInitResponse,
|
||||
AppLogResponse,
|
||||
AppModesResponse,
|
||||
AppProvidersResponse,
|
||||
)
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="get /app">client.app.<a href="./src/opencode_ai/resources/app.py">get</a>() -> <a href="./src/opencode_ai/types/app.py">App</a></code>
|
||||
- <code title="post /app/init">client.app.<a href="./src/opencode_ai/resources/app.py">init</a>() -> <a href="./src/opencode_ai/types/app_init_response.py">AppInitResponse</a></code>
|
||||
- <code title="post /log">client.app.<a href="./src/opencode_ai/resources/app.py">log</a>(\*\*<a href="src/opencode_ai/types/app_log_params.py">params</a>) -> <a href="./src/opencode_ai/types/app_log_response.py">AppLogResponse</a></code>
|
||||
- <code title="get /mode">client.app.<a href="./src/opencode_ai/resources/app.py">modes</a>() -> <a href="./src/opencode_ai/types/app_modes_response.py">AppModesResponse</a></code>
|
||||
- <code title="get /config/providers">client.app.<a href="./src/opencode_ai/resources/app.py">providers</a>() -> <a href="./src/opencode_ai/types/app_providers_response.py">AppProvidersResponse</a></code>
|
||||
|
||||
# Find
|
||||
|
||||
Types:
|
||||
|
||||
```python
|
||||
from opencode_ai.types import Symbol, FindFilesResponse, FindSymbolsResponse, FindTextResponse
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="get /find/file">client.find.<a href="./src/opencode_ai/resources/find.py">files</a>(\*\*<a href="src/opencode_ai/types/find_files_params.py">params</a>) -> <a href="./src/opencode_ai/types/find_files_response.py">FindFilesResponse</a></code>
|
||||
- <code title="get /find/symbol">client.find.<a href="./src/opencode_ai/resources/find.py">symbols</a>(\*\*<a href="src/opencode_ai/types/find_symbols_params.py">params</a>) -> <a href="./src/opencode_ai/types/find_symbols_response.py">FindSymbolsResponse</a></code>
|
||||
- <code title="get /find">client.find.<a href="./src/opencode_ai/resources/find.py">text</a>(\*\*<a href="src/opencode_ai/types/find_text_params.py">params</a>) -> <a href="./src/opencode_ai/types/find_text_response.py">FindTextResponse</a></code>
|
||||
|
||||
# File
|
||||
|
||||
Types:
|
||||
|
||||
```python
|
||||
from opencode_ai.types import FileSearchResponse
|
||||
from opencode_ai.types import File, FileReadResponse, FileStatusResponse
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="get /file">client.file.<a href="./src/opencode_ai/resources/file.py">search</a>(\*\*<a href="src/opencode_ai/types/file_search_params.py">params</a>) -> <a href="./src/opencode_ai/types/file_search_response.py">FileSearchResponse</a></code>
|
||||
- <code title="get /file">client.file.<a href="./src/opencode_ai/resources/file.py">read</a>(\*\*<a href="src/opencode_ai/types/file_read_params.py">params</a>) -> <a href="./src/opencode_ai/types/file_read_response.py">FileReadResponse</a></code>
|
||||
- <code title="get /file/status">client.file.<a href="./src/opencode_ai/resources/file.py">status</a>() -> <a href="./src/opencode_ai/types/file_status_response.py">FileStatusResponse</a></code>
|
||||
|
||||
# Config
|
||||
|
||||
Types:
|
||||
|
||||
```python
|
||||
from opencode_ai.types import (
|
||||
Config,
|
||||
Keybinds,
|
||||
McpLocal,
|
||||
McpRemote,
|
||||
Model,
|
||||
Provider,
|
||||
ConfigProvidersResponse,
|
||||
)
|
||||
from opencode_ai.types import Config, KeybindsConfig, McpLocalConfig, McpRemoteConfig, ModeConfig
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="get /config">client.config.<a href="./src/opencode_ai/resources/config.py">get</a>() -> <a href="./src/opencode_ai/types/config.py">Config</a></code>
|
||||
- <code title="get /config/providers">client.config.<a href="./src/opencode_ai/resources/config.py">providers</a>() -> <a href="./src/opencode_ai/types/config_providers_response.py">ConfigProvidersResponse</a></code>
|
||||
|
||||
# Session
|
||||
|
||||
|
|
@ -68,18 +86,27 @@ Types:
|
|||
|
||||
```python
|
||||
from opencode_ai.types import (
|
||||
AssistantMessage,
|
||||
FilePart,
|
||||
FilePartInput,
|
||||
FilePartSource,
|
||||
FilePartSourceText,
|
||||
FileSource,
|
||||
Message,
|
||||
MessagePart,
|
||||
ReasoningPart,
|
||||
Part,
|
||||
Session,
|
||||
SourceURLPart,
|
||||
SnapshotPart,
|
||||
StepFinishPart,
|
||||
StepStartPart,
|
||||
SymbolSource,
|
||||
TextPart,
|
||||
ToolCall,
|
||||
ToolInvocationPart,
|
||||
ToolPartialCall,
|
||||
ToolResult,
|
||||
TextPartInput,
|
||||
ToolPart,
|
||||
ToolStateCompleted,
|
||||
ToolStateError,
|
||||
ToolStatePending,
|
||||
ToolStateRunning,
|
||||
UserMessage,
|
||||
SessionListResponse,
|
||||
SessionDeleteResponse,
|
||||
SessionAbortResponse,
|
||||
|
|
@ -95,9 +122,24 @@ Methods:
|
|||
- <code title="get /session">client.session.<a href="./src/opencode_ai/resources/session.py">list</a>() -> <a href="./src/opencode_ai/types/session_list_response.py">SessionListResponse</a></code>
|
||||
- <code title="delete /session/{id}">client.session.<a href="./src/opencode_ai/resources/session.py">delete</a>(id) -> <a href="./src/opencode_ai/types/session_delete_response.py">SessionDeleteResponse</a></code>
|
||||
- <code title="post /session/{id}/abort">client.session.<a href="./src/opencode_ai/resources/session.py">abort</a>(id) -> <a href="./src/opencode_ai/types/session_abort_response.py">SessionAbortResponse</a></code>
|
||||
- <code title="post /session/{id}/message">client.session.<a href="./src/opencode_ai/resources/session.py">chat</a>(id, \*\*<a href="src/opencode_ai/types/session_chat_params.py">params</a>) -> <a href="./src/opencode_ai/types/message.py">Message</a></code>
|
||||
- <code title="post /session/{id}/message">client.session.<a href="./src/opencode_ai/resources/session.py">chat</a>(id, \*\*<a href="src/opencode_ai/types/session_chat_params.py">params</a>) -> <a href="./src/opencode_ai/types/assistant_message.py">AssistantMessage</a></code>
|
||||
- <code title="post /session/{id}/init">client.session.<a href="./src/opencode_ai/resources/session.py">init</a>(id, \*\*<a href="src/opencode_ai/types/session_init_params.py">params</a>) -> <a href="./src/opencode_ai/types/session_init_response.py">SessionInitResponse</a></code>
|
||||
- <code title="get /session/{id}/message">client.session.<a href="./src/opencode_ai/resources/session.py">messages</a>(id) -> <a href="./src/opencode_ai/types/session_messages_response.py">SessionMessagesResponse</a></code>
|
||||
- <code title="post /session/{id}/revert">client.session.<a href="./src/opencode_ai/resources/session.py">revert</a>(id, \*\*<a href="src/opencode_ai/types/session_revert_params.py">params</a>) -> <a href="./src/opencode_ai/types/session.py">Session</a></code>
|
||||
- <code title="post /session/{id}/share">client.session.<a href="./src/opencode_ai/resources/session.py">share</a>(id) -> <a href="./src/opencode_ai/types/session.py">Session</a></code>
|
||||
- <code title="post /session/{id}/summarize">client.session.<a href="./src/opencode_ai/resources/session.py">summarize</a>(id, \*\*<a href="src/opencode_ai/types/session_summarize_params.py">params</a>) -> <a href="./src/opencode_ai/types/session_summarize_response.py">SessionSummarizeResponse</a></code>
|
||||
- <code title="post /session/{id}/unrevert">client.session.<a href="./src/opencode_ai/resources/session.py">unrevert</a>(id) -> <a href="./src/opencode_ai/types/session.py">Session</a></code>
|
||||
- <code title="delete /session/{id}/share">client.session.<a href="./src/opencode_ai/resources/session.py">unshare</a>(id) -> <a href="./src/opencode_ai/types/session.py">Session</a></code>
|
||||
|
||||
# Tui
|
||||
|
||||
Types:
|
||||
|
||||
```python
|
||||
from opencode_ai.types import TuiAppendPromptResponse, TuiOpenHelpResponse
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="post /tui/append-prompt">client.tui.<a href="./src/opencode_ai/resources/tui.py">append_prompt</a>(\*\*<a href="src/opencode_ai/types/tui_append_prompt_params.py">params</a>) -> <a href="./src/opencode_ai/types/tui_append_prompt_response.py">TuiAppendPromptResponse</a></code>
|
||||
- <code title="post /tui/open-help">client.tui.<a href="./src/opencode_ai/resources/tui.py">open_help</a>() -> <a href="./src/opencode_ai/types/tui_open_help_response.py">TuiOpenHelpResponse</a></code>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
[project]
|
||||
name = "opencode-ai"
|
||||
version = "0.1.0-alpha.3"
|
||||
version = "0.1.0-alpha.36"
|
||||
description = "The official Python library for the opencode API"
|
||||
dynamic = ["readme"]
|
||||
license = "Apache-2.0"
|
||||
license = "MIT"
|
||||
authors = [
|
||||
{ name = "Opencode", email = "hello@sst.dev" },
|
||||
{ name = "Opencode", email = "support@sst.dev" },
|
||||
]
|
||||
dependencies = [
|
||||
"httpx>=0.23.0, <1",
|
||||
|
|
@ -24,13 +24,14 @@ classifiers = [
|
|||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Programming Language :: Python :: 3.13",
|
||||
"Operating System :: OS Independent",
|
||||
"Operating System :: POSIX",
|
||||
"Operating System :: MacOS",
|
||||
"Operating System :: POSIX :: Linux",
|
||||
"Operating System :: Microsoft :: Windows",
|
||||
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||
"License :: OSI Approved :: Apache Software License"
|
||||
"License :: OSI Approved :: MIT License"
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
|
|
@ -38,7 +39,7 @@ Homepage = "https://github.com/sst/opencode-sdk-python"
|
|||
Repository = "https://github.com/sst/opencode-sdk-python"
|
||||
|
||||
[project.optional-dependencies]
|
||||
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.6"]
|
||||
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.8"]
|
||||
|
||||
[tool.rye]
|
||||
managed = true
|
||||
|
|
@ -147,6 +148,7 @@ exclude = [
|
|||
"_dev",
|
||||
".venv",
|
||||
".nox",
|
||||
".git",
|
||||
]
|
||||
|
||||
reportImplicitOverride = true
|
||||
|
|
@ -158,7 +160,7 @@ reportPrivateUsage = false
|
|||
[tool.ruff]
|
||||
line-length = 120
|
||||
output-format = "grouped"
|
||||
target-version = "py37"
|
||||
target-version = "py38"
|
||||
|
||||
[tool.ruff.format]
|
||||
docstring-code-format = true
|
||||
|
|
|
|||
|
|
@ -48,15 +48,15 @@ filelock==3.12.4
|
|||
frozenlist==1.6.2
|
||||
# via aiohttp
|
||||
# via aiosignal
|
||||
h11==0.14.0
|
||||
h11==0.16.0
|
||||
# via httpcore
|
||||
httpcore==1.0.2
|
||||
httpcore==1.0.9
|
||||
# via httpx
|
||||
httpx==0.28.1
|
||||
# via httpx-aiohttp
|
||||
# via opencode-ai
|
||||
# via respx
|
||||
httpx-aiohttp==0.1.6
|
||||
httpx-aiohttp==0.1.8
|
||||
# via opencode-ai
|
||||
idna==3.4
|
||||
# via anyio
|
||||
|
|
|
|||
|
|
@ -36,14 +36,14 @@ exceptiongroup==1.2.2
|
|||
frozenlist==1.6.2
|
||||
# via aiohttp
|
||||
# via aiosignal
|
||||
h11==0.14.0
|
||||
h11==0.16.0
|
||||
# via httpcore
|
||||
httpcore==1.0.2
|
||||
httpcore==1.0.9
|
||||
# via httpx
|
||||
httpx==0.28.1
|
||||
# via httpx-aiohttp
|
||||
# via opencode-ai
|
||||
httpx-aiohttp==0.1.6
|
||||
httpx-aiohttp==0.1.8
|
||||
# via opencode-ai
|
||||
idna==3.4
|
||||
# via anyio
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}"
|
|||
|
||||
# Run prism mock on the given spec
|
||||
if [ "$1" == "--daemon" ]; then
|
||||
npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" &> .prism.log &
|
||||
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log &
|
||||
|
||||
# Wait for server to come online
|
||||
echo -n "Waiting for server"
|
||||
|
|
@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then
|
|||
|
||||
echo
|
||||
else
|
||||
npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL"
|
||||
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ elif ! prism_is_running ; then
|
|||
echo -e "To run the server, pass in the path or url of your OpenAPI"
|
||||
echo -e "spec to the prism command:"
|
||||
echo
|
||||
echo -e " \$ ${YELLOW}npm exec --package=@stoplight/prism-cli@~5.3.2 -- prism mock path/to/your.openapi.yml${NC}"
|
||||
echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}"
|
||||
echo
|
||||
|
||||
exit 1
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
set -exuo pipefail
|
||||
|
||||
RESPONSE=$(curl -X POST "$URL" \
|
||||
FILENAME=$(basename dist/*.whl)
|
||||
|
||||
RESPONSE=$(curl -X POST "$URL?filename=$FILENAME" \
|
||||
-H "Authorization: Bearer $AUTH" \
|
||||
-H "Content-Type: application/json")
|
||||
|
||||
|
|
@ -12,13 +14,13 @@ if [[ "$SIGNED_URL" == "null" ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
UPLOAD_RESPONSE=$(tar -cz . | curl -v -X PUT \
|
||||
-H "Content-Type: application/gzip" \
|
||||
--data-binary @- "$SIGNED_URL" 2>&1)
|
||||
UPLOAD_RESPONSE=$(curl -v -X PUT \
|
||||
-H "Content-Type: binary/octet-stream" \
|
||||
--data-binary "@dist/$FILENAME" "$SIGNED_URL" 2>&1)
|
||||
|
||||
if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then
|
||||
echo -e "\033[32mUploaded build to Stainless storage.\033[0m"
|
||||
echo -e "\033[32mInstallation: pip install --pre 'https://pkg.stainless.com/s/opencode-python/$SHA'\033[0m"
|
||||
echo -e "\033[32mInstallation: pip install 'https://pkg.stainless.com/s/opencode-python/$SHA/$FILENAME'\033[0m"
|
||||
else
|
||||
echo -e "\033[31mFailed to upload artifact.\033[0m"
|
||||
exit 1
|
||||
|
|
|
|||
|
|
@ -529,6 +529,18 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|||
# work around https://github.com/encode/httpx/discussions/2880
|
||||
kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")}
|
||||
|
||||
is_body_allowed = options.method.lower() != "get"
|
||||
|
||||
if is_body_allowed:
|
||||
if isinstance(json_data, bytes):
|
||||
kwargs["content"] = json_data
|
||||
else:
|
||||
kwargs["json"] = json_data if is_given(json_data) else None
|
||||
kwargs["files"] = files
|
||||
else:
|
||||
headers.pop("Content-Type", None)
|
||||
kwargs.pop("data", None)
|
||||
|
||||
# TODO: report this error to httpx
|
||||
return self._client.build_request( # pyright: ignore[reportUnknownMemberType]
|
||||
headers=headers,
|
||||
|
|
@ -540,8 +552,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|||
# so that passing a `TypedDict` doesn't cause an error.
|
||||
# https://github.com/microsoft/pyright/issues/3526#event-6715453066
|
||||
params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None,
|
||||
json=json_data if is_given(json_data) else None,
|
||||
files=files,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ from ._types import (
|
|||
)
|
||||
from ._utils import is_given, get_async_library
|
||||
from ._version import __version__
|
||||
from .resources import app, file, event, config, session
|
||||
from .resources import app, tui, file, find, event, config, session
|
||||
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
|
||||
from ._exceptions import APIStatusError
|
||||
from ._base_client import (
|
||||
|
|
@ -45,9 +45,11 @@ __all__ = [
|
|||
class Opencode(SyncAPIClient):
|
||||
event: event.EventResource
|
||||
app: app.AppResource
|
||||
find: find.FindResource
|
||||
file: file.FileResource
|
||||
config: config.ConfigResource
|
||||
session: session.SessionResource
|
||||
tui: tui.TuiResource
|
||||
with_raw_response: OpencodeWithRawResponse
|
||||
with_streaming_response: OpencodeWithStreamedResponse
|
||||
|
||||
|
|
@ -92,11 +94,15 @@ class Opencode(SyncAPIClient):
|
|||
_strict_response_validation=_strict_response_validation,
|
||||
)
|
||||
|
||||
self._default_stream_cls = Stream
|
||||
|
||||
self.event = event.EventResource(self)
|
||||
self.app = app.AppResource(self)
|
||||
self.find = find.FindResource(self)
|
||||
self.file = file.FileResource(self)
|
||||
self.config = config.ConfigResource(self)
|
||||
self.session = session.SessionResource(self)
|
||||
self.tui = tui.TuiResource(self)
|
||||
self.with_raw_response = OpencodeWithRawResponse(self)
|
||||
self.with_streaming_response = OpencodeWithStreamedResponse(self)
|
||||
|
||||
|
|
@ -200,9 +206,11 @@ class Opencode(SyncAPIClient):
|
|||
class AsyncOpencode(AsyncAPIClient):
|
||||
event: event.AsyncEventResource
|
||||
app: app.AsyncAppResource
|
||||
find: find.AsyncFindResource
|
||||
file: file.AsyncFileResource
|
||||
config: config.AsyncConfigResource
|
||||
session: session.AsyncSessionResource
|
||||
tui: tui.AsyncTuiResource
|
||||
with_raw_response: AsyncOpencodeWithRawResponse
|
||||
with_streaming_response: AsyncOpencodeWithStreamedResponse
|
||||
|
||||
|
|
@ -247,11 +255,15 @@ class AsyncOpencode(AsyncAPIClient):
|
|||
_strict_response_validation=_strict_response_validation,
|
||||
)
|
||||
|
||||
self._default_stream_cls = AsyncStream
|
||||
|
||||
self.event = event.AsyncEventResource(self)
|
||||
self.app = app.AsyncAppResource(self)
|
||||
self.find = find.AsyncFindResource(self)
|
||||
self.file = file.AsyncFileResource(self)
|
||||
self.config = config.AsyncConfigResource(self)
|
||||
self.session = session.AsyncSessionResource(self)
|
||||
self.tui = tui.AsyncTuiResource(self)
|
||||
self.with_raw_response = AsyncOpencodeWithRawResponse(self)
|
||||
self.with_streaming_response = AsyncOpencodeWithStreamedResponse(self)
|
||||
|
||||
|
|
@ -356,36 +368,44 @@ class OpencodeWithRawResponse:
|
|||
def __init__(self, client: Opencode) -> None:
|
||||
self.event = event.EventResourceWithRawResponse(client.event)
|
||||
self.app = app.AppResourceWithRawResponse(client.app)
|
||||
self.find = find.FindResourceWithRawResponse(client.find)
|
||||
self.file = file.FileResourceWithRawResponse(client.file)
|
||||
self.config = config.ConfigResourceWithRawResponse(client.config)
|
||||
self.session = session.SessionResourceWithRawResponse(client.session)
|
||||
self.tui = tui.TuiResourceWithRawResponse(client.tui)
|
||||
|
||||
|
||||
class AsyncOpencodeWithRawResponse:
|
||||
def __init__(self, client: AsyncOpencode) -> None:
|
||||
self.event = event.AsyncEventResourceWithRawResponse(client.event)
|
||||
self.app = app.AsyncAppResourceWithRawResponse(client.app)
|
||||
self.find = find.AsyncFindResourceWithRawResponse(client.find)
|
||||
self.file = file.AsyncFileResourceWithRawResponse(client.file)
|
||||
self.config = config.AsyncConfigResourceWithRawResponse(client.config)
|
||||
self.session = session.AsyncSessionResourceWithRawResponse(client.session)
|
||||
self.tui = tui.AsyncTuiResourceWithRawResponse(client.tui)
|
||||
|
||||
|
||||
class OpencodeWithStreamedResponse:
|
||||
def __init__(self, client: Opencode) -> None:
|
||||
self.event = event.EventResourceWithStreamingResponse(client.event)
|
||||
self.app = app.AppResourceWithStreamingResponse(client.app)
|
||||
self.find = find.FindResourceWithStreamingResponse(client.find)
|
||||
self.file = file.FileResourceWithStreamingResponse(client.file)
|
||||
self.config = config.ConfigResourceWithStreamingResponse(client.config)
|
||||
self.session = session.SessionResourceWithStreamingResponse(client.session)
|
||||
self.tui = tui.TuiResourceWithStreamingResponse(client.tui)
|
||||
|
||||
|
||||
class AsyncOpencodeWithStreamedResponse:
|
||||
def __init__(self, client: AsyncOpencode) -> None:
|
||||
self.event = event.AsyncEventResourceWithStreamingResponse(client.event)
|
||||
self.app = app.AsyncAppResourceWithStreamingResponse(client.app)
|
||||
self.find = find.AsyncFindResourceWithStreamingResponse(client.find)
|
||||
self.file = file.AsyncFileResourceWithStreamingResponse(client.file)
|
||||
self.config = config.AsyncConfigResourceWithStreamingResponse(client.config)
|
||||
self.session = session.AsyncSessionResourceWithStreamingResponse(client.session)
|
||||
self.tui = tui.AsyncTuiResourceWithStreamingResponse(client.tui)
|
||||
|
||||
|
||||
Client = Opencode
|
||||
|
|
|
|||
|
|
@ -69,12 +69,12 @@ def _transform_file(file: FileTypes) -> HttpxFileTypes:
|
|||
return file
|
||||
|
||||
if is_tuple_t(file):
|
||||
return (file[0], _read_file_content(file[1]), *file[2:])
|
||||
return (file[0], read_file_content(file[1]), *file[2:])
|
||||
|
||||
raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple")
|
||||
|
||||
|
||||
def _read_file_content(file: FileContent) -> HttpxFileContent:
|
||||
def read_file_content(file: FileContent) -> HttpxFileContent:
|
||||
if isinstance(file, os.PathLike):
|
||||
return pathlib.Path(file).read_bytes()
|
||||
return file
|
||||
|
|
@ -111,12 +111,12 @@ async def _async_transform_file(file: FileTypes) -> HttpxFileTypes:
|
|||
return file
|
||||
|
||||
if is_tuple_t(file):
|
||||
return (file[0], await _async_read_file_content(file[1]), *file[2:])
|
||||
return (file[0], await async_read_file_content(file[1]), *file[2:])
|
||||
|
||||
raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple")
|
||||
|
||||
|
||||
async def _async_read_file_content(file: FileContent) -> HttpxFileContent:
|
||||
async def async_read_file_content(file: FileContent) -> HttpxFileContent:
|
||||
if isinstance(file, os.PathLike):
|
||||
return await anyio.Path(file).read_bytes()
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,10 @@ from __future__ import annotations
|
|||
|
||||
import os
|
||||
import inspect
|
||||
from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, cast
|
||||
from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast
|
||||
from datetime import date, datetime
|
||||
from typing_extensions import (
|
||||
List,
|
||||
Unpack,
|
||||
Literal,
|
||||
ClassVar,
|
||||
|
|
@ -207,14 +208,18 @@ class BaseModel(pydantic.BaseModel):
|
|||
else:
|
||||
fields_values[name] = field_get_default(field)
|
||||
|
||||
extra_field_type = _get_extra_fields_type(__cls)
|
||||
|
||||
_extra = {}
|
||||
for key, value in values.items():
|
||||
if key not in model_fields:
|
||||
parsed = construct_type(value=value, type_=extra_field_type) if extra_field_type is not None else value
|
||||
|
||||
if PYDANTIC_V2:
|
||||
_extra[key] = value
|
||||
_extra[key] = parsed
|
||||
else:
|
||||
_fields_set.add(key)
|
||||
fields_values[key] = value
|
||||
fields_values[key] = parsed
|
||||
|
||||
object.__setattr__(m, "__dict__", fields_values)
|
||||
|
||||
|
|
@ -299,7 +304,7 @@ class BaseModel(pydantic.BaseModel):
|
|||
exclude_none=exclude_none,
|
||||
)
|
||||
|
||||
return cast(dict[str, Any], json_safe(dumped)) if mode == "json" else dumped
|
||||
return cast("dict[str, Any]", json_safe(dumped)) if mode == "json" else dumped
|
||||
|
||||
@override
|
||||
def model_dump_json(
|
||||
|
|
@ -366,7 +371,24 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object:
|
|||
if type_ is None:
|
||||
raise RuntimeError(f"Unexpected field type is None for {key}")
|
||||
|
||||
return construct_type(value=value, type_=type_)
|
||||
return construct_type(value=value, type_=type_, metadata=getattr(field, "metadata", None))
|
||||
|
||||
|
||||
def _get_extra_fields_type(cls: type[pydantic.BaseModel]) -> type | None:
|
||||
if not PYDANTIC_V2:
|
||||
# TODO
|
||||
return None
|
||||
|
||||
schema = cls.__pydantic_core_schema__
|
||||
if schema["type"] == "model":
|
||||
fields = schema["schema"]
|
||||
if fields["type"] == "model-fields":
|
||||
extras = fields.get("extras_schema")
|
||||
if extras and "cls" in extras:
|
||||
# mypy can't narrow the type
|
||||
return extras["cls"] # type: ignore[no-any-return]
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def is_basemodel(type_: type) -> bool:
|
||||
|
|
@ -420,7 +442,7 @@ def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T:
|
|||
return cast(_T, construct_type(value=value, type_=type_))
|
||||
|
||||
|
||||
def construct_type(*, value: object, type_: object) -> object:
|
||||
def construct_type(*, value: object, type_: object, metadata: Optional[List[Any]] = None) -> object:
|
||||
"""Loose coercion to the expected type with construction of nested values.
|
||||
|
||||
If the given value does not match the expected type then it is returned as-is.
|
||||
|
|
@ -438,8 +460,10 @@ def construct_type(*, value: object, type_: object) -> object:
|
|||
type_ = type_.__value__ # type: ignore[unreachable]
|
||||
|
||||
# unwrap `Annotated[T, ...]` -> `T`
|
||||
if is_annotated_type(type_):
|
||||
meta: tuple[Any, ...] = get_args(type_)[1:]
|
||||
if metadata is not None and len(metadata) > 0:
|
||||
meta: tuple[Any, ...] = tuple(metadata)
|
||||
elif is_annotated_type(type_):
|
||||
meta = get_args(type_)[1:]
|
||||
type_ = extract_type_arg(type_, 0)
|
||||
else:
|
||||
meta = tuple()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
__title__ = "opencode_ai"
|
||||
__version__ = "0.1.0-alpha.3" # x-release-please-version
|
||||
__version__ = "0.1.0-alpha.36" # x-release-please-version
|
||||
|
|
|
|||
|
|
@ -8,6 +8,14 @@ from .app import (
|
|||
AppResourceWithStreamingResponse,
|
||||
AsyncAppResourceWithStreamingResponse,
|
||||
)
|
||||
from .tui import (
|
||||
TuiResource,
|
||||
AsyncTuiResource,
|
||||
TuiResourceWithRawResponse,
|
||||
AsyncTuiResourceWithRawResponse,
|
||||
TuiResourceWithStreamingResponse,
|
||||
AsyncTuiResourceWithStreamingResponse,
|
||||
)
|
||||
from .file import (
|
||||
FileResource,
|
||||
AsyncFileResource,
|
||||
|
|
@ -16,6 +24,14 @@ from .file import (
|
|||
FileResourceWithStreamingResponse,
|
||||
AsyncFileResourceWithStreamingResponse,
|
||||
)
|
||||
from .find import (
|
||||
FindResource,
|
||||
AsyncFindResource,
|
||||
FindResourceWithRawResponse,
|
||||
AsyncFindResourceWithRawResponse,
|
||||
FindResourceWithStreamingResponse,
|
||||
AsyncFindResourceWithStreamingResponse,
|
||||
)
|
||||
from .event import (
|
||||
EventResource,
|
||||
AsyncEventResource,
|
||||
|
|
@ -54,6 +70,12 @@ __all__ = [
|
|||
"AsyncAppResourceWithRawResponse",
|
||||
"AppResourceWithStreamingResponse",
|
||||
"AsyncAppResourceWithStreamingResponse",
|
||||
"FindResource",
|
||||
"AsyncFindResource",
|
||||
"FindResourceWithRawResponse",
|
||||
"AsyncFindResourceWithRawResponse",
|
||||
"FindResourceWithStreamingResponse",
|
||||
"AsyncFindResourceWithStreamingResponse",
|
||||
"FileResource",
|
||||
"AsyncFileResource",
|
||||
"FileResourceWithRawResponse",
|
||||
|
|
@ -72,4 +94,10 @@ __all__ = [
|
|||
"AsyncSessionResourceWithRawResponse",
|
||||
"SessionResourceWithStreamingResponse",
|
||||
"AsyncSessionResourceWithStreamingResponse",
|
||||
"TuiResource",
|
||||
"AsyncTuiResource",
|
||||
"TuiResourceWithRawResponse",
|
||||
"AsyncTuiResourceWithRawResponse",
|
||||
"TuiResourceWithStreamingResponse",
|
||||
"AsyncTuiResourceWithStreamingResponse",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -2,9 +2,14 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Dict
|
||||
from typing_extensions import Literal
|
||||
|
||||
import httpx
|
||||
|
||||
from ..types import app_log_params
|
||||
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from .._utils import maybe_transform, async_maybe_transform
|
||||
from .._compat import cached_property
|
||||
from .._resource import SyncAPIResource, AsyncAPIResource
|
||||
from .._response import (
|
||||
|
|
@ -15,7 +20,10 @@ from .._response import (
|
|||
)
|
||||
from ..types.app import App
|
||||
from .._base_client import make_request_options
|
||||
from ..types.app_log_response import AppLogResponse
|
||||
from ..types.app_init_response import AppInitResponse
|
||||
from ..types.app_modes_response import AppModesResponse
|
||||
from ..types.app_providers_response import AppProvidersResponse
|
||||
|
||||
__all__ = ["AppResource", "AsyncAppResource"]
|
||||
|
||||
|
|
@ -78,6 +86,95 @@ class AppResource(SyncAPIResource):
|
|||
cast_to=AppInitResponse,
|
||||
)
|
||||
|
||||
def log(
|
||||
self,
|
||||
*,
|
||||
level: Literal["debug", "info", "error", "warn"],
|
||||
message: str,
|
||||
service: str,
|
||||
extra: Dict[str, object] | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> AppLogResponse:
|
||||
"""
|
||||
Write a log entry to the server logs
|
||||
|
||||
Args:
|
||||
level: Log level
|
||||
|
||||
message: Log message
|
||||
|
||||
service: Service name for the log entry
|
||||
|
||||
extra: Additional metadata for the log entry
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
return self._post(
|
||||
"/log",
|
||||
body=maybe_transform(
|
||||
{
|
||||
"level": level,
|
||||
"message": message,
|
||||
"service": service,
|
||||
"extra": extra,
|
||||
},
|
||||
app_log_params.AppLogParams,
|
||||
),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=AppLogResponse,
|
||||
)
|
||||
|
||||
def modes(
|
||||
self,
|
||||
*,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> AppModesResponse:
|
||||
"""List all modes"""
|
||||
return self._get(
|
||||
"/mode",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=AppModesResponse,
|
||||
)
|
||||
|
||||
def providers(
|
||||
self,
|
||||
*,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> AppProvidersResponse:
|
||||
"""List all providers"""
|
||||
return self._get(
|
||||
"/config/providers",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=AppProvidersResponse,
|
||||
)
|
||||
|
||||
|
||||
class AsyncAppResource(AsyncAPIResource):
|
||||
@cached_property
|
||||
|
|
@ -137,6 +234,95 @@ class AsyncAppResource(AsyncAPIResource):
|
|||
cast_to=AppInitResponse,
|
||||
)
|
||||
|
||||
async def log(
|
||||
self,
|
||||
*,
|
||||
level: Literal["debug", "info", "error", "warn"],
|
||||
message: str,
|
||||
service: str,
|
||||
extra: Dict[str, object] | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> AppLogResponse:
|
||||
"""
|
||||
Write a log entry to the server logs
|
||||
|
||||
Args:
|
||||
level: Log level
|
||||
|
||||
message: Log message
|
||||
|
||||
service: Service name for the log entry
|
||||
|
||||
extra: Additional metadata for the log entry
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
return await self._post(
|
||||
"/log",
|
||||
body=await async_maybe_transform(
|
||||
{
|
||||
"level": level,
|
||||
"message": message,
|
||||
"service": service,
|
||||
"extra": extra,
|
||||
},
|
||||
app_log_params.AppLogParams,
|
||||
),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=AppLogResponse,
|
||||
)
|
||||
|
||||
async def modes(
|
||||
self,
|
||||
*,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> AppModesResponse:
|
||||
"""List all modes"""
|
||||
return await self._get(
|
||||
"/mode",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=AppModesResponse,
|
||||
)
|
||||
|
||||
async def providers(
|
||||
self,
|
||||
*,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> AppProvidersResponse:
|
||||
"""List all providers"""
|
||||
return await self._get(
|
||||
"/config/providers",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=AppProvidersResponse,
|
||||
)
|
||||
|
||||
|
||||
class AppResourceWithRawResponse:
|
||||
def __init__(self, app: AppResource) -> None:
|
||||
|
|
@ -148,6 +334,15 @@ class AppResourceWithRawResponse:
|
|||
self.init = to_raw_response_wrapper(
|
||||
app.init,
|
||||
)
|
||||
self.log = to_raw_response_wrapper(
|
||||
app.log,
|
||||
)
|
||||
self.modes = to_raw_response_wrapper(
|
||||
app.modes,
|
||||
)
|
||||
self.providers = to_raw_response_wrapper(
|
||||
app.providers,
|
||||
)
|
||||
|
||||
|
||||
class AsyncAppResourceWithRawResponse:
|
||||
|
|
@ -160,6 +355,15 @@ class AsyncAppResourceWithRawResponse:
|
|||
self.init = async_to_raw_response_wrapper(
|
||||
app.init,
|
||||
)
|
||||
self.log = async_to_raw_response_wrapper(
|
||||
app.log,
|
||||
)
|
||||
self.modes = async_to_raw_response_wrapper(
|
||||
app.modes,
|
||||
)
|
||||
self.providers = async_to_raw_response_wrapper(
|
||||
app.providers,
|
||||
)
|
||||
|
||||
|
||||
class AppResourceWithStreamingResponse:
|
||||
|
|
@ -172,6 +376,15 @@ class AppResourceWithStreamingResponse:
|
|||
self.init = to_streamed_response_wrapper(
|
||||
app.init,
|
||||
)
|
||||
self.log = to_streamed_response_wrapper(
|
||||
app.log,
|
||||
)
|
||||
self.modes = to_streamed_response_wrapper(
|
||||
app.modes,
|
||||
)
|
||||
self.providers = to_streamed_response_wrapper(
|
||||
app.providers,
|
||||
)
|
||||
|
||||
|
||||
class AsyncAppResourceWithStreamingResponse:
|
||||
|
|
@ -184,3 +397,12 @@ class AsyncAppResourceWithStreamingResponse:
|
|||
self.init = async_to_streamed_response_wrapper(
|
||||
app.init,
|
||||
)
|
||||
self.log = async_to_streamed_response_wrapper(
|
||||
app.log,
|
||||
)
|
||||
self.modes = async_to_streamed_response_wrapper(
|
||||
app.modes,
|
||||
)
|
||||
self.providers = async_to_streamed_response_wrapper(
|
||||
app.providers,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ from .._response import (
|
|||
)
|
||||
from .._base_client import make_request_options
|
||||
from ..types.config import Config
|
||||
from ..types.config_providers_response import ConfigProvidersResponse
|
||||
|
||||
__all__ = ["ConfigResource", "AsyncConfigResource"]
|
||||
|
||||
|
|
@ -59,25 +58,6 @@ class ConfigResource(SyncAPIResource):
|
|||
cast_to=Config,
|
||||
)
|
||||
|
||||
def providers(
|
||||
self,
|
||||
*,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> ConfigProvidersResponse:
|
||||
"""List all providers"""
|
||||
return self._get(
|
||||
"/config/providers",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=ConfigProvidersResponse,
|
||||
)
|
||||
|
||||
|
||||
class AsyncConfigResource(AsyncAPIResource):
|
||||
@cached_property
|
||||
|
|
@ -118,25 +98,6 @@ class AsyncConfigResource(AsyncAPIResource):
|
|||
cast_to=Config,
|
||||
)
|
||||
|
||||
async def providers(
|
||||
self,
|
||||
*,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> ConfigProvidersResponse:
|
||||
"""List all providers"""
|
||||
return await self._get(
|
||||
"/config/providers",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=ConfigProvidersResponse,
|
||||
)
|
||||
|
||||
|
||||
class ConfigResourceWithRawResponse:
|
||||
def __init__(self, config: ConfigResource) -> None:
|
||||
|
|
@ -145,9 +106,6 @@ class ConfigResourceWithRawResponse:
|
|||
self.get = to_raw_response_wrapper(
|
||||
config.get,
|
||||
)
|
||||
self.providers = to_raw_response_wrapper(
|
||||
config.providers,
|
||||
)
|
||||
|
||||
|
||||
class AsyncConfigResourceWithRawResponse:
|
||||
|
|
@ -157,9 +115,6 @@ class AsyncConfigResourceWithRawResponse:
|
|||
self.get = async_to_raw_response_wrapper(
|
||||
config.get,
|
||||
)
|
||||
self.providers = async_to_raw_response_wrapper(
|
||||
config.providers,
|
||||
)
|
||||
|
||||
|
||||
class ConfigResourceWithStreamingResponse:
|
||||
|
|
@ -169,9 +124,6 @@ class ConfigResourceWithStreamingResponse:
|
|||
self.get = to_streamed_response_wrapper(
|
||||
config.get,
|
||||
)
|
||||
self.providers = to_streamed_response_wrapper(
|
||||
config.providers,
|
||||
)
|
||||
|
||||
|
||||
class AsyncConfigResourceWithStreamingResponse:
|
||||
|
|
@ -181,6 +133,3 @@ class AsyncConfigResourceWithStreamingResponse:
|
|||
self.get = async_to_streamed_response_wrapper(
|
||||
config.get,
|
||||
)
|
||||
self.providers = async_to_streamed_response_wrapper(
|
||||
config.providers,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ from .._response import (
|
|||
async_to_raw_response_wrapper,
|
||||
async_to_streamed_response_wrapper,
|
||||
)
|
||||
from .._streaming import Stream, AsyncStream
|
||||
from .._base_client import make_request_options
|
||||
from ..types.event_list_response import EventListResponse
|
||||
|
||||
|
|
@ -50,17 +51,16 @@ class EventResource(SyncAPIResource):
|
|||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> EventListResponse:
|
||||
) -> Stream[EventListResponse]:
|
||||
"""Get events"""
|
||||
return cast(
|
||||
EventListResponse,
|
||||
self._get(
|
||||
"/event",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=cast(Any, EventListResponse), # Union types cannot be passed in as arguments in the type system
|
||||
return self._get(
|
||||
"/event",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=cast(Any, EventListResponse), # Union types cannot be passed in as arguments in the type system
|
||||
stream=True,
|
||||
stream_cls=Stream[EventListResponse],
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -93,17 +93,16 @@ class AsyncEventResource(AsyncAPIResource):
|
|||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> EventListResponse:
|
||||
) -> AsyncStream[EventListResponse]:
|
||||
"""Get events"""
|
||||
return cast(
|
||||
EventListResponse,
|
||||
await self._get(
|
||||
"/event",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=cast(Any, EventListResponse), # Union types cannot be passed in as arguments in the type system
|
||||
return await self._get(
|
||||
"/event",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=cast(Any, EventListResponse), # Union types cannot be passed in as arguments in the type system
|
||||
stream=True,
|
||||
stream_cls=AsyncStream[EventListResponse],
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
|||
|
||||
import httpx
|
||||
|
||||
from ..types import file_search_params
|
||||
from ..types import file_read_params
|
||||
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from .._utils import maybe_transform, async_maybe_transform
|
||||
from .._compat import cached_property
|
||||
|
|
@ -16,7 +16,8 @@ from .._response import (
|
|||
async_to_streamed_response_wrapper,
|
||||
)
|
||||
from .._base_client import make_request_options
|
||||
from ..types.file_search_response import FileSearchResponse
|
||||
from ..types.file_read_response import FileReadResponse
|
||||
from ..types.file_status_response import FileStatusResponse
|
||||
|
||||
__all__ = ["FileResource", "AsyncFileResource"]
|
||||
|
||||
|
|
@ -41,19 +42,19 @@ class FileResource(SyncAPIResource):
|
|||
"""
|
||||
return FileResourceWithStreamingResponse(self)
|
||||
|
||||
def search(
|
||||
def read(
|
||||
self,
|
||||
*,
|
||||
query: str,
|
||||
path: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> FileSearchResponse:
|
||||
) -> FileReadResponse:
|
||||
"""
|
||||
Search for files
|
||||
Read a file
|
||||
|
||||
Args:
|
||||
extra_headers: Send extra headers
|
||||
|
|
@ -71,9 +72,28 @@ class FileResource(SyncAPIResource):
|
|||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=maybe_transform({"query": query}, file_search_params.FileSearchParams),
|
||||
query=maybe_transform({"path": path}, file_read_params.FileReadParams),
|
||||
),
|
||||
cast_to=FileSearchResponse,
|
||||
cast_to=FileReadResponse,
|
||||
)
|
||||
|
||||
def status(
|
||||
self,
|
||||
*,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> FileStatusResponse:
|
||||
"""Get file status"""
|
||||
return self._get(
|
||||
"/file/status",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=FileStatusResponse,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -97,19 +117,19 @@ class AsyncFileResource(AsyncAPIResource):
|
|||
"""
|
||||
return AsyncFileResourceWithStreamingResponse(self)
|
||||
|
||||
async def search(
|
||||
async def read(
|
||||
self,
|
||||
*,
|
||||
query: str,
|
||||
path: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> FileSearchResponse:
|
||||
) -> FileReadResponse:
|
||||
"""
|
||||
Search for files
|
||||
Read a file
|
||||
|
||||
Args:
|
||||
extra_headers: Send extra headers
|
||||
|
|
@ -127,9 +147,28 @@ class AsyncFileResource(AsyncAPIResource):
|
|||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=await async_maybe_transform({"query": query}, file_search_params.FileSearchParams),
|
||||
query=await async_maybe_transform({"path": path}, file_read_params.FileReadParams),
|
||||
),
|
||||
cast_to=FileSearchResponse,
|
||||
cast_to=FileReadResponse,
|
||||
)
|
||||
|
||||
async def status(
|
||||
self,
|
||||
*,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> FileStatusResponse:
|
||||
"""Get file status"""
|
||||
return await self._get(
|
||||
"/file/status",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=FileStatusResponse,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -137,8 +176,11 @@ class FileResourceWithRawResponse:
|
|||
def __init__(self, file: FileResource) -> None:
|
||||
self._file = file
|
||||
|
||||
self.search = to_raw_response_wrapper(
|
||||
file.search,
|
||||
self.read = to_raw_response_wrapper(
|
||||
file.read,
|
||||
)
|
||||
self.status = to_raw_response_wrapper(
|
||||
file.status,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -146,8 +188,11 @@ class AsyncFileResourceWithRawResponse:
|
|||
def __init__(self, file: AsyncFileResource) -> None:
|
||||
self._file = file
|
||||
|
||||
self.search = async_to_raw_response_wrapper(
|
||||
file.search,
|
||||
self.read = async_to_raw_response_wrapper(
|
||||
file.read,
|
||||
)
|
||||
self.status = async_to_raw_response_wrapper(
|
||||
file.status,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -155,8 +200,11 @@ class FileResourceWithStreamingResponse:
|
|||
def __init__(self, file: FileResource) -> None:
|
||||
self._file = file
|
||||
|
||||
self.search = to_streamed_response_wrapper(
|
||||
file.search,
|
||||
self.read = to_streamed_response_wrapper(
|
||||
file.read,
|
||||
)
|
||||
self.status = to_streamed_response_wrapper(
|
||||
file.status,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -164,6 +212,9 @@ class AsyncFileResourceWithStreamingResponse:
|
|||
def __init__(self, file: AsyncFileResource) -> None:
|
||||
self._file = file
|
||||
|
||||
self.search = async_to_streamed_response_wrapper(
|
||||
file.search,
|
||||
self.read = async_to_streamed_response_wrapper(
|
||||
file.read,
|
||||
)
|
||||
self.status = async_to_streamed_response_wrapper(
|
||||
file.status,
|
||||
)
|
||||
|
|
|
|||
335
src/opencode_ai/resources/find.py
Normal file
335
src/opencode_ai/resources/find.py
Normal file
|
|
@ -0,0 +1,335 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import httpx
|
||||
|
||||
from ..types import find_text_params, find_files_params, find_symbols_params
|
||||
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from .._utils import maybe_transform, async_maybe_transform
|
||||
from .._compat import cached_property
|
||||
from .._resource import SyncAPIResource, AsyncAPIResource
|
||||
from .._response import (
|
||||
to_raw_response_wrapper,
|
||||
to_streamed_response_wrapper,
|
||||
async_to_raw_response_wrapper,
|
||||
async_to_streamed_response_wrapper,
|
||||
)
|
||||
from .._base_client import make_request_options
|
||||
from ..types.find_text_response import FindTextResponse
|
||||
from ..types.find_files_response import FindFilesResponse
|
||||
from ..types.find_symbols_response import FindSymbolsResponse
|
||||
|
||||
__all__ = ["FindResource", "AsyncFindResource"]
|
||||
|
||||
|
||||
class FindResource(SyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> FindResourceWithRawResponse:
|
||||
"""
|
||||
This property can be used as a prefix for any HTTP method call to return
|
||||
the raw response object instead of the parsed content.
|
||||
|
||||
For more information, see https://www.github.com/sst/opencode-sdk-python#accessing-raw-response-data-eg-headers
|
||||
"""
|
||||
return FindResourceWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> FindResourceWithStreamingResponse:
|
||||
"""
|
||||
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
||||
|
||||
For more information, see https://www.github.com/sst/opencode-sdk-python#with_streaming_response
|
||||
"""
|
||||
return FindResourceWithStreamingResponse(self)
|
||||
|
||||
def files(
|
||||
self,
|
||||
*,
|
||||
query: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> FindFilesResponse:
|
||||
"""
|
||||
Find files
|
||||
|
||||
Args:
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
return self._get(
|
||||
"/find/file",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=maybe_transform({"query": query}, find_files_params.FindFilesParams),
|
||||
),
|
||||
cast_to=FindFilesResponse,
|
||||
)
|
||||
|
||||
def symbols(
|
||||
self,
|
||||
*,
|
||||
query: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> FindSymbolsResponse:
|
||||
"""
|
||||
Find workspace symbols
|
||||
|
||||
Args:
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
return self._get(
|
||||
"/find/symbol",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=maybe_transform({"query": query}, find_symbols_params.FindSymbolsParams),
|
||||
),
|
||||
cast_to=FindSymbolsResponse,
|
||||
)
|
||||
|
||||
def text(
|
||||
self,
|
||||
*,
|
||||
pattern: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> FindTextResponse:
|
||||
"""
|
||||
Find text in files
|
||||
|
||||
Args:
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
return self._get(
|
||||
"/find",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=maybe_transform({"pattern": pattern}, find_text_params.FindTextParams),
|
||||
),
|
||||
cast_to=FindTextResponse,
|
||||
)
|
||||
|
||||
|
||||
class AsyncFindResource(AsyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncFindResourceWithRawResponse:
|
||||
"""
|
||||
This property can be used as a prefix for any HTTP method call to return
|
||||
the raw response object instead of the parsed content.
|
||||
|
||||
For more information, see https://www.github.com/sst/opencode-sdk-python#accessing-raw-response-data-eg-headers
|
||||
"""
|
||||
return AsyncFindResourceWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AsyncFindResourceWithStreamingResponse:
|
||||
"""
|
||||
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
||||
|
||||
For more information, see https://www.github.com/sst/opencode-sdk-python#with_streaming_response
|
||||
"""
|
||||
return AsyncFindResourceWithStreamingResponse(self)
|
||||
|
||||
async def files(
|
||||
self,
|
||||
*,
|
||||
query: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> FindFilesResponse:
|
||||
"""
|
||||
Find files
|
||||
|
||||
Args:
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
return await self._get(
|
||||
"/find/file",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=await async_maybe_transform({"query": query}, find_files_params.FindFilesParams),
|
||||
),
|
||||
cast_to=FindFilesResponse,
|
||||
)
|
||||
|
||||
async def symbols(
|
||||
self,
|
||||
*,
|
||||
query: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> FindSymbolsResponse:
|
||||
"""
|
||||
Find workspace symbols
|
||||
|
||||
Args:
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
return await self._get(
|
||||
"/find/symbol",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=await async_maybe_transform({"query": query}, find_symbols_params.FindSymbolsParams),
|
||||
),
|
||||
cast_to=FindSymbolsResponse,
|
||||
)
|
||||
|
||||
async def text(
|
||||
self,
|
||||
*,
|
||||
pattern: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> FindTextResponse:
|
||||
"""
|
||||
Find text in files
|
||||
|
||||
Args:
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
return await self._get(
|
||||
"/find",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=await async_maybe_transform({"pattern": pattern}, find_text_params.FindTextParams),
|
||||
),
|
||||
cast_to=FindTextResponse,
|
||||
)
|
||||
|
||||
|
||||
class FindResourceWithRawResponse:
|
||||
def __init__(self, find: FindResource) -> None:
|
||||
self._find = find
|
||||
|
||||
self.files = to_raw_response_wrapper(
|
||||
find.files,
|
||||
)
|
||||
self.symbols = to_raw_response_wrapper(
|
||||
find.symbols,
|
||||
)
|
||||
self.text = to_raw_response_wrapper(
|
||||
find.text,
|
||||
)
|
||||
|
||||
|
||||
class AsyncFindResourceWithRawResponse:
|
||||
def __init__(self, find: AsyncFindResource) -> None:
|
||||
self._find = find
|
||||
|
||||
self.files = async_to_raw_response_wrapper(
|
||||
find.files,
|
||||
)
|
||||
self.symbols = async_to_raw_response_wrapper(
|
||||
find.symbols,
|
||||
)
|
||||
self.text = async_to_raw_response_wrapper(
|
||||
find.text,
|
||||
)
|
||||
|
||||
|
||||
class FindResourceWithStreamingResponse:
|
||||
def __init__(self, find: FindResource) -> None:
|
||||
self._find = find
|
||||
|
||||
self.files = to_streamed_response_wrapper(
|
||||
find.files,
|
||||
)
|
||||
self.symbols = to_streamed_response_wrapper(
|
||||
find.symbols,
|
||||
)
|
||||
self.text = to_streamed_response_wrapper(
|
||||
find.text,
|
||||
)
|
||||
|
||||
|
||||
class AsyncFindResourceWithStreamingResponse:
|
||||
def __init__(self, find: AsyncFindResource) -> None:
|
||||
self._find = find
|
||||
|
||||
self.files = async_to_streamed_response_wrapper(
|
||||
find.files,
|
||||
)
|
||||
self.symbols = async_to_streamed_response_wrapper(
|
||||
find.symbols,
|
||||
)
|
||||
self.text = async_to_streamed_response_wrapper(
|
||||
find.text,
|
||||
)
|
||||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Iterable
|
||||
from typing import Dict, Iterable
|
||||
|
||||
import httpx
|
||||
|
||||
from ..types import session_chat_params, session_init_params, session_summarize_params
|
||||
from ..types import session_chat_params, session_init_params, session_revert_params, session_summarize_params
|
||||
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from .._utils import maybe_transform, async_maybe_transform
|
||||
from .._compat import cached_property
|
||||
|
|
@ -18,9 +18,8 @@ from .._response import (
|
|||
async_to_streamed_response_wrapper,
|
||||
)
|
||||
from .._base_client import make_request_options
|
||||
from ..types.message import Message
|
||||
from ..types.session import Session
|
||||
from ..types.message_part_param import MessagePartParam
|
||||
from ..types.assistant_message import AssistantMessage
|
||||
from ..types.session_init_response import SessionInitResponse
|
||||
from ..types.session_list_response import SessionListResponse
|
||||
from ..types.session_abort_response import SessionAbortResponse
|
||||
|
|
@ -160,15 +159,19 @@ class SessionResource(SyncAPIResource):
|
|||
id: str,
|
||||
*,
|
||||
model_id: str,
|
||||
parts: Iterable[MessagePartParam],
|
||||
parts: Iterable[session_chat_params.Part],
|
||||
provider_id: str,
|
||||
message_id: str | NotGiven = NOT_GIVEN,
|
||||
mode: str | NotGiven = NOT_GIVEN,
|
||||
system: str | NotGiven = NOT_GIVEN,
|
||||
tools: Dict[str, bool] | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> Message:
|
||||
) -> AssistantMessage:
|
||||
"""
|
||||
Create and send a new message to a session
|
||||
|
||||
|
|
@ -192,19 +195,24 @@ class SessionResource(SyncAPIResource):
|
|||
"model_id": model_id,
|
||||
"parts": parts,
|
||||
"provider_id": provider_id,
|
||||
"message_id": message_id,
|
||||
"mode": mode,
|
||||
"system": system,
|
||||
"tools": tools,
|
||||
},
|
||||
session_chat_params.SessionChatParams,
|
||||
),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=Message,
|
||||
cast_to=AssistantMessage,
|
||||
)
|
||||
|
||||
def init(
|
||||
self,
|
||||
id: str,
|
||||
*,
|
||||
message_id: str,
|
||||
model_id: str,
|
||||
provider_id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
|
|
@ -234,6 +242,7 @@ class SessionResource(SyncAPIResource):
|
|||
f"/session/{id}/init",
|
||||
body=maybe_transform(
|
||||
{
|
||||
"message_id": message_id,
|
||||
"model_id": model_id,
|
||||
"provider_id": provider_id,
|
||||
},
|
||||
|
|
@ -280,6 +289,48 @@ class SessionResource(SyncAPIResource):
|
|||
cast_to=SessionMessagesResponse,
|
||||
)
|
||||
|
||||
def revert(
|
||||
self,
|
||||
id: str,
|
||||
*,
|
||||
message_id: str,
|
||||
part_id: str | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> Session:
|
||||
"""
|
||||
Revert a message
|
||||
|
||||
Args:
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not id:
|
||||
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
||||
return self._post(
|
||||
f"/session/{id}/revert",
|
||||
body=maybe_transform(
|
||||
{
|
||||
"message_id": message_id,
|
||||
"part_id": part_id,
|
||||
},
|
||||
session_revert_params.SessionRevertParams,
|
||||
),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=Session,
|
||||
)
|
||||
|
||||
def share(
|
||||
self,
|
||||
id: str,
|
||||
|
|
@ -357,6 +408,39 @@ class SessionResource(SyncAPIResource):
|
|||
cast_to=SessionSummarizeResponse,
|
||||
)
|
||||
|
||||
def unrevert(
|
||||
self,
|
||||
id: str,
|
||||
*,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> Session:
|
||||
"""
|
||||
Restore all reverted messages
|
||||
|
||||
Args:
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not id:
|
||||
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
||||
return self._post(
|
||||
f"/session/{id}/unrevert",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=Session,
|
||||
)
|
||||
|
||||
def unshare(
|
||||
self,
|
||||
id: str,
|
||||
|
|
@ -520,15 +604,19 @@ class AsyncSessionResource(AsyncAPIResource):
|
|||
id: str,
|
||||
*,
|
||||
model_id: str,
|
||||
parts: Iterable[MessagePartParam],
|
||||
parts: Iterable[session_chat_params.Part],
|
||||
provider_id: str,
|
||||
message_id: str | NotGiven = NOT_GIVEN,
|
||||
mode: str | NotGiven = NOT_GIVEN,
|
||||
system: str | NotGiven = NOT_GIVEN,
|
||||
tools: Dict[str, bool] | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> Message:
|
||||
) -> AssistantMessage:
|
||||
"""
|
||||
Create and send a new message to a session
|
||||
|
||||
|
|
@ -552,19 +640,24 @@ class AsyncSessionResource(AsyncAPIResource):
|
|||
"model_id": model_id,
|
||||
"parts": parts,
|
||||
"provider_id": provider_id,
|
||||
"message_id": message_id,
|
||||
"mode": mode,
|
||||
"system": system,
|
||||
"tools": tools,
|
||||
},
|
||||
session_chat_params.SessionChatParams,
|
||||
),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=Message,
|
||||
cast_to=AssistantMessage,
|
||||
)
|
||||
|
||||
async def init(
|
||||
self,
|
||||
id: str,
|
||||
*,
|
||||
message_id: str,
|
||||
model_id: str,
|
||||
provider_id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
|
|
@ -594,6 +687,7 @@ class AsyncSessionResource(AsyncAPIResource):
|
|||
f"/session/{id}/init",
|
||||
body=await async_maybe_transform(
|
||||
{
|
||||
"message_id": message_id,
|
||||
"model_id": model_id,
|
||||
"provider_id": provider_id,
|
||||
},
|
||||
|
|
@ -640,6 +734,48 @@ class AsyncSessionResource(AsyncAPIResource):
|
|||
cast_to=SessionMessagesResponse,
|
||||
)
|
||||
|
||||
async def revert(
|
||||
self,
|
||||
id: str,
|
||||
*,
|
||||
message_id: str,
|
||||
part_id: str | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> Session:
|
||||
"""
|
||||
Revert a message
|
||||
|
||||
Args:
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not id:
|
||||
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
||||
return await self._post(
|
||||
f"/session/{id}/revert",
|
||||
body=await async_maybe_transform(
|
||||
{
|
||||
"message_id": message_id,
|
||||
"part_id": part_id,
|
||||
},
|
||||
session_revert_params.SessionRevertParams,
|
||||
),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=Session,
|
||||
)
|
||||
|
||||
async def share(
|
||||
self,
|
||||
id: str,
|
||||
|
|
@ -717,6 +853,39 @@ class AsyncSessionResource(AsyncAPIResource):
|
|||
cast_to=SessionSummarizeResponse,
|
||||
)
|
||||
|
||||
async def unrevert(
|
||||
self,
|
||||
id: str,
|
||||
*,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> Session:
|
||||
"""
|
||||
Restore all reverted messages
|
||||
|
||||
Args:
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not id:
|
||||
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
||||
return await self._post(
|
||||
f"/session/{id}/unrevert",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=Session,
|
||||
)
|
||||
|
||||
async def unshare(
|
||||
self,
|
||||
id: str,
|
||||
|
|
@ -776,12 +945,18 @@ class SessionResourceWithRawResponse:
|
|||
self.messages = to_raw_response_wrapper(
|
||||
session.messages,
|
||||
)
|
||||
self.revert = to_raw_response_wrapper(
|
||||
session.revert,
|
||||
)
|
||||
self.share = to_raw_response_wrapper(
|
||||
session.share,
|
||||
)
|
||||
self.summarize = to_raw_response_wrapper(
|
||||
session.summarize,
|
||||
)
|
||||
self.unrevert = to_raw_response_wrapper(
|
||||
session.unrevert,
|
||||
)
|
||||
self.unshare = to_raw_response_wrapper(
|
||||
session.unshare,
|
||||
)
|
||||
|
|
@ -812,12 +987,18 @@ class AsyncSessionResourceWithRawResponse:
|
|||
self.messages = async_to_raw_response_wrapper(
|
||||
session.messages,
|
||||
)
|
||||
self.revert = async_to_raw_response_wrapper(
|
||||
session.revert,
|
||||
)
|
||||
self.share = async_to_raw_response_wrapper(
|
||||
session.share,
|
||||
)
|
||||
self.summarize = async_to_raw_response_wrapper(
|
||||
session.summarize,
|
||||
)
|
||||
self.unrevert = async_to_raw_response_wrapper(
|
||||
session.unrevert,
|
||||
)
|
||||
self.unshare = async_to_raw_response_wrapper(
|
||||
session.unshare,
|
||||
)
|
||||
|
|
@ -848,12 +1029,18 @@ class SessionResourceWithStreamingResponse:
|
|||
self.messages = to_streamed_response_wrapper(
|
||||
session.messages,
|
||||
)
|
||||
self.revert = to_streamed_response_wrapper(
|
||||
session.revert,
|
||||
)
|
||||
self.share = to_streamed_response_wrapper(
|
||||
session.share,
|
||||
)
|
||||
self.summarize = to_streamed_response_wrapper(
|
||||
session.summarize,
|
||||
)
|
||||
self.unrevert = to_streamed_response_wrapper(
|
||||
session.unrevert,
|
||||
)
|
||||
self.unshare = to_streamed_response_wrapper(
|
||||
session.unshare,
|
||||
)
|
||||
|
|
@ -884,12 +1071,18 @@ class AsyncSessionResourceWithStreamingResponse:
|
|||
self.messages = async_to_streamed_response_wrapper(
|
||||
session.messages,
|
||||
)
|
||||
self.revert = async_to_streamed_response_wrapper(
|
||||
session.revert,
|
||||
)
|
||||
self.share = async_to_streamed_response_wrapper(
|
||||
session.share,
|
||||
)
|
||||
self.summarize = async_to_streamed_response_wrapper(
|
||||
session.summarize,
|
||||
)
|
||||
self.unrevert = async_to_streamed_response_wrapper(
|
||||
session.unrevert,
|
||||
)
|
||||
self.unshare = async_to_streamed_response_wrapper(
|
||||
session.unshare,
|
||||
)
|
||||
|
|
|
|||
214
src/opencode_ai/resources/tui.py
Normal file
214
src/opencode_ai/resources/tui.py
Normal file
|
|
@ -0,0 +1,214 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import httpx
|
||||
|
||||
from ..types import tui_append_prompt_params
|
||||
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from .._utils import maybe_transform, async_maybe_transform
|
||||
from .._compat import cached_property
|
||||
from .._resource import SyncAPIResource, AsyncAPIResource
|
||||
from .._response import (
|
||||
to_raw_response_wrapper,
|
||||
to_streamed_response_wrapper,
|
||||
async_to_raw_response_wrapper,
|
||||
async_to_streamed_response_wrapper,
|
||||
)
|
||||
from .._base_client import make_request_options
|
||||
from ..types.tui_open_help_response import TuiOpenHelpResponse
|
||||
from ..types.tui_append_prompt_response import TuiAppendPromptResponse
|
||||
|
||||
__all__ = ["TuiResource", "AsyncTuiResource"]
|
||||
|
||||
|
||||
class TuiResource(SyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> TuiResourceWithRawResponse:
|
||||
"""
|
||||
This property can be used as a prefix for any HTTP method call to return
|
||||
the raw response object instead of the parsed content.
|
||||
|
||||
For more information, see https://www.github.com/sst/opencode-sdk-python#accessing-raw-response-data-eg-headers
|
||||
"""
|
||||
return TuiResourceWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> TuiResourceWithStreamingResponse:
|
||||
"""
|
||||
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
||||
|
||||
For more information, see https://www.github.com/sst/opencode-sdk-python#with_streaming_response
|
||||
"""
|
||||
return TuiResourceWithStreamingResponse(self)
|
||||
|
||||
def append_prompt(
|
||||
self,
|
||||
*,
|
||||
text: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> TuiAppendPromptResponse:
|
||||
"""
|
||||
Append prompt to the TUI
|
||||
|
||||
Args:
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
return self._post(
|
||||
"/tui/append-prompt",
|
||||
body=maybe_transform({"text": text}, tui_append_prompt_params.TuiAppendPromptParams),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=TuiAppendPromptResponse,
|
||||
)
|
||||
|
||||
def open_help(
|
||||
self,
|
||||
*,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> TuiOpenHelpResponse:
|
||||
"""Open the help dialog"""
|
||||
return self._post(
|
||||
"/tui/open-help",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=TuiOpenHelpResponse,
|
||||
)
|
||||
|
||||
|
||||
class AsyncTuiResource(AsyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncTuiResourceWithRawResponse:
|
||||
"""
|
||||
This property can be used as a prefix for any HTTP method call to return
|
||||
the raw response object instead of the parsed content.
|
||||
|
||||
For more information, see https://www.github.com/sst/opencode-sdk-python#accessing-raw-response-data-eg-headers
|
||||
"""
|
||||
return AsyncTuiResourceWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AsyncTuiResourceWithStreamingResponse:
|
||||
"""
|
||||
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
||||
|
||||
For more information, see https://www.github.com/sst/opencode-sdk-python#with_streaming_response
|
||||
"""
|
||||
return AsyncTuiResourceWithStreamingResponse(self)
|
||||
|
||||
async def append_prompt(
|
||||
self,
|
||||
*,
|
||||
text: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> TuiAppendPromptResponse:
|
||||
"""
|
||||
Append prompt to the TUI
|
||||
|
||||
Args:
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
return await self._post(
|
||||
"/tui/append-prompt",
|
||||
body=await async_maybe_transform({"text": text}, tui_append_prompt_params.TuiAppendPromptParams),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=TuiAppendPromptResponse,
|
||||
)
|
||||
|
||||
async def open_help(
|
||||
self,
|
||||
*,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> TuiOpenHelpResponse:
|
||||
"""Open the help dialog"""
|
||||
return await self._post(
|
||||
"/tui/open-help",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=TuiOpenHelpResponse,
|
||||
)
|
||||
|
||||
|
||||
class TuiResourceWithRawResponse:
|
||||
def __init__(self, tui: TuiResource) -> None:
|
||||
self._tui = tui
|
||||
|
||||
self.append_prompt = to_raw_response_wrapper(
|
||||
tui.append_prompt,
|
||||
)
|
||||
self.open_help = to_raw_response_wrapper(
|
||||
tui.open_help,
|
||||
)
|
||||
|
||||
|
||||
class AsyncTuiResourceWithRawResponse:
|
||||
def __init__(self, tui: AsyncTuiResource) -> None:
|
||||
self._tui = tui
|
||||
|
||||
self.append_prompt = async_to_raw_response_wrapper(
|
||||
tui.append_prompt,
|
||||
)
|
||||
self.open_help = async_to_raw_response_wrapper(
|
||||
tui.open_help,
|
||||
)
|
||||
|
||||
|
||||
class TuiResourceWithStreamingResponse:
|
||||
def __init__(self, tui: TuiResource) -> None:
|
||||
self._tui = tui
|
||||
|
||||
self.append_prompt = to_streamed_response_wrapper(
|
||||
tui.append_prompt,
|
||||
)
|
||||
self.open_help = to_streamed_response_wrapper(
|
||||
tui.open_help,
|
||||
)
|
||||
|
||||
|
||||
class AsyncTuiResourceWithStreamingResponse:
|
||||
def __init__(self, tui: AsyncTuiResource) -> None:
|
||||
self._tui = tui
|
||||
|
||||
self.append_prompt = async_to_streamed_response_wrapper(
|
||||
tui.append_prompt,
|
||||
)
|
||||
self.open_help = async_to_streamed_response_wrapper(
|
||||
tui.open_help,
|
||||
)
|
||||
|
|
@ -3,46 +3,71 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from .app import App as App
|
||||
from .file import File as File
|
||||
from .mode import Mode as Mode
|
||||
from .part import Part as Part
|
||||
from .model import Model as Model
|
||||
from .config import Config as Config
|
||||
from .shared import UnknownError as UnknownError, ProviderAuthError as ProviderAuthError
|
||||
from .shared import (
|
||||
UnknownError as UnknownError,
|
||||
ProviderAuthError as ProviderAuthError,
|
||||
MessageAbortedError as MessageAbortedError,
|
||||
)
|
||||
from .symbol import Symbol as Symbol
|
||||
from .message import Message as Message
|
||||
from .session import Session as Session
|
||||
from .keybinds import Keybinds as Keybinds
|
||||
from .provider import Provider as Provider
|
||||
from .file_part import FilePart as FilePart
|
||||
from .mcp_local import McpLocal as McpLocal
|
||||
from .text_part import TextPart as TextPart
|
||||
from .tool_call import ToolCall as ToolCall
|
||||
from .mcp_remote import McpRemote as McpRemote
|
||||
from .tool_result import ToolResult as ToolResult
|
||||
from .message_part import MessagePart as MessagePart
|
||||
from .reasoning_part import ReasoningPart as ReasoningPart
|
||||
from .file_part_param import FilePartParam as FilePartParam
|
||||
from .source_url_part import SourceURLPart as SourceURLPart
|
||||
from .tool_part import ToolPart as ToolPart
|
||||
from .file_source import FileSource as FileSource
|
||||
from .mode_config import ModeConfig as ModeConfig
|
||||
from .user_message import UserMessage as UserMessage
|
||||
from .snapshot_part import SnapshotPart as SnapshotPart
|
||||
from .symbol_source import SymbolSource as SymbolSource
|
||||
from .app_log_params import AppLogParams as AppLogParams
|
||||
from .keybinds_config import KeybindsConfig as KeybindsConfig
|
||||
from .step_start_part import StepStartPart as StepStartPart
|
||||
from .text_part_param import TextPartParam as TextPartParam
|
||||
from .tool_call_param import ToolCallParam as ToolCallParam
|
||||
from .app_log_response import AppLogResponse as AppLogResponse
|
||||
from .file_part_source import FilePartSource as FilePartSource
|
||||
from .file_read_params import FileReadParams as FileReadParams
|
||||
from .find_text_params import FindTextParams as FindTextParams
|
||||
from .mcp_local_config import McpLocalConfig as McpLocalConfig
|
||||
from .step_finish_part import StepFinishPart as StepFinishPart
|
||||
from .tool_state_error import ToolStateError as ToolStateError
|
||||
from .app_init_response import AppInitResponse as AppInitResponse
|
||||
from .tool_partial_call import ToolPartialCall as ToolPartialCall
|
||||
from .tool_result_param import ToolResultParam as ToolResultParam
|
||||
from .file_search_params import FileSearchParams as FileSearchParams
|
||||
from .message_part_param import MessagePartParam as MessagePartParam
|
||||
from .assistant_message import AssistantMessage as AssistantMessage
|
||||
from .file_source_param import FileSourceParam as FileSourceParam
|
||||
from .find_files_params import FindFilesParams as FindFilesParams
|
||||
from .mcp_remote_config import McpRemoteConfig as McpRemoteConfig
|
||||
from .app_modes_response import AppModesResponse as AppModesResponse
|
||||
from .file_read_response import FileReadResponse as FileReadResponse
|
||||
from .find_text_response import FindTextResponse as FindTextResponse
|
||||
from .tool_state_pending import ToolStatePending as ToolStatePending
|
||||
from .tool_state_running import ToolStateRunning as ToolStateRunning
|
||||
from .event_list_response import EventListResponse as EventListResponse
|
||||
from .find_files_response import FindFilesResponse as FindFilesResponse
|
||||
from .find_symbols_params import FindSymbolsParams as FindSymbolsParams
|
||||
from .session_chat_params import SessionChatParams as SessionChatParams
|
||||
from .session_init_params import SessionInitParams as SessionInitParams
|
||||
from .file_search_response import FileSearchResponse as FileSearchResponse
|
||||
from .reasoning_part_param import ReasoningPartParam as ReasoningPartParam
|
||||
from .tool_invocation_part import ToolInvocationPart as ToolInvocationPart
|
||||
from .symbol_source_param import SymbolSourceParam as SymbolSourceParam
|
||||
from .file_status_response import FileStatusResponse as FileStatusResponse
|
||||
from .tool_state_completed import ToolStateCompleted as ToolStateCompleted
|
||||
from .file_part_input_param import FilePartInputParam as FilePartInputParam
|
||||
from .file_part_source_text import FilePartSourceText as FilePartSourceText
|
||||
from .find_symbols_response import FindSymbolsResponse as FindSymbolsResponse
|
||||
from .session_init_response import SessionInitResponse as SessionInitResponse
|
||||
from .session_list_response import SessionListResponse as SessionListResponse
|
||||
from .source_url_part_param import SourceURLPartParam as SourceURLPartParam
|
||||
from .step_start_part_param import StepStartPartParam as StepStartPartParam
|
||||
from .session_revert_params import SessionRevertParams as SessionRevertParams
|
||||
from .text_part_input_param import TextPartInputParam as TextPartInputParam
|
||||
from .app_providers_response import AppProvidersResponse as AppProvidersResponse
|
||||
from .file_part_source_param import FilePartSourceParam as FilePartSourceParam
|
||||
from .session_abort_response import SessionAbortResponse as SessionAbortResponse
|
||||
from .tui_open_help_response import TuiOpenHelpResponse as TuiOpenHelpResponse
|
||||
from .session_delete_response import SessionDeleteResponse as SessionDeleteResponse
|
||||
from .tool_partial_call_param import ToolPartialCallParam as ToolPartialCallParam
|
||||
from .session_summarize_params import SessionSummarizeParams as SessionSummarizeParams
|
||||
from .config_providers_response import ConfigProvidersResponse as ConfigProvidersResponse
|
||||
from .tui_append_prompt_params import TuiAppendPromptParams as TuiAppendPromptParams
|
||||
from .session_messages_response import SessionMessagesResponse as SessionMessagesResponse
|
||||
from .session_summarize_response import SessionSummarizeResponse as SessionSummarizeResponse
|
||||
from .tool_invocation_part_param import ToolInvocationPartParam as ToolInvocationPartParam
|
||||
from .tui_append_prompt_response import TuiAppendPromptResponse as TuiAppendPromptResponse
|
||||
from .file_part_source_text_param import FilePartSourceTextParam as FilePartSourceTextParam
|
||||
|
|
|
|||
|
|
@ -30,8 +30,4 @@ class App(BaseModel):
|
|||
|
||||
path: Path
|
||||
|
||||
project: str
|
||||
|
||||
time: Time
|
||||
|
||||
user: str
|
||||
|
|
|
|||
22
src/opencode_ai/types/app_log_params.py
Normal file
22
src/opencode_ai/types/app_log_params.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Dict
|
||||
from typing_extensions import Literal, Required, TypedDict
|
||||
|
||||
__all__ = ["AppLogParams"]
|
||||
|
||||
|
||||
class AppLogParams(TypedDict, total=False):
|
||||
level: Required[Literal["debug", "info", "error", "warn"]]
|
||||
"""Log level"""
|
||||
|
||||
message: Required[str]
|
||||
"""Log message"""
|
||||
|
||||
service: Required[str]
|
||||
"""Service name for the log entry"""
|
||||
|
||||
extra: Dict[str, object]
|
||||
"""Additional metadata for the log entry"""
|
||||
7
src/opencode_ai/types/app_log_response.py
Normal file
7
src/opencode_ai/types/app_log_response.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
__all__ = ["AppLogResponse"]
|
||||
|
||||
AppLogResponse: TypeAlias = bool
|
||||
10
src/opencode_ai/types/app_modes_response.py
Normal file
10
src/opencode_ai/types/app_modes_response.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import List
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from .mode import Mode
|
||||
|
||||
__all__ = ["AppModesResponse"]
|
||||
|
||||
AppModesResponse: TypeAlias = List[Mode]
|
||||
|
|
@ -5,10 +5,10 @@ from typing import Dict, List
|
|||
from .._models import BaseModel
|
||||
from .provider import Provider
|
||||
|
||||
__all__ = ["ConfigProvidersResponse"]
|
||||
__all__ = ["AppProvidersResponse"]
|
||||
|
||||
|
||||
class ConfigProvidersResponse(BaseModel):
|
||||
class AppProvidersResponse(BaseModel):
|
||||
default: Dict[str, str]
|
||||
|
||||
providers: List[Provider]
|
||||
82
src/opencode_ai/types/assistant_message.py
Normal file
82
src/opencode_ai/types/assistant_message.py
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import List, Union, Optional
|
||||
from typing_extensions import Literal, Annotated, TypeAlias
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
from .._models import BaseModel
|
||||
from .shared.unknown_error import UnknownError
|
||||
from .shared.provider_auth_error import ProviderAuthError
|
||||
from .shared.message_aborted_error import MessageAbortedError
|
||||
|
||||
__all__ = ["AssistantMessage", "Path", "Time", "Tokens", "TokensCache", "Error", "ErrorMessageOutputLengthError"]
|
||||
|
||||
|
||||
class Path(BaseModel):
|
||||
cwd: str
|
||||
|
||||
root: str
|
||||
|
||||
|
||||
class Time(BaseModel):
|
||||
created: float
|
||||
|
||||
completed: Optional[float] = None
|
||||
|
||||
|
||||
class TokensCache(BaseModel):
|
||||
read: float
|
||||
|
||||
write: float
|
||||
|
||||
|
||||
class Tokens(BaseModel):
|
||||
cache: TokensCache
|
||||
|
||||
input: float
|
||||
|
||||
output: float
|
||||
|
||||
reasoning: float
|
||||
|
||||
|
||||
class ErrorMessageOutputLengthError(BaseModel):
|
||||
data: object
|
||||
|
||||
name: Literal["MessageOutputLengthError"]
|
||||
|
||||
|
||||
Error: TypeAlias = Annotated[
|
||||
Union[ProviderAuthError, UnknownError, ErrorMessageOutputLengthError, MessageAbortedError],
|
||||
PropertyInfo(discriminator="name"),
|
||||
]
|
||||
|
||||
|
||||
class AssistantMessage(BaseModel):
|
||||
id: str
|
||||
|
||||
cost: float
|
||||
|
||||
mode: str
|
||||
|
||||
api_model_id: str = FieldInfo(alias="modelID")
|
||||
|
||||
path: Path
|
||||
|
||||
provider_id: str = FieldInfo(alias="providerID")
|
||||
|
||||
role: Literal["assistant"]
|
||||
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
|
||||
system: List[str]
|
||||
|
||||
time: Time
|
||||
|
||||
tokens: Tokens
|
||||
|
||||
error: Optional[Error] = None
|
||||
|
||||
summary: Optional[bool] = None
|
||||
|
|
@ -1,30 +1,55 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Dict, List, Union, Optional
|
||||
from typing_extensions import Annotated, TypeAlias
|
||||
from typing import TYPE_CHECKING, Dict, List, Union, Optional
|
||||
from typing_extensions import Literal, Annotated, TypeAlias
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
from .._models import BaseModel
|
||||
from .keybinds import Keybinds
|
||||
from .mcp_local import McpLocal
|
||||
from .mcp_remote import McpRemote
|
||||
from .mode_config import ModeConfig
|
||||
from .keybinds_config import KeybindsConfig
|
||||
from .mcp_local_config import McpLocalConfig
|
||||
from .mcp_remote_config import McpRemoteConfig
|
||||
|
||||
__all__ = [
|
||||
"Config",
|
||||
"Agent",
|
||||
"AgentGeneral",
|
||||
"AgentAgentItem",
|
||||
"Experimental",
|
||||
"ExperimentalHook",
|
||||
"ExperimentalHookFileEdited",
|
||||
"ExperimentalHookSessionCompleted",
|
||||
"Mcp",
|
||||
"Mode",
|
||||
"Provider",
|
||||
"ProviderModels",
|
||||
"ProviderModelsCost",
|
||||
"ProviderModelsLimit",
|
||||
"ProviderOptions",
|
||||
]
|
||||
|
||||
|
||||
class AgentGeneral(ModeConfig):
|
||||
description: str
|
||||
|
||||
|
||||
class AgentAgentItem(ModeConfig):
|
||||
description: str
|
||||
|
||||
|
||||
class Agent(BaseModel):
|
||||
general: Optional[AgentGeneral] = None
|
||||
|
||||
__pydantic_extra__: Dict[str, AgentAgentItem] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
if TYPE_CHECKING:
|
||||
# Stub to indicate that arbitrary properties are accepted.
|
||||
# To access properties that are not valid identifiers you can use `getattr`, e.g.
|
||||
# `getattr(obj, '$type')`
|
||||
def __getattr__(self, attr: str) -> AgentAgentItem: ...
|
||||
|
||||
|
||||
class ExperimentalHookFileEdited(BaseModel):
|
||||
command: List[str]
|
||||
|
||||
|
|
@ -47,7 +72,20 @@ class Experimental(BaseModel):
|
|||
hook: Optional[ExperimentalHook] = None
|
||||
|
||||
|
||||
Mcp: TypeAlias = Annotated[Union[McpLocal, McpRemote], PropertyInfo(discriminator="type")]
|
||||
Mcp: TypeAlias = Annotated[Union[McpLocalConfig, McpRemoteConfig], PropertyInfo(discriminator="type")]
|
||||
|
||||
|
||||
class Mode(BaseModel):
|
||||
build: Optional[ModeConfig] = None
|
||||
|
||||
plan: Optional[ModeConfig] = None
|
||||
|
||||
__pydantic_extra__: Dict[str, ModeConfig] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
if TYPE_CHECKING:
|
||||
# Stub to indicate that arbitrary properties are accepted.
|
||||
# To access properties that are not valid identifiers you can use `getattr`, e.g.
|
||||
# `getattr(obj, '$type')`
|
||||
def __getattr__(self, attr: str) -> ModeConfig: ...
|
||||
|
||||
|
||||
class ProviderModelsCost(BaseModel):
|
||||
|
|
@ -81,11 +119,26 @@ class ProviderModels(BaseModel):
|
|||
|
||||
reasoning: Optional[bool] = None
|
||||
|
||||
release_date: Optional[str] = None
|
||||
|
||||
temperature: Optional[bool] = None
|
||||
|
||||
tool_call: Optional[bool] = None
|
||||
|
||||
|
||||
class ProviderOptions(BaseModel):
|
||||
api_key: Optional[str] = FieldInfo(alias="apiKey", default=None)
|
||||
|
||||
base_url: Optional[str] = FieldInfo(alias="baseURL", default=None)
|
||||
|
||||
__pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
||||
if TYPE_CHECKING:
|
||||
# Stub to indicate that arbitrary properties are accepted.
|
||||
# To access properties that are not valid identifiers you can use `getattr`, e.g.
|
||||
# `getattr(obj, '$type')`
|
||||
def __getattr__(self, attr: str) -> object: ...
|
||||
|
||||
|
||||
class Provider(BaseModel):
|
||||
models: Dict[str, ProviderModels]
|
||||
|
||||
|
|
@ -99,15 +152,21 @@ class Provider(BaseModel):
|
|||
|
||||
npm: Optional[str] = None
|
||||
|
||||
options: Optional[Dict[str, object]] = None
|
||||
options: Optional[ProviderOptions] = None
|
||||
|
||||
|
||||
class Config(BaseModel):
|
||||
schema_: Optional[str] = FieldInfo(alias="$schema", default=None)
|
||||
"""JSON schema reference for configuration validation"""
|
||||
|
||||
agent: Optional[Agent] = None
|
||||
"""Modes configuration, see https://opencode.ai/docs/modes"""
|
||||
|
||||
autoshare: Optional[bool] = None
|
||||
"""Share newly created sessions automatically"""
|
||||
"""@deprecated Use 'share' field instead.
|
||||
|
||||
Share newly created sessions automatically
|
||||
"""
|
||||
|
||||
autoupdate: Optional[bool] = None
|
||||
"""Automatically update to the latest version"""
|
||||
|
|
@ -117,17 +176,41 @@ class Config(BaseModel):
|
|||
|
||||
experimental: Optional[Experimental] = None
|
||||
|
||||
keybinds: Optional[Keybinds] = None
|
||||
instructions: Optional[List[str]] = None
|
||||
"""Additional instruction files or patterns to include"""
|
||||
|
||||
keybinds: Optional[KeybindsConfig] = None
|
||||
"""Custom keybind configurations"""
|
||||
|
||||
layout: Optional[Literal["auto", "stretch"]] = None
|
||||
"""@deprecated Always uses stretch layout."""
|
||||
|
||||
mcp: Optional[Dict[str, Mcp]] = None
|
||||
"""MCP (Model Context Protocol) server configurations"""
|
||||
|
||||
mode: Optional[Mode] = None
|
||||
"""Modes configuration, see https://opencode.ai/docs/modes"""
|
||||
|
||||
model: Optional[str] = None
|
||||
"""Model to use in the format of provider/model, eg anthropic/claude-2"""
|
||||
|
||||
provider: Optional[Dict[str, Provider]] = None
|
||||
"""Custom provider configurations and model overrides"""
|
||||
|
||||
share: Optional[Literal["manual", "auto", "disabled"]] = None
|
||||
"""
|
||||
Control sharing behavior:'manual' allows manual sharing via commands, 'auto'
|
||||
enables automatic sharing, 'disabled' disables all sharing
|
||||
"""
|
||||
|
||||
small_model: Optional[str] = None
|
||||
"""
|
||||
Small model to use for tasks like summarization and title generation in the
|
||||
format of provider/model
|
||||
"""
|
||||
|
||||
theme: Optional[str] = None
|
||||
"""Theme name to use for the interface"""
|
||||
|
||||
username: Optional[str] = None
|
||||
"""Custom username to display in conversations instead of system username"""
|
||||
|
|
|
|||
|
|
@ -5,52 +5,54 @@ from typing_extensions import Literal, Annotated, TypeAlias
|
|||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .part import Part
|
||||
from .._utils import PropertyInfo
|
||||
from .message import Message
|
||||
from .session import Session
|
||||
from .._models import BaseModel
|
||||
from .message_part import MessagePart
|
||||
from .shared.unknown_error import UnknownError
|
||||
from .shared.provider_auth_error import ProviderAuthError
|
||||
from .shared.message_aborted_error import MessageAbortedError
|
||||
|
||||
__all__ = [
|
||||
"EventListResponse",
|
||||
"EventStorageWrite",
|
||||
"EventStorageWriteProperties",
|
||||
"EventInstallationUpdated",
|
||||
"EventInstallationUpdatedProperties",
|
||||
"EventLspClientDiagnostics",
|
||||
"EventLspClientDiagnosticsProperties",
|
||||
"EventMessageUpdated",
|
||||
"EventMessageUpdatedProperties",
|
||||
"EventMessageRemoved",
|
||||
"EventMessageRemovedProperties",
|
||||
"EventMessagePartUpdated",
|
||||
"EventMessagePartUpdatedProperties",
|
||||
"EventMessagePartRemoved",
|
||||
"EventMessagePartRemovedProperties",
|
||||
"EventStorageWrite",
|
||||
"EventStorageWriteProperties",
|
||||
"EventPermissionUpdated",
|
||||
"EventPermissionUpdatedProperties",
|
||||
"EventPermissionUpdatedPropertiesTime",
|
||||
"EventMessageUpdated",
|
||||
"EventMessageUpdatedProperties",
|
||||
"EventMessagePartUpdated",
|
||||
"EventMessagePartUpdatedProperties",
|
||||
"EventFileEdited",
|
||||
"EventFileEditedProperties",
|
||||
"EventSessionUpdated",
|
||||
"EventSessionUpdatedProperties",
|
||||
"EventSessionDeleted",
|
||||
"EventSessionDeletedProperties",
|
||||
"EventSessionIdle",
|
||||
"EventSessionIdleProperties",
|
||||
"EventSessionError",
|
||||
"EventSessionErrorProperties",
|
||||
"EventSessionErrorPropertiesError",
|
||||
"EventSessionErrorPropertiesErrorMessageOutputLengthError",
|
||||
"EventServerConnected",
|
||||
"EventFileWatcherUpdated",
|
||||
"EventFileWatcherUpdatedProperties",
|
||||
"EventIdeInstalled",
|
||||
"EventIdeInstalledProperties",
|
||||
]
|
||||
|
||||
|
||||
class EventStorageWriteProperties(BaseModel):
|
||||
key: str
|
||||
|
||||
content: Optional[object] = None
|
||||
|
||||
|
||||
class EventStorageWrite(BaseModel):
|
||||
properties: EventStorageWriteProperties
|
||||
|
||||
type: Literal["storage.write"]
|
||||
|
||||
|
||||
class EventInstallationUpdatedProperties(BaseModel):
|
||||
version: str
|
||||
|
||||
|
|
@ -73,6 +75,64 @@ class EventLspClientDiagnostics(BaseModel):
|
|||
type: Literal["lsp.client.diagnostics"]
|
||||
|
||||
|
||||
class EventMessageUpdatedProperties(BaseModel):
|
||||
info: Message
|
||||
|
||||
|
||||
class EventMessageUpdated(BaseModel):
|
||||
properties: EventMessageUpdatedProperties
|
||||
|
||||
type: Literal["message.updated"]
|
||||
|
||||
|
||||
class EventMessageRemovedProperties(BaseModel):
|
||||
message_id: str = FieldInfo(alias="messageID")
|
||||
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
|
||||
|
||||
class EventMessageRemoved(BaseModel):
|
||||
properties: EventMessageRemovedProperties
|
||||
|
||||
type: Literal["message.removed"]
|
||||
|
||||
|
||||
class EventMessagePartUpdatedProperties(BaseModel):
|
||||
part: Part
|
||||
|
||||
|
||||
class EventMessagePartUpdated(BaseModel):
|
||||
properties: EventMessagePartUpdatedProperties
|
||||
|
||||
type: Literal["message.part.updated"]
|
||||
|
||||
|
||||
class EventMessagePartRemovedProperties(BaseModel):
|
||||
message_id: str = FieldInfo(alias="messageID")
|
||||
|
||||
part_id: str = FieldInfo(alias="partID")
|
||||
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
|
||||
|
||||
class EventMessagePartRemoved(BaseModel):
|
||||
properties: EventMessagePartRemovedProperties
|
||||
|
||||
type: Literal["message.part.removed"]
|
||||
|
||||
|
||||
class EventStorageWriteProperties(BaseModel):
|
||||
key: str
|
||||
|
||||
content: Optional[object] = None
|
||||
|
||||
|
||||
class EventStorageWrite(BaseModel):
|
||||
properties: EventStorageWriteProperties
|
||||
|
||||
type: Literal["storage.write"]
|
||||
|
||||
|
||||
class EventPermissionUpdatedPropertiesTime(BaseModel):
|
||||
created: float
|
||||
|
||||
|
|
@ -95,28 +155,14 @@ class EventPermissionUpdated(BaseModel):
|
|||
type: Literal["permission.updated"]
|
||||
|
||||
|
||||
class EventMessageUpdatedProperties(BaseModel):
|
||||
info: Message
|
||||
class EventFileEditedProperties(BaseModel):
|
||||
file: str
|
||||
|
||||
|
||||
class EventMessageUpdated(BaseModel):
|
||||
properties: EventMessageUpdatedProperties
|
||||
class EventFileEdited(BaseModel):
|
||||
properties: EventFileEditedProperties
|
||||
|
||||
type: Literal["message.updated"]
|
||||
|
||||
|
||||
class EventMessagePartUpdatedProperties(BaseModel):
|
||||
message_id: str = FieldInfo(alias="messageID")
|
||||
|
||||
part: MessagePart
|
||||
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
|
||||
|
||||
class EventMessagePartUpdated(BaseModel):
|
||||
properties: EventMessagePartUpdatedProperties
|
||||
|
||||
type: Literal["message.part.updated"]
|
||||
type: Literal["file.edited"]
|
||||
|
||||
|
||||
class EventSessionUpdatedProperties(BaseModel):
|
||||
|
|
@ -139,6 +185,16 @@ class EventSessionDeleted(BaseModel):
|
|||
type: Literal["session.deleted"]
|
||||
|
||||
|
||||
class EventSessionIdleProperties(BaseModel):
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
|
||||
|
||||
class EventSessionIdle(BaseModel):
|
||||
properties: EventSessionIdleProperties
|
||||
|
||||
type: Literal["session.idle"]
|
||||
|
||||
|
||||
class EventSessionErrorPropertiesErrorMessageOutputLengthError(BaseModel):
|
||||
data: object
|
||||
|
||||
|
|
@ -146,7 +202,9 @@ class EventSessionErrorPropertiesErrorMessageOutputLengthError(BaseModel):
|
|||
|
||||
|
||||
EventSessionErrorPropertiesError: TypeAlias = Annotated[
|
||||
Union[ProviderAuthError, UnknownError, EventSessionErrorPropertiesErrorMessageOutputLengthError],
|
||||
Union[
|
||||
ProviderAuthError, UnknownError, EventSessionErrorPropertiesErrorMessageOutputLengthError, MessageAbortedError
|
||||
],
|
||||
PropertyInfo(discriminator="name"),
|
||||
]
|
||||
|
||||
|
|
@ -154,6 +212,8 @@ EventSessionErrorPropertiesError: TypeAlias = Annotated[
|
|||
class EventSessionErrorProperties(BaseModel):
|
||||
error: Optional[EventSessionErrorPropertiesError] = None
|
||||
|
||||
session_id: Optional[str] = FieldInfo(alias="sessionID", default=None)
|
||||
|
||||
|
||||
class EventSessionError(BaseModel):
|
||||
properties: EventSessionErrorProperties
|
||||
|
|
@ -161,17 +221,52 @@ class EventSessionError(BaseModel):
|
|||
type: Literal["session.error"]
|
||||
|
||||
|
||||
class EventServerConnected(BaseModel):
|
||||
properties: object
|
||||
|
||||
type: Literal["server.connected"]
|
||||
|
||||
|
||||
class EventFileWatcherUpdatedProperties(BaseModel):
|
||||
event: Literal["rename", "change"]
|
||||
|
||||
file: str
|
||||
|
||||
|
||||
class EventFileWatcherUpdated(BaseModel):
|
||||
properties: EventFileWatcherUpdatedProperties
|
||||
|
||||
type: Literal["file.watcher.updated"]
|
||||
|
||||
|
||||
class EventIdeInstalledProperties(BaseModel):
|
||||
ide: str
|
||||
|
||||
|
||||
class EventIdeInstalled(BaseModel):
|
||||
properties: EventIdeInstalledProperties
|
||||
|
||||
type: Literal["ide.installed"]
|
||||
|
||||
|
||||
EventListResponse: TypeAlias = Annotated[
|
||||
Union[
|
||||
EventStorageWrite,
|
||||
EventInstallationUpdated,
|
||||
EventLspClientDiagnostics,
|
||||
EventPermissionUpdated,
|
||||
EventMessageUpdated,
|
||||
EventMessageRemoved,
|
||||
EventMessagePartUpdated,
|
||||
EventMessagePartRemoved,
|
||||
EventStorageWrite,
|
||||
EventPermissionUpdated,
|
||||
EventFileEdited,
|
||||
EventSessionUpdated,
|
||||
EventSessionDeleted,
|
||||
EventSessionIdle,
|
||||
EventSessionError,
|
||||
EventServerConnected,
|
||||
EventFileWatcherUpdated,
|
||||
EventIdeInstalled,
|
||||
],
|
||||
PropertyInfo(discriminator="type"),
|
||||
]
|
||||
|
|
|
|||
17
src/opencode_ai/types/file.py
Normal file
17
src/opencode_ai/types/file.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["File"]
|
||||
|
||||
|
||||
class File(BaseModel):
|
||||
added: int
|
||||
|
||||
path: str
|
||||
|
||||
removed: int
|
||||
|
||||
status: Literal["added", "deleted", "modified"]
|
||||
|
|
@ -6,15 +6,24 @@ from typing_extensions import Literal
|
|||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._models import BaseModel
|
||||
from .file_part_source import FilePartSource
|
||||
|
||||
__all__ = ["FilePart"]
|
||||
|
||||
|
||||
class FilePart(BaseModel):
|
||||
media_type: str = FieldInfo(alias="mediaType")
|
||||
id: str
|
||||
|
||||
message_id: str = FieldInfo(alias="messageID")
|
||||
|
||||
mime: str
|
||||
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
|
||||
type: Literal["file"]
|
||||
|
||||
url: str
|
||||
|
||||
filename: Optional[str] = None
|
||||
|
||||
source: Optional[FilePartSource] = None
|
||||
|
|
|
|||
23
src/opencode_ai/types/file_part_input_param.py
Normal file
23
src/opencode_ai/types/file_part_input_param.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Literal, Required, TypedDict
|
||||
|
||||
from .file_part_source_param import FilePartSourceParam
|
||||
|
||||
__all__ = ["FilePartInputParam"]
|
||||
|
||||
|
||||
class FilePartInputParam(TypedDict, total=False):
|
||||
mime: Required[str]
|
||||
|
||||
type: Required[Literal["file"]]
|
||||
|
||||
url: Required[str]
|
||||
|
||||
id: str
|
||||
|
||||
filename: str
|
||||
|
||||
source: FilePartSourceParam
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Literal, Required, Annotated, TypedDict
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
|
||||
__all__ = ["FilePartParam"]
|
||||
|
||||
|
||||
class FilePartParam(TypedDict, total=False):
|
||||
media_type: Required[Annotated[str, PropertyInfo(alias="mediaType")]]
|
||||
|
||||
type: Required[Literal["file"]]
|
||||
|
||||
url: Required[str]
|
||||
|
||||
filename: str
|
||||
12
src/opencode_ai/types/file_part_source.py
Normal file
12
src/opencode_ai/types/file_part_source.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Union
|
||||
from typing_extensions import Annotated, TypeAlias
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
from .file_source import FileSource
|
||||
from .symbol_source import SymbolSource
|
||||
|
||||
__all__ = ["FilePartSource"]
|
||||
|
||||
FilePartSource: TypeAlias = Annotated[Union[FileSource, SymbolSource], PropertyInfo(discriminator="type")]
|
||||
13
src/opencode_ai/types/file_part_source_param.py
Normal file
13
src/opencode_ai/types/file_part_source_param.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Union
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from .file_source_param import FileSourceParam
|
||||
from .symbol_source_param import SymbolSourceParam
|
||||
|
||||
__all__ = ["FilePartSourceParam"]
|
||||
|
||||
FilePartSourceParam: TypeAlias = Union[FileSourceParam, SymbolSourceParam]
|
||||
13
src/opencode_ai/types/file_part_source_text.py
Normal file
13
src/opencode_ai/types/file_part_source_text.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["FilePartSourceText"]
|
||||
|
||||
|
||||
class FilePartSourceText(BaseModel):
|
||||
end: int
|
||||
|
||||
start: int
|
||||
|
||||
value: str
|
||||
15
src/opencode_ai/types/file_part_source_text_param.py
Normal file
15
src/opencode_ai/types/file_part_source_text_param.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
__all__ = ["FilePartSourceTextParam"]
|
||||
|
||||
|
||||
class FilePartSourceTextParam(TypedDict, total=False):
|
||||
end: Required[int]
|
||||
|
||||
start: Required[int]
|
||||
|
||||
value: Required[str]
|
||||
11
src/opencode_ai/types/file_read_params.py
Normal file
11
src/opencode_ai/types/file_read_params.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
__all__ = ["FileReadParams"]
|
||||
|
||||
|
||||
class FileReadParams(TypedDict, total=False):
|
||||
path: Required[str]
|
||||
13
src/opencode_ai/types/file_read_response.py
Normal file
13
src/opencode_ai/types/file_read_response.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["FileReadResponse"]
|
||||
|
||||
|
||||
class FileReadResponse(BaseModel):
|
||||
content: str
|
||||
|
||||
type: Literal["raw", "patch"]
|
||||
16
src/opencode_ai/types/file_source.py
Normal file
16
src/opencode_ai/types/file_source.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .._models import BaseModel
|
||||
from .file_part_source_text import FilePartSourceText
|
||||
|
||||
__all__ = ["FileSource"]
|
||||
|
||||
|
||||
class FileSource(BaseModel):
|
||||
path: str
|
||||
|
||||
text: FilePartSourceText
|
||||
|
||||
type: Literal["file"]
|
||||
17
src/opencode_ai/types/file_source_param.py
Normal file
17
src/opencode_ai/types/file_source_param.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Literal, Required, TypedDict
|
||||
|
||||
from .file_part_source_text_param import FilePartSourceTextParam
|
||||
|
||||
__all__ = ["FileSourceParam"]
|
||||
|
||||
|
||||
class FileSourceParam(TypedDict, total=False):
|
||||
path: Required[str]
|
||||
|
||||
text: Required[FilePartSourceTextParam]
|
||||
|
||||
type: Required[Literal["file"]]
|
||||
10
src/opencode_ai/types/file_status_response.py
Normal file
10
src/opencode_ai/types/file_status_response.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import List
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from .file import File
|
||||
|
||||
__all__ = ["FileStatusResponse"]
|
||||
|
||||
FileStatusResponse: TypeAlias = List[File]
|
||||
|
|
@ -4,8 +4,8 @@ from __future__ import annotations
|
|||
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
__all__ = ["FileSearchParams"]
|
||||
__all__ = ["FindFilesParams"]
|
||||
|
||||
|
||||
class FileSearchParams(TypedDict, total=False):
|
||||
class FindFilesParams(TypedDict, total=False):
|
||||
query: Required[str]
|
||||
|
|
@ -3,6 +3,6 @@
|
|||
from typing import List
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
__all__ = ["FileSearchResponse"]
|
||||
__all__ = ["FindFilesResponse"]
|
||||
|
||||
FileSearchResponse: TypeAlias = List[str]
|
||||
FindFilesResponse: TypeAlias = List[str]
|
||||
11
src/opencode_ai/types/find_symbols_params.py
Normal file
11
src/opencode_ai/types/find_symbols_params.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
__all__ = ["FindSymbolsParams"]
|
||||
|
||||
|
||||
class FindSymbolsParams(TypedDict, total=False):
|
||||
query: Required[str]
|
||||
10
src/opencode_ai/types/find_symbols_response.py
Normal file
10
src/opencode_ai/types/find_symbols_response.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import List
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from .symbol import Symbol
|
||||
|
||||
__all__ = ["FindSymbolsResponse"]
|
||||
|
||||
FindSymbolsResponse: TypeAlias = List[Symbol]
|
||||
11
src/opencode_ai/types/find_text_params.py
Normal file
11
src/opencode_ai/types/find_text_params.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
__all__ = ["FindTextParams"]
|
||||
|
||||
|
||||
class FindTextParams(TypedDict, total=False):
|
||||
pattern: Required[str]
|
||||
50
src/opencode_ai/types/find_text_response.py
Normal file
50
src/opencode_ai/types/find_text_response.py
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import List
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = [
|
||||
"FindTextResponse",
|
||||
"FindTextResponseItem",
|
||||
"FindTextResponseItemLines",
|
||||
"FindTextResponseItemPath",
|
||||
"FindTextResponseItemSubmatch",
|
||||
"FindTextResponseItemSubmatchMatch",
|
||||
]
|
||||
|
||||
|
||||
class FindTextResponseItemLines(BaseModel):
|
||||
text: str
|
||||
|
||||
|
||||
class FindTextResponseItemPath(BaseModel):
|
||||
text: str
|
||||
|
||||
|
||||
class FindTextResponseItemSubmatchMatch(BaseModel):
|
||||
text: str
|
||||
|
||||
|
||||
class FindTextResponseItemSubmatch(BaseModel):
|
||||
end: float
|
||||
|
||||
match: FindTextResponseItemSubmatchMatch
|
||||
|
||||
start: float
|
||||
|
||||
|
||||
class FindTextResponseItem(BaseModel):
|
||||
absolute_offset: float
|
||||
|
||||
line_number: float
|
||||
|
||||
lines: FindTextResponseItemLines
|
||||
|
||||
path: FindTextResponseItemPath
|
||||
|
||||
submatches: List[FindTextResponseItemSubmatch]
|
||||
|
||||
|
||||
FindTextResponse: TypeAlias = List[FindTextResponseItem]
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["Keybinds"]
|
||||
|
||||
|
||||
class Keybinds(BaseModel):
|
||||
app_exit: Optional[str] = None
|
||||
"""Exit the application"""
|
||||
|
||||
editor_open: Optional[str] = None
|
||||
"""Open external editor"""
|
||||
|
||||
help: Optional[str] = None
|
||||
"""Show help dialog"""
|
||||
|
||||
history_next: Optional[str] = None
|
||||
"""Navigate to next history item"""
|
||||
|
||||
history_previous: Optional[str] = None
|
||||
"""Navigate to previous history item"""
|
||||
|
||||
input_clear: Optional[str] = None
|
||||
"""Clear input field"""
|
||||
|
||||
input_newline: Optional[str] = None
|
||||
"""Insert newline in input"""
|
||||
|
||||
input_paste: Optional[str] = None
|
||||
"""Paste from clipboard"""
|
||||
|
||||
input_submit: Optional[str] = None
|
||||
"""Submit input"""
|
||||
|
||||
leader: Optional[str] = None
|
||||
"""Leader key for keybind combinations"""
|
||||
|
||||
messages_first: Optional[str] = None
|
||||
"""Navigate to first message"""
|
||||
|
||||
messages_half_page_down: Optional[str] = None
|
||||
"""Scroll messages down by half page"""
|
||||
|
||||
messages_half_page_up: Optional[str] = None
|
||||
"""Scroll messages up by half page"""
|
||||
|
||||
messages_last: Optional[str] = None
|
||||
"""Navigate to last message"""
|
||||
|
||||
messages_next: Optional[str] = None
|
||||
"""Navigate to next message"""
|
||||
|
||||
messages_page_down: Optional[str] = None
|
||||
"""Scroll messages down by one page"""
|
||||
|
||||
messages_page_up: Optional[str] = None
|
||||
"""Scroll messages up by one page"""
|
||||
|
||||
messages_previous: Optional[str] = None
|
||||
"""Navigate to previous message"""
|
||||
|
||||
api_model_list: Optional[str] = FieldInfo(alias="model_list", default=None)
|
||||
"""List available models"""
|
||||
|
||||
project_init: Optional[str] = None
|
||||
"""Initialize project configuration"""
|
||||
|
||||
session_compact: Optional[str] = None
|
||||
"""Toggle compact mode for session"""
|
||||
|
||||
session_interrupt: Optional[str] = None
|
||||
"""Interrupt current session"""
|
||||
|
||||
session_list: Optional[str] = None
|
||||
"""List all sessions"""
|
||||
|
||||
session_new: Optional[str] = None
|
||||
"""Create a new session"""
|
||||
|
||||
session_share: Optional[str] = None
|
||||
"""Share current session"""
|
||||
|
||||
theme_list: Optional[str] = None
|
||||
"""List available themes"""
|
||||
|
||||
tool_details: Optional[str] = None
|
||||
"""Show tool details"""
|
||||
123
src/opencode_ai/types/keybinds_config.py
Normal file
123
src/opencode_ai/types/keybinds_config.py
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["KeybindsConfig"]
|
||||
|
||||
|
||||
class KeybindsConfig(BaseModel):
|
||||
app_exit: str
|
||||
"""Exit the application"""
|
||||
|
||||
app_help: str
|
||||
"""Show help dialog"""
|
||||
|
||||
editor_open: str
|
||||
"""Open external editor"""
|
||||
|
||||
file_close: str
|
||||
"""Close file"""
|
||||
|
||||
file_diff_toggle: str
|
||||
"""Split/unified diff"""
|
||||
|
||||
file_list: str
|
||||
"""List files"""
|
||||
|
||||
file_search: str
|
||||
"""Search file"""
|
||||
|
||||
input_clear: str
|
||||
"""Clear input field"""
|
||||
|
||||
input_newline: str
|
||||
"""Insert newline in input"""
|
||||
|
||||
input_paste: str
|
||||
"""Paste from clipboard"""
|
||||
|
||||
input_submit: str
|
||||
"""Submit input"""
|
||||
|
||||
leader: str
|
||||
"""Leader key for keybind combinations"""
|
||||
|
||||
messages_copy: str
|
||||
"""Copy message"""
|
||||
|
||||
messages_first: str
|
||||
"""Navigate to first message"""
|
||||
|
||||
messages_half_page_down: str
|
||||
"""Scroll messages down by half page"""
|
||||
|
||||
messages_half_page_up: str
|
||||
"""Scroll messages up by half page"""
|
||||
|
||||
messages_last: str
|
||||
"""Navigate to last message"""
|
||||
|
||||
messages_layout_toggle: str
|
||||
"""Toggle layout"""
|
||||
|
||||
messages_next: str
|
||||
"""Navigate to next message"""
|
||||
|
||||
messages_page_down: str
|
||||
"""Scroll messages down by one page"""
|
||||
|
||||
messages_page_up: str
|
||||
"""Scroll messages up by one page"""
|
||||
|
||||
messages_previous: str
|
||||
"""Navigate to previous message"""
|
||||
|
||||
messages_redo: str
|
||||
"""Redo message"""
|
||||
|
||||
messages_revert: str
|
||||
"""@deprecated use messages_undo. Revert message"""
|
||||
|
||||
messages_undo: str
|
||||
"""Undo message"""
|
||||
|
||||
api_model_list: str = FieldInfo(alias="model_list")
|
||||
"""List available models"""
|
||||
|
||||
project_init: str
|
||||
"""Create/update AGENTS.md"""
|
||||
|
||||
session_compact: str
|
||||
"""Compact the session"""
|
||||
|
||||
session_export: str
|
||||
"""Export session to editor"""
|
||||
|
||||
session_interrupt: str
|
||||
"""Interrupt current session"""
|
||||
|
||||
session_list: str
|
||||
"""List all sessions"""
|
||||
|
||||
session_new: str
|
||||
"""Create a new session"""
|
||||
|
||||
session_share: str
|
||||
"""Share current session"""
|
||||
|
||||
session_unshare: str
|
||||
"""Unshare current session"""
|
||||
|
||||
switch_mode: str
|
||||
"""Next mode"""
|
||||
|
||||
switch_mode_reverse: str
|
||||
"""Previous Mode"""
|
||||
|
||||
theme_list: str
|
||||
"""List available themes"""
|
||||
|
||||
tool_details: str
|
||||
"""Toggle tool details"""
|
||||
|
|
@ -5,15 +5,18 @@ from typing_extensions import Literal
|
|||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["McpLocal"]
|
||||
__all__ = ["McpLocalConfig"]
|
||||
|
||||
|
||||
class McpLocal(BaseModel):
|
||||
class McpLocalConfig(BaseModel):
|
||||
command: List[str]
|
||||
"""Command and arguments to run the MCP server"""
|
||||
|
||||
type: Literal["local"]
|
||||
"""Type of MCP server connection"""
|
||||
|
||||
enabled: Optional[bool] = None
|
||||
"""Enable or disable the MCP server on startup"""
|
||||
|
||||
environment: Optional[Dict[str, str]] = None
|
||||
"""Environment variables to set when running the MCP server"""
|
||||
|
|
@ -1,15 +1,22 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Dict, Optional
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["McpRemote"]
|
||||
__all__ = ["McpRemoteConfig"]
|
||||
|
||||
|
||||
class McpRemote(BaseModel):
|
||||
class McpRemoteConfig(BaseModel):
|
||||
type: Literal["remote"]
|
||||
"""Type of MCP server connection"""
|
||||
|
||||
url: str
|
||||
"""URL of the remote MCP server"""
|
||||
|
||||
enabled: Optional[bool] = None
|
||||
"""Enable or disable the MCP server on startup"""
|
||||
|
||||
headers: Optional[Dict[str, str]] = None
|
||||
"""Headers to send with the request"""
|
||||
|
|
@ -1,121 +1,12 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import TYPE_CHECKING, Dict, List, Union, Optional
|
||||
from typing_extensions import Literal, Annotated, TypeAlias
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
from typing import Union
|
||||
from typing_extensions import Annotated, TypeAlias
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
from .._models import BaseModel
|
||||
from .message_part import MessagePart
|
||||
from .shared.unknown_error import UnknownError
|
||||
from .shared.provider_auth_error import ProviderAuthError
|
||||
from .user_message import UserMessage
|
||||
from .assistant_message import AssistantMessage
|
||||
|
||||
__all__ = [
|
||||
"Message",
|
||||
"Metadata",
|
||||
"MetadataTime",
|
||||
"MetadataTool",
|
||||
"MetadataToolTime",
|
||||
"MetadataAssistant",
|
||||
"MetadataAssistantPath",
|
||||
"MetadataAssistantTokens",
|
||||
"MetadataAssistantTokensCache",
|
||||
"MetadataError",
|
||||
"MetadataErrorMessageOutputLengthError",
|
||||
]
|
||||
__all__ = ["Message"]
|
||||
|
||||
|
||||
class MetadataTime(BaseModel):
|
||||
created: float
|
||||
|
||||
completed: Optional[float] = None
|
||||
|
||||
|
||||
class MetadataToolTime(BaseModel):
|
||||
end: float
|
||||
|
||||
start: float
|
||||
|
||||
|
||||
class MetadataTool(BaseModel):
|
||||
time: MetadataToolTime
|
||||
|
||||
title: str
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# Stub to indicate that arbitrary properties are accepted.
|
||||
# To access properties that are not valid identifiers you can use `getattr`, e.g.
|
||||
# `getattr(obj, '$type')`
|
||||
def __getattr__(self, attr: str) -> object: ...
|
||||
|
||||
|
||||
class MetadataAssistantPath(BaseModel):
|
||||
cwd: str
|
||||
|
||||
root: str
|
||||
|
||||
|
||||
class MetadataAssistantTokensCache(BaseModel):
|
||||
read: float
|
||||
|
||||
write: float
|
||||
|
||||
|
||||
class MetadataAssistantTokens(BaseModel):
|
||||
cache: MetadataAssistantTokensCache
|
||||
|
||||
input: float
|
||||
|
||||
output: float
|
||||
|
||||
reasoning: float
|
||||
|
||||
|
||||
class MetadataAssistant(BaseModel):
|
||||
cost: float
|
||||
|
||||
api_model_id: str = FieldInfo(alias="modelID")
|
||||
|
||||
path: MetadataAssistantPath
|
||||
|
||||
provider_id: str = FieldInfo(alias="providerID")
|
||||
|
||||
system: List[str]
|
||||
|
||||
tokens: MetadataAssistantTokens
|
||||
|
||||
summary: Optional[bool] = None
|
||||
|
||||
|
||||
class MetadataErrorMessageOutputLengthError(BaseModel):
|
||||
data: object
|
||||
|
||||
name: Literal["MessageOutputLengthError"]
|
||||
|
||||
|
||||
MetadataError: TypeAlias = Annotated[
|
||||
Union[ProviderAuthError, UnknownError, MetadataErrorMessageOutputLengthError], PropertyInfo(discriminator="name")
|
||||
]
|
||||
|
||||
|
||||
class Metadata(BaseModel):
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
|
||||
time: MetadataTime
|
||||
|
||||
tool: Dict[str, MetadataTool]
|
||||
|
||||
assistant: Optional[MetadataAssistant] = None
|
||||
|
||||
error: Optional[MetadataError] = None
|
||||
|
||||
|
||||
class Message(BaseModel):
|
||||
id: str
|
||||
|
||||
metadata: Metadata
|
||||
|
||||
parts: List[MessagePart]
|
||||
|
||||
role: Literal["user", "assistant"]
|
||||
Message: TypeAlias = Annotated[Union[UserMessage, AssistantMessage], PropertyInfo(discriminator="role")]
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Union
|
||||
from typing_extensions import Annotated, TypeAlias
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
from .file_part import FilePart
|
||||
from .text_part import TextPart
|
||||
from .reasoning_part import ReasoningPart
|
||||
from .source_url_part import SourceURLPart
|
||||
from .step_start_part import StepStartPart
|
||||
from .tool_invocation_part import ToolInvocationPart
|
||||
|
||||
__all__ = ["MessagePart"]
|
||||
|
||||
MessagePart: TypeAlias = Annotated[
|
||||
Union[TextPart, ReasoningPart, ToolInvocationPart, SourceURLPart, FilePart, StepStartPart],
|
||||
PropertyInfo(discriminator="type"),
|
||||
]
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Union
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from .file_part_param import FilePartParam
|
||||
from .text_part_param import TextPartParam
|
||||
from .reasoning_part_param import ReasoningPartParam
|
||||
from .source_url_part_param import SourceURLPartParam
|
||||
from .step_start_part_param import StepStartPartParam
|
||||
from .tool_invocation_part_param import ToolInvocationPartParam
|
||||
|
||||
__all__ = ["MessagePartParam"]
|
||||
|
||||
MessagePartParam: TypeAlias = Union[
|
||||
TextPartParam, ReasoningPartParam, ToolInvocationPartParam, SourceURLPartParam, FilePartParam, StepStartPartParam
|
||||
]
|
||||
27
src/opencode_ai/types/mode.py
Normal file
27
src/opencode_ai/types/mode.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Dict, Optional
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["Mode", "Model"]
|
||||
|
||||
|
||||
class Model(BaseModel):
|
||||
api_model_id: str = FieldInfo(alias="modelID")
|
||||
|
||||
provider_id: str = FieldInfo(alias="providerID")
|
||||
|
||||
|
||||
class Mode(BaseModel):
|
||||
name: str
|
||||
|
||||
tools: Dict[str, bool]
|
||||
|
||||
model: Optional[Model] = None
|
||||
|
||||
prompt: Optional[str] = None
|
||||
|
||||
temperature: Optional[float] = None
|
||||
19
src/opencode_ai/types/mode_config.py
Normal file
19
src/opencode_ai/types/mode_config.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Dict, Optional
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["ModeConfig"]
|
||||
|
||||
|
||||
class ModeConfig(BaseModel):
|
||||
disable: Optional[bool] = None
|
||||
|
||||
model: Optional[str] = None
|
||||
|
||||
prompt: Optional[str] = None
|
||||
|
||||
temperature: Optional[float] = None
|
||||
|
||||
tools: Optional[Dict[str, bool]] = None
|
||||
|
|
@ -38,6 +38,8 @@ class Model(BaseModel):
|
|||
|
||||
reasoning: bool
|
||||
|
||||
release_date: str
|
||||
|
||||
temperature: bool
|
||||
|
||||
tool_call: bool
|
||||
|
|
|
|||
37
src/opencode_ai/types/part.py
Normal file
37
src/opencode_ai/types/part.py
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import List, Union
|
||||
from typing_extensions import Literal, Annotated, TypeAlias
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
from .._models import BaseModel
|
||||
from .file_part import FilePart
|
||||
from .text_part import TextPart
|
||||
from .tool_part import ToolPart
|
||||
from .snapshot_part import SnapshotPart
|
||||
from .step_start_part import StepStartPart
|
||||
from .step_finish_part import StepFinishPart
|
||||
|
||||
__all__ = ["Part", "PatchPart"]
|
||||
|
||||
|
||||
class PatchPart(BaseModel):
|
||||
id: str
|
||||
|
||||
files: List[str]
|
||||
|
||||
hash: str
|
||||
|
||||
message_id: str = FieldInfo(alias="messageID")
|
||||
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
|
||||
type: Literal["patch"]
|
||||
|
||||
|
||||
Part: TypeAlias = Annotated[
|
||||
Union[TextPart, FilePart, ToolPart, StepStartPart, StepFinishPart, SnapshotPart, PatchPart],
|
||||
PropertyInfo(discriminator="type"),
|
||||
]
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Dict, Optional
|
||||
from typing_extensions import Literal
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["ReasoningPart"]
|
||||
|
||||
|
||||
class ReasoningPart(BaseModel):
|
||||
text: str
|
||||
|
||||
type: Literal["reasoning"]
|
||||
|
||||
provider_metadata: Optional[Dict[str, object]] = FieldInfo(alias="providerMetadata", default=None)
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Dict
|
||||
from typing_extensions import Literal, Required, Annotated, TypedDict
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
|
||||
__all__ = ["ReasoningPartParam"]
|
||||
|
||||
|
||||
class ReasoningPartParam(TypedDict, total=False):
|
||||
text: Required[str]
|
||||
|
||||
type: Required[Literal["reasoning"]]
|
||||
|
||||
provider_metadata: Annotated[Dict[str, object], PropertyInfo(alias="providerMetadata")]
|
||||
|
|
@ -6,7 +6,7 @@ from pydantic import Field as FieldInfo
|
|||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["Session", "Time", "Share"]
|
||||
__all__ = ["Session", "Time", "Revert", "Share"]
|
||||
|
||||
|
||||
class Time(BaseModel):
|
||||
|
|
@ -15,6 +15,16 @@ class Time(BaseModel):
|
|||
updated: float
|
||||
|
||||
|
||||
class Revert(BaseModel):
|
||||
message_id: str = FieldInfo(alias="messageID")
|
||||
|
||||
diff: Optional[str] = None
|
||||
|
||||
part_id: Optional[str] = FieldInfo(alias="partID", default=None)
|
||||
|
||||
snapshot: Optional[str] = None
|
||||
|
||||
|
||||
class Share(BaseModel):
|
||||
url: str
|
||||
|
||||
|
|
@ -30,4 +40,6 @@ class Session(BaseModel):
|
|||
|
||||
parent_id: Optional[str] = FieldInfo(alias="parentID", default=None)
|
||||
|
||||
revert: Optional[Revert] = None
|
||||
|
||||
share: Optional[Share] = None
|
||||
|
|
|
|||
|
|
@ -2,18 +2,30 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Iterable
|
||||
from typing_extensions import Required, Annotated, TypedDict
|
||||
from typing import Dict, Union, Iterable
|
||||
from typing_extensions import Required, Annotated, TypeAlias, TypedDict
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
from .message_part_param import MessagePartParam
|
||||
from .file_part_input_param import FilePartInputParam
|
||||
from .text_part_input_param import TextPartInputParam
|
||||
|
||||
__all__ = ["SessionChatParams"]
|
||||
__all__ = ["SessionChatParams", "Part"]
|
||||
|
||||
|
||||
class SessionChatParams(TypedDict, total=False):
|
||||
model_id: Required[Annotated[str, PropertyInfo(alias="modelID")]]
|
||||
|
||||
parts: Required[Iterable[MessagePartParam]]
|
||||
parts: Required[Iterable[Part]]
|
||||
|
||||
provider_id: Required[Annotated[str, PropertyInfo(alias="providerID")]]
|
||||
|
||||
message_id: Annotated[str, PropertyInfo(alias="messageID")]
|
||||
|
||||
mode: str
|
||||
|
||||
system: str
|
||||
|
||||
tools: Dict[str, bool]
|
||||
|
||||
|
||||
Part: TypeAlias = Union[TextPartInputParam, FilePartInputParam]
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ __all__ = ["SessionInitParams"]
|
|||
|
||||
|
||||
class SessionInitParams(TypedDict, total=False):
|
||||
message_id: Required[Annotated[str, PropertyInfo(alias="messageID")]]
|
||||
|
||||
model_id: Required[Annotated[str, PropertyInfo(alias="modelID")]]
|
||||
|
||||
provider_id: Required[Annotated[str, PropertyInfo(alias="providerID")]]
|
||||
|
|
|
|||
|
|
@ -3,8 +3,17 @@
|
|||
from typing import List
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from .part import Part
|
||||
from .message import Message
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["SessionMessagesResponse"]
|
||||
__all__ = ["SessionMessagesResponse", "SessionMessagesResponseItem"]
|
||||
|
||||
SessionMessagesResponse: TypeAlias = List[Message]
|
||||
|
||||
class SessionMessagesResponseItem(BaseModel):
|
||||
info: Message
|
||||
|
||||
parts: List[Part]
|
||||
|
||||
|
||||
SessionMessagesResponse: TypeAlias = List[SessionMessagesResponseItem]
|
||||
|
|
|
|||
15
src/opencode_ai/types/session_revert_params.py
Normal file
15
src/opencode_ai/types/session_revert_params.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Required, Annotated, TypedDict
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
|
||||
__all__ = ["SessionRevertParams"]
|
||||
|
||||
|
||||
class SessionRevertParams(TypedDict, total=False):
|
||||
message_id: Required[Annotated[str, PropertyInfo(alias="messageID")]]
|
||||
|
||||
part_id: Annotated[str, PropertyInfo(alias="partID")]
|
||||
|
|
@ -2,3 +2,4 @@
|
|||
|
||||
from .unknown_error import UnknownError as UnknownError
|
||||
from .provider_auth_error import ProviderAuthError as ProviderAuthError
|
||||
from .message_aborted_error import MessageAbortedError as MessageAbortedError
|
||||
|
|
|
|||
13
src/opencode_ai/types/shared/message_aborted_error.py
Normal file
13
src/opencode_ai/types/shared/message_aborted_error.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from ..._models import BaseModel
|
||||
|
||||
__all__ = ["MessageAbortedError"]
|
||||
|
||||
|
||||
class MessageAbortedError(BaseModel):
|
||||
data: object
|
||||
|
||||
name: Literal["MessageAbortedError"]
|
||||
21
src/opencode_ai/types/snapshot_part.py
Normal file
21
src/opencode_ai/types/snapshot_part.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["SnapshotPart"]
|
||||
|
||||
|
||||
class SnapshotPart(BaseModel):
|
||||
id: str
|
||||
|
||||
message_id: str = FieldInfo(alias="messageID")
|
||||
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
|
||||
snapshot: str
|
||||
|
||||
type: Literal["snapshot"]
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Dict, Optional
|
||||
from typing_extensions import Literal
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["SourceURLPart"]
|
||||
|
||||
|
||||
class SourceURLPart(BaseModel):
|
||||
source_id: str = FieldInfo(alias="sourceId")
|
||||
|
||||
type: Literal["source-url"]
|
||||
|
||||
url: str
|
||||
|
||||
provider_metadata: Optional[Dict[str, object]] = FieldInfo(alias="providerMetadata", default=None)
|
||||
|
||||
title: Optional[str] = None
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Dict
|
||||
from typing_extensions import Literal, Required, Annotated, TypedDict
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
|
||||
__all__ = ["SourceURLPartParam"]
|
||||
|
||||
|
||||
class SourceURLPartParam(TypedDict, total=False):
|
||||
source_id: Required[Annotated[str, PropertyInfo(alias="sourceId")]]
|
||||
|
||||
type: Required[Literal["source-url"]]
|
||||
|
||||
url: Required[str]
|
||||
|
||||
provider_metadata: Annotated[Dict[str, object], PropertyInfo(alias="providerMetadata")]
|
||||
|
||||
title: str
|
||||
39
src/opencode_ai/types/step_finish_part.py
Normal file
39
src/opencode_ai/types/step_finish_part.py
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["StepFinishPart", "Tokens", "TokensCache"]
|
||||
|
||||
|
||||
class TokensCache(BaseModel):
|
||||
read: float
|
||||
|
||||
write: float
|
||||
|
||||
|
||||
class Tokens(BaseModel):
|
||||
cache: TokensCache
|
||||
|
||||
input: float
|
||||
|
||||
output: float
|
||||
|
||||
reasoning: float
|
||||
|
||||
|
||||
class StepFinishPart(BaseModel):
|
||||
id: str
|
||||
|
||||
cost: float
|
||||
|
||||
message_id: str = FieldInfo(alias="messageID")
|
||||
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
|
||||
tokens: Tokens
|
||||
|
||||
type: Literal["step-finish"]
|
||||
|
|
@ -2,10 +2,18 @@
|
|||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["StepStartPart"]
|
||||
|
||||
|
||||
class StepStartPart(BaseModel):
|
||||
id: str
|
||||
|
||||
message_id: str = FieldInfo(alias="messageID")
|
||||
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
|
||||
type: Literal["step-start"]
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Literal, Required, TypedDict
|
||||
|
||||
__all__ = ["StepStartPartParam"]
|
||||
|
||||
|
||||
class StepStartPartParam(TypedDict, total=False):
|
||||
type: Required[Literal["step-start"]]
|
||||
37
src/opencode_ai/types/symbol.py
Normal file
37
src/opencode_ai/types/symbol.py
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["Symbol", "Location", "LocationRange", "LocationRangeEnd", "LocationRangeStart"]
|
||||
|
||||
|
||||
class LocationRangeEnd(BaseModel):
|
||||
character: float
|
||||
|
||||
line: float
|
||||
|
||||
|
||||
class LocationRangeStart(BaseModel):
|
||||
character: float
|
||||
|
||||
line: float
|
||||
|
||||
|
||||
class LocationRange(BaseModel):
|
||||
end: LocationRangeEnd
|
||||
|
||||
start: LocationRangeStart
|
||||
|
||||
|
||||
class Location(BaseModel):
|
||||
range: LocationRange
|
||||
|
||||
uri: str
|
||||
|
||||
|
||||
class Symbol(BaseModel):
|
||||
kind: float
|
||||
|
||||
location: Location
|
||||
|
||||
name: str
|
||||
40
src/opencode_ai/types/symbol_source.py
Normal file
40
src/opencode_ai/types/symbol_source.py
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .._models import BaseModel
|
||||
from .file_part_source_text import FilePartSourceText
|
||||
|
||||
__all__ = ["SymbolSource", "Range", "RangeEnd", "RangeStart"]
|
||||
|
||||
|
||||
class RangeEnd(BaseModel):
|
||||
character: float
|
||||
|
||||
line: float
|
||||
|
||||
|
||||
class RangeStart(BaseModel):
|
||||
character: float
|
||||
|
||||
line: float
|
||||
|
||||
|
||||
class Range(BaseModel):
|
||||
end: RangeEnd
|
||||
|
||||
start: RangeStart
|
||||
|
||||
|
||||
class SymbolSource(BaseModel):
|
||||
kind: int
|
||||
|
||||
name: str
|
||||
|
||||
path: str
|
||||
|
||||
range: Range
|
||||
|
||||
text: FilePartSourceText
|
||||
|
||||
type: Literal["symbol"]
|
||||
41
src/opencode_ai/types/symbol_source_param.py
Normal file
41
src/opencode_ai/types/symbol_source_param.py
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Literal, Required, TypedDict
|
||||
|
||||
from .file_part_source_text_param import FilePartSourceTextParam
|
||||
|
||||
__all__ = ["SymbolSourceParam", "Range", "RangeEnd", "RangeStart"]
|
||||
|
||||
|
||||
class RangeEnd(TypedDict, total=False):
|
||||
character: Required[float]
|
||||
|
||||
line: Required[float]
|
||||
|
||||
|
||||
class RangeStart(TypedDict, total=False):
|
||||
character: Required[float]
|
||||
|
||||
line: Required[float]
|
||||
|
||||
|
||||
class Range(TypedDict, total=False):
|
||||
end: Required[RangeEnd]
|
||||
|
||||
start: Required[RangeStart]
|
||||
|
||||
|
||||
class SymbolSourceParam(TypedDict, total=False):
|
||||
kind: Required[int]
|
||||
|
||||
name: Required[str]
|
||||
|
||||
path: Required[str]
|
||||
|
||||
range: Required[Range]
|
||||
|
||||
text: Required[FilePartSourceTextParam]
|
||||
|
||||
type: Required[Literal["symbol"]]
|
||||
|
|
@ -1,13 +1,32 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
from typing_extensions import Literal
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["TextPart"]
|
||||
__all__ = ["TextPart", "Time"]
|
||||
|
||||
|
||||
class Time(BaseModel):
|
||||
start: float
|
||||
|
||||
end: Optional[float] = None
|
||||
|
||||
|
||||
class TextPart(BaseModel):
|
||||
id: str
|
||||
|
||||
message_id: str = FieldInfo(alias="messageID")
|
||||
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
|
||||
text: str
|
||||
|
||||
type: Literal["text"]
|
||||
|
||||
synthetic: Optional[bool] = None
|
||||
|
||||
time: Optional[Time] = None
|
||||
|
|
|
|||
|
|
@ -4,10 +4,22 @@ from __future__ import annotations
|
|||
|
||||
from typing_extensions import Literal, Required, TypedDict
|
||||
|
||||
__all__ = ["TextPartParam"]
|
||||
__all__ = ["TextPartInputParam", "Time"]
|
||||
|
||||
|
||||
class TextPartParam(TypedDict, total=False):
|
||||
class Time(TypedDict, total=False):
|
||||
start: Required[float]
|
||||
|
||||
end: float
|
||||
|
||||
|
||||
class TextPartInputParam(TypedDict, total=False):
|
||||
text: Required[str]
|
||||
|
||||
type: Required[Literal["text"]]
|
||||
|
||||
id: str
|
||||
|
||||
synthetic: bool
|
||||
|
||||
time: Time
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
from typing_extensions import Literal
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["ToolCall"]
|
||||
|
||||
|
||||
class ToolCall(BaseModel):
|
||||
state: Literal["call"]
|
||||
|
||||
tool_call_id: str = FieldInfo(alias="toolCallId")
|
||||
|
||||
tool_name: str = FieldInfo(alias="toolName")
|
||||
|
||||
args: Optional[object] = None
|
||||
|
||||
step: Optional[float] = None
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Literal, Required, Annotated, TypedDict
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
|
||||
__all__ = ["ToolCallParam"]
|
||||
|
||||
|
||||
class ToolCallParam(TypedDict, total=False):
|
||||
state: Required[Literal["call"]]
|
||||
|
||||
tool_call_id: Required[Annotated[str, PropertyInfo(alias="toolCallId")]]
|
||||
|
||||
tool_name: Required[Annotated[str, PropertyInfo(alias="toolName")]]
|
||||
|
||||
args: object
|
||||
|
||||
step: float
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Union
|
||||
from typing_extensions import Literal, Annotated, TypeAlias
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
from .._models import BaseModel
|
||||
from .tool_call import ToolCall
|
||||
from .tool_result import ToolResult
|
||||
from .tool_partial_call import ToolPartialCall
|
||||
|
||||
__all__ = ["ToolInvocationPart", "ToolInvocation"]
|
||||
|
||||
ToolInvocation: TypeAlias = Annotated[Union[ToolCall, ToolPartialCall, ToolResult], PropertyInfo(discriminator="state")]
|
||||
|
||||
|
||||
class ToolInvocationPart(BaseModel):
|
||||
tool_invocation: ToolInvocation = FieldInfo(alias="toolInvocation")
|
||||
|
||||
type: Literal["tool-invocation"]
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Union
|
||||
from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
from .tool_call_param import ToolCallParam
|
||||
from .tool_result_param import ToolResultParam
|
||||
from .tool_partial_call_param import ToolPartialCallParam
|
||||
|
||||
__all__ = ["ToolInvocationPartParam", "ToolInvocation"]
|
||||
|
||||
ToolInvocation: TypeAlias = Union[ToolCallParam, ToolPartialCallParam, ToolResultParam]
|
||||
|
||||
|
||||
class ToolInvocationPartParam(TypedDict, total=False):
|
||||
tool_invocation: Required[Annotated[ToolInvocation, PropertyInfo(alias="toolInvocation")]]
|
||||
|
||||
type: Required[Literal["tool-invocation"]]
|
||||
35
src/opencode_ai/types/tool_part.py
Normal file
35
src/opencode_ai/types/tool_part.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Union
|
||||
from typing_extensions import Literal, Annotated, TypeAlias
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
from .._models import BaseModel
|
||||
from .tool_state_error import ToolStateError
|
||||
from .tool_state_pending import ToolStatePending
|
||||
from .tool_state_running import ToolStateRunning
|
||||
from .tool_state_completed import ToolStateCompleted
|
||||
|
||||
__all__ = ["ToolPart", "State"]
|
||||
|
||||
State: TypeAlias = Annotated[
|
||||
Union[ToolStatePending, ToolStateRunning, ToolStateCompleted, ToolStateError], PropertyInfo(discriminator="status")
|
||||
]
|
||||
|
||||
|
||||
class ToolPart(BaseModel):
|
||||
id: str
|
||||
|
||||
call_id: str = FieldInfo(alias="callID")
|
||||
|
||||
message_id: str = FieldInfo(alias="messageID")
|
||||
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
|
||||
state: State
|
||||
|
||||
tool: str
|
||||
|
||||
type: Literal["tool"]
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
from typing_extensions import Literal
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["ToolPartialCall"]
|
||||
|
||||
|
||||
class ToolPartialCall(BaseModel):
|
||||
state: Literal["partial-call"]
|
||||
|
||||
tool_call_id: str = FieldInfo(alias="toolCallId")
|
||||
|
||||
tool_name: str = FieldInfo(alias="toolName")
|
||||
|
||||
args: Optional[object] = None
|
||||
|
||||
step: Optional[float] = None
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Literal, Required, Annotated, TypedDict
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
|
||||
__all__ = ["ToolPartialCallParam"]
|
||||
|
||||
|
||||
class ToolPartialCallParam(TypedDict, total=False):
|
||||
state: Required[Literal["partial-call"]]
|
||||
|
||||
tool_call_id: Required[Annotated[str, PropertyInfo(alias="toolCallId")]]
|
||||
|
||||
tool_name: Required[Annotated[str, PropertyInfo(alias="toolName")]]
|
||||
|
||||
args: object
|
||||
|
||||
step: float
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
from typing_extensions import Literal
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["ToolResult"]
|
||||
|
||||
|
||||
class ToolResult(BaseModel):
|
||||
result: str
|
||||
|
||||
state: Literal["result"]
|
||||
|
||||
tool_call_id: str = FieldInfo(alias="toolCallId")
|
||||
|
||||
tool_name: str = FieldInfo(alias="toolName")
|
||||
|
||||
args: Optional[object] = None
|
||||
|
||||
step: Optional[float] = None
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Literal, Required, Annotated, TypedDict
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
|
||||
__all__ = ["ToolResultParam"]
|
||||
|
||||
|
||||
class ToolResultParam(TypedDict, total=False):
|
||||
result: Required[str]
|
||||
|
||||
state: Required[Literal["result"]]
|
||||
|
||||
tool_call_id: Required[Annotated[str, PropertyInfo(alias="toolCallId")]]
|
||||
|
||||
tool_name: Required[Annotated[str, PropertyInfo(alias="toolName")]]
|
||||
|
||||
args: object
|
||||
|
||||
step: float
|
||||
28
src/opencode_ai/types/tool_state_completed.py
Normal file
28
src/opencode_ai/types/tool_state_completed.py
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Dict
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["ToolStateCompleted", "Time"]
|
||||
|
||||
|
||||
class Time(BaseModel):
|
||||
end: float
|
||||
|
||||
start: float
|
||||
|
||||
|
||||
class ToolStateCompleted(BaseModel):
|
||||
input: Dict[str, object]
|
||||
|
||||
metadata: Dict[str, object]
|
||||
|
||||
output: str
|
||||
|
||||
status: Literal["completed"]
|
||||
|
||||
time: Time
|
||||
|
||||
title: str
|
||||
24
src/opencode_ai/types/tool_state_error.py
Normal file
24
src/opencode_ai/types/tool_state_error.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Dict
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["ToolStateError", "Time"]
|
||||
|
||||
|
||||
class Time(BaseModel):
|
||||
end: float
|
||||
|
||||
start: float
|
||||
|
||||
|
||||
class ToolStateError(BaseModel):
|
||||
error: str
|
||||
|
||||
input: Dict[str, object]
|
||||
|
||||
status: Literal["error"]
|
||||
|
||||
time: Time
|
||||
11
src/opencode_ai/types/tool_state_pending.py
Normal file
11
src/opencode_ai/types/tool_state_pending.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["ToolStatePending"]
|
||||
|
||||
|
||||
class ToolStatePending(BaseModel):
|
||||
status: Literal["pending"]
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue