codemie-sdk-python 0.1.714__py3-none-any.whl → 0.1.716__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.
codemie_sdk/__init__.py CHANGED
@@ -213,6 +213,28 @@ from .models.provisioning import (
213
213
  ProvisioningBudgetResult,
214
214
  )
215
215
  from .services.provisioning import ProvisioningService
216
+ from .models.hosted_application import (
217
+ HostedApplication,
218
+ HostedApplicationCapabilities,
219
+ HostedApplicationCreator,
220
+ HostedApplicationDeletion,
221
+ HostedApplicationDeletionStatus,
222
+ HostedApplicationLaunch,
223
+ HostedApplicationList,
224
+ HostedApplicationSharableUsers,
225
+ HostedApplicationSharedWith,
226
+ HostedApplicationShareLink,
227
+ HostedApplicationShareLinkInfo,
228
+ HostedApplicationShareLinkTarget,
229
+ HostedApplicationUploadReceipt,
230
+ HostedApplicationUsage,
231
+ HostedApplicationValidationReport,
232
+ HostedApplicationVersion,
233
+ HostedApplicationVersionList,
234
+ HostedApplicationVersionQueued,
235
+ HostedApplicationVersionStart,
236
+ )
237
+ from .services.hosted_application import HostedApplicationService
216
238
 
217
239
  try:
218
240
  __version__ = _pkg_version("codemie-sdk-python")
@@ -381,4 +403,24 @@ __all__ = [
381
403
  "MarketplaceForcePublishResponse",
382
404
  "MarketplaceDecisionRequest",
383
405
  "MarketplaceManagementService",
406
+ "HostedApplication",
407
+ "HostedApplicationCapabilities",
408
+ "HostedApplicationCreator",
409
+ "HostedApplicationDeletion",
410
+ "HostedApplicationDeletionStatus",
411
+ "HostedApplicationLaunch",
412
+ "HostedApplicationList",
413
+ "HostedApplicationSharableUsers",
414
+ "HostedApplicationSharedWith",
415
+ "HostedApplicationShareLink",
416
+ "HostedApplicationShareLinkInfo",
417
+ "HostedApplicationShareLinkTarget",
418
+ "HostedApplicationUploadReceipt",
419
+ "HostedApplicationUsage",
420
+ "HostedApplicationValidationReport",
421
+ "HostedApplicationVersion",
422
+ "HostedApplicationVersionList",
423
+ "HostedApplicationVersionQueued",
424
+ "HostedApplicationVersionStart",
425
+ "HostedApplicationService",
384
426
  ]
@@ -37,6 +37,7 @@ from ..services.provisioning import ProvisioningService
37
37
  from ..services.usage_attribution import UsageAttributionService
38
38
  from ..services.marketplace_management import MarketplaceManagementService
39
39
  from ..services.export import ExportService
40
+ from ..services.hosted_application import HostedApplicationService
40
41
 
41
42
 
42
43
  class CodeMieClient:
@@ -205,6 +206,9 @@ class CodeMieClient:
205
206
  self.provisioning = ProvisioningService(
206
207
  self._api_domain, _token_source, verify_ssl=self._verify_ssl
207
208
  )
209
+ self.hosted_applications = HostedApplicationService(
210
+ self._api_domain, _token_source, verify_ssl=self._verify_ssl
211
+ )
208
212
 
209
213
  @property
210
214
  def token(self) -> str:
@@ -157,6 +157,23 @@ class MCPServerDetails(BaseModel):
157
157
  tools: list[str] | None = None
158
158
 
159
159
 
160
+ class SubAssistantPublishSettings(BaseModel):
161
+ """Settings for one sub-assistant when the parent is published to the marketplace.
162
+
163
+ Mirrors the backend's ``SubAssistantPublishSettings``
164
+ (``codemie/src/codemie/rest_api/models/assistant.py``); sent as
165
+ ``sub_assistants_settings`` on ``AssistantService.publish``.
166
+ """
167
+
168
+ model_config = ConfigDict(extra="ignore")
169
+
170
+ assistant_id: str
171
+ is_global: bool = True
172
+ toolkits: list[ToolKitDetails] | None = None
173
+ mcp_servers: list[MCPServerDetails] | None = None
174
+ categories: list[str] | None = Field(default_factory=list)
175
+
176
+
160
177
  class SystemPromptHistory(BaseModel):
161
178
  """Model for system prompt history."""
162
179
 
