kimi-agent-module-api 2.0.0__tar.gz → 2.1.0__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.
Files changed (22) hide show
  1. {kimi_agent_module_api-2.0.0/src/kimi_agent_module_api.egg-info → kimi_agent_module_api-2.1.0}/PKG-INFO +12 -8
  2. {kimi_agent_module_api-2.0.0 → kimi_agent_module_api-2.1.0}/README.md +11 -7
  3. {kimi_agent_module_api-2.0.0 → kimi_agent_module_api-2.1.0}/pyproject.toml +1 -1
  4. {kimi_agent_module_api-2.0.0 → kimi_agent_module_api-2.1.0}/src/kimi_agent_module_api/tools.py +3 -0
  5. {kimi_agent_module_api-2.0.0 → kimi_agent_module_api-2.1.0/src/kimi_agent_module_api.egg-info}/PKG-INFO +12 -8
  6. {kimi_agent_module_api-2.0.0 → kimi_agent_module_api-2.1.0}/tests/test_contracts.py +5 -0
  7. {kimi_agent_module_api-2.0.0 → kimi_agent_module_api-2.1.0}/LICENSE +0 -0
  8. {kimi_agent_module_api-2.0.0 → kimi_agent_module_api-2.1.0}/setup.cfg +0 -0
  9. {kimi_agent_module_api-2.0.0 → kimi_agent_module_api-2.1.0}/src/kimi_agent_module_api/__init__.py +0 -0
  10. {kimi_agent_module_api-2.0.0 → kimi_agent_module_api-2.1.0}/src/kimi_agent_module_api/contracts.py +0 -0
  11. {kimi_agent_module_api-2.0.0 → kimi_agent_module_api-2.1.0}/src/kimi_agent_module_api/events.py +0 -0
  12. {kimi_agent_module_api-2.0.0 → kimi_agent_module_api-2.1.0}/src/kimi_agent_module_api/images.py +0 -0
  13. {kimi_agent_module_api-2.0.0 → kimi_agent_module_api-2.1.0}/src/kimi_agent_module_api/py.typed +0 -0
  14. {kimi_agent_module_api-2.0.0 → kimi_agent_module_api-2.1.0}/src/kimi_agent_module_api/settings.py +0 -0
  15. {kimi_agent_module_api-2.0.0 → kimi_agent_module_api-2.1.0}/src/kimi_agent_module_api/testing.py +0 -0
  16. {kimi_agent_module_api-2.0.0 → kimi_agent_module_api-2.1.0}/src/kimi_agent_module_api/trust.py +0 -0
  17. {kimi_agent_module_api-2.0.0 → kimi_agent_module_api-2.1.0}/src/kimi_agent_module_api.egg-info/SOURCES.txt +0 -0
  18. {kimi_agent_module_api-2.0.0 → kimi_agent_module_api-2.1.0}/src/kimi_agent_module_api.egg-info/dependency_links.txt +0 -0
  19. {kimi_agent_module_api-2.0.0 → kimi_agent_module_api-2.1.0}/src/kimi_agent_module_api.egg-info/requires.txt +0 -0
  20. {kimi_agent_module_api-2.0.0 → kimi_agent_module_api-2.1.0}/src/kimi_agent_module_api.egg-info/top_level.txt +0 -0
  21. {kimi_agent_module_api-2.0.0 → kimi_agent_module_api-2.1.0}/tests/test_public_api.py +0 -0
  22. {kimi_agent_module_api-2.0.0 → kimi_agent_module_api-2.1.0}/tests/test_testing.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kimi-agent-module-api
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: Stable contracts for community-built assistant modules
5
5
  Author: Webhead
6
6
  License-Expression: MIT
