plan-manager-client-dev 0.2.186__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.
Files changed (37) hide show
  1. plan_manager_client/__init__.py +10 -0
  2. plan_manager_client/_version.py +58 -0
  3. plan_manager_client/authoring_diagnostics.py +137 -0
  4. plan_manager_client/client.py +75 -0
  5. plan_manager_client/config.py +320 -0
  6. plan_manager_client/delivery/__init__.py +7 -0
  7. plan_manager_client/delivery/archive.py +140 -0
  8. plan_manager_client/delivery/atomicity.py +93 -0
  9. plan_manager_client/delivery/commit.py +113 -0
  10. plan_manager_client/delivery/destination.py +140 -0
  11. plan_manager_client/delivery/provenance.py +88 -0
  12. plan_manager_client/delivery/upload.py +118 -0
  13. plan_manager_client/dispatch.py +380 -0
  14. plan_manager_client/export_fetch_chunks.py +166 -0
  15. plan_manager_client/export_fetch_request.py +88 -0
  16. plan_manager_client/export_fetch_unpack.py +149 -0
  17. plan_manager_client/export_fetch_verify.py +101 -0
  18. plan_manager_client/facade_agent_config_mixin.py +224 -0
  19. plan_manager_client/facade_bug_project_mixin.py +202 -0
  20. plan_manager_client/facade_context_gate_mixin.py +303 -0
  21. plan_manager_client/facade_entity_common_mixin.py +38 -0
  22. plan_manager_client/facade_hrs_file_mixin.py +206 -0
  23. plan_manager_client/facade_plan_hrs_mixin.py +200 -0
  24. plan_manager_client/facade_runtime_mixin/__init__.py +11 -0
  25. plan_manager_client/facade_runtime_mixin/authoring_part.py +442 -0
  26. plan_manager_client/facade_runtime_mixin/facade.py +380 -0
  27. plan_manager_client/facade_runtime_mixin/overlay_part.py +192 -0
  28. plan_manager_client/facade_step_graph_mixin.py +158 -0
  29. plan_manager_client/id_rule.py +115 -0
  30. plan_manager_client/info_walker.py +133 -0
  31. plan_manager_client/scenario_runtime.py +65 -0
  32. plan_manager_client/server_api.py +427 -0
  33. plan_manager_client/server_api_mutating.py +105 -0
  34. plan_manager_client_dev-0.2.186.dist-info/METADATA +10 -0
  35. plan_manager_client_dev-0.2.186.dist-info/RECORD +37 -0
  36. plan_manager_client_dev-0.2.186.dist-info/WHEEL +5 -0
  37. plan_manager_client_dev-0.2.186.dist-info/top_level.txt +1 -0