@@ -0,0 +1,285 @@
1
+ # Copyright 2026 EPAM Systems, Inc. ("EPAM")
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """Hosted application models for the CodeMie SDK.
16
+
17
+ Shapes of the management API under ``/v1/hosted-applications``: applications, their
18
+ versions and uploads, sharing and the launch ticket of a viewing session.
19
+ """
20
+
21
+ from typing import Any
22
+
23
+ from pydantic import BaseModel, ConfigDict, Field
24
+
25
+
26
+ class HostedApplicationCapabilities(BaseModel):
27
+ """What the caller may do with hosted applications on this stand."""
28
+
29
+ model_config = ConfigDict(extra="ignore")
30
+
31
+ create: bool = Field(description="The caller may create applications")
32
+ view: bool = Field(description="The caller may open applications")
33
+ disabled_reason: str | None = Field(
34
+ default=None, description="Why the feature is unavailable, when it is"
35
+ )
36
+ launch_policy: dict[str, Any] | None = None
37
+ limits: dict[str, Any] = Field(default_factory=dict)
38
+
39
+
40
+ class HostedApplicationUsage(BaseModel):
41
+ """Storage quota of the caller, in bytes."""
42
+
43
+ model_config = ConfigDict(extra="ignore")
44
+
45
+ byte_limit: int
46
+ available_bytes: int
47
+ stored_bytes: int
48
+ reserved_bytes: int
49
+
50
+
51
+ class HostedApplicationCreator(BaseModel):
52
+ """The user who created an application."""
53
+
54
+ model_config = ConfigDict(extra="ignore")
55
+
56
+ id: str | None = None
57
+ username: str | None = None
58
+ name: str | None = None
59
+
60
+
61
+ class HostedApplication(BaseModel):
62
+ """An application as the caller sees it.
63
+
64
+ The fields after ``has_cover`` are present for managers only.
65
+ """
66
+
67
+ model_config = ConfigDict(extra="ignore")
68
+
69
+ id: str
70
+ name: str
71
+ description: str | None = None
72
+ artifact_kind: str | None = None
73
+ updated_at: str | None = None
74
+ publisher: dict[str, Any] | None = None
75
+ project: str | None = None
76
+ shared: bool = False
77
+ is_global: bool = False
78
+ created_by: HostedApplicationCreator | None = None
79
+ user_abilities: list[str] = Field(default_factory=list)
80
+ can_share: bool = False
81
+ can_moderate: bool = False
82
+ suspended: bool = False
83
+ suspension_refuses: Any = None
84
+ has_active_version: bool = False
85
+ has_cover: bool = False
86
+ selected_version_id: str | None = None
87
+ active_version_id: str | None = None
88
+ lifecycle_state: str | None = None
89
+ revision: int | None = None
90
+ etag: str | None = Field(
91
+ default=None, description="Value to send as If-Match on the next change"
92
+ )
93
+ created_at: str | None = None
94
+
95
+
96
+ class HostedApplicationList(BaseModel):
97
+ """One page of applications."""
98
+
99
+ model_config = ConfigDict(extra="ignore")
100
+
101
+ items: list[HostedApplication] = Field(default_factory=list)
102
+ next_cursor: str | None = None
103
+
104
+
105
+ class HostedApplicationVersionStart(BaseModel):
106
+ """A new version whose artifact is yet to be uploaded."""
107
+
108
+ model_config = ConfigDict(extra="ignore")
109
+
110
+ version_id: str
111
+ sequence: int
112
+ upload_id: str
113
+ generation: int
114
+ expires_at: str | None = None
115
+ upload_path: str | None = None
116
+ upload_etag: str
117
+ version_etag: str
118
+ app_etag: str
119
+ limits: dict[str, Any] = Field(default_factory=dict)
120
+
121
+
122
+ class HostedApplicationUploadReceipt(BaseModel):
123
+ """Receipt of a stored artifact."""
124
+
125
+ model_config = ConfigDict(extra="ignore")
126
+
127
+ upload_id: str
128
+ generation: int
129
+ state: str
130
+ received_bytes: int
131
+ sha256: str
132
+ upload_etag: str
133
+ version_etag: str
134
+
135
+
136
+ class HostedApplicationVersionQueued(BaseModel):
137
+ """Answer to completing an upload, configuring or retrying a version: validation is queued."""
138
+
139
+ model_config = ConfigDict(extra="ignore")
140
+
141
+ job_id: str | None = None
142
+ state: str
143
+ version_etag: str | None = None
144
+ upload_etag: str | None = None
145
+
146
+
147
+ class HostedApplicationVersion(BaseModel):
148
+ """A version of an application with its validation state."""
149
+
150
+ model_config = ConfigDict(extra="ignore")
151
+
152
+ id: str
153
+ sequence: int
154
+ filename: str | None = None
155
+ artifact_kind: str | None = None
156
+ expected_bytes: int | None = None
157
+ validation_state: str = Field(
158
+ description=(
159
+ "uploading, queued, validating, awaiting_configuration, accepted, "
160
+ "failed, rejected or canceled"
161
+ )
162
+ )
163
+ security_state: str | None = None
164
+ can_preview: bool = False
165
+ can_activate: bool = False
166
+ revision: int | None = None
167
+ etag: str | None = None
168
+ configuration_revision: int | None = None
169
+ requested_configuration: dict[str, Any] = Field(default_factory=dict)
170
+ candidate_manifest_digest: str | None = None
171
+ upload: dict[str, Any] | None = None
172
+ created_at: str | None = None
173
+ job: dict[str, Any] | None = None
174
+ accepted: dict[str, Any] | None = None
175
+
176
+
177
+ class HostedApplicationVersionList(BaseModel):
178
+ """One page of versions, newest first."""
179
+
180
+ model_config = ConfigDict(extra="ignore")
181
+
182
+ items: list[HostedApplicationVersion] = Field(default_factory=list)
183
+ next_cursor: str | None = None
184
+
185
+
186
+ class HostedApplicationValidationReport(BaseModel):
187
+ """Validation report of a version: detected options, findings and the rejection code."""
188
+
189
+ model_config = ConfigDict(extra="ignore")
190
+
191
+ state: str
192
+ job_id: str | None = None
193
+ phase: str | None = None
194
+ candidate_manifest_digest: str | None = None
195
+ roots: list[str] = Field(default_factory=list)
196
+ entries: list[str] = Field(default_factory=list)
197
+ warnings: list[Any] = Field(default_factory=list)
198
+ errors: list[dict[str, Any]] = Field(default_factory=list)
199
+ configuration_revision: int | None = None
200
+ file_count: int = 0
201
+ expanded_bytes: int = 0
202
+ next_offset: int | None = None
203
+ error_code: str | None = None
204
+ scanner: Any = None
205
+ policy_version: str | None = None
206
+ etag: str | None = None
207
+
208
+
209
+ class HostedApplicationLaunch(BaseModel):
210
+ """Launch ticket: the form a browser posts to the content origin to open a version."""
211
+
212
+ model_config = ConfigDict(extra="ignore")
213
+
214
+ method: str
215
+ version_id: str
216
+ policy_version: str | None = None
217
+ content_origin: str
218
+ action: str
219
+ ticket: str = Field(repr=False)
220
+ issued_at: str | None = None
221
+ expires_at: str | None = None
222
+
223
+
224
+ class HostedApplicationSharedWith(BaseModel):
225
+ """People an application is shared with by name."""
226
+
227
+ model_config = ConfigDict(extra="ignore")
228
+
229
+ shared_with: list[dict[str, Any]] = Field(default_factory=list)
230
+
231
+
232
+ class HostedApplicationSharableUsers(BaseModel):
233
+ """Directory users that can be granted access."""
234
+
235
+ model_config = ConfigDict(extra="ignore")
236
+
237
+ users: list[dict[str, Any]] = Field(default_factory=list)
238
+
239
+
240
+ class HostedApplicationShareLinkInfo(BaseModel):
241
+ """A share link of an application."""
242
+
243
+ model_config = ConfigDict(extra="ignore")
244
+
245
+ id: str
246
+ token: str = Field(repr=False)
247
+ created_at: str | None = None
248
+
249
+
250
+ class HostedApplicationShareLink(BaseModel):
251
+ """The live share link of an application, or none."""
252
+
253
+ model_config = ConfigDict(extra="ignore")
254
+
255
+ link: HostedApplicationShareLinkInfo | None = None
256
+
257
+
258
+ class HostedApplicationShareLinkTarget(BaseModel):
259
+ """Answer to opening a share link: the application it leads to."""
260
+
261
+ model_config = ConfigDict(extra="ignore")
262
+
263
+ app_id: str
264
+
265
+
266
+ class HostedApplicationDeletion(BaseModel):
267
+ """Answer to deleting an application: the purge is queued."""
268
+
269
+ model_config = ConfigDict(extra="ignore")
270
+
271
+ state: str
272
+ job_id: str | None = None
273
+ application: dict[str, Any] | None = None
274
+
275
+
276
+ class HostedApplicationDeletionStatus(BaseModel):
277
+ """Progress of the purge of a deleted application."""
278
+
279
+ model_config = ConfigDict(extra="ignore")
280
+
281
+ state: str = Field(description="purging or purged")
282
+ app_id: str
283
+ remaining_prefixes: int = 0
284
+ charged_bytes: int = 0
285
+ etag: str | None = None
@@ -71,6 +71,69 @@ class Workflow(BaseModel):
71
71
  required_variables: list[str] = Field(default_factory=list)
