@proteos/sdk 0.87.0 → 0.88.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -2
- package/dist/index.d.ts +15 -2
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/knowledge/index.ts +1 -0
- package/src/knowledge/nodes.ts +12 -2
- package/src/knowledge/types.ts +14 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
package/src/knowledge/index.ts
CHANGED
package/src/knowledge/nodes.ts
CHANGED
|
@@ -20,6 +20,7 @@ import type {
|
|
|
20
20
|
SearchContentResponse,
|
|
21
21
|
SearchNodesRequest,
|
|
22
22
|
UpdateNodeRequest,
|
|
23
|
+
WriteContentOptions,
|
|
23
24
|
WriteContentResponse,
|
|
24
25
|
} from './types.js'
|
|
25
26
|
|
|
@@ -62,7 +63,11 @@ export interface NodeService {
|
|
|
62
63
|
getContent(id: string): Promise<ContentResponse>
|
|
63
64
|
|
|
64
65
|
/** Overwrites a node's content body. Rejects derived (file/url) nodes. */
|
|
65
|
-
writeContent(
|
|
66
|
+
writeContent(
|
|
67
|
+
id: string,
|
|
68
|
+
content: string,
|
|
69
|
+
options?: WriteContentOptions,
|
|
70
|
+
): Promise<WriteContentResponse>
|
|
66
71
|
|
|
67
72
|
/** Applies a surgical anchored edit to a node's content body. */
|
|
68
73
|
editContent(id: string, request: EditContentRequest): Promise<EditContentResponse>
|
|
@@ -151,9 +156,14 @@ export class NodeServiceImpl implements NodeService {
|
|
|
151
156
|
return this.client.request<ContentResponse>('GET', `${NODES_BASE_PATH}/${id}/content`)
|
|
152
157
|
}
|
|
153
158
|
|
|
154
|
-
async writeContent(
|
|
159
|
+
async writeContent(
|
|
160
|
+
id: string,
|
|
161
|
+
content: string,
|
|
162
|
+
options: WriteContentOptions = {},
|
|
163
|
+
): Promise<WriteContentResponse> {
|
|
155
164
|
return this.client.request<WriteContentResponse>('PUT', `${NODES_BASE_PATH}/${id}/content`, {
|
|
156
165
|
content,
|
|
166
|
+
...options,
|
|
157
167
|
})
|
|
158
168
|
}
|
|
159
169
|
|
package/src/knowledge/types.ts
CHANGED
|
@@ -228,11 +228,25 @@ export interface ContentResponse {
|
|
|
228
228
|
id: string
|
|
229
229
|
content: string
|
|
230
230
|
lines_total: number
|
|
231
|
+
/** Hex SHA-256 of the body — the version token to pass back as
|
|
232
|
+
* `expected_content_hash` when writing, so a newer change is not overwritten. */
|
|
233
|
+
content_hash: string
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Options for `nodes.writeContent`. `expected_content_hash` makes the write
|
|
238
|
+
* conditional: the server refuses it with 409 `content_conflict` when the
|
|
239
|
+
* stored body no longer hashes to it (someone else wrote it since).
|
|
240
|
+
*/
|
|
241
|
+
export interface WriteContentOptions {
|
|
242
|
+
expected_content_hash?: string
|
|
231
243
|
}
|
|
232
244
|
|
|
233
245
|
export interface WriteContentResponse {
|
|
234
246
|
id: string
|
|
235
247
|
lines_total: number
|
|
248
|
+
/** Hash of the body just written. */
|
|
249
|
+
content_hash: string
|
|
236
250
|
}
|
|
237
251
|
|
|
238
252
|
/** A surgical anchored edit (mirrors Claude Code's `Edit`). */
|