@@ -0,0 +1,442 @@
1
+ """Module for split package."""
2
+
3
+ from __future__ import annotations
4
+ from typing import Any
5
+
6
+ ABSENT: Any = object()
7
+ """Marks an argument the caller did not pass (block 0156, bug 614b5032): it is left out of the wire params, so the
8
+ server answers the missing or unknown field with its own -32602 violation instead of a Python TypeError."""
9
+
10
+
11
+ def supplied(**given: Any) -> dict[str, Any]:
12
+ """The wire params of the given arguments, leaving out every ABSENT one."""
13
+ return {name: value for name, value in given.items() if value is not ABSENT}
14
+
15
+
16
+ class RuntimeAuthoringPart:
17
+ """One method per plan_manager command in the runtime work-item family.
18
+
19
+ Assumes it is mixed into a class that also inherits
20
+ plan_manager_client.dispatch._CommandDispatchMixin, which supplies the
21
+ coroutine async def _call(self, command: str, params: dict[str, Any] | None = None) -> Any
22
+ used by every method below."""
23
+
24
+ def __init__(self, owner):
25
+ self._owner = owner
26
+
27
+ def __getattr__(self, name):
28
+ """Resolve names this part does not define on the owning facade."""
29
+ if name == "_owner":
30
+ raise AttributeError(name)
31
+ return getattr(self._owner, name)
32
+
33
+ async def authoring_usage_get(self, step: str, include_descendants: bool, plan: str | None = None) -> Any:
34
+ """Read persisted MACSC token usage for one planned step (its id, a uuid4, or with plan its path) or its subtree."""
35
+ params: dict[str, Any] = {"step": step, "include_descendants": include_descendants}
36
+ if plan is not None:
37
+ params["plan"] = plan
38
+ return await self._call("authoring_usage_get", params)
39
+
40
+ async def model_binding_set(self, **params: Any) -> Any:
41
+ """Create a model binding runtime-configuration record (C-009) for the given scope."""
42
+ return await self._call("model_binding_set", params)
43
+
44
+ async def model_binding_get(self, **params: Any) -> Any:
45
+ """Retrieve a single model binding record (C-009) by its binding identifier."""
46
+ return await self._call("model_binding_get", params)
47
+
48
+ async def model_binding_list(self, **params: Any) -> Any:
49
+ """List a paginated page of model binding records (C-009) filtered by plan, scope, and role."""
50
+ return await self._call("model_binding_list", params)
51
+
52
+ async def model_binding_update(self, **params: Any) -> Any:
53
+ """Patch the mutable fields of an existing model binding record (C-009) in place."""
54
+ return await self._call("model_binding_update", params)
55
+
56
+ async def model_binding_remove(self, **params: Any) -> Any:
57
+ """Soft-delete a model binding record (C-009) by its binding identifier."""
58
+ return await self._call("model_binding_remove", params)
59
+
60
+ async def model_binding_resolve(self, **params: Any) -> Any:
61
+ """Resolve the effective model for a target step and role from the binding inheritance (C-012)."""
62
+ return await self._call("model_binding_resolve", params)
63
+
64
+ async def authoring_session_create(
65
+ self,
66
+ plan: str,
67
+ common_prompt_document_id: str | None = None,
68
+ executor_prompt_document_ids: dict[str, str] | None = None,
69
+ ) -> Any:
70
+ """Create the immutable authoring session binding for a plan."""
71
+ params: dict[str, Any] = {"plan": plan}
72
+ if common_prompt_document_id is not None:
73
+ params["common_prompt_document_id"] = common_prompt_document_id
74
+ if executor_prompt_document_ids is not None:
75
+ params["executor_prompt_document_ids"] = executor_prompt_document_ids
76
+ return await self._call("authoring_session_create", params)
77
+
78
+ async def authoring_session_get(self, session_id: Any = ABSENT, **unknown: Any) -> Any:
79
+ """Read one authoring session by its uuid4; a session marked for deletion carries deleted_at (AUTHORING_SESSION_NOT_FOUND when absent).
80
+
81
+ A missing session_id or an unknown field is passed to the server unchanged and refused there with -32602 (missing / unknown).
82
+ """
83
+ params = supplied(session_id=session_id)
84
+ params.update(unknown)
85
+ return await self._call("authoring_session_get", params)
86
+
87
+ async def authoring_session_list(
88
+ self,
89
+ plan: Any = ABSENT,
90
+ include_deleted: Any = ABSENT,
91
+ limit: Any = ABSENT,
92
+ offset: Any = ABSENT,
93
+ **unknown: Any,
94
+ ) -> Any:
95
+ """List authoring sessions page by page (sessions, total, limit, offset); a marked session is shown with include_deleted=True.
96
+
97
+ Every argument is passed to the server unchanged; a wrong value is refused there (INVALID_PAGINATION, PLAN_NOT_FOUND, -32602).
98
+ """
99
+ params = supplied(plan=plan, include_deleted=include_deleted, limit=limit, offset=offset)
100
+ params.update(unknown)
101
+ return await self._call("authoring_session_list", params)
102
+
103
+ async def authoring_session_update(
104
+ self,
105
+ session_id: Any = ABSENT,
106
+ changed_by: Any = ABSENT,
107
+ common_prompt_document_id: Any = ABSENT,
108
+ executor_prompt_document_ids: Any = ABSENT,
109
+ **unknown: Any,
110
+ ) -> Any:
111
+ """Always refused (AUTHORING_SESSION_IMMUTABLE): the binding of a session is fixed at create.
112
+
113
+ A missing session_id / changed_by, an empty patch or an unknown field is passed to the server unchanged and refused there with -32602.
114
+ """
115
+ params = supplied(
116
+ session_id=session_id, changed_by=changed_by,
117
+ common_prompt_document_id=common_prompt_document_id, executor_prompt_document_ids=executor_prompt_document_ids,
118
+ )
119
+ params.update(unknown)
120
+ return await self._call("authoring_session_update", params)
121
+
122
+ async def authoring_session_delete(
123
+ self,
124
+ session_id: Any = ABSENT,
125
+ changed_by: Any = ABSENT,
126
+ hard: bool = False,
127
+ recursive: bool = False,
128
+ dry_run: bool = False,
129
+ drop_dialogue: Any = ABSENT,
130
+ **unknown: Any,
131
+ ) -> Any:
132
+ """Soft-delete (mark) one authoring session; hard=True removes an already marked one and deletes its CAS session without force.
133
+
134
+ drop_dialogue is accepted only together with hard=True. A missing session_id / changed_by or an unknown field is passed to the
135
+ server unchanged and refused there with -32602.
136
+ """
137
+ params = supplied(session_id=session_id, changed_by=changed_by, drop_dialogue=drop_dialogue)
138
+ if hard:
139
+ params["hard"] = True
140
+ if recursive:
141
+ params["recursive"] = True
142
+ if dry_run:
143
+ params["dry_run"] = True
144
+ params.update(unknown)
145
+ return await self._call("authoring_session_delete", params)
146
+
147
+ async def authoring_job_start(
148
+ self,
149
+ plan: str,
150
+ step: str,
151
+ session_id: str,
152
+ orchestrator_model_id: str | None = None,
153
+ ) -> Any:
154
+ """Start one session-bound authoring job for the step ``step`` (its id, a uuid4)."""
155
+ params = {"plan": plan, "step": step, "session_id": session_id}
156
+ if orchestrator_model_id is not None:
157
+ params["orchestrator_model_id"] = orchestrator_model_id
158
+ return await self._call("authoring_job_start", params)
159
+
160
+ async def authoring_job_status(
161
+ self, plan: str, step: str, session_id: str
162
+ ) -> Any:
163
+ """Read the scoped state of the authoring job of the step ``step`` (its id, a uuid4).
164
+
165
+ The result data carries ``events``: the newest visible job events up to the server cap AUTHORING_STATUS_EVENTS_MAX, oldest first (write order on equal created_at), each
166
+ ``{event_type, created_at, metadata}`` (always present, empty when none).
167
+ """
168
+ return await self._call(
169
+ "authoring_job_status",
170
+ {"plan": plan, "step": step, "session_id": session_id},
171
+ )
172
+
173
+ async def authoring_job_resume(
174
+ self,
175
+ plan: str,
176
+ step: str,
177
+ session_id: str,
178
+ answer: str,
179
+ orchestrator_model_id: str | None = None,
180
+ ) -> Any:
181
+ """Answer and resume the waiting authoring job of the step ``step`` (its id, a uuid4)."""
182
+ params = {
183
+ "plan": plan,
184
+ "step": step,
185
+ "session_id": session_id,
186
+ "answer": answer,
187
+ }
188
+ if orchestrator_model_id is not None:
189
+ params["orchestrator_model_id"] = orchestrator_model_id
190
+ return await self._call("authoring_job_resume", params)
191
+
192
+ async def authoring_job_stop(self, plan: str, step: str, session_id: str) -> Any:
193
+ """Stop the authoring job of the step ``step`` (its id, a uuid4) and its active same-session descendants."""
194
+ return await self._call(
195
+ "authoring_job_stop",
196
+ {"plan": plan, "step": step, "session_id": session_id},
197
+ )
198
+
199
+ async def authoring_job_get(self, job_id: Any = ABSENT, **unknown: Any) -> Any:
200
+ """Read one authoring job by its uuid4; a soft-marked job carries deleted_at (AUTHORING_JOB_NOT_FOUND when absent).
201
+
202
+ A missing job_id or an unknown field is passed to the server unchanged and refused there with -32602 (missing / unknown).
203
+ """
204
+ params = supplied(job_id=job_id)
205
+ params.update(unknown)
206
+ return await self._call("authoring_job_get", params)
207
+
208
+ async def authoring_job_update(
209
+ self,
210
+ job_id: Any = ABSENT,
211
+ changed_by: Any = ABSENT,
212
+ state: str | None = None,
213
+ result: dict[str, Any] | None = None,
214
+ question: str | None = None,
215
+ answer: str | None = None,
216
+ error_reason: str | None = None,
217
+ **unknown: Any,
218
+ ) -> Any:
219
+ """Always refused (AUTHORING_JOB_UPDATE_REFUSED): the state moves only through start, stop and resume.
220
+
221
+ A missing job_id / changed_by or an unknown field is passed to the server unchanged and refused there with -32602.
222
+ """
223
+ params = supplied(job_id=job_id, changed_by=changed_by)
224
+ for name, value in (("state", state), ("result", result), ("question", question), ("answer", answer), ("error_reason", error_reason)):
225
+ if value is not None:
226
+ params[name] = value
227
+ params.update(unknown)
228
+ return await self._call("authoring_job_update", params)
229
+
230
+ async def authoring_job_delete(self, job_id: Any = ABSENT, hard: bool = False, recursive: bool = False, **unknown: Any) -> Any:
231
+ """Soft-delete (mark) one terminal authoring job; hard=True removes an already marked job (server default: false).
232
+
233
+ A missing job_id or an unknown field is passed to the server unchanged and refused there with -32602.
234
+ """
235
+ params = supplied(job_id=job_id)
236
+ if hard:
237
+ params["hard"] = True
238
+ if recursive:
239
+ params["recursive"] = True
240
+ params.update(unknown)
241
+ return await self._call("authoring_job_delete", params)
242
+
243
+ async def authoring_child_list(self, step: str, plan: str | None = None) -> Any:
244
+ """List the direct planned children of the step ``step`` (its id, a uuid4, or with ``plan`` its path)."""
245
+ params: dict[str, Any] = {"step": step}
246
+ if plan is not None:
247
+ params["plan"] = plan
248
+ return await self._call("authoring_child_list", params)
249
+
250
+ async def authoring_context_read(self, section: Any = ABSENT, ids: Any = ABSENT, offset: Any = ABSENT, limit: Any = ABSENT, **unknown: Any) -> Any:
251
+ """Model tool: read one section (common, specific, concepts, relations, names) of the calling job's step context.
252
+
253
+ Works only inside an authoring job (outside one the server answers AUTHORING_NO_CURRENT_JOB). A missing section or an unknown
254
+ field is passed to the server unchanged and refused there with -32602.
255
+ """
256
+ params = supplied(section=section, ids=ids, offset=offset, limit=limit)
257
+ params.update(unknown)
258
+ return await self._call("authoring_context_read", params)
259
+
260
+ async def authoring_child_write(self, children: Any = ABSENT, **unknown: Any) -> Any:
261
+ """Model tool: create (slug) and update (step) up to 12 direct children of the calling job's step in one transaction.
262
+
263
+ Works only inside an authoring job (outside one the server answers AUTHORING_NO_CURRENT_JOB). A missing children list or an
264
+ unknown field is passed to the server unchanged and refused there with -32602.
265
+ """
266
+ params = supplied(children=children)
267
+ params.update(unknown)
268
+ return await self._call("authoring_child_write", params)
269
+
270
+ async def authoring_child_start(self, steps: Any = ABSENT, restart: Any = ABSENT, **unknown: Any) -> Any:
271
+ """Model tool: start the jobs of up to 12 direct children of the calling job's step; restart=True restarts failed or stopped children.
272
+
273
+ Works only inside an authoring job (outside one the server answers AUTHORING_NO_CURRENT_JOB). A missing steps list, a wrongly typed
274
+ restart or an unknown field is passed to the server unchanged and refused there with -32602.
275
+ """
276
+ params = supplied(steps=steps, restart=restart)
277
+ params.update(unknown)
278
+ return await self._call("authoring_child_start", params)
279
+
280
+ async def authoring_child_status(self, steps: Any = ABSENT, **unknown: Any) -> Any:
281
+ """Model tool: the state of the direct children of the calling job's step and of their jobs (read-only).
282
+
283
+ Works only inside an authoring job (outside one the server answers AUTHORING_NO_CURRENT_JOB). A wrongly typed steps list or an
284
+ unknown field is passed to the server unchanged and refused there with -32602.
285
+ """
286
+ params = supplied(steps=steps)
287
+ params.update(unknown)
288
+ return await self._call("authoring_child_status", params)
289
+
290
+ async def authoring_child_wait(self, until: Any = ABSENT, timeout_seconds: Any = ABSENT, **unknown: Any) -> Any:
291
+ """Model tool: wait for the child jobs of the calling job (returns at once or parks the job until the children need it).
292
+
293
+ Works only inside an authoring job (outside one the server answers AUTHORING_NO_CURRENT_JOB). A wrongly typed or out-of-range
294
+ argument or an unknown field is passed to the server unchanged and refused there with -32602.
295
+ """
296
+ params = supplied(until=until, timeout_seconds=timeout_seconds)
297
+ params.update(unknown)
298
+ return await self._call("authoring_child_wait", params)
299
+
300
+ async def authoring_child_answer(self, answers: Any = ABSENT, **unknown: Any) -> Any:
301
+ """Model tool: answer the questions of up to 12 waiting child jobs of the calling job's step in one call.
302
+
303
+ Works only inside an authoring job (outside one the server answers AUTHORING_NO_CURRENT_JOB). A missing answers list or an
304
+ unknown field is passed to the server unchanged and refused there with -32602.
305
+ """
306
+ params = supplied(answers=answers)
307
+ params.update(unknown)
308
+ return await self._call("authoring_child_answer", params)
309
+
310
+ async def authoring_step_create(self, **params: Any) -> Any:
311
+ return await self._call("authoring_step_create", params)
312
+
313
+ async def authoring_step_update(self, **params: Any) -> Any:
314
+ return await self._call("authoring_step_update", params)
315
+
316
+ async def authoring_step_delete(self, **params: Any) -> Any:
317
+ return await self._call("authoring_step_delete", params)
318
+
319
+ async def authoring_step_submit(self, step_payload: dict[str, Any]) -> Any:
320
+ """Submit the current job's assigned-step payload."""
321
+ return await self._call("authoring_step_submit", {"step_payload": step_payload})
322
+
323
+ async def authoring_escalate(self, question: str) -> Any:
324
+ """Pause the current job with a question for its direct parent."""
325
+ return await self._call("authoring_escalate", {"question": question})
326
+
327
+ async def execution_attempt_create(self, **params: Any) -> Any:
328
+ """Create a new execution attempt anchored to a plan/step."""
329
+ return await self._call("execution_attempt_create", params)
330
+
331
+ async def execution_attempt_report(self, **params: Any) -> Any:
332
+ """Record the outcome of an execution attempt run. Never a confirmation of correctness -- acceptance is recorded separately by a review result."""
333
+ return await self._call("execution_attempt_report", params)
334
+
335
+ async def execution_attempt_get(self, **params: Any) -> Any:
336
+ """Retrieve a single execution attempt by identifier."""
337
+ return await self._call("execution_attempt_get", params)
338
+
339
+ async def execution_attempt_list(self, **params: Any) -> Any:
340
+ """List a paginated page of execution attempts filtered by plan, step, status, and parent attempt lineage."""
341
+ return await self._call("execution_attempt_list", params)
342
+
343
+ async def execution_attempt_supersede(self, **params: Any) -> Any:
344
+ """Record that a stale execution attempt was replaced by a specific later attempt, without touching the stale attempt's own status."""
345
+ return await self._call("execution_attempt_supersede", params)
346
+
347
+ async def execution_attempt_delete(self, **params: Any) -> Any:
348
+ """Delete an execution attempt: mark by default, hard=true removes a marked attempt, dry_run previews (parameters passed through; the server validates them)."""
349
+ return await self._call("execution_attempt_delete", params)
350
+
351
+ async def review_result_create(self, **params: Any) -> Any:
352
+ """Create a review result recording the outcome of reviewing an execution attempt or revision."""
353
+ return await self._call("review_result_create", params)
354
+
355
+ async def review_result_get(self, **params: Any) -> Any:
356
+ """Retrieve a single review result by identifier."""
357
+ return await self._call("review_result_get", params)
358
+
359
+ async def review_result_list(self, **params: Any) -> Any:
360
+ """List a paginated page of review results scoped by reviewed execution attempt and status."""
361
+ return await self._call("review_result_list", params)
362
+
363
+ async def review_result_supersede(self, **params: Any) -> Any:
364
+ """Record that a stale review result was replaced by a specific later review result, without touching the stale review's own status."""
365
+ return await self._call("review_result_supersede", params)
366
+
367
+ async def review_result_delete(self, **params: Any) -> Any:
368
+ """Delete a review result: mark by default, hard=true removes a marked review, dry_run previews (parameters passed through; the server validates them)."""
369
+ return await self._call("review_result_delete", params)
370
+
371
+ async def escalation_create(self, **params: Any) -> Any:
372
+ """Create an escalation raised to the owner of the next level up."""
373
+ return await self._call("escalation_create", params)
374
+
375
+ async def escalation_get(self, **params: Any) -> Any:
376
+ """Retrieve a single escalation by its identifier."""
377
+ return await self._call("escalation_get", params)
378
+
379
+ async def escalation_list(self, **params: Any) -> Any:
380
+ """List escalations with optional status/anchor filtering and pagination."""
381
+ return await self._call("escalation_list", params)
382
+
383
+ async def escalation_resolve(self, **params: Any) -> Any:
384
+ """Resolve an open escalation, recording the resolution and the resolving owner."""
385
+ return await self._call("escalation_resolve", params)
386
+
387
+ async def escalation_reanchor(self, **params: Any) -> Any:
388
+ """Move an escalation's primary anchor to a new target, with an audit record."""
389
+ return await self._call("escalation_reanchor", params)
390
+
391
+ async def escalation_delete(self, **params: Any) -> Any:
392
+ """Delete an escalation: soft by default, hard when hard=true, dry_run previews."""
393
+ return await self._call("escalation_delete", params)
394
+
395
+ async def escalation_update(self, **params: Any) -> Any:
396
+ """Update mutable fields of an existing escalation."""
397
+ return await self._call("escalation_update", params)
398
+
399
+ async def escalation_policy_create(self, **params: Any) -> Any:
400
+ """Create an escalation policy record fixing authority typology and escalation rules."""
401
+ return await self._call("escalation_policy_create", params)
402
+
403
+ async def escalation_policy_get(self, **params: Any) -> Any:
404
+ """Retrieve a single escalation policy by its identifier."""
405
+ return await self._call("escalation_policy_get", params)
406
+
407
+ async def escalation_policy_list(self, **params: Any) -> Any:
408
+ """List escalation policies with optional filtering."""
409
+ return await self._call("escalation_policy_list", params)
410
+
411
+ async def escalation_policy_update(self, **params: Any) -> Any:
412
+ """Update mutable fields of an existing escalation policy."""
413
+ return await self._call("escalation_policy_update", params)
414
+
415
+ async def escalation_policy_delete(self, **params: Any) -> Any:
416
+ """Delete an escalation policy: soft by default, hard when hard=true, dry_run previews."""
417
+ return await self._call("escalation_policy_delete", params)
418
+
419
+ async def escalation_policy_get_active(self, **params: Any) -> Any:
420
+ """Retrieve the currently active escalation policy record."""
421
+ return await self._call("escalation_policy_get_active", params)
422
+
423
+ async def answer_envelope_create(self, **params: Any) -> Any:
424
+ """Create an answer envelope record: discriminating result, escalation, and tool_call answer kinds."""
425
+ return await self._call("answer_envelope_create", params)
426
+
427
+ async def answer_envelope_get(self, **params: Any) -> Any:
428
+ """Retrieve a single answer envelope record by its envelope identifier."""
429
+ return await self._call("answer_envelope_get", params)
430
+
431
+ async def answer_envelope_list(self, **params: Any) -> Any:
432
+ """List answer envelope records filtered by kind, attempt, or plan anchor."""
433
+ return await self._call("answer_envelope_list", params)
434
+
435
+ async def answer_envelope_update(self, **params: Any) -> Any:
436
+ """Patch mutable fields of an existing answer envelope record in place."""
437
+ return await self._call("answer_envelope_update", params)
438
+
439
+ async def answer_envelope_delete(self, **params: Any) -> Any:
440
+ """Delete an answer envelope: soft by default, hard when hard=true, dry_run previews."""
441
+ return await self._call("answer_envelope_delete", params)
442
+