72
72
 
73
73
 
74
+ class WorkflowRevision(BaseModel):
75
+ """A saved revision of a workflow's YAML configuration."""
76
+
77
+ model_config = ConfigDict(extra="ignore")
78
+
79
+ revision_index: int = Field(
80
+ ..., description="Absolute 0-based position in the full history, newest first"
81
+ )
82
+ yaml_config: str
83
+ date: datetime
84
+ created_by: User | None = None
85
+ change_notes: str | None = None
86
+
87
+
88
+ class WorkflowVersionHistoryResponse(BaseModel):
89
+ """One page of a workflow's revision history."""
90
+
91
+ model_config = ConfigDict(extra="ignore")
92
+
93
+ revisions: list[WorkflowRevision] = Field(default_factory=list)
94
+ total_revisions: int
95
+ workflow_name: str
96
+ workflow_id: str
97
+
98
+
99
+ class WorkflowRollbackRequest(BaseModel):
100
+ """Request model for rolling a workflow back to an earlier revision."""
101
+
102
+ revision_index: int = Field(..., ge=0)
103
+ change_notes: str | None = Field(default=None, max_length=1000)
104
+
105
+
106
+ class DisabledMcpServerInfo(BaseModel):
107
+ """One mcp_servers link a rollback disabled because its catalog entry is
108
+ unavailable. The backend reports these fields in snake_case already."""
109
+
110
+ model_config = ConfigDict(populate_by_name=True)
111
+
112
+ name: str
113
+ mcp_config_id: str | None = None
114
+ reason: str | None = None
115
+ address: str | None = None
116
+
117
+
118
+ class WorkflowRollbackResponse(BaseModel):
119
+ """Response for a workflow rollback.
120
+
121
+ The backend wraps this in a model with ``alias_generator=to_camel``, so the
122
+ raw JSON carries ``disabledMcpServers`` even though the nested
123
+ ``DisabledMcpServerInfo`` fields stay snake_case. ``populate_by_name`` plus the
124
+ alias below let ``model_validate`` read the camelCase wire field while
125
+ ``model_dump()`` (no ``by_alias``) still writes it back out as
126
+ ``disabled_mcp_servers``, consistent with the rest of the SDK's conventions.
127
+ """
128
+
129
+ model_config = ConfigDict(populate_by_name=True)
130
+
131
+ message: str
132
+ disabled_mcp_servers: list[DisabledMcpServerInfo] = Field(
133
+ default_factory=list, alias="disabledMcpServers"
134
+ )
135
+
136
+
74
137
  class ExecutionStatus(str, Enum):