@@ -69,23 +69,27 @@ documents installation, declarations, lifecycle, and every runtime port. The
69
69
  [reference module](https://github.com/webhead2oo9/kimi-agent/tree/main/bot/modules/example)
70
70
  is a complete, commented example that exercises most ports; start there.
71
71
 
72
- Guild-scoped live command replacement was added in 1.1. Modules using
72
+ Modules using guild-scoped live command replacement through
73
73
  `InteractionRouter.replace_guild_commands()` should require the host capability
74
74
  `discord.guild_commands.v1`.
75
75
 
76
- Version 1.2 adds typed modal forms and a narrow Components V2 layout model. Once a response uses
76
+ The SDK provides typed modal forms and a narrow Components V2 layout model. Once a response uses
77
77
  that layout model, Discord requires every later edit of the same message to remain a layout.
78
78
  Modules using them should require
79
79
  `discord.modals.v1` and/or `discord.components_v2.v1`.
80
80
 
81
- Version 1.3 adds cached author classification to message-deletion events:
81
+ Message-deletion events include cached author classification:
82
82
  `MessageDeleteEvent.author_is_bot` and `MessageBulkDeleteEvent.bot_message_ids`.
83
83
  The values remain unknown for messages that were absent from Discord's cache.
84
84
 
85
- Version 2 requires an explicit, source-pinned `ModuleSpec.api_version`, and
86
- removes the temporary guild-settings legacy flag and module table aliases.
87
- Modules must use namespaced guild documents and migrate legacy tables to the
88
- physical names returned by `ctx.storage.table()` before upgrading.
85
+ SDK 2.1 adds `ModuleToolContext.trigger_discord_message_id`. Mention-path tool
86
+ calls receive the exact source Discord message snowflake; other surfaces receive
87
+ `None`. Modules that act on a user's source message should require
88
+ `kimi-agent-module-api>=2.1,<3`, reject `None`, fetch that exact message through
89
+ `ctx.discord`, and verify its author before acting.
90
+
91
+ Modules use namespaced guild documents and the physical table names returned
92
+ by `ctx.storage.table()`.
89
93
 
90
94
  ## Testing the SDK
91
95
 
@@ -52,23 +52,27 @@ documents installation, declarations, lifecycle, and every runtime port. The
52
52
  [reference module](https://github.com/webhead2oo9/kimi-agent/tree/main/bot/modules/example)
53
53
  is a complete, commented example that exercises most ports; start there.
54
54
 
55
- Guild-scoped live command replacement was added in 1.1. Modules using
55
+ Modules using guild-scoped live command replacement through
56
56
  `InteractionRouter.replace_guild_commands()` should require the host capability
57
57
  `discord.guild_commands.v1`.
58
58
 
59
- Version 1.2 adds typed modal forms and a narrow Components V2 layout model. Once a response uses
59
+ The SDK provides typed modal forms and a narrow Components V2 layout model. Once a response uses
60
60
  that layout model, Discord requires every later edit of the same message to remain a layout.
61
61
  Modules using them should require
62
62
  `discord.modals.v1` and/or `discord.components_v2.v1`.
63
63
 
64
- Version 1.3 adds cached author classification to message-deletion events:
64
+ Message-deletion events include cached author classification:
65
65
  `MessageDeleteEvent.author_is_bot` and `MessageBulkDeleteEvent.bot_message_ids`.
66
66
  The values remain unknown for messages that were absent from Discord's cache.
67
67
 
68
- Version 2 requires an explicit, source-pinned `ModuleSpec.api_version`, and
69
- removes the temporary guild-settings legacy flag and module table aliases.
70
- Modules must use namespaced guild documents and migrate legacy tables to the
71
- physical names returned by `ctx.storage.table()` before upgrading.
68
+ SDK 2.1 adds `ModuleToolContext.trigger_discord_message_id`. Mention-path tool
69
+ calls receive the exact source Discord message snowflake; other surfaces receive
70
+ `None`. Modules that act on a user's source message should require
71
+ `kimi-agent-module-api>=2.1,<3`, reject `None`, fetch that exact message through
72
+ `ctx.discord`, and verify its author before acting.
73
+
74
+ Modules use namespaced guild documents and the physical table names returned
75
+ by `ctx.storage.table()`.
72
76
 
73
77
  ## Testing the SDK
74
78
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "kimi-agent-module-api"
3
- version = "2.0.0"
3
+ version = "2.1.0"
4
4
  description = "Stable contracts for community-built assistant modules"
5
5
  requires-python = ">=3.14"
6
6
  authors = [{ name = "Webhead" }]
@@ -29,6 +29,9 @@ class ModuleToolContext:
29
29
  trust_tier: TrustTier
30
30
  # Operator per-tool configuration from ``<CONFIG_DIR>/tools/<tool>.md``.
31
31
  tool_configs: Mapping[str, Mapping[str, Any]] = field(default_factory=dict)
32
+ # Discord message that initiated this model turn. It is absent for personal
33
+ # app commands and other surfaces that are not rooted in a Discord message.
34
+ trigger_discord_message_id: int | None = None
32
35
 
33
36
 
34
37
  type ModuleToolHandler = Callable[[dict[str, Any], ModuleToolContext], Coroutine[Any, Any, str]]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kimi-agent-module-api
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: Stable contracts for community-built assistant modules
5
5
  Author: Webhead
6
6
  License-Expression: MIT
@@ -69,23 +69,27 @@ documents installation, declarations, lifecycle, and every runtime port. The
69
69
  [reference module](https://github.com/webhead2oo9/kimi-agent/tree/main/bot/modules/example)
70
70
  is a complete, commented example that exercises most ports; start there.
71
71
 
72
- Guild-scoped live command replacement was added in 1.1. Modules using
72
+ Modules using guild-scoped live command replacement through
73
73
  `InteractionRouter.replace_guild_commands()` should require the host capability
74
74
  `discord.guild_commands.v1`.
75
75
 
76
- Version 1.2 adds typed modal forms and a narrow Components V2 layout model. Once a response uses
76
+ The SDK provides typed modal forms and a narrow Components V2 layout model. Once a response uses
77
77
  that layout model, Discord requires every later edit of the same message to remain a layout.
78
78
  Modules using them should require
79
79
  `discord.modals.v1` and/or `discord.components_v2.v1`.
80
80
 
81
- Version 1.3 adds cached author classification to message-deletion events:
81
+ Message-deletion events include cached author classification:
82
82
  `MessageDeleteEvent.author_is_bot` and `MessageBulkDeleteEvent.bot_message_ids`.
83
83
  The values remain unknown for messages that were absent from Discord's cache.
84
84
 
85
- Version 2 requires an explicit, source-pinned `ModuleSpec.api_version`, and
86
- removes the temporary guild-settings legacy flag and module table aliases.
87
- Modules must use namespaced guild documents and migrate legacy tables to the
88
- physical names returned by `ctx.storage.table()` before upgrading.
85
+ SDK 2.1 adds `ModuleToolContext.trigger_discord_message_id`. Mention-path tool
86
+ calls receive the exact source Discord message snowflake; other surfaces receive
87
+ `None`. Modules that act on a user's source message should require
88
+ `kimi-agent-module-api>=2.1,<3`, reject `None`, fetch that exact message through
89
+ `ctx.discord`, and verify its author before acting.
90
+
91
+ Modules use namespaced guild documents and the physical table names returned
92
+ by `ctx.storage.table()`.
89
93
 
90
94
  ## Testing the SDK
91
95
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ from importlib.metadata import version
5
6
  import dataclasses
6
7
  from typing import Any
7
8
 
@@ -82,6 +83,10 @@ def test_spec_and_runtime_context_keep_stable_defaults() -> None:
82
83
  assert {"events", "scheduler", "storage", "discord", "interactions", "services"} <= required
83
84
 
84
85
 
86
+ def test_distribution_version_includes_trigger_message_contract() -> None:
87
+ assert version("kimi-agent-module-api") == "2.1.0"
88
+
89
+
85
90
  def test_spec_requires_an_explicit_keyword_api_version() -> None:
86
91
  def create(_ctx: ModuleLoadContext) -> AppModule:
87
92
  raise AssertionError("not called")