qoder-agent-sdk 1.0.16__tar.gz → 1.0.17__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.
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/PKG-INFO +1 -1
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/pyproject.toml +1 -1
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/__init__.py +101 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/_cli_version.py +1 -1
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/_internal/client.py +59 -11
- qoder_agent_sdk-1.0.17/src/qoder_agent_sdk/_internal/daemon_connection.py +832 -0
- qoder_agent_sdk-1.0.17/src/qoder_agent_sdk/_internal/plugin_reports.py +116 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/_internal/query.py +403 -63
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/_internal/transport/__init__.py +4 -0
- qoder_agent_sdk-1.0.17/src/qoder_agent_sdk/_internal/transport/daemon_process.py +222 -0
- qoder_agent_sdk-1.0.17/src/qoder_agent_sdk/_internal/transport/daemon_session.py +392 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/_internal/transport/subprocess_cli.py +89 -85
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/_version.py +1 -1
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/client.py +85 -9
- qoder_agent_sdk-1.0.17/src/qoder_agent_sdk/daemon.py +963 -0
- qoder_agent_sdk-1.0.17/src/qoder_agent_sdk/daemon_types.py +348 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/plugins.py +44 -110
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/types.py +8 -1
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/.gitignore +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/LICENSE +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/README.md +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/_brand.py +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/_bundled/.gitignore +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/_errors.py +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/_internal/__init__.py +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/_internal/auth_helpers.py +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/_internal/cloud_agent.py +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/_internal/mcp_handler.py +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/_internal/mcp_serialize.py +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/_internal/memory.py +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/_internal/message_parser.py +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/_internal/sdk_mcp_transport.py +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/_internal/session_mutations.py +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/_internal/session_storage.py +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/_internal/sessions.py +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/_internal/skill_evolution.py +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/_tool_results.py +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/auth.py +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/memory.py +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/py.typed +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/query.py +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/session_import.py +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/session_store.py +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/settings.py +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/store_sessions.py +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/testing/__init__.py +0 -0
- {qoder_agent_sdk-1.0.16 → qoder_agent_sdk-1.0.17}/src/qoder_agent_sdk/testing/session_store_conformance.py +0 -0
|
@@ -79,6 +79,58 @@ from .auth import (
|
|
|
79
79
|
service_account_from_env,
|
|
80
80
|
)
|
|
81
81
|
from .client import QoderSDKClient
|
|
82
|
+
from .daemon import (
|
|
83
|
+
Daemon,
|
|
84
|
+
DaemonOptions,
|
|
85
|
+
init_daemon,
|
|
86
|
+
shutdown_daemon,
|
|
87
|
+
start_daemon,
|
|
88
|
+
)
|
|
89
|
+
from .daemon_types import (
|
|
90
|
+
DAEMON_HEARTBEAT_TIMEOUT_MS,
|
|
91
|
+
DAEMON_PROXY_CAPABILITY,
|
|
92
|
+
DAEMON_VALIDATE_PLUGINS_CAPABILITY,
|
|
93
|
+
AccountInfo,
|
|
94
|
+
ByokConfigCheckDetails,
|
|
95
|
+
ByokConfigCheckResult,
|
|
96
|
+
ByokConfigInfo,
|
|
97
|
+
ByokConfigReference,
|
|
98
|
+
ByokModelConfigInfo,
|
|
99
|
+
ByokModelConfigInput,
|
|
100
|
+
ByokModelConfigReference,
|
|
101
|
+
BYOKModelValidationInput,
|
|
102
|
+
ByokProtocol,
|
|
103
|
+
CheckByokConfigInput,
|
|
104
|
+
CreateByokConfigInput,
|
|
105
|
+
CustomByokProviderConfigInfo,
|
|
106
|
+
CustomByokProviderConfigInput,
|
|
107
|
+
CustomByokProviderConfigReference,
|
|
108
|
+
CustomByokProviderModelCapabilitiesInput,
|
|
109
|
+
CustomByokProviderModelConfigInfo,
|
|
110
|
+
CustomByokProviderModelInput,
|
|
111
|
+
CustomByokProviderReasoningEffortLevel,
|
|
112
|
+
CustomByokProviderThinkingCapabilitiesInput,
|
|
113
|
+
CustomByokProviderThinkingMode,
|
|
114
|
+
DaemonConfigurationConflictError,
|
|
115
|
+
DaemonDirectResult,
|
|
116
|
+
DaemonFallbackReason,
|
|
117
|
+
DaemonGetModelsParams,
|
|
118
|
+
DaemonHeartbeatTimeoutError,
|
|
119
|
+
DaemonInitResult,
|
|
120
|
+
DaemonProtocolError,
|
|
121
|
+
DaemonProtocolVersionMismatchError,
|
|
122
|
+
DaemonReadyResult,
|
|
123
|
+
DaemonRpcError,
|
|
124
|
+
DaemonSessionAlreadyOpenError,
|
|
125
|
+
DaemonSessionInfo,
|
|
126
|
+
DaemonState,
|
|
127
|
+
DaemonValidateByokModelParams,
|
|
128
|
+
DeleteByokConfigInput,
|
|
129
|
+
SessionRuntimeState,
|
|
130
|
+
UpdateByokConfigInput,
|
|
131
|
+
UpdateByokModelConfigInput,
|
|
132
|
+
UpdateCustomByokProviderConfigInput,
|
|
133
|
+
)
|
|
82
134
|
from .memory import (
|
|
83
135
|
EffectiveMemoryConfig,
|
|
84
136
|
EffectiveMemoryRoot,
|
|
@@ -909,6 +961,55 @@ __all__ = [
|
|
|
909
961
|
# Main exports
|
|
910
962
|
"query",
|
|
911
963
|
"__version__",
|
|
964
|
+
"Daemon",
|
|
965
|
+
"DaemonOptions",
|
|
966
|
+
"start_daemon",
|
|
967
|
+
"init_daemon",
|
|
968
|
+
"shutdown_daemon",
|
|
969
|
+
# daemon_types.__all__
|
|
970
|
+
"AccountInfo",
|
|
971
|
+
"DaemonState",
|
|
972
|
+
"SessionRuntimeState",
|
|
973
|
+
"DaemonFallbackReason",
|
|
974
|
+
"DaemonSessionInfo",
|
|
975
|
+
"DaemonReadyResult",
|
|
976
|
+
"DaemonDirectResult",
|
|
977
|
+
"DaemonInitResult",
|
|
978
|
+
"DaemonRpcError",
|
|
979
|
+
"DaemonProtocolError",
|
|
980
|
+
"DaemonProtocolVersionMismatchError",
|
|
981
|
+
"DaemonConfigurationConflictError",
|
|
982
|
+
"DaemonHeartbeatTimeoutError",
|
|
983
|
+
"DaemonSessionAlreadyOpenError",
|
|
984
|
+
"DAEMON_HEARTBEAT_TIMEOUT_MS",
|
|
985
|
+
"DAEMON_PROXY_CAPABILITY",
|
|
986
|
+
"DAEMON_VALIDATE_PLUGINS_CAPABILITY",
|
|
987
|
+
"DaemonGetModelsParams",
|
|
988
|
+
"BYOKModelValidationInput",
|
|
989
|
+
"DaemonValidateByokModelParams",
|
|
990
|
+
"ByokProtocol",
|
|
991
|
+
"ByokModelConfigInfo",
|
|
992
|
+
"CustomByokProviderConfigInfo",
|
|
993
|
+
"CustomByokProviderModelConfigInfo",
|
|
994
|
+
"CustomByokProviderThinkingMode",
|
|
995
|
+
"CustomByokProviderReasoningEffortLevel",
|
|
996
|
+
"ByokConfigInfo",
|
|
997
|
+
"ByokModelConfigInput",
|
|
998
|
+
"CustomByokProviderThinkingCapabilitiesInput",
|
|
999
|
+
"CustomByokProviderModelCapabilitiesInput",
|
|
1000
|
+
"CustomByokProviderModelInput",
|
|
1001
|
+
"CustomByokProviderConfigInput",
|
|
1002
|
+
"CreateByokConfigInput",
|
|
1003
|
+
"CheckByokConfigInput",
|
|
1004
|
+
"UpdateByokModelConfigInput",
|
|
1005
|
+
"UpdateCustomByokProviderConfigInput",
|
|
1006
|
+
"UpdateByokConfigInput",
|
|
1007
|
+
"ByokModelConfigReference",
|
|
1008
|
+
"CustomByokProviderConfigReference",
|
|
1009
|
+
"ByokConfigReference",
|
|
1010
|
+
"DeleteByokConfigInput",
|
|
1011
|
+
"ByokConfigCheckDetails",
|
|
1012
|
+
"ByokConfigCheckResult",
|
|
912
1013
|
# Auth helpers
|
|
913
1014
|
"DEFAULT_ACCESS_TOKEN_ENV_VAR",
|
|
914
1015
|
"DEFAULT_SERVICE_ACCOUNT_ENV_VAR",
|
|
@@ -27,6 +27,7 @@ from .skill_evolution import (
|
|
|
27
27
|
prepare_evolution_options,
|
|
28
28
|
)
|
|
29
29
|
from .transport import Transport
|
|
30
|
+
from .transport.daemon_session import validate_daemon_session_options
|
|
30
31
|
from .transport.subprocess_cli import SubprocessCLITransport
|
|
31
32
|
|
|
32
33
|
|
|
@@ -62,6 +63,14 @@ class InternalClient:
|
|
|
62
63
|
) -> AsyncIterator[Message]:
|
|
63
64
|
"""Process a query through transport and Query."""
|
|
64
65
|
|
|
66
|
+
if options.daemon is not None:
|
|
67
|
+
if transport is not None:
|
|
68
|
+
raise ValueError("daemon cannot be combined with a custom transport")
|
|
69
|
+
if options.experimental_cloud_agent is not None:
|
|
70
|
+
raise ValueError(
|
|
71
|
+
"daemon cannot be combined with experimental_cloud_agent"
|
|
72
|
+
)
|
|
73
|
+
|
|
65
74
|
# Validate and configure permission settings (matching TypeScript SDK logic)
|
|
66
75
|
configured_options = options
|
|
67
76
|
normalized_evolution, normalized_skill_evolution = prepare_evolution_options(
|
|
@@ -94,7 +103,9 @@ class InternalClient:
|
|
|
94
103
|
)
|
|
95
104
|
|
|
96
105
|
# Automatically set permission_prompt_tool_name to "stdio" for control protocol
|
|
97
|
-
configured_options = replace(
|
|
106
|
+
configured_options = replace(
|
|
107
|
+
configured_options, permission_prompt_tool_name="stdio"
|
|
108
|
+
)
|
|
98
109
|
|
|
99
110
|
on_auth_expired = once_callback(configured_options.on_auth_expired)
|
|
100
111
|
if on_auth_expired is not None:
|
|
@@ -102,6 +113,9 @@ class InternalClient:
|
|
|
102
113
|
configured_options, on_auth_expired=on_auth_expired
|
|
103
114
|
)
|
|
104
115
|
|
|
116
|
+
# Fail fast on invalid daemon session options before touching the Store.
|
|
117
|
+
if configured_options.daemon is not None:
|
|
118
|
+
validate_daemon_session_options(configured_options)
|
|
105
119
|
prepared_memory = prepare_memory_options(configured_options.memory)
|
|
106
120
|
requires_store_resume = configured_options.session_store is not None and (
|
|
107
121
|
configured_options.resume is not None
|
|
@@ -120,18 +134,43 @@ class InternalClient:
|
|
|
120
134
|
else None
|
|
121
135
|
)
|
|
122
136
|
if materialized_session is not None:
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
137
|
+
updates: dict[str, Any] = {
|
|
138
|
+
"resume": materialized_session.session_id,
|
|
139
|
+
"continue_conversation": False,
|
|
140
|
+
}
|
|
141
|
+
if configured_options.daemon is None:
|
|
142
|
+
# Daemon sessions carry the config dir per session in
|
|
143
|
+
# open_session; a shared process env cannot express it.
|
|
144
|
+
updates["env"] = {
|
|
128
145
|
**configured_options.env,
|
|
129
146
|
CONFIG_DIR_ENV: str(materialized_session.config_dir),
|
|
130
|
-
}
|
|
147
|
+
}
|
|
148
|
+
configured_options = replace(configured_options, **updates)
|
|
149
|
+
elif requires_store_resume and configured_options.continue_conversation:
|
|
150
|
+
# The Store resolved no restorable transcript: start fresh instead
|
|
151
|
+
# of consulting local continue history (explicit resume stays for
|
|
152
|
+
# the CLI's local-transcript fallback).
|
|
153
|
+
configured_options = replace(
|
|
154
|
+
configured_options, continue_conversation=False
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
daemon_transport = (
|
|
158
|
+
configured_options.daemon._create_transport(
|
|
159
|
+
configured_options,
|
|
160
|
+
config_dir=(
|
|
161
|
+
str(materialized_session.config_dir)
|
|
162
|
+
if materialized_session is not None
|
|
163
|
+
else None
|
|
164
|
+
),
|
|
131
165
|
)
|
|
166
|
+
if configured_options.daemon is not None
|
|
167
|
+
else None
|
|
168
|
+
)
|
|
132
169
|
|
|
133
|
-
# Use
|
|
134
|
-
if
|
|
170
|
+
# Use the selected daemon, custom, or legacy subprocess transport.
|
|
171
|
+
if daemon_transport is not None:
|
|
172
|
+
chosen_transport = daemon_transport
|
|
173
|
+
elif transport is not None:
|
|
135
174
|
chosen_transport = transport
|
|
136
175
|
else:
|
|
137
176
|
chosen_transport = SubprocessCLITransport(
|
|
@@ -201,6 +240,7 @@ class InternalClient:
|
|
|
201
240
|
session_store_flush=configured_options.session_store_flush,
|
|
202
241
|
default_custom_context=configured_options.custom_context,
|
|
203
242
|
skill_evolution=normalized_skill_evolution,
|
|
243
|
+
finite_input=True,
|
|
204
244
|
)
|
|
205
245
|
except BaseException:
|
|
206
246
|
await chosen_transport.close()
|
|
@@ -226,10 +266,18 @@ class InternalClient:
|
|
|
226
266
|
"parent_tool_use_id": None,
|
|
227
267
|
}
|
|
228
268
|
await query.write_user_message(user_message)
|
|
229
|
-
|
|
269
|
+
if configured_options.daemon is not None:
|
|
270
|
+
query.spawn_task(
|
|
271
|
+
query.wait_for_result_and_end_input(), input_task=True
|
|
272
|
+
)
|
|
273
|
+
else:
|
|
274
|
+
query.spawn_task(query.wait_for_result_and_end_input())
|
|
230
275
|
elif isinstance(prompt, AsyncIterable):
|
|
231
276
|
# Stream input in background for async iterables
|
|
232
|
-
|
|
277
|
+
if configured_options.daemon is not None:
|
|
278
|
+
query.spawn_task(query.stream_input(prompt), input_task=True)
|
|
279
|
+
else:
|
|
280
|
+
query.spawn_task(query.stream_input(prompt))
|
|
233
281
|
|
|
234
282
|
# Yield parsed messages, skipping unknown message types
|
|
235
283
|
async for data in query.receive_messages():
|