75
138
  IN_PROGRESS = "In Progress"
76
139
  NOT_STARTED = "Not Started"
@@ -32,10 +32,12 @@ from ..models.assistant import (
32
32
  AssistantProjectFeature,
33
33
  AssistantProjectMappingListResponse,
34
34
  AssistantProjectMappingRequest,
35
+ SubAssistantPublishSettings,
35
36
  )
36
37
  from ..models.common import PaginationParams
37
38
  from ..models.conversation import BaseResponse
38
39
  from ..utils import ApiRequestHandler, TokenSource
40
+ from ..utils.payload import without_none
39
41
 
40
42
 
41
43
  class AssistantService:
@@ -562,6 +564,7 @@ class AssistantService:
562
564
  ignore_recommendations: bool = False,
563
565
  force_publish: bool = False,
564
566
  override_notice: str | None = None,
567
+ sub_assistants_settings: list[SubAssistantPublishSettings] | None = None,
565
568
  ) -> dict:
566
569
  """Publish an assistant to the marketplace.
567
570
  Args:
@@ -571,6 +574,9 @@ class AssistantService:
571
574
  force_publish: Admins and maintainers only: publish over CRITICAL gate findings.
572
575
  Requires override_notice.
573
576
  override_notice: Justification for force_publish, 20 to 2000 characters
577
+ sub_assistants_settings: Per-sub-assistant settings (marketplace visibility,
578
+ toolkits, mcp_servers, categories) applied when this assistant has
579
+ sub-assistants
574
580
  """
575
581
  body = {}
576
582
  if categories:
@@ -581,6 +587,11 @@ class AssistantService:
581
587
  body["force_publish"] = force_publish
