superdoc-sdk 1.0.0a48__tar.gz → 1.0.0.dev74__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/PKG-INFO +37 -44
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/README.md +31 -38
- superdoc_sdk-1.0.0.dev74/pyproject.toml +33 -0
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc/__init__.py +3 -1
- superdoc_sdk-1.0.0.dev74/superdoc/client.py +424 -0
- superdoc_sdk-1.0.0.dev74/superdoc/generated/__init__.py +2 -0
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc/generated/client.py +24113 -1467
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc/generated/contract.py +1 -1
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc/tools/catalog.json +1036 -98
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc/tools/tools-policy.json +1 -1
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc/tools/tools.anthropic.json +1065 -135
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc/tools/tools.generic.json +1028 -98
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc/tools/tools.openai.json +1075 -145
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc/tools/tools.vercel.json +1075 -145
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc/tools_api.py +15 -12
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc_sdk.egg-info/PKG-INFO +37 -44
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc_sdk.egg-info/requires.txt +5 -5
- superdoc_sdk-1.0.0a48/pyproject.toml +0 -33
- superdoc_sdk-1.0.0a48/superdoc/client.py +0 -109
- superdoc_sdk-1.0.0a48/superdoc/generated/__init__.py +0 -1
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/setup.cfg +0 -0
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc/embedded_cli.py +0 -0
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc/errors.py +0 -0
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc/protocol.py +0 -0
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc/runtime.py +0 -0
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc/skill_api.py +0 -0
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc/skills/__init__.py +0 -0
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc/skills/editing-docx.md +0 -0
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc/test_parity_helper.py +0 -0
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc/tools/intent_dispatch_generated.py +0 -0
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc/transport.py +0 -0
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc_sdk.egg-info/SOURCES.txt +0 -0
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc_sdk.egg-info/dependency_links.txt +0 -0
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/superdoc_sdk.egg-info/top_level.txt +0 -0
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/tests/test_client_method_naming.py +0 -0
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/tests/test_helpers_reexports.py +0 -0
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/tests/test_protocol.py +0 -0
- {superdoc_sdk-1.0.0a48 → superdoc_sdk-1.0.0.dev74}/tests/test_transport.py +0 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: superdoc-sdk
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.0.dev74
|
|
4
4
|
Summary: SuperDoc SDK (CLI-backed)
|
|
5
5
|
Author: SuperDoc
|
|
6
6
|
License-Expression: AGPL-3.0
|
|
7
7
|
Requires-Python: >=3.9
|
|
8
8
|
Description-Content-Type: text/markdown
|
|
9
|
-
Requires-Dist: superdoc-sdk-cli-darwin-arm64==1.0.
|
|
10
|
-
Requires-Dist: superdoc-sdk-cli-darwin-x64==1.0.
|
|
11
|
-
Requires-Dist: superdoc-sdk-cli-linux-x64==1.0.
|
|
12
|
-
Requires-Dist: superdoc-sdk-cli-linux-arm64==1.0.
|
|
13
|
-
Requires-Dist: superdoc-sdk-cli-windows-x64==1.0.
|
|
9
|
+
Requires-Dist: superdoc-sdk-cli-darwin-arm64==1.0.0.dev74; platform_system == "Darwin" and (platform_machine == "arm64" or platform_machine == "aarch64" or platform_machine == "ARM64")
|
|
10
|
+
Requires-Dist: superdoc-sdk-cli-darwin-x64==1.0.0.dev74; platform_system == "Darwin" and (platform_machine == "x86_64" or platform_machine == "AMD64" or platform_machine == "amd64")
|
|
11
|
+
Requires-Dist: superdoc-sdk-cli-linux-x64==1.0.0.dev74; platform_system == "Linux" and (platform_machine == "x86_64" or platform_machine == "AMD64" or platform_machine == "amd64")
|
|
12
|
+
Requires-Dist: superdoc-sdk-cli-linux-arm64==1.0.0.dev74; platform_system == "Linux" and (platform_machine == "arm64" or platform_machine == "aarch64" or platform_machine == "ARM64")
|
|
13
|
+
Requires-Dist: superdoc-sdk-cli-windows-x64==1.0.0.dev74; platform_system == "Windows" and (platform_machine == "x86_64" or platform_machine == "AMD64" or platform_machine == "amd64")
|
|
14
14
|
|
|
15
15
|
# superdoc-sdk
|
|
16
16
|
|
|
@@ -43,10 +43,10 @@ from superdoc import AsyncSuperDocClient
|
|
|
43
43
|
async def main():
|
|
44
44
|
async with AsyncSuperDocClient(default_change_mode="tracked") as client:
|
|
45
45
|
# Open a document
|
|
46
|
-
await client.
|
|
46
|
+
doc = await client.open({"doc": "./contract.docx"})
|
|
47
47
|
|
|
48
48
|
# Find and replace text with query + mutation plan
|
|
49
|
-
match = await
|
|
49
|
+
match = await doc.query.match(
|
|
50
50
|
{
|
|
51
51
|
"select": {"type": "text", "pattern": "ACME Corp"},
|
|
52
52
|
"require": "first",
|
|
@@ -57,7 +57,7 @@ async def main():
|
|
|
57
57
|
first_item = items[0] if items else {}
|
|
58
58
|
ref = first_item.get("handle", {}).get("ref")
|
|
59
59
|
if ref:
|
|
60
|
-
await
|
|
60
|
+
await doc.mutations.apply(
|
|
61
61
|
{
|
|
62
62
|
"expectedRevision": match["evaluatedRevision"],
|
|
63
63
|
"atomic": True,
|
|
@@ -73,8 +73,8 @@ async def main():
|
|
|
73
73
|
)
|
|
74
74
|
|
|
75
75
|
# Save and close
|
|
76
|
-
await
|
|
77
|
-
await
|
|
76
|
+
await doc.save({"inPlace": True})
|
|
77
|
+
await doc.close({})
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
asyncio.run(main())
|
|
@@ -82,7 +82,7 @@ asyncio.run(main())
|
|
|
82
82
|
|
|
83
83
|
Set `default_change_mode="tracked"` to make mutations use tracked changes by default. If you pass `changeMode` on a specific call, that explicit value overrides the default.
|
|
84
84
|
|
|
85
|
-
The SDK also exposes a synchronous `SuperDocClient` with the same
|
|
85
|
+
The SDK also exposes a synchronous `SuperDocClient` with the same document-handle methods when you prefer non-async code paths.
|
|
86
86
|
|
|
87
87
|
### Sync
|
|
88
88
|
|
|
@@ -90,13 +90,13 @@ The SDK also exposes a synchronous `SuperDocClient` with the same `doc.*` operat
|
|
|
90
90
|
from superdoc import SuperDocClient
|
|
91
91
|
|
|
92
92
|
with SuperDocClient() as client:
|
|
93
|
-
client.
|
|
93
|
+
doc = client.open({"doc": "./contract.docx"})
|
|
94
94
|
|
|
95
|
-
info =
|
|
95
|
+
info = doc.info({})
|
|
96
96
|
print(info["counts"])
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
doc.save({"inPlace": True})
|
|
99
|
+
doc.close({})
|
|
100
100
|
```
|
|
101
101
|
|
|
102
102
|
## User identity
|
|
@@ -107,7 +107,7 @@ By default the SDK attributes edits to a generic "CLI" user. Set `user` on the c
|
|
|
107
107
|
client = AsyncSuperDocClient(user={"name": "Review Bot", "email": "bot@example.com"})
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
-
The `user` is injected into every `
|
|
110
|
+
The `user` is injected into every `client.open` call. If you pass `userName` or `userEmail` on a specific `client.open`, those per-call values take precedence.
|
|
111
111
|
|
|
112
112
|
## Client lifecycle
|
|
113
113
|
|
|
@@ -118,11 +118,13 @@ The SDK uses a persistent host process for all operations. The host is started o
|
|
|
118
118
|
```python
|
|
119
119
|
# Sync
|
|
120
120
|
with SuperDocClient() as client:
|
|
121
|
-
client.
|
|
121
|
+
doc = client.open({"doc": "./test.docx"})
|
|
122
|
+
doc.find({"query": "test"})
|
|
122
123
|
|
|
123
124
|
# Async
|
|
124
125
|
async with AsyncSuperDocClient() as client:
|
|
125
|
-
await client.
|
|
126
|
+
doc = await client.open({"doc": "./test.docx"})
|
|
127
|
+
await doc.find({"query": "test"})
|
|
126
128
|
```
|
|
127
129
|
|
|
128
130
|
The context manager calls `connect()` on entry and `dispose()` on exit (including on exception).
|
|
@@ -132,7 +134,8 @@ The context manager calls `connect()` on entry and `dispose()` on exit (includin
|
|
|
132
134
|
```python
|
|
133
135
|
client = SuperDocClient()
|
|
134
136
|
client.connect() # Optional — first invoke() auto-connects
|
|
135
|
-
|
|
137
|
+
doc = client.open({"doc": "./test.docx"})
|
|
138
|
+
result = doc.find({"query": "test"})
|
|
136
139
|
client.dispose() # Shuts down the host process
|
|
137
140
|
```
|
|
138
141
|
|
|
@@ -162,7 +165,7 @@ Use this when your app already has a live collaboration room (Liveblocks, Hocusp
|
|
|
162
165
|
|
|
163
166
|
### Join an existing room
|
|
164
167
|
|
|
165
|
-
Pass `collabUrl` and `collabDocumentId` to `
|
|
168
|
+
Pass `collabUrl` and `collabDocumentId` to `client.open`:
|
|
166
169
|
|
|
167
170
|
```python
|
|
168
171
|
import asyncio
|
|
@@ -172,12 +175,12 @@ from superdoc import AsyncSuperDocClient
|
|
|
172
175
|
|
|
173
176
|
async def main():
|
|
174
177
|
async with AsyncSuperDocClient() as client:
|
|
175
|
-
await client.
|
|
178
|
+
doc = await client.open({
|
|
176
179
|
"collabUrl": "ws://localhost:4000",
|
|
177
180
|
"collabDocumentId": "my-doc-room",
|
|
178
181
|
})
|
|
179
182
|
|
|
180
|
-
await
|
|
183
|
+
await doc.insert({
|
|
181
184
|
"target": {"type": "end"},
|
|
182
185
|
"content": "Added by the SDK",
|
|
183
186
|
})
|
|
@@ -191,7 +194,7 @@ asyncio.run(main())
|
|
|
191
194
|
If the room is empty, pass `doc` together with collaboration params:
|
|
192
195
|
|
|
193
196
|
```python
|
|
194
|
-
await client.
|
|
197
|
+
doc = await client.open({
|
|
195
198
|
"doc": "./starting-template.docx",
|
|
196
199
|
"collabUrl": "ws://localhost:4000",
|
|
197
200
|
"collabDocumentId": "my-doc-room",
|
|
@@ -219,7 +222,7 @@ What happens when you pass `doc`:
|
|
|
219
222
|
If you only want to join rooms that already exist, use `onMissing: 'error'`:
|
|
220
223
|
|
|
221
224
|
```python
|
|
222
|
-
await client.
|
|
225
|
+
doc = await client.open({
|
|
223
226
|
"collabUrl": "ws://localhost:4000",
|
|
224
227
|
"collabDocumentId": "my-doc-room",
|
|
225
228
|
"onMissing": "error",
|
|
@@ -228,30 +231,30 @@ await client.doc.open({
|
|
|
228
231
|
|
|
229
232
|
### Check if the SDK seeded or joined
|
|
230
233
|
|
|
231
|
-
`
|
|
234
|
+
`client.open` returns a bound document handle. In collaboration mode, bootstrap details are available on `doc.open_result`:
|
|
232
235
|
|
|
233
236
|
```python
|
|
234
|
-
|
|
237
|
+
doc = await client.open({
|
|
235
238
|
"doc": "./starting-template.docx",
|
|
236
239
|
"collabUrl": "ws://localhost:4000",
|
|
237
240
|
"collabDocumentId": "my-doc-room",
|
|
238
241
|
})
|
|
239
242
|
|
|
240
|
-
print(
|
|
243
|
+
print(doc.open_result.get("bootstrap"))
|
|
241
244
|
# { roomState, bootstrapApplied, bootstrapSource }
|
|
242
245
|
```
|
|
243
246
|
|
|
244
247
|
## Available operations
|
|
245
248
|
|
|
246
|
-
The SDK exposes all operations from the [Document API](https://docs.superdoc.dev/document-api/overview) plus lifecycle and
|
|
249
|
+
The SDK exposes all document-handle operations from the [Document API](https://docs.superdoc.dev/document-api/overview) plus client lifecycle and introspection methods.
|
|
247
250
|
|
|
248
251
|
### Lifecycle
|
|
249
252
|
|
|
250
253
|
| Operation | Description |
|
|
251
254
|
| --- | --- |
|
|
252
|
-
| `
|
|
255
|
+
| `client.open` | Open a document and return a bound document handle. Optionally override the document body with contentOverride + overrideType (markdown, html, or text). |
|
|
253
256
|
| `doc.save` | Save the current session to the original file or a new path. |
|
|
254
|
-
| `doc.close` | Close the
|
|
257
|
+
| `doc.close` | Close the bound editing session and clean up resources. |
|
|
255
258
|
|
|
256
259
|
### Query
|
|
257
260
|
|
|
@@ -355,22 +358,12 @@ And 30+ additional formatting operations (letter spacing, vertical alignment, sm
|
|
|
355
358
|
| `doc.history.undo` | Undo the most recent history-safe mutation in the active editor. |
|
|
356
359
|
| `doc.history.redo` | Redo the most recently undone action in the active editor. |
|
|
357
360
|
|
|
358
|
-
###
|
|
361
|
+
### Client methods
|
|
359
362
|
|
|
360
363
|
| Operation | Description |
|
|
361
364
|
| --- | --- |
|
|
362
|
-
| `
|
|
363
|
-
| `
|
|
364
|
-
| `doc.session.close` | Close a specific editing session by ID. |
|
|
365
|
-
| `doc.session.set_default` | Set the default session for subsequent commands. |
|
|
366
|
-
|
|
367
|
-
### Introspection
|
|
368
|
-
|
|
369
|
-
| Operation | Description |
|
|
370
|
-
| --- | --- |
|
|
371
|
-
| `doc.status` | Show the current session status and document metadata. |
|
|
372
|
-
| `doc.describe` | List all available CLI operations and contract metadata. |
|
|
373
|
-
| `doc.describe_command` | Show detailed metadata for a single CLI operation. |
|
|
365
|
+
| `client.describe` | List all available CLI operations and contract metadata. |
|
|
366
|
+
| `client.describe_command` | Show detailed metadata for a single CLI operation. |
|
|
374
367
|
|
|
375
368
|
## Troubleshooting
|
|
376
369
|
|
|
@@ -29,10 +29,10 @@ from superdoc import AsyncSuperDocClient
|
|
|
29
29
|
async def main():
|
|
30
30
|
async with AsyncSuperDocClient(default_change_mode="tracked") as client:
|
|
31
31
|
# Open a document
|
|
32
|
-
await client.
|
|
32
|
+
doc = await client.open({"doc": "./contract.docx"})
|
|
33
33
|
|
|
34
34
|
# Find and replace text with query + mutation plan
|
|
35
|
-
match = await
|
|
35
|
+
match = await doc.query.match(
|
|
36
36
|
{
|
|
37
37
|
"select": {"type": "text", "pattern": "ACME Corp"},
|
|
38
38
|
"require": "first",
|
|
@@ -43,7 +43,7 @@ async def main():
|
|
|
43
43
|
first_item = items[0] if items else {}
|
|
44
44
|
ref = first_item.get("handle", {}).get("ref")
|
|
45
45
|
if ref:
|
|
46
|
-
await
|
|
46
|
+
await doc.mutations.apply(
|
|
47
47
|
{
|
|
48
48
|
"expectedRevision": match["evaluatedRevision"],
|
|
49
49
|
"atomic": True,
|
|
@@ -59,8 +59,8 @@ async def main():
|
|
|
59
59
|
)
|
|
60
60
|
|
|
61
61
|
# Save and close
|
|
62
|
-
await
|
|
63
|
-
await
|
|
62
|
+
await doc.save({"inPlace": True})
|
|
63
|
+
await doc.close({})
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
asyncio.run(main())
|
|
@@ -68,7 +68,7 @@ asyncio.run(main())
|
|
|
68
68
|
|
|
69
69
|
Set `default_change_mode="tracked"` to make mutations use tracked changes by default. If you pass `changeMode` on a specific call, that explicit value overrides the default.
|
|
70
70
|
|
|
71
|
-
The SDK also exposes a synchronous `SuperDocClient` with the same
|
|
71
|
+
The SDK also exposes a synchronous `SuperDocClient` with the same document-handle methods when you prefer non-async code paths.
|
|
72
72
|
|
|
73
73
|
### Sync
|
|
74
74
|
|
|
@@ -76,13 +76,13 @@ The SDK also exposes a synchronous `SuperDocClient` with the same `doc.*` operat
|
|
|
76
76
|
from superdoc import SuperDocClient
|
|
77
77
|
|
|
78
78
|
with SuperDocClient() as client:
|
|
79
|
-
client.
|
|
79
|
+
doc = client.open({"doc": "./contract.docx"})
|
|
80
80
|
|
|
81
|
-
info =
|
|
81
|
+
info = doc.info({})
|
|
82
82
|
print(info["counts"])
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
doc.save({"inPlace": True})
|
|
85
|
+
doc.close({})
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
## User identity
|
|
@@ -93,7 +93,7 @@ By default the SDK attributes edits to a generic "CLI" user. Set `user` on the c
|
|
|
93
93
|
client = AsyncSuperDocClient(user={"name": "Review Bot", "email": "bot@example.com"})
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
The `user` is injected into every `
|
|
96
|
+
The `user` is injected into every `client.open` call. If you pass `userName` or `userEmail` on a specific `client.open`, those per-call values take precedence.
|
|
97
97
|
|
|
98
98
|
## Client lifecycle
|
|
99
99
|
|
|
@@ -104,11 +104,13 @@ The SDK uses a persistent host process for all operations. The host is started o
|
|
|
104
104
|
```python
|
|
105
105
|
# Sync
|
|
106
106
|
with SuperDocClient() as client:
|
|
107
|
-
client.
|
|
107
|
+
doc = client.open({"doc": "./test.docx"})
|
|
108
|
+
doc.find({"query": "test"})
|
|
108
109
|
|
|
109
110
|
# Async
|
|
110
111
|
async with AsyncSuperDocClient() as client:
|
|
111
|
-
await client.
|
|
112
|
+
doc = await client.open({"doc": "./test.docx"})
|
|
113
|
+
await doc.find({"query": "test"})
|
|
112
114
|
```
|
|
113
115
|
|
|
114
116
|
The context manager calls `connect()` on entry and `dispose()` on exit (including on exception).
|
|
@@ -118,7 +120,8 @@ The context manager calls `connect()` on entry and `dispose()` on exit (includin
|
|
|
118
120
|
```python
|
|
119
121
|
client = SuperDocClient()
|
|
120
122
|
client.connect() # Optional — first invoke() auto-connects
|
|
121
|
-
|
|
123
|
+
doc = client.open({"doc": "./test.docx"})
|
|
124
|
+
result = doc.find({"query": "test"})
|
|
122
125
|
client.dispose() # Shuts down the host process
|
|
123
126
|
```
|
|
124
127
|
|
|
@@ -148,7 +151,7 @@ Use this when your app already has a live collaboration room (Liveblocks, Hocusp
|
|
|
148
151
|
|
|
149
152
|
### Join an existing room
|
|
150
153
|
|
|
151
|
-
Pass `collabUrl` and `collabDocumentId` to `
|
|
154
|
+
Pass `collabUrl` and `collabDocumentId` to `client.open`:
|
|
152
155
|
|
|
153
156
|
```python
|
|
154
157
|
import asyncio
|
|
@@ -158,12 +161,12 @@ from superdoc import AsyncSuperDocClient
|
|
|
158
161
|
|
|
159
162
|
async def main():
|
|
160
163
|
async with AsyncSuperDocClient() as client:
|
|
161
|
-
await client.
|
|
164
|
+
doc = await client.open({
|
|
162
165
|
"collabUrl": "ws://localhost:4000",
|
|
163
166
|
"collabDocumentId": "my-doc-room",
|
|
164
167
|
})
|
|
165
168
|
|
|
166
|
-
await
|
|
169
|
+
await doc.insert({
|
|
167
170
|
"target": {"type": "end"},
|
|
168
171
|
"content": "Added by the SDK",
|
|
169
172
|
})
|
|
@@ -177,7 +180,7 @@ asyncio.run(main())
|
|
|
177
180
|
If the room is empty, pass `doc` together with collaboration params:
|
|
178
181
|
|
|
179
182
|
```python
|
|
180
|
-
await client.
|
|
183
|
+
doc = await client.open({
|
|
181
184
|
"doc": "./starting-template.docx",
|
|
182
185
|
"collabUrl": "ws://localhost:4000",
|
|
183
186
|
"collabDocumentId": "my-doc-room",
|
|
@@ -205,7 +208,7 @@ What happens when you pass `doc`:
|
|
|
205
208
|
If you only want to join rooms that already exist, use `onMissing: 'error'`:
|
|
206
209
|
|
|
207
210
|
```python
|
|
208
|
-
await client.
|
|
211
|
+
doc = await client.open({
|
|
209
212
|
"collabUrl": "ws://localhost:4000",
|
|
210
213
|
"collabDocumentId": "my-doc-room",
|
|
211
214
|
"onMissing": "error",
|
|
@@ -214,30 +217,30 @@ await client.doc.open({
|
|
|
214
217
|
|
|
215
218
|
### Check if the SDK seeded or joined
|
|
216
219
|
|
|
217
|
-
`
|
|
220
|
+
`client.open` returns a bound document handle. In collaboration mode, bootstrap details are available on `doc.open_result`:
|
|
218
221
|
|
|
219
222
|
```python
|
|
220
|
-
|
|
223
|
+
doc = await client.open({
|
|
221
224
|
"doc": "./starting-template.docx",
|
|
222
225
|
"collabUrl": "ws://localhost:4000",
|
|
223
226
|
"collabDocumentId": "my-doc-room",
|
|
224
227
|
})
|
|
225
228
|
|
|
226
|
-
print(
|
|
229
|
+
print(doc.open_result.get("bootstrap"))
|
|
227
230
|
# { roomState, bootstrapApplied, bootstrapSource }
|
|
228
231
|
```
|
|
229
232
|
|
|
230
233
|
## Available operations
|
|
231
234
|
|
|
232
|
-
The SDK exposes all operations from the [Document API](https://docs.superdoc.dev/document-api/overview) plus lifecycle and
|
|
235
|
+
The SDK exposes all document-handle operations from the [Document API](https://docs.superdoc.dev/document-api/overview) plus client lifecycle and introspection methods.
|
|
233
236
|
|
|
234
237
|
### Lifecycle
|
|
235
238
|
|
|
236
239
|
| Operation | Description |
|
|
237
240
|
| --- | --- |
|
|
238
|
-
| `
|
|
241
|
+
| `client.open` | Open a document and return a bound document handle. Optionally override the document body with contentOverride + overrideType (markdown, html, or text). |
|
|
239
242
|
| `doc.save` | Save the current session to the original file or a new path. |
|
|
240
|
-
| `doc.close` | Close the
|
|
243
|
+
| `doc.close` | Close the bound editing session and clean up resources. |
|
|
241
244
|
|
|
242
245
|
### Query
|
|
243
246
|
|
|
@@ -341,22 +344,12 @@ And 30+ additional formatting operations (letter spacing, vertical alignment, sm
|
|
|
341
344
|
| `doc.history.undo` | Undo the most recent history-safe mutation in the active editor. |
|
|
342
345
|
| `doc.history.redo` | Redo the most recently undone action in the active editor. |
|
|
343
346
|
|
|
344
|
-
###
|
|
347
|
+
### Client methods
|
|
345
348
|
|
|
346
349
|
| Operation | Description |
|
|
347
350
|
| --- | --- |
|
|
348
|
-
| `
|
|
349
|
-
| `
|
|
350
|
-
| `doc.session.close` | Close a specific editing session by ID. |
|
|
351
|
-
| `doc.session.set_default` | Set the default session for subsequent commands. |
|
|
352
|
-
|
|
353
|
-
### Introspection
|
|
354
|
-
|
|
355
|
-
| Operation | Description |
|
|
356
|
-
| --- | --- |
|
|
357
|
-
| `doc.status` | Show the current session status and document metadata. |
|
|
358
|
-
| `doc.describe` | List all available CLI operations and contract metadata. |
|
|
359
|
-
| `doc.describe_command` | Show detailed metadata for a single CLI operation. |
|
|
351
|
+
| `client.describe` | List all available CLI operations and contract metadata. |
|
|
352
|
+
| `client.describe_command` | Show detailed metadata for a single CLI operation. |
|
|
360
353
|
|
|
361
354
|
## Troubleshooting
|
|
362
355
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=70.1", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "superdoc-sdk"
|
|
7
|
+
version = "1.0.0.dev74"
|
|
8
|
+
description = "SuperDoc SDK (CLI-backed)"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "AGPL-3.0"
|
|
12
|
+
authors = [{ name = "SuperDoc" }]
|
|
13
|
+
dependencies = [
|
|
14
|
+
"superdoc-sdk-cli-darwin-arm64==1.0.0.dev74; platform_system == 'Darwin' and (platform_machine == 'arm64' or platform_machine == 'aarch64' or platform_machine == 'ARM64')",
|
|
15
|
+
"superdoc-sdk-cli-darwin-x64==1.0.0.dev74; platform_system == 'Darwin' and (platform_machine == 'x86_64' or platform_machine == 'AMD64' or platform_machine == 'amd64')",
|
|
16
|
+
"superdoc-sdk-cli-linux-x64==1.0.0.dev74; platform_system == 'Linux' and (platform_machine == 'x86_64' or platform_machine == 'AMD64' or platform_machine == 'amd64')",
|
|
17
|
+
"superdoc-sdk-cli-linux-arm64==1.0.0.dev74; platform_system == 'Linux' and (platform_machine == 'arm64' or platform_machine == 'aarch64' or platform_machine == 'ARM64')",
|
|
18
|
+
"superdoc-sdk-cli-windows-x64==1.0.0.dev74; platform_system == 'Windows' and (platform_machine == 'x86_64' or platform_machine == 'AMD64' or platform_machine == 'amd64')",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[tool.setuptools]
|
|
22
|
+
packages = [
|
|
23
|
+
"superdoc",
|
|
24
|
+
"superdoc.generated",
|
|
25
|
+
"superdoc.skills",
|
|
26
|
+
"superdoc.tools",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[tool.setuptools.package-data]
|
|
30
|
+
superdoc = [
|
|
31
|
+
"skills/*.md",
|
|
32
|
+
"tools/*.json",
|
|
33
|
+
]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from .client import AsyncSuperDocClient, SuperDocClient
|
|
1
|
+
from .client import AsyncSuperDocClient, AsyncSuperDocDocument, SuperDocClient, SuperDocDocument
|
|
2
2
|
from .errors import SuperDocError
|
|
3
3
|
from .skill_api import get_skill, install_skill, list_skills
|
|
4
4
|
from .tools_api import (
|
|
@@ -13,6 +13,8 @@ from .tools_api import (
|
|
|
13
13
|
__all__ = [
|
|
14
14
|
"SuperDocClient",
|
|
15
15
|
"AsyncSuperDocClient",
|
|
16
|
+
"SuperDocDocument",
|
|
17
|
+
"AsyncSuperDocDocument",
|
|
16
18
|
"SuperDocError",
|
|
17
19
|
"get_skill",
|
|
18
20
|
"install_skill",
|