agenthooksprotocol 0.1.0__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 (61) hide show
  1. agenthooksprotocol/__init__.py +64 -0
  2. agenthooksprotocol/_boundaries.py +498 -0
  3. agenthooksprotocol/_content.py +672 -0
  4. agenthooksprotocol/_diagnostics.py +93 -0
  5. agenthooksprotocol/_grants.py +597 -0
  6. agenthooksprotocol/_hooks.py +925 -0
  7. agenthooksprotocol/_models/__init__.py +18414 -0
  8. agenthooksprotocol/_models/capability.py +282 -0
  9. agenthooksprotocol/_models/content.py +58 -0
  10. agenthooksprotocol/_models/effect.py +52 -0
  11. agenthooksprotocol/_models/event.py +230 -0
  12. agenthooksprotocol/_models/registration.py +20 -0
  13. agenthooksprotocol/_models/subscription.py +24 -0
  14. agenthooksprotocol/_models/tool.py +132 -0
  15. agenthooksprotocol/_models/transport.py +8 -0
  16. agenthooksprotocol/ahp-codegen.lock.json +123 -0
  17. agenthooksprotocol/auth.py +343 -0
  18. agenthooksprotocol/candidate.py +10 -0
  19. agenthooksprotocol/capability.py +193 -0
  20. agenthooksprotocol/catalogue.py +201 -0
  21. agenthooksprotocol/codec.py +32 -0
  22. agenthooksprotocol/compaction.py +211 -0
  23. agenthooksprotocol/content.py +131 -0
  24. agenthooksprotocol/diagnostics.py +15 -0
  25. agenthooksprotocol/effect.py +160 -0
  26. agenthooksprotocol/elicitation.py +250 -0
  27. agenthooksprotocol/event.py +114 -0
  28. agenthooksprotocol/generated.py +11595 -0
  29. agenthooksprotocol/integrations/__init__.py +1 -0
  30. agenthooksprotocol/integrations/pydantic.py +28 -0
  31. agenthooksprotocol/interop.py +1075 -0
  32. agenthooksprotocol/lifecycle.py +294 -0
  33. agenthooksprotocol/lifecycle_client.py +417 -0
  34. agenthooksprotocol/lifecycle_server.py +490 -0
  35. agenthooksprotocol/lineage.py +115 -0
  36. agenthooksprotocol/observation_chain.py +151 -0
  37. agenthooksprotocol/path.py +4 -0
  38. agenthooksprotocol/permission.py +2 -0
  39. agenthooksprotocol/py.typed +0 -0
  40. agenthooksprotocol/registration.py +148 -0
  41. agenthooksprotocol/runtime.py +354 -0
  42. agenthooksprotocol/schemas.json +10557 -0
  43. agenthooksprotocol/server/__init__.py +8 -0
  44. agenthooksprotocol/server/_framing.py +33 -0
  45. agenthooksprotocol/server/_json.py +18 -0
  46. agenthooksprotocol/server/asgi.py +66 -0
  47. agenthooksprotocol/server/attachments.py +205 -0
  48. agenthooksprotocol/server/hooks.py +163 -0
  49. agenthooksprotocol/server/stdio.py +176 -0
  50. agenthooksprotocol/state.py +34 -0
  51. agenthooksprotocol/subscription.py +11 -0
  52. agenthooksprotocol/tool.py +63 -0
  53. agenthooksprotocol/transport.py +6 -0
  54. agenthooksprotocol/transports/__init__.py +14 -0
  55. agenthooksprotocol/transports/http.py +144 -0
  56. agenthooksprotocol/transports/stdio.py +92 -0
  57. agenthooksprotocol-0.1.0.dist-info/METADATA +370 -0
  58. agenthooksprotocol-0.1.0.dist-info/RECORD +61 -0
  59. agenthooksprotocol-0.1.0.dist-info/WHEEL +5 -0
  60. agenthooksprotocol-0.1.0.dist-info/licenses/LICENSE +202 -0
  61. agenthooksprotocol-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,64 @@