582
588
  if override_notice is not None:
583
589
  body["override_notice"] = override_notice
590
+ if sub_assistants_settings is not None:
591
+ body["sub_assistants_settings"] = [
592
+ settings.model_dump(exclude_none=True)
593
+ for settings in sub_assistants_settings
594
+ ]
584
595
 
585
596
  return self._api.post(
586
597
  f"/v1/assistants/{assistant_id}/marketplace/publish",
@@ -606,6 +617,121 @@ class AssistantService:
606
617
  f"/v1/assistants/{assistant_id}/marketplace/publish/validate", dict
607
618
  )
608
619
 
620
+ def generate(
621
+ self,
622
+ text: str,
623
+ include_tools: bool = True,
624
+ llm_model: str | None = None,
625
+ ) -> dict:
626
+ """Generate assistant details (name, description, system prompt, ...) from a text with AI.
627
+
628
+ Nothing is created: the result is a draft to review.
629
+
630
+ Args:
631
+ text: Description of the desired assistant
632
+ include_tools: Whether to suggest toolkits
633
+ llm_model: LLM model to use; platform default when omitted
634
+
635
+ Returns:
636
+ Dict with the generated assistant details
637
+ """
638
+ return self._api.post(
639
+ "/v1/assistants/generate",
640
+ dict,
641
+ json_data=without_none(
642
+ {"text": text, "include_tools": include_tools, "llm_model": llm_model}
643
+ ),
644
+ wrap_response=False,
645
+ )
646
+
647
+ def generate_prompt(
648
+ self,
649
+ text: str | None = None,
650
+ system_prompt: str | None = None,
651
+ llm_model: str | None = None,
652
+ ) -> dict:
653
+ """Generate or improve an assistant system prompt with AI.
654
+
655
+ Args:
656
+ text: Description of what the assistant should do
657
+ system_prompt: Existing system prompt to improve
658
+ llm_model: LLM model to use; platform default when omitted
659
+
660
+ Returns:
661
+ Dict with the generated `system_prompt`
662
+ """
663
+ return self._api.post(
664
+ "/v1/assistants/prompt/generate",
665
+ dict,
666
+ json_data=without_none(
667
+ {
668
+ "text": text,
669
+ "system_prompt": system_prompt,
670
+ "llm_model": llm_model,
671
+ }
672
+ ),
673
+ wrap_response=False,
674
+ )
675
+
676
+ def refine(
677
+ self,
678
+ name: str | None = None,
679
+ description: str | None = None,
680
+ conversation_starters: list[str] | None = None,
681
+ system_prompt: str | None = None,
682
+ toolkits: list[dict] | None = None,
683
+ context: list[dict] | None = None,
684
+ categories: list[str] | None = None,
685
+ refine_prompt: str | None = None,
686
+ llm_model: str | None = None,
687
+ include_tools: bool = True,
688
+ include_context: bool = True,
689
+ include_categories: bool = True,
690
+ project: str | None = None,
691
+ ) -> dict:
692
+ """Ask AI for recommendations to improve an assistant draft.
693
+
694
+ Args:
695
+ name: Draft assistant name
696
+ description: Draft assistant description
697
+ conversation_starters: Draft conversation starters
698
+ system_prompt: Draft system prompt
699
+ toolkits: Selected toolkits
700
+ context: Selected contexts, each with `name` and `context_type`
701
+ categories: Selected categories
702
+ refine_prompt: Custom refinement instructions
703
+ llm_model: LLM model to use; platform default when omitted
704
+ include_tools: Whether to assess toolkits
705
+ include_context: Whether to assess contexts
706
+ include_categories: Whether to assess categories
707
+ project: Project the draft belongs to
708
+
709
+ Returns:
710
+ Dict with the recommendations
711
+ """
712
+ return self._api.post(
713
+ "/v1/assistants/refine",
714
+ dict,
715
+ json_data=without_none(
716
+ {
717
+ "name": name,
718
+ "description": description,
719
+ "conversation_starters": conversation_starters,
720
+ "system_prompt": system_prompt,
721
+ "toolkits": toolkits,
722
+ "context": context,
723
+ "categories": categories,
724
+ "refine_prompt": refine_prompt,
725
+ "llm_model": llm_model,
726
+ "include_tools": include_tools,
727
+ "include_context": include_context,
728
+ "include_categories": include_categories,
729
+ "project": project,
730
+ }
731
+ ),
732
+ wrap_response=False,
733
+ )
734
+
609
735
  def resume_tool_call(
610
736
  self,
611
737
  assistant_id: str,