ailogger-client-dev 0.1.51__py3-none-any.whl
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.
- ailogger_client/__init__.py +96 -0
- ailogger_client/client.py +220 -0
- ailogger_client/config.py +386 -0
- ailogger_client/errors.py +610 -0
- ailogger_client/file_transfer.py +110 -0
- ailogger_client/invocation.py +550 -0
- ailogger_client/message_methods.py +332 -0
- ailogger_client/observation_methods.py +195 -0
- ailogger_client/py.typed +0 -0
- ailogger_client/queued_methods.py +247 -0
- ailogger_client/read_methods.py +585 -0
- ailogger_client/retrieval_methods.py +314 -0
- ailogger_client/service_methods.py +148 -0
- ailogger_client/session_methods.py +236 -0
- ailogger_client_dev-0.1.51.dist-info/METADATA +108 -0
- ailogger_client_dev-0.1.51.dist-info/RECORD +18 -0
- ailogger_client_dev-0.1.51.dist-info/WHEEL +5 -0
- ailogger_client_dev-0.1.51.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,585 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Typed methods for reading dialogue session data.
|
|
3
|
+
|
|
4
|
+
This module carries the single mixin class whose typed methods let a caller
|
|
5
|
+
read what a single session holds through five distinct reads: the journal
|
|
6
|
+
window of messages in arrival order, the chain running from a named node to
|
|
7
|
+
its root, the relations declared in the session, the leaves and branching
|
|
8
|
+
points of the session structure, and the graph descending from a named node.
|
|
9
|
+
|
|
10
|
+
Each method names its arguments for what the corresponding command's parameter
|
|
11
|
+
schema declares, so a caller reads in the service's own terms and never
|
|
12
|
+
assembles a request envelope, never names a command as a free string and never
|
|
13
|
+
guesses a parameter name.
|
|
14
|
+
|
|
15
|
+
A parameter the command declares as required is a required argument of the
|
|
16
|
+
method; a parameter the command declares as optional is optional on the method
|
|
17
|
+
and is simply not carried when the caller does not supply it, so the service's
|
|
18
|
+
own resolution of an unsupplied optional parameter is never pre-empted by a
|
|
19
|
+
value invented in this client.
|
|
20
|
+
|
|
21
|
+
Each method carries its arguments to the invocation seam of G-012/T-002/A-001
|
|
22
|
+
and returns one page exactly as the service publishes it. No iteration, no
|
|
23
|
+
accumulation, no stitching of pages happens here: a caller asks for a window
|
|
24
|
+
and receives that window, and walking a sequence of windows is the caller's
|
|
25
|
+
business.
|
|
26
|
+
|
|
27
|
+
Required and optional parameters are mirrored exactly from the service command
|
|
28
|
+
declarations read as reference: messages_read_command.py (G-009/T-004/A-002),
|
|
29
|
+
path_read_command.py (G-009/T-004/A-005), relations_read_command.py
|
|
30
|
+
(G-009/T-004/A-008), leaves_read_command.py (G-009/T-004/A-010),
|
|
31
|
+
graph_read_command.py (G-009/T-004/A-012), and sessions_list_command.py
|
|
32
|
+
(G-009/T-004/A-015).
|
|
33
|
+
|
|
34
|
+
NETWORK LAW. This module imports nothing from the adapter framework's
|
|
35
|
+
implementation and adds no transport of its own. All network interaction goes
|
|
36
|
+
through the invocation seam and thence through the privately held framework
|
|
37
|
+
client instance, and through nothing else.
|
|
38
|
+
|
|
39
|
+
BOUNDARIES. This module declares no generic call, no completion default, no
|
|
40
|
+
non-blocking path or any job-observing call (all owned by earlier steps).
|
|
41
|
+
Every declaration in this file is fully annotated for the pipeline's named
|
|
42
|
+
strict type check, and the module satisfies its named lint check.
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
from __future__ import annotations
|
|
46
|
+
|
|
47
|
+
from typing import Any
|
|
48
|
+
|
|
49
|
+
from ailogger_client.errors import WrongArgumentTypeError
|
|
50
|
+
|
|
51
|
+
__all__ = ["ReadMixin"]
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class ReadMixin:
|
|
55
|
+
"""Mixin providing typed methods for reading dialogue session data.
|
|
56
|
+
|
|
57
|
+
Declares six typed methods: five that read what a single dialogue session
|
|
58
|
+
holds (the journal window of messages in arrival order, the path from a
|
|
59
|
+
named node to its root, the relations declared within the session, the
|
|
60
|
+
leaves and branching points of the session structure, and the graph
|
|
61
|
+
descending from a named node), and one that lists sessions matching
|
|
62
|
+
constrained filter axes across the whole store.
|
|
63
|
+
|
|
64
|
+
This mixin expects to be composed with InvocationMixin, which provides
|
|
65
|
+
the _invoke method.
|
|
66
|
+
"""
|
|
67
|
+
|
|
68
|
+
async def _invoke(
|
|
69
|
+
self,
|
|
70
|
+
command: str,
|
|
71
|
+
params: dict[str, Any] | None = None,
|
|
72
|
+
*,
|
|
73
|
+
wait_for_result: bool = True,
|
|
74
|
+
) -> Any:
|
|
75
|
+
"""Private invocation entry point.
|
|
76
|
+
|
|
77
|
+
This method is provided by InvocationMixin when this mixin is composed
|
|
78
|
+
into a class. This stub is declared here for type checking purposes
|
|
79
|
+
only.
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
command: The name of the command to execute.
|
|
83
|
+
params: An optional mapping of command parameters.
|
|
84
|
+
wait_for_result: When True (default), wait for queued commands to
|
|
85
|
+
completion and return the finished result.
|
|
86
|
+
|
|
87
|
+
Returns:
|
|
88
|
+
The command result.
|
|
89
|
+
"""
|
|
90
|
+
raise NotImplementedError # Provided by InvocationMixin
|
|
91
|
+
|
|
92
|
+
async def messages_read( # noqa: PLR0912, PLR0913, PLR0917
|
|
93
|
+
self,
|
|
94
|
+
session_id: str | None = None,
|
|
95
|
+
start_sequence_number: int | None = None,
|
|
96
|
+
block_size: int | None = None,
|
|
97
|
+
continuation: str | None = None,
|
|
98
|
+
mode: str | None = None,
|
|
99
|
+
caller_id: str | None = None,
|
|
100
|
+
recipient_id: str | None = None,
|
|
101
|
+
period_start: str | None = None,
|
|
102
|
+
period_end: str | None = None,
|
|
103
|
+
page_offset: int | None = None,
|
|
104
|
+
page_size: int | None = None,
|
|
105
|
+
preview_size: int | None = None,
|
|
106
|
+
show_deleted: bool | None = None,
|
|
107
|
+
) -> Any:
|
|
108
|
+
"""Read a legacy journal window or a filtered message preview.
|
|
109
|
+
|
|
110
|
+
Returns one bounded block of the messages of the addressed dialogue
|
|
111
|
+
session, in arrival order, starting at the requested sequence position.
|
|
112
|
+
The window is the bounded page that the service delivers at that
|
|
113
|
+
position, never a whole-session read, and pagination parameters govern
|
|
114
|
+
how much of the dialogue is retrieved at once.
|
|
115
|
+
|
|
116
|
+
The window begins at the sequence position the caller supplies, unless
|
|
117
|
+
a resumption point from a previous call to this method is present, in
|
|
118
|
+
which case the resumed request starts at that point instead and the
|
|
119
|
+
start position is ignored. Sequence positions are service-assigned
|
|
120
|
+
arrival indices starting from zero.
|
|
121
|
+
|
|
122
|
+
The block_size, continuation, and mode parameters are optional. When
|
|
123
|
+
not supplied, the service resolves them through its own order: the
|
|
124
|
+
call arguments, otherwise the service configuration, otherwise shipped
|
|
125
|
+
constants. Omitting block_size does not cause this method to invent
|
|
126
|
+
one; the service resolves its own bound. Omitting mode does not select
|
|
127
|
+
a default in this signature; the service resolves which recorded
|
|
128
|
+
versions the answer delivers.
|
|
129
|
+
|
|
130
|
+
Args:
|
|
131
|
+
session_id: Identity of the dialogue session whose messages are
|
|
132
|
+
to be read. Required: this method reads from an existing
|
|
133
|
+
session, never from the whole message store.
|
|
134
|
+
start_sequence_number: The zero-based arrival position at which
|
|
135
|
+
the requested window begins. Required unless continuation is
|
|
136
|
+
supplied: a continuation alone decides where the block begins.
|
|
137
|
+
The window is addressed by sequence number, not by identifier
|
|
138
|
+
or offset.
|
|
139
|
+
block_size: The number of messages one answer may carry. Optional:
|
|
140
|
+
when not supplied, the service resolves the bound through its
|
|
141
|
+
own order. This client never invents a page size and never
|
|
142
|
+
pre-empts the service's resolution of an unsupplied value.
|
|
143
|
+
continuation: The resumption point a previous call to this method
|
|
144
|
+
returned, sent back unread and unedited to continue that read.
|
|
145
|
+
Optional: absent on a first request, in which case the window
|
|
146
|
+
begins at the requested start position instead.
|
|
147
|
+
mode: Which recorded versions this read delivers. 'resolved'
|
|
148
|
+
delivers each correction chain as the version that arrived
|
|
149
|
+
last; 'full' delivers every recorded version exactly as
|
|
150
|
+
recorded, superseded wording included. Neither mode changes
|
|
151
|
+
anything stored. Optional: omit it to read under the mode the
|
|
152
|
+
service resolves.
|
|
153
|
+
|
|
154
|
+
With ``mode="preview"``, session_id, caller_id, recipient_id,
|
|
155
|
+
period_start and period_end are independent optional filters. Empty
|
|
156
|
+
filters are omitted. page_offset and page_size identify the requested
|
|
157
|
+
page; preview_size controls the returned text prefix and defaults to
|
|
158
|
+
200 characters. The result contains entries, total_messages,
|
|
159
|
+
total_pages, page_offset and page_size.
|
|
160
|
+
|
|
161
|
+
Returns:
|
|
162
|
+
One page of the journal window exactly as the service publishes it,
|
|
163
|
+
carrying the bounded block, the statement of whether further
|
|
164
|
+
results follow, and the resumption point for the next block.
|
|
165
|
+
"""
|
|
166
|
+
params: dict[str, Any] = {}
|
|
167
|
+
if session_id is not None:
|
|
168
|
+
params["session_id"] = session_id
|
|
169
|
+
if start_sequence_number is not None:
|
|
170
|
+
params["start_sequence_number"] = start_sequence_number
|
|
171
|
+
if block_size is not None:
|
|
172
|
+
params["block_size"] = block_size
|
|
173
|
+
if continuation is not None:
|
|
174
|
+
params["continuation"] = continuation
|
|
175
|
+
if mode is not None:
|
|
176
|
+
params["mode"] = mode
|
|
177
|
+
if caller_id is not None:
|
|
178
|
+
params["caller_id"] = caller_id
|
|
179
|
+
if recipient_id is not None:
|
|
180
|
+
params["recipient_id"] = recipient_id
|
|
181
|
+
if period_start is not None:
|
|
182
|
+
params["period_start"] = period_start
|
|
183
|
+
if period_end is not None:
|
|
184
|
+
params["period_end"] = period_end
|
|
185
|
+
if page_offset is not None:
|
|
186
|
+
params["page_offset"] = page_offset
|
|
187
|
+
if page_size is not None:
|
|
188
|
+
params["page_size"] = page_size
|
|
189
|
+
if preview_size is not None:
|
|
190
|
+
params["preview_size"] = preview_size
|
|
191
|
+
if isinstance(show_deleted, bool):
|
|
192
|
+
params["show_deleted"] = show_deleted
|
|
193
|
+
elif isinstance(show_deleted, str) and not show_deleted.strip():
|
|
194
|
+
pass
|
|
195
|
+
elif show_deleted is not None:
|
|
196
|
+
raise WrongArgumentTypeError()
|
|
197
|
+
return await self._invoke("messages_read", params)
|
|
198
|
+
|
|
199
|
+
async def path_read(
|
|
200
|
+
self,
|
|
201
|
+
session_id: str,
|
|
202
|
+
node_id: str,
|
|
203
|
+
block_size: int | None = None,
|
|
204
|
+
continuation: str | None = None,
|
|
205
|
+
mode: str | None = None,
|
|
206
|
+
) -> Any:
|
|
207
|
+
"""Read the chain from a named node to its dialogue root.
|
|
208
|
+
|
|
209
|
+
Returns the path running from the named node of the addressed dialogue
|
|
210
|
+
session back to the root of that node's own line, in the order from the
|
|
211
|
+
node towards the root. The path is the bounded page that the service
|
|
212
|
+
delivers at that position, never a whole-session read, and pagination
|
|
213
|
+
parameters govern how much of the chain is retrieved at once.
|
|
214
|
+
|
|
215
|
+
The path is addressed by a specific node within the session. A node
|
|
216
|
+
belongs to the addressed session by definition of this read: the pair
|
|
217
|
+
is meaningful only when the node is in fact a node of that session,
|
|
218
|
+
and a node of another session is not contained in this one.
|
|
219
|
+
|
|
220
|
+
The block_size, continuation, and mode parameters are optional. When
|
|
221
|
+
not supplied, the service resolves them through its own order: the
|
|
222
|
+
call arguments, otherwise the service configuration, otherwise shipped
|
|
223
|
+
constants. Omitting block_size does not cause this method to invent
|
|
224
|
+
one; the service resolves its own bound. Omitting mode does not select
|
|
225
|
+
a default in this signature; the service resolves which recorded
|
|
226
|
+
versions the answer delivers.
|
|
227
|
+
|
|
228
|
+
Args:
|
|
229
|
+
session_id: Identity of the dialogue session whose path is to be
|
|
230
|
+
read. Required: this method walks a line inside an existing
|
|
231
|
+
session, never across the whole store.
|
|
232
|
+
node_id: Identity of the node whose line is walked back to its
|
|
233
|
+
root. Required: the path is addressed by a specific node.
|
|
234
|
+
block_size: The number of chain nodes one answer may carry.
|
|
235
|
+
Optional: when not supplied, the service resolves the bound
|
|
236
|
+
through its own order. This client never invents a page size
|
|
237
|
+
and never pre-empts the service's resolution of an unsupplied
|
|
238
|
+
value.
|
|
239
|
+
continuation: The resumption point a previous call to this method
|
|
240
|
+
returned, sent back unread and unedited to continue that read.
|
|
241
|
+
Optional: absent on a first request, in which case the chain
|
|
242
|
+
begins at the named node instead.
|
|
243
|
+
mode: Which recorded versions this read delivers. 'resolved'
|
|
244
|
+
delivers each correction chain along the line represented by
|
|
245
|
+
the version that arrived last; 'full' delivers every recorded
|
|
246
|
+
version exactly as recorded, superseded wording included.
|
|
247
|
+
Neither mode changes anything stored. Optional: omit it to read
|
|
248
|
+
under the mode the service resolves.
|
|
249
|
+
|
|
250
|
+
Returns:
|
|
251
|
+
One page of the path exactly as the service publishes it, carrying
|
|
252
|
+
the bounded block of chain nodes, the statement of whether further
|
|
253
|
+
results follow, and the resumption point for the next block.
|
|
254
|
+
"""
|
|
255
|
+
params: dict[str, Any] = {
|
|
256
|
+
"session_id": session_id,
|
|
257
|
+
"node_id": node_id,
|
|
258
|
+
}
|
|
259
|
+
if block_size is not None:
|
|
260
|
+
params["block_size"] = block_size
|
|
261
|
+
if continuation is not None:
|
|
262
|
+
params["continuation"] = continuation
|
|
263
|
+
if mode is not None:
|
|
264
|
+
params["mode"] = mode
|
|
265
|
+
return await self._invoke("path_read", params)
|
|
266
|
+
|
|
267
|
+
async def relations_read(
|
|
268
|
+
self,
|
|
269
|
+
session_id: str,
|
|
270
|
+
block_size: int | None = None,
|
|
271
|
+
continuation: str | None = None,
|
|
272
|
+
) -> Any:
|
|
273
|
+
"""Read the relations declared in one dialogue session.
|
|
274
|
+
|
|
275
|
+
Returns the relations declared in the addressed dialogue session, each
|
|
276
|
+
with its kind and its two endpoint nodes. The relation set is the
|
|
277
|
+
bounded page that the service delivers at that position, never a
|
|
278
|
+
whole-session read, and pagination parameters govern how much of the
|
|
279
|
+
declared relations are retrieved at once.
|
|
280
|
+
|
|
281
|
+
The relations reported are exactly the links between nodes that are
|
|
282
|
+
stored: the four kinds the service declares (reply, influence,
|
|
283
|
+
tool-result, and correction), reported with the correction link visible
|
|
284
|
+
among the others, because this read is where a consumer reaches the
|
|
285
|
+
history of a correction at all.
|
|
286
|
+
|
|
287
|
+
This read is a structural read: it reports which links exist between
|
|
288
|
+
which nodes and substitutes nothing whatever a caller states. No mode
|
|
289
|
+
parameter is declared in the schema, and sending one causes refusal as
|
|
290
|
+
an unnamed parameter. The answer over a session containing a correction
|
|
291
|
+
chain is identical to any request, because this read never resolves a
|
|
292
|
+
correction chain to its final version.
|
|
293
|
+
|
|
294
|
+
The block_size and continuation parameters are optional. When not
|
|
295
|
+
supplied, the service resolves them through its own order: the call
|
|
296
|
+
arguments, otherwise the service configuration, otherwise shipped
|
|
297
|
+
constants. Omitting block_size does not cause this method to invent
|
|
298
|
+
one; the service resolves its own bound.
|
|
299
|
+
|
|
300
|
+
Args:
|
|
301
|
+
session_id: Identity of the dialogue session whose declared
|
|
302
|
+
relations are to be returned. Required: this method reads the
|
|
303
|
+
relations of an existing session, never of the whole store.
|
|
304
|
+
block_size: The number of relations one answer may carry. Optional:
|
|
305
|
+
when not supplied, the service resolves the bound through its
|
|
306
|
+
own order. This client never invents a page size and never
|
|
307
|
+
pre-empts the service's resolution of an unsupplied value.
|
|
308
|
+
continuation: The resumption point a previous call to this method
|
|
309
|
+
returned, sent back unread and unedited to continue that read.
|
|
310
|
+
Optional: absent on a first request.
|
|
311
|
+
|
|
312
|
+
Returns:
|
|
313
|
+
One page of the relation set exactly as the service publishes it,
|
|
314
|
+
carrying the bounded block of relations, the statement of whether
|
|
315
|
+
further results follow, and the resumption point for the next block.
|
|
316
|
+
"""
|
|
317
|
+
params: dict[str, Any] = {
|
|
318
|
+
"session_id": session_id,
|
|
319
|
+
}
|
|
320
|
+
if block_size is not None:
|
|
321
|
+
params["block_size"] = block_size
|
|
322
|
+
if continuation is not None:
|
|
323
|
+
params["continuation"] = continuation
|
|
324
|
+
return await self._invoke("relations_read", params)
|
|
325
|
+
|
|
326
|
+
async def leaves_read(
|
|
327
|
+
self,
|
|
328
|
+
session_id: str,
|
|
329
|
+
block_size: int | None = None,
|
|
330
|
+
continuation: str | None = None,
|
|
331
|
+
) -> Any:
|
|
332
|
+
"""Read the leaves and branching points of a dialogue session.
|
|
333
|
+
|
|
334
|
+
Returns, for the addressed dialogue session, the nodes that nothing
|
|
335
|
+
continues from (reported as leaves) and the nodes that more than one
|
|
336
|
+
node continues from (reported as branching points together with the
|
|
337
|
+
count of distinct nodes that continue from each). The computed view
|
|
338
|
+
is the bounded page that the service delivers at that position, never
|
|
339
|
+
a whole-session read, and pagination parameters govern how much of the
|
|
340
|
+
computed view is retrieved at once.
|
|
341
|
+
|
|
342
|
+
Each entry names which of the two roles it holds, so a consumer never
|
|
343
|
+
has to infer one from the other. The view is computed at the moment of
|
|
344
|
+
each read and never kept: a leaf reported by one call simply ceases to
|
|
345
|
+
be reported by the next as soon as a node continues from it, with no
|
|
346
|
+
maintenance step of any kind in between.
|
|
347
|
+
|
|
348
|
+
This read is a structural read: it reports which nodes hold which role
|
|
349
|
+
in the shape of the session and substitutes nothing whatever a caller
|
|
350
|
+
states. No mode parameter is declared in the schema, and sending one
|
|
351
|
+
causes refusal as an unnamed parameter. The answer for a session
|
|
352
|
+
containing a correction chain is identical to any request, because
|
|
353
|
+
this read never resolves a correction chain to its final version.
|
|
354
|
+
|
|
355
|
+
The block_size and continuation parameters are optional. When not
|
|
356
|
+
supplied, the service resolves them through its own order: the call
|
|
357
|
+
arguments, otherwise the service configuration, otherwise shipped
|
|
358
|
+
constants. Omitting block_size does not cause this method to invent
|
|
359
|
+
one; the service resolves its own bound.
|
|
360
|
+
|
|
361
|
+
Args:
|
|
362
|
+
session_id: Identity of the dialogue session whose leaves and
|
|
363
|
+
branching points are to be reported. Required: this method
|
|
364
|
+
reads the view of an existing session, never of the whole store.
|
|
365
|
+
block_size: The number of view entries one answer may carry.
|
|
366
|
+
Optional: when not supplied, the service resolves the bound
|
|
367
|
+
through its own order. This client never invents a page size
|
|
368
|
+
and never pre-empts the service's resolution of an unsupplied
|
|
369
|
+
value.
|
|
370
|
+
continuation: The resumption point a previous call to this method
|
|
371
|
+
returned, sent back unread and unedited to continue that read.
|
|
372
|
+
Optional: absent on a first request.
|
|
373
|
+
|
|
374
|
+
Returns:
|
|
375
|
+
One page of the leaves-and-branching view exactly as the service
|
|
376
|
+
publishes it, carrying the bounded block of nodes, the statement
|
|
377
|
+
of whether further results follow, and the resumption point for
|
|
378
|
+
the next block.
|
|
379
|
+
"""
|
|
380
|
+
params: dict[str, Any] = {
|
|
381
|
+
"session_id": session_id,
|
|
382
|
+
}
|
|
383
|
+
if block_size is not None:
|
|
384
|
+
params["block_size"] = block_size
|
|
385
|
+
if continuation is not None:
|
|
386
|
+
params["continuation"] = continuation
|
|
387
|
+
return await self._invoke("leaves_read", params)
|
|
388
|
+
|
|
389
|
+
async def graph_read(
|
|
390
|
+
self,
|
|
391
|
+
session_id: str,
|
|
392
|
+
anchor_node_id: str,
|
|
393
|
+
drilldown_depth: int | None = None,
|
|
394
|
+
block_size: int | None = None,
|
|
395
|
+
continuation: str | None = None,
|
|
396
|
+
) -> Any:
|
|
397
|
+
"""Read the graph descending from a named node.
|
|
398
|
+
|
|
399
|
+
Returns the graph descending from the named anchor node of the
|
|
400
|
+
addressed dialogue session, bounded by a requested depth below that
|
|
401
|
+
node so that a consumer wanting the shape of a dialogue rather than
|
|
402
|
+
one line of it reaches it through a command of its own instead of
|
|
403
|
+
reassembling it out of the flat relation set. The graph is the bounded
|
|
404
|
+
page that the service delivers at that position, never a whole-session
|
|
405
|
+
read, and pagination parameters govern how much of the answer is
|
|
406
|
+
retrieved at once.
|
|
407
|
+
|
|
408
|
+
This is a drill-down read: the consumer names one node and the number
|
|
409
|
+
of levels of descendants it wants below that node. The command never
|
|
410
|
+
descends from a session as a whole and never picks an anchor for the
|
|
411
|
+
caller. The drilldown_depth parameter has no default, no default
|
|
412
|
+
factory and no fallback to a root, a leaf or a most recent node:
|
|
413
|
+
omitting it causes the service to resolve the bound through its own
|
|
414
|
+
order (the call arguments, otherwise the configuration, otherwise
|
|
415
|
+
shipped constants), and omitting it does not select a default in this
|
|
416
|
+
signature.
|
|
417
|
+
|
|
418
|
+
A resolved depth of zero answers with the anchor node alone. A
|
|
419
|
+
resolved depth of one answers with the anchor and its immediate
|
|
420
|
+
descendants. A resolved depth larger than the deepest line below the
|
|
421
|
+
anchor answers with everything below the anchor and is NOT a refusal.
|
|
422
|
+
Nothing deeper than the resolved number of levels ever appears in the
|
|
423
|
+
answer.
|
|
424
|
+
|
|
425
|
+
The drilldown_depth and block_size are two distinct bounds: the depth
|
|
426
|
+
bounds how far below the anchor the drill-down reaches, and the block
|
|
427
|
+
size bounds how much of that result one answer carries. A small block
|
|
428
|
+
size never shortens the depth, and a small depth never removes the
|
|
429
|
+
need for pagination.
|
|
430
|
+
|
|
431
|
+
Resuming continues the same drill-down: a resumed request whose anchor
|
|
432
|
+
or whose resolved depth disagrees with that datum is REFUSED rather
|
|
433
|
+
than silently reinterpreted, so a resumed block can never descend
|
|
434
|
+
further than the first block was permitted to.
|
|
435
|
+
|
|
436
|
+
The drilldown_depth, block_size, and continuation parameters are
|
|
437
|
+
optional. When not supplied, the service resolves them through its own
|
|
438
|
+
order: the call arguments, otherwise the service configuration,
|
|
439
|
+
otherwise shipped constants. Omitting a parameter does not cause this
|
|
440
|
+
method to invent one; the service resolves its own bounds.
|
|
441
|
+
|
|
442
|
+
Args:
|
|
443
|
+
session_id: Identity of the dialogue session the graph is read
|
|
444
|
+
inside. Required: this method descends inside an existing
|
|
445
|
+
session, never from the whole store.
|
|
446
|
+
anchor_node_id: Identity of the node the drill-down descends from.
|
|
447
|
+
Required: the graph is addressed by a specific node, and
|
|
448
|
+
omitting it causes refusal rather than a whole-session read.
|
|
449
|
+
drilldown_depth: The number of levels of descendants below the
|
|
450
|
+
anchor node to include in the drill-down. Optional: when not
|
|
451
|
+
supplied, the service resolves the bound through its own order.
|
|
452
|
+
This client never invents a depth and never pre-empts the
|
|
453
|
+
service's resolution of an unsupplied value.
|
|
454
|
+
block_size: The number of reached nodes one answer may carry.
|
|
455
|
+
Optional: when not supplied, the service resolves the bound
|
|
456
|
+
through its own order. This client never invents a page size
|
|
457
|
+
and never pre-empts the service's resolution of an unsupplied
|
|
458
|
+
value.
|
|
459
|
+
continuation: The resumption point a previous call to this method
|
|
460
|
+
returned, sent back unread and unedited to continue that read.
|
|
461
|
+
Optional: absent on a first request, in which case the graph
|
|
462
|
+
begins at the anchor node instead.
|
|
463
|
+
|
|
464
|
+
Returns:
|
|
465
|
+
One page of the graph exactly as the service publishes it, carrying
|
|
466
|
+
the bounded block of nodes and connecting relations, the statement
|
|
467
|
+
of whether further results follow, and the resumption point for the
|
|
468
|
+
next block.
|
|
469
|
+
"""
|
|
470
|
+
params: dict[str, Any] = {
|
|
471
|
+
"session_id": session_id,
|
|
472
|
+
"anchor_node_id": anchor_node_id,
|
|
473
|
+
}
|
|
474
|
+
if drilldown_depth is not None:
|
|
475
|
+
params["drilldown_depth"] = drilldown_depth
|
|
476
|
+
if block_size is not None:
|
|
477
|
+
params["block_size"] = block_size
|
|
478
|
+
if continuation is not None:
|
|
479
|
+
params["continuation"] = continuation
|
|
480
|
+
return await self._invoke("graph_read", params)
|
|
481
|
+
|
|
482
|
+
async def sessions_list( # noqa: PLR0913, PLR0917
|
|
483
|
+
self,
|
|
484
|
+
project_id: str | None = None,
|
|
485
|
+
lifecycle: str | None = None,
|
|
486
|
+
dialogue_kind: str | None = None,
|
|
487
|
+
participant: str | None = None,
|
|
488
|
+
created_at_range: dict[str, str] | None = None,
|
|
489
|
+
block_size: int | None = None,
|
|
490
|
+
continuation: str | None = None,
|
|
491
|
+
) -> Any:
|
|
492
|
+
"""List dialogue sessions matching supplied filter axes.
|
|
493
|
+
|
|
494
|
+
Returns one bounded block of the dialogue sessions matching the filter
|
|
495
|
+
axes a caller chooses to constrain. The sessions reported are constrained
|
|
496
|
+
by their recorded attributes alone: no message text, no excerpt, no
|
|
497
|
+
preview and no content-derived data are carried. Each session is
|
|
498
|
+
identified by its session identity, the project that owns it, its
|
|
499
|
+
lifecycle state, the pairing of participant kinds it was declared to
|
|
500
|
+
run between, its recorded participants and its recorded UTC creation
|
|
501
|
+
time.
|
|
502
|
+
|
|
503
|
+
The answer is the bounded page that the service delivers at the
|
|
504
|
+
requested position, never a whole-store read, and pagination parameters
|
|
505
|
+
govern how many sessions one answer carries at once. Following the
|
|
506
|
+
resumption point each answer returns yields every matching session
|
|
507
|
+
exactly once, with none skipped and none repeated across a block
|
|
508
|
+
boundary.
|
|
509
|
+
|
|
510
|
+
Five optional filter axes may be constrained independently: the owning
|
|
511
|
+
project, the recorded lifecycle state, the declared pairing of participant
|
|
512
|
+
kinds, a participant, and the recorded UTC creation time as one range
|
|
513
|
+
carrying both of its inclusive bounds. An omitted axis constrains nothing
|
|
514
|
+
and is never filled in from the configuration or the shipped constants.
|
|
515
|
+
Axes given together compose conjunctively: a session is reported only when
|
|
516
|
+
it satisfies every axis the caller constrained. A request constraining no
|
|
517
|
+
axis at all validly lists every session the service knows, still in
|
|
518
|
+
bounded blocks.
|
|
519
|
+
|
|
520
|
+
A combination of axes matching nothing yields an empty block rather than
|
|
521
|
+
an error, because this read addresses no single session and raises no
|
|
522
|
+
unknown-session refusal.
|
|
523
|
+
|
|
524
|
+
The block_size and continuation parameters are optional. When not
|
|
525
|
+
supplied, the service resolves them through its own order: the call
|
|
526
|
+
arguments, otherwise the service configuration, otherwise shipped
|
|
527
|
+
constants. Omitting block_size does not cause this method to invent
|
|
528
|
+
one; the service resolves its own bound. Omitting continuation leaves
|
|
529
|
+
the read unconstrained on a first request; when present it carries the
|
|
530
|
+
resumption point a previous answer of this same listing returned, sent
|
|
531
|
+
back unread and unedited.
|
|
532
|
+
|
|
533
|
+
Args:
|
|
534
|
+
project_id: Report only sessions owned by this project. Optional:
|
|
535
|
+
omit to leave the project axis unconstrained.
|
|
536
|
+
(sessions_list_command.py:277)
|
|
537
|
+
lifecycle: Report only sessions recorded in this lifecycle state.
|
|
538
|
+
Optional: omit to leave the lifecycle axis unconstrained.
|
|
539
|
+
(sessions_list_command.py:280)
|
|
540
|
+
dialogue_kind: Report only sessions declared to run between this
|
|
541
|
+
pairing of participant kinds, named as '<first>-to-<second>'.
|
|
542
|
+
Optional: omit to leave the dialogue-kind axis unconstrained.
|
|
543
|
+
(sessions_list_command.py:284)
|
|
544
|
+
participant: Report only sessions whose recorded participants
|
|
545
|
+
include this one. Optional: omit to leave the participant axis
|
|
546
|
+
unconstrained. (sessions_list_command.py:288)
|
|
547
|
+
created_at_range: Report only sessions whose recorded UTC creation
|
|
548
|
+
time falls in this range. One axis carrying both bounds: 'from'
|
|
549
|
+
and 'to' are ISO-8601 instants in UTC, each inclusive at the
|
|
550
|
+
stated boundary, and either may be omitted to leave that end
|
|
551
|
+
unbounded. Optional: omit to leave the creation-time axis
|
|
552
|
+
unconstrained. (sessions_list_command.py:292)
|
|
553
|
+
block_size: How many sessions one answer may carry. Optional: when
|
|
554
|
+
not supplied, the service resolves the bound through its own
|
|
555
|
+
order. This client never invents a page size and never pre-empts
|
|
556
|
+
the service's resolution of an unsupplied value.
|
|
557
|
+
(sessions_list_command.py:303)
|
|
558
|
+
continuation: The resumption point a previous answer of this same
|
|
559
|
+
listing returned, sent back unread and unedited to continue that
|
|
560
|
+
read under the same constrained axes. Optional: absent on a first
|
|
561
|
+
request, in which case the listing begins at the first matching
|
|
562
|
+
session. (sessions_list_command.py:308)
|
|
563
|
+
|
|
564
|
+
Returns:
|
|
565
|
+
One page of the matching sessions exactly as the service publishes
|
|
566
|
+
it, carrying the bounded block of session entries, the statement of
|
|
567
|
+
whether further results follow, and the resumption point for the
|
|
568
|
+
next block.
|
|
569
|
+
"""
|
|
570
|
+
params: dict[str, Any] = {}
|
|
571
|
+
if project_id is not None:
|
|
572
|
+
params["project_id"] = project_id
|
|
573
|
+
if lifecycle is not None:
|
|
574
|
+
params["lifecycle"] = lifecycle
|
|
575
|
+
if dialogue_kind is not None:
|
|
576
|
+
params["dialogue_kind"] = dialogue_kind
|
|
577
|
+
if participant is not None:
|
|
578
|
+
params["participant"] = participant
|
|
579
|
+
if created_at_range is not None:
|
|
580
|
+
params["created_at_range"] = created_at_range
|
|
581
|
+
if block_size is not None:
|
|
582
|
+
params["block_size"] = block_size
|
|
583
|
+
if continuation is not None:
|
|
584
|
+
params["continuation"] = continuation
|
|
585
|
+
return await self._invoke("sessions_list", params)
|