1
+ """Asynchronous Agent Hooks Protocol harness and schema-generated models."""
2
+
3
+ from . import (
4
+ capability,
5
+ candidate,
6
+ state,
7
+ diagnostics,
8
+ auth,
9
+ effect,
10
+ event,
11
+ generated,
12
+ path,
13
+ registration,
14
+ subscription,
15
+ tool,
16
+ transport,
17
+ )
18
+ from ._content import ContentContext as ContentContext
19
+ from ._models import * # noqa: F403
20
+ from ._models import __all__ as _model_names
21
+ from ._hooks import (
22
+ HookResult as HookResult,
23
+ Hooks as Hooks,
24
+ PendingInvocation as PendingInvocation,
25
+ HooksClosedError as HooksClosedError,
26
+ )
27
+ from .permission import Permission as Permission
28
+ from .content import (
29
+ OwnedContentSource as OwnedContentSource,
30
+ ContentSources as ContentSources,
31
+ )
32
+ from .codec import Codec as Codec, IdentityCodec as IdentityCodec
33
+ from .runtime import (
34
+ ProtocolError as ProtocolError,
35
+ OperationCancelledError as OperationCancelledError,
36
+ )
37
+
38
+ __all__ = list(_model_names) + [
39
+ "ContentContext",
40
+ "OwnedContentSource",
41
+ "ContentSources",
42
+ "Permission",
43
+ "state",
44
+ "candidate",
45
+ "diagnostics",
46
+ "auth",
47
+ "HooksClosedError",
48
+ "OperationCancelledError",
49
+ "capability",
50
+ "effect",
51
+ "event",
52
+ "path",
53
+ "registration",
54
+ "subscription",
55
+ "tool",
56
+ "transport",
57
+ "Hooks",
58
+ "HookResult",
59
+ "PendingInvocation",
60
+ "ProtocolError",
61
+ "Codec",
62
+ "IdentityCodec",
63
+ "generated",
64
+ ]
@@ -0,0 +1,498 @@
1
+ # Generated by ahp-codegen. DO NOT EDIT.
2
+ from __future__ import annotations
3
+ from typing import TYPE_CHECKING, Any, cast
4
+
5
+ if TYPE_CHECKING:
6
+ from ._hooks import HookResult, Hooks
7
+ from . import _models as models
8
+
9
+
10
+ class BoundaryMixin:
11
+ """Schema-derived named boundaries; implemented by Hooks.dispatch."""
12
+
13
+ async def config_change_after(
14
+ self, input: models.ConfigChangeAfterInput | dict[str, Any], **kwargs: Any
15
+ ) -> HookResult:
16
+ return await cast("Hooks", self).dispatch(
17
+ "config.change.after", input, **kwargs
18
+ )
19
+
20
+ async def config_change_before(
21
+ self, input: models.ConfigChangeBeforeInput | dict[str, Any], **kwargs: Any
22
+ ) -> HookResult:
23
+ return await cast("Hooks", self).dispatch(
24
+ "config.change.before", input, **kwargs
25
+ )
26
+
27
+ async def context_compact_after(
28
+ self, input: models.ContextCompactAfterInput | dict[str, Any], **kwargs: Any
29
+ ) -> HookResult:
30
+ return await cast("Hooks", self).dispatch(
31
+ "context.compact.after", input, **kwargs
32
+ )
33
+
34
+ async def context_compact_before(
35
+ self, input: models.ContextCompactBeforeInput | dict[str, Any], **kwargs: Any
36
+ ) -> HookResult:
37
+ return await cast("Hooks", self).dispatch(
38
+ "context.compact.before", input, **kwargs
39
+ )
40
+
41
+ async def file_changed(
42
+ self, input: models.FileChangedInput | dict[str, Any], **kwargs: Any
43
+ ) -> HookResult:
44
+ return await cast("Hooks", self).dispatch("file.changed", input, **kwargs)
45
+
46
+ async def hook_failure(
47
+ self, input: models.HookFailureInput | dict[str, Any], **kwargs: Any
48
+ ) -> HookResult:
49
+ return await cast("Hooks", self).dispatch("hook.failure", input, **kwargs)
50
+
51
+ async def model_error(
52
+ self, input: models.ModelErrorInput | dict[str, Any], **kwargs: Any
53
+ ) -> HookResult:
54
+ return await cast("Hooks", self).dispatch("model.error", input, **kwargs)
55
+
56
+ async def model_request_before(
57
+ self, input: models.ModelRequestBeforeInput | dict[str, Any], **kwargs: Any
58
+ ) -> HookResult:
59
+ return await cast("Hooks", self).dispatch(
60
+ "model.request.before", input, **kwargs
61
+ )
62
+
63
+ async def model_response_after(
64
+ self, input: models.ModelResponseAfterInput | dict[str, Any], **kwargs: Any
65
+ ) -> HookResult:
66
+ return await cast("Hooks", self).dispatch(
67
+ "model.response.after", input, **kwargs
68
+ )
69
+
70
+ async def model_switch_after(
71
+ self, input: models.ModelSwitchAfterInput | dict[str, Any], **kwargs: Any
72
+ ) -> HookResult:
73
+ return await cast("Hooks", self).dispatch("model.switch.after", input, **kwargs)
74
+
75
+ async def model_switch_before(
76
+ self, input: models.ModelSwitchBeforeInput | dict[str, Any], **kwargs: Any
77
+ ) -> HookResult:
78
+ return await cast("Hooks", self).dispatch(
79
+ "model.switch.before", input, **kwargs
80
+ )
81
+
82
+ async def session_end(
83
+ self, input: models.SessionEndInput | dict[str, Any], **kwargs: Any
84
+ ) -> HookResult:
85
+ return await cast("Hooks", self).dispatch("session.end", input, **kwargs)
86
+
87
+ async def session_start(
88
+ self, input: models.SessionStartInput | dict[str, Any], **kwargs: Any
89
+ ) -> HookResult:
90
+ return await cast("Hooks", self).dispatch("session.start", input, **kwargs)
91
+
92
+ async def task_change_after(
93
+ self, input: models.TaskChangeAfterInput | dict[str, Any], **kwargs: Any
94
+ ) -> HookResult:
95
+ return await cast("Hooks", self).dispatch("task.change.after", input, **kwargs)
96
+
97
+ async def task_change_before(
98
+ self, input: models.TaskChangeBeforeInput | dict[str, Any], **kwargs: Any
99
+ ) -> HookResult:
100
+ return await cast("Hooks", self).dispatch("task.change.before", input, **kwargs)
101
+
102
+ async def tool_after(
103
+ self, input: models.ToolAfterInput | dict[str, Any], **kwargs: Any
104
+ ) -> HookResult:
105
+ return await cast("Hooks", self).dispatch("tool.after", input, **kwargs)
106
+
107
+ async def tool_batch_after(
108
+ self, input: models.ToolBatchAfterInput | dict[str, Any], **kwargs: Any
109
+ ) -> HookResult:
110
+ return await cast("Hooks", self).dispatch("tool.batch.after", input, **kwargs)
111
+
112
+ async def tool_before(
113
+ self, input: models.ToolBeforeInput | dict[str, Any], **kwargs: Any
114
+ ) -> HookResult:
115
+ return await cast("Hooks", self).dispatch("tool.before", input, **kwargs)
116
+
117
+ async def tool_permission_request(
118
+ self, input: models.ToolPermissionRequestInput | dict[str, Any], **kwargs: Any
119
+ ) -> HookResult:
120
+ return await cast("Hooks", self).dispatch(
121
+ "tool.permission.request", input, **kwargs
122
+ )
123
+
124
+ async def tool_permission_resolved(
125
+ self, input: models.ToolPermissionResolvedInput | dict[str, Any], **kwargs: Any
126
+ ) -> HookResult:
127
+ return await cast("Hooks", self).dispatch(
128
+ "tool.permission.resolved", input, **kwargs
129
+ )
130
+
131
+ async def tool_progress(
132
+ self, input: models.ToolProgressInput | dict[str, Any], **kwargs: Any
133
+ ) -> HookResult:
134
+ return await cast("Hooks", self).dispatch("tool.progress", input, **kwargs)
135
+
136
+ async def turn_end(
137
+ self, input: models.TurnEndInput | dict[str, Any], **kwargs: Any
138
+ ) -> HookResult:
139
+ return await cast("Hooks", self).dispatch("turn.end", input, **kwargs)
140
+
141
+ async def turn_finish_before(
142
+ self, input: models.TurnFinishBeforeInput | dict[str, Any], **kwargs: Any
143
+ ) -> HookResult:
144
+ return await cast("Hooks", self).dispatch("turn.finish.before", input, **kwargs)
145
+
146
+ async def turn_progress(
147
+ self, input: models.TurnProgressInput | dict[str, Any], **kwargs: Any
148
+ ) -> HookResult:
149
+ return await cast("Hooks", self).dispatch("turn.progress", input, **kwargs)
150
+
151
+ async def turn_start(
152
+ self, input: models.TurnStartInput | dict[str, Any], **kwargs: Any
153
+ ) -> HookResult:
154
+ return await cast("Hooks", self).dispatch("turn.start", input, **kwargs)
155
+
156
+ async def user_attention(
157
+ self, input: models.UserAttentionInput | dict[str, Any], **kwargs: Any
158
+ ) -> HookResult:
159
+ return await cast("Hooks", self).dispatch("user.attention", input, **kwargs)
160
+
161
+ async def user_elicitation_request(
162
+ self, input: models.UserElicitationRequestInput | dict[str, Any], **kwargs: Any
163
+ ) -> HookResult:
164
+ return await cast("Hooks", self).dispatch(
165
+ "user.elicitation.request", input, **kwargs
166
+ )
167
+
168
+ async def user_elicitation_result(
169
+ self, input: models.UserElicitationResultInput | dict[str, Any], **kwargs: Any
170
+ ) -> HookResult:
171
+ return await cast("Hooks", self).dispatch(
172
+ "user.elicitation.result", input, **kwargs
173
+ )
174
+
175
+ async def user_message_inbound(
176
+ self, input: models.UserMessageInboundInput | dict[str, Any], **kwargs: Any
177
+ ) -> HookResult:
178
+ return await cast("Hooks", self).dispatch(
179
+ "user.message.inbound", input, **kwargs
180
+ )
181
+
182
+ async def user_message_outbound(
183
+ self, input: models.UserMessageOutboundInput | dict[str, Any], **kwargs: Any
184
+ ) -> HookResult:
185
+ return await cast("Hooks", self).dispatch(
186
+ "user.message.outbound", input, **kwargs
187
+ )
188
+
189
+ async def workspace_change_after(
190
+ self, input: models.WorkspaceChangeAfterInput | dict[str, Any], **kwargs: Any
191
+ ) -> HookResult:
192
+ return await cast("Hooks", self).dispatch(
193
+ "workspace.change.after", input, **kwargs
194
+ )
195
+
196
+ async def workspace_change_before(
197
+ self, input: models.WorkspaceChangeBeforeInput | dict[str, Any], **kwargs: Any
198
+ ) -> HookResult:
199
+ return await cast("Hooks", self).dispatch(
200
+ "workspace.change.before", input, **kwargs
201
+ )
202
+
203
+
204
+ CONTENT_SOURCE_SLOTS: dict[str, tuple[str, tuple[str, ...]]] = {
205
+ "config.change.after.items": (
206
+ "config.change.after",
207
+ (
208
+ "items",
209
+ "*",
210
+ ),
211
+ ),
212
+ "config.change.before.items": (
213
+ "config.change.before",
214
+ (
215
+ "items",
216
+ "*",
217
+ ),
218
+ ),
219
+ "context.compact.after.items": (
220
+ "context.compact.after",
221
+ (
222
+ "items",
223
+ "*",
224
+ ),
225
+ ),
226
+ "context.compact.after.summary": ("context.compact.after", ("summary",)),
227
+ "context.compact.before.instructions": (
228
+ "context.compact.before",
229
+ ("instructions",),
230
+ ),
231
+ "context.compact.before.items": (
232
+ "context.compact.before",
233
+ (
234
+ "items",
235
+ "*",
236
+ ),
237
+ ),
238
+ "file.changed.items": (
239
+ "file.changed",
240
+ (
241
+ "items",
242
+ "*",
243
+ ),
244
+ ),
245
+ "hook.failure.items": (
246
+ "hook.failure",
247
+ (
248
+ "items",
249
+ "*",
250
+ ),
251
+ ),
252
+ "model.error.items": (
253
+ "model.error",
254
+ (
255
+ "items",
256
+ "*",
257
+ ),
258
+ ),
259
+ "model.request.before.items": (
260
+ "model.request.before",
261
+ (
262
+ "items",
263
+ "*",
264
+ ),
265
+ ),
266
+ "model.response.after.items": (
267
+ "model.response.after",
268
+ (
269
+ "items",
270
+ "*",
271
+ ),
272
+ ),
273
+ "model.switch.after.items": (
274
+ "model.switch.after",
275
+ (
276
+ "items",
277
+ "*",
278
+ ),
279
+ ),
280
+ "model.switch.before.items": (
281
+ "model.switch.before",
282
+ (
283
+ "items",
284
+ "*",
285
+ ),
286
+ ),
287
+ "session.end.items": (
288
+ "session.end",
289
+ (
290
+ "items",
291
+ "*",
292
+ ),
293
+ ),
294
+ "session.start.items": (
295
+ "session.start",
296
+ (
297
+ "items",
298
+ "*",
299
+ ),
300
+ ),
301
+ "task.change.after.items": (
302
+ "task.change.after",
303
+ (
304
+ "items",
305
+ "*",
306
+ ),
307
+ ),
308
+ "task.change.before.items": (
309
+ "task.change.before",
310
+ (
311
+ "items",
312
+ "*",
313
+ ),
314
+ ),
315
+ "tool.after.file_changes_after": (
316
+ "tool.after",
317
+ (
318
+ "fileChanges",
319
+ "*",
320
+ "after",
321
+ ),
322
+ ),
323
+ "tool.after.file_changes_before": (
324
+ "tool.after",
325
+ (
326
+ "fileChanges",
327
+ "*",
328
+ "before",
329
+ ),
330
+ ),
331
+ "tool.after.items": (
332
+ "tool.after",
333
+ (
334
+ "items",
335
+ "*",
336
+ ),
337
+ ),
338
+ "tool.batch.after.items": (
339
+ "tool.batch.after",
340
+ (
341
+ "items",
342
+ "*",
343
+ ),
344
+ ),
345
+ "tool.before.items": (
346
+ "tool.before",
347
+ (
348
+ "items",
349
+ "*",
350
+ ),
351
+ ),
352
+ "tool.permission.request.items": (
353
+ "tool.permission.request",
354
+ (
355
+ "items",
356
+ "*",
357
+ ),
358
+ ),
359
+ "tool.permission.resolved.items": (
360
+ "tool.permission.resolved",
361
+ (
362
+ "items",
363
+ "*",
364
+ ),
365
+ ),
366
+ "tool.progress.items": (
367
+ "tool.progress",
368
+ (
369
+ "items",
370
+ "*",
371
+ ),
372
+ ),
373
+ "tool.progress.partial_output": ("tool.progress", ("partialOutput",)),
374
+ "turn.end.items": (
375
+ "turn.end",
376
+ (
377
+ "items",
378
+ "*",
379
+ ),
380
+ ),
381
+ "turn.finish.before.items": (
382
+ "turn.finish.before",
383
+ (
384
+ "items",
385
+ "*",
386
+ ),
387
+ ),
388
+ "turn.progress.delta": ("turn.progress", ("delta",)),
389
+ "turn.progress.items": (
390
+ "turn.progress",
391
+ (
392
+ "items",
393
+ "*",
394
+ ),
395
+ ),
396
+ "turn.start.items": (
397
+ "turn.start",
398
+ (
399
+ "items",
400
+ "*",
401
+ ),
402
+ ),
403
+ "user.attention.items": (
404
+ "user.attention",
405
+ (
406
+ "items",
407
+ "*",
408
+ ),
409
+ ),
410
+ "user.attention.attention_message": (
411
+ "user.attention",
412
+ (
413
+ "attention",
414
+ "message",
415
+ "*",
416
+ ),
417
+ ),
418
+ "user.attention.attention_title": (
419
+ "user.attention",
420
+ (
421
+ "attention",
422
+ "title",
423
+ "*",
424
+ ),
425
+ ),
426
+ "user.elicitation.request.items": (
427
+ "user.elicitation.request",
428
+ (
429
+ "items",
430
+ "*",
431
+ ),
432
+ ),
433
+ "user.elicitation.request.elicitation_request": (
434
+ "user.elicitation.request",
435
+ (
436
+ "elicitation",
437
+ "request",
438
+ ),
439
+ ),
440
+ "user.elicitation.result.items": (
441
+ "user.elicitation.result",
442
+ (
443
+ "items",
444
+ "*",
445
+ ),
446
+ ),
447
+ "user.elicitation.result.elicitation_result": (
448
+ "user.elicitation.result",
449
+ (
450
+ "elicitation",
451
+ "result",
452
+ ),
453
+ ),
454
+ "user.message.inbound.items": (
455
+ "user.message.inbound",
456
+ (
457
+ "items",
458
+ "*",
459
+ ),
460
+ ),
461
+ "user.message.inbound.message_text": (
462
+ "user.message.inbound",
463
+ (
464
+ "message",
465
+ "text",
466
+ "*",
467
+ ),
468
+ ),
469
+ "user.message.outbound.items": (
470
+ "user.message.outbound",
471
+ (
472
+ "items",
473
+ "*",
474
+ ),
475
+ ),
476
+ "user.message.outbound.message_payload": (
477
+ "user.message.outbound",
478
+ (
479
+ "message",
480
+ "payload",
481
+ "*",
482
+ ),
483
+ ),
484
+ "workspace.change.after.items": (
485
+ "workspace.change.after",
486
+ (
487
+ "items",
488
+ "*",
489
+ ),
490
+ ),
491
+ "workspace.change.before.items": (
492
+ "workspace.change.before",
493
+ (
494
+ "items",
495
+ "*",
496
+ ),
497
+ ),
498
+ }