nosis-agent 0.1.1__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 (194) hide show
  1. agent_core/__init__.py +411 -0
  2. agent_core/_posix_files.py +84 -0
  3. agent_core/_windows_files.py +241 -0
  4. agent_core/agent.py +566 -0
  5. agent_core/approval.py +77 -0
  6. agent_core/atomic.py +25 -0
  7. agent_core/auxiliary.py +45 -0
  8. agent_core/config.py +371 -0
  9. agent_core/content.py +79 -0
  10. agent_core/context_manager.py +515 -0
  11. agent_core/errors.py +52 -0
  12. agent_core/execution/__init__.py +62 -0
  13. agent_core/execution/authority.py +94 -0
  14. agent_core/execution/executor.py +117 -0
  15. agent_core/execution/process.py +437 -0
  16. agent_core/execution/router.py +102 -0
  17. agent_core/execution/sandbox/__init__.py +38 -0
  18. agent_core/execution/sandbox/base.py +117 -0
  19. agent_core/execution/sandbox/linux.py +101 -0
  20. agent_core/execution/sandbox/macos.py +112 -0
  21. agent_core/execution/sandbox/windows.py +121 -0
  22. agent_core/file_lock.py +43 -0
  23. agent_core/files.py +147 -0
  24. agent_core/hooks.py +262 -0
  25. agent_core/image_generation.py +28 -0
  26. agent_core/jobs.py +451 -0
  27. agent_core/llm.py +121 -0
  28. agent_core/loop_policy.py +107 -0
  29. agent_core/mcp/__init__.py +22 -0
  30. agent_core/mcp/config.py +403 -0
  31. agent_core/mcp/connection.py +96 -0
  32. agent_core/mcp/manager.py +413 -0
  33. agent_core/mcp/tool.py +128 -0
  34. agent_core/media.py +337 -0
  35. agent_core/memory.py +407 -0
  36. agent_core/path_utils.py +25 -0
  37. agent_core/permissions.py +99 -0
  38. agent_core/plan.py +158 -0
  39. agent_core/projection.py +80 -0
  40. agent_core/prompting.py +97 -0
  41. agent_core/providers/__init__.py +37 -0
  42. agent_core/providers/_utils.py +8 -0
  43. agent_core/providers/base.py +573 -0
  44. agent_core/providers/data/tokenizers/LICENSE.tiktoken +21 -0
  45. agent_core/providers/data/tokenizers/README.md +18 -0
  46. agent_core/providers/data/tokenizers/cl100k_base.tiktoken.gz +0 -0
  47. agent_core/providers/data/tokenizers/encodings.json +21 -0
  48. agent_core/providers/data/tokenizers/o200k_base.tiktoken.gz +0 -0
  49. agent_core/providers/deepseek_models.py +17 -0
  50. agent_core/providers/http.py +29 -0
  51. agent_core/providers/image_generation.py +145 -0
  52. agent_core/providers/image_limits.py +31 -0
  53. agent_core/providers/litellm_provider.py +166 -0
  54. agent_core/providers/openai_models.py +45 -0
  55. agent_core/providers/openai_provider.py +371 -0
  56. agent_core/providers/openai_tokens.py +58 -0
  57. agent_core/providers/reasoning.py +139 -0
  58. agent_core/providers/tool_call_stream.py +239 -0
  59. agent_core/public_url.py +106 -0
  60. agent_core/scheduler.py +619 -0
  61. agent_core/session.py +772 -0
  62. agent_core/session_paths.py +50 -0
  63. agent_core/session_store.py +762 -0
  64. agent_core/session_title.py +67 -0
  65. agent_core/skills.py +226 -0
  66. agent_core/subagent.py +326 -0
  67. agent_core/time_utils.py +13 -0
  68. agent_core/tool_batch.py +304 -0
  69. agent_core/tool_result.py +185 -0
  70. agent_core/tools/__init__.py +94 -0
  71. agent_core/tools/base.py +227 -0
  72. agent_core/tools/budget.py +41 -0
  73. agent_core/tools/builtin/__init__.py +86 -0
  74. agent_core/tools/builtin/_desktop.py +66 -0
  75. agent_core/tools/builtin/analyze_image.py +79 -0
  76. agent_core/tools/builtin/apply_patch.py +440 -0
  77. agent_core/tools/builtin/ask_user.py +148 -0
  78. agent_core/tools/builtin/computer_action.py +169 -0
  79. agent_core/tools/builtin/computer_screenshot.py +64 -0
  80. agent_core/tools/builtin/edit_file.py +78 -0
  81. agent_core/tools/builtin/generate_image.py +203 -0
  82. agent_core/tools/builtin/job_control.py +59 -0
  83. agent_core/tools/builtin/list_directory.py +237 -0
  84. agent_core/tools/builtin/present_file.py +63 -0
  85. agent_core/tools/builtin/read_file.py +95 -0
  86. agent_core/tools/builtin/read_image.py +127 -0
  87. agent_core/tools/builtin/read_skill.py +125 -0
  88. agent_core/tools/builtin/remember.py +72 -0
  89. agent_core/tools/builtin/schedule.py +306 -0
  90. agent_core/tools/builtin/search_files.py +551 -0
  91. agent_core/tools/builtin/shell.py +407 -0
  92. agent_core/tools/builtin/subagent.py +101 -0
  93. agent_core/tools/builtin/update_plan.py +124 -0
  94. agent_core/tools/builtin/web_fetch.py +261 -0
  95. agent_core/tools/builtin/web_search.py +286 -0
  96. agent_core/tools/builtin/write_file.py +74 -0
  97. agent_core/tools/catalog.py +189 -0
  98. agent_core/tools/config.py +109 -0
  99. agent_core/tools/context.py +107 -0
  100. agent_core/tools/globs.py +43 -0
  101. agent_core/tools/paths.py +89 -0
  102. agent_core/tools/policy.py +92 -0
  103. agent_core/tools/text.py +241 -0
  104. agent_core/turn_control.py +114 -0
  105. agent_core/usage.py +59 -0
  106. agent_core/windows_sandbox.py +1371 -0
  107. agent_core/workspace.py +33 -0
  108. agent_core/workspace_instructions.py +19 -0
  109. agent_runtime/__init__.py +20 -0
  110. agent_runtime/attachments.py +98 -0
  111. agent_runtime/callbacks.py +19 -0
  112. agent_runtime/config.py +627 -0
  113. agent_runtime/defaults/__init__.py +0 -0
  114. agent_runtime/defaults/agent_config.json +73 -0
  115. agent_runtime/defaults/im_channels.json +12 -0
  116. agent_runtime/defaults/plugins/playwright/.mcp.json +8 -0
  117. agent_runtime/defaults/plugins/playwright/plugin.json +9 -0
  118. agent_runtime/defaults/prompts_template/Consolidator.md +60 -0
  119. agent_runtime/defaults/prompts_template/GlobalMemory.md +15 -0
  120. agent_runtime/defaults/prompts_template/SessionTitle.md +8 -0
  121. agent_runtime/defaults/prompts_template/Soul.md +21 -0
  122. agent_runtime/defaults/prompts_template/SubAgent.md +11 -0
  123. agent_runtime/defaults/prompts_template/WorkspaceMemory.md +16 -0
  124. agent_runtime/defaults/provider_config.json +50 -0
  125. agent_runtime/defaults/skills/plugin-creator/SKILL.md +64 -0
  126. agent_runtime/defaults/skills/plugin-creator/references/hooks.md +68 -0
  127. agent_runtime/defaults/skills/plugin-creator/references/installing-and-updating.md +62 -0
  128. agent_runtime/defaults/skills/plugin-creator/references/plugin-json-spec.md +148 -0
  129. agent_runtime/defaults/skills/plugin-creator/scripts/create_basic_plugin.py +166 -0
  130. agent_runtime/defaults/skills/plugin-creator/scripts/plugin_names.py +28 -0
  131. agent_runtime/defaults/skills/plugin-creator/scripts/validate_plugin.py +516 -0
  132. agent_runtime/defaults/skills/skill-creator/SKILL.md +205 -0
  133. agent_runtime/defaults/skills/skill-creator/license.txt +202 -0
  134. agent_runtime/defaults/skills/skill-creator/scripts/init_skill.py +291 -0
  135. agent_runtime/defaults/skills/skill-creator/scripts/quick_validate.py +127 -0
  136. agent_runtime/defaults/tool_config.json +21 -0
  137. agent_runtime/desktop/__init__.py +5 -0
  138. agent_runtime/desktop/computer.py +641 -0
  139. agent_runtime/desktop/pyautogui_input.py +124 -0
  140. agent_runtime/desktop/windows.py +363 -0
  141. agent_runtime/execution_plane.py +110 -0
  142. agent_runtime/host.py +153 -0
  143. agent_runtime/instructions.py +51 -0
  144. agent_runtime/plane_manager.py +588 -0
  145. agent_runtime/plugins.py +469 -0
  146. agent_runtime/role_tools.py +58 -0
  147. agent_runtime/scheduled_runner.py +52 -0
  148. agent_runtime/services.py +46 -0
  149. agent_runtime/session_controller.py +138 -0
  150. agent_runtime/session_title.py +63 -0
  151. agent_runtime/settings.py +676 -0
  152. agent_runtime/turn_runner.py +126 -0
  153. interfaces/__init__.py +0 -0
  154. interfaces/application_host.py +140 -0
  155. interfaces/bridge/__init__.py +0 -0
  156. interfaces/bridge/__main__.py +75 -0
  157. interfaces/bridge/bridge.py +616 -0
  158. interfaces/bridge/event_stream.py +35 -0
  159. interfaces/bridge/managed_workspaces.py +51 -0
  160. interfaces/bridge/protocol.py +425 -0
  161. interfaces/bridge/server.py +91 -0
  162. interfaces/bridge_process.py +201 -0
  163. interfaces/gui/__init__.py +0 -0
  164. interfaces/gui/routes/__init__.py +1 -0
  165. interfaces/gui/routes/media.py +226 -0
  166. interfaces/gui/routes/schedules.py +92 -0
  167. interfaces/gui/routes/sessions.py +522 -0
  168. interfaces/gui/routes/settings.py +99 -0
  169. interfaces/gui/routes/workspace.py +136 -0
  170. interfaces/gui/server.py +115 -0
  171. interfaces/gui/static/assets/index-D76InFO1.css +1 -0
  172. interfaces/gui/static/assets/index-D7__YYLa.js +47 -0
  173. interfaces/gui/static/index.html +15 -0
  174. interfaces/gui/static/nosis-avatar-128.png +0 -0
  175. interfaces/gui/static/nosis-avatar.png +0 -0
  176. interfaces/gui/windows_folders.py +41 -0
  177. interfaces/launch.py +69 -0
  178. interfaces/mobile/__init__.py +1 -0
  179. interfaces/mobile/bindings.py +72 -0
  180. interfaces/mobile/config.py +53 -0
  181. interfaces/mobile/controller.py +753 -0
  182. interfaces/mobile/dist/feishu.cjs +126926 -0
  183. interfaces/mobile/feishu.py +256 -0
  184. interfaces/mobile/service.py +41 -0
  185. interfaces/mobile/streaming.py +113 -0
  186. interfaces/mobile/views.py +30 -0
  187. interfaces/session_host.py +340 -0
  188. interfaces/tui/dist/app.js +26255 -0
  189. nosis_agent-0.1.1.dist-info/METADATA +209 -0
  190. nosis_agent-0.1.1.dist-info/RECORD +194 -0
  191. nosis_agent-0.1.1.dist-info/WHEEL +5 -0
  192. nosis_agent-0.1.1.dist-info/entry_points.txt +4 -0
  193. nosis_agent-0.1.1.dist-info/licenses/LICENSE +21 -0
  194. nosis_agent-0.1.1.dist-info/top_level.txt +3 -0
agent_core/__init__.py ADDED
@@ -0,0 +1,411 @@
1
+ from .agent import (
2
+ Agent,
3
+ AgentEvent,
4
+ AgentRunResult,
5
+ AssistantMessageDeltaEvent,
6
+ ReasoningDeltaEvent,
7
+ AssistantMessageEvent,
8
+ ModelCompletedEvent,
9
+ CompressionCompletedEvent,
10
+ UnitCompletedEvent,
11
+ ContextWindowEvent,
12
+ ToolBatchStartedEvent,
13
+ ToolCallEvent,
14
+ ToolMediaEvent,
15
+ ToolResultEvent,
16
+ UserSteerAppliedEvent,
17
+ JobStatusEvent,
18
+ )
19
+ from .loop_policy import ToolCallLimitExceededError
20
+ from .hooks import HookCompletedEvent
21
+ from .config import (
22
+ AgentConfig,
23
+ ContextCompressionConfig,
24
+ MemoryConfig,
25
+ ProviderRequestConfig,
26
+ SkillConfig,
27
+ SubagentRoleConfig,
28
+ load_agent_config,
29
+ )
30
+ from .context_manager import ContextManager, ContextWindow, ContextWindowExceededError
31
+ from .execution import (
32
+ APPROVAL_REQUIRED_AUTHORITY,
33
+ CommandCancelled,
34
+ CommandExecutionResult,
35
+ CommandOutputSpool,
36
+ CommandExecutor,
37
+ ExecutionAuthority,
38
+ ExecutionRouter,
39
+ ExecutionScope,
40
+ FULL_ACCESS_AUTHORITY,
41
+ FilesystemAccess,
42
+ HostCommandExecutor,
43
+ LinuxSandboxBackend,
44
+ MacOSSandboxBackend,
45
+ NetworkAccess,
46
+ ProcessIsolation,
47
+ SandboxBackend,
48
+ SandboxedCommandExecutor,
49
+ SandboxPolicy,
50
+ ShellLauncher,
51
+ TemporaryDirectoryMode,
52
+ ResolvedExecution,
53
+ WORKSPACE_ACCESS_AUTHORITY,
54
+ WORKSPACE_ONLY_AUTHORITY,
55
+ WindowsSandboxBackend,
56
+ platform_shell_launcher,
57
+ platform_workspace_sandbox_backend,
58
+ )
59
+ from .errors import (
60
+ ProviderError,
61
+ ProviderProtocolError,
62
+ ProviderRequestError,
63
+ ProviderStreamError,
64
+ RuntimeErrorInfo,
65
+ runtime_error_info,
66
+ )
67
+ from .jobs import (
68
+ CancellationToken, JobCancelled, JobContext, JobHandle, JobManager,
69
+ JobResult, JobSnapshot, JobUpdate,
70
+ )
71
+ from .llm import LLMProvider, LLMRequest, LLMResponse, ProviderCapabilities
72
+ from .usage import CacheUsage, TokenUsage
73
+ from .image_generation import GeneratedImage, ImageGenerator
74
+ from .content import (
75
+ AttachmentPart,
76
+ Content,
77
+ ContentPart,
78
+ FilePart,
79
+ ImagePart,
80
+ TextPart,
81
+ )
82
+ from .media import (
83
+ ImageInfo,
84
+ MAX_IMAGE_BYTES,
85
+ SUPPORTED_IMAGE_MIME_TYPES,
86
+ UnsupportedImageError,
87
+ estimate_image_tokens,
88
+ image_extension,
89
+ probe_image,
90
+ )
91
+ from .memory import (
92
+ MemoryCandidate,
93
+ MemoryContext,
94
+ MemoryDocument,
95
+ MemoryManager,
96
+ MemoryReconciler,
97
+ MemoryStore,
98
+ )
99
+ from .session import (
100
+ Message,
101
+ MessageOrigin,
102
+ Session,
103
+ message_to_dict,
104
+ )
105
+ from .permissions import PermissionController, PermissionPreset
106
+ from .plan import (
107
+ MAX_PLAN_STEP_OUTCOME_CHARS,
108
+ PlanManager,
109
+ PlanSnapshot,
110
+ PlanStep,
111
+ PlanStepStatus,
112
+ plan_snapshot_to_dict,
113
+ )
114
+ from .session_store import JsonlSessionStore, SessionInUseError
115
+ from .scheduler import (
116
+ AgentTurnAction,
117
+ CronTrigger,
118
+ IntervalTrigger,
119
+ OneShotTrigger,
120
+ Schedule,
121
+ ScheduleUpdateInput,
122
+ ScheduledRun,
123
+ SchedulerService,
124
+ parse_end_at_input,
125
+ parse_schedule_enabled_input,
126
+ parse_schedule_id_input,
127
+ parse_schedule_prompt_input,
128
+ parse_schedule_update_input,
129
+ parse_trigger_input,
130
+ trigger_to_dict,
131
+ )
132
+ from .skills import (
133
+ DirectorySkillSource,
134
+ Skill,
135
+ SkillLoader,
136
+ SkillLocation,
137
+ SkillRegistry,
138
+ SkillSource,
139
+ )
140
+ from .subagent import (
141
+ SubagentRole,
142
+ SubagentRoleRegistry,
143
+ SubagentRuntime,
144
+ skill_aware_tool_names,
145
+ vision_aware_tool_names,
146
+ )
147
+ from .tool_result import (
148
+ DEFAULT_TOOL_RESULT_PREVIEW_CHARS,
149
+ ToolResultNormalizer,
150
+ )
151
+ from .tool_batch import ToolBatchExecutor
152
+ from .tools import (
153
+ AnalyzeImageTool,
154
+ ApplyPatchTool,
155
+ AskUserTool,
156
+ CompositeToolPolicy,
157
+ ComputerApprovalPolicy,
158
+ ComputerScreenshotTool,
159
+ ComputerActionTool,
160
+ EditFileTool,
161
+ GenerateImageTool,
162
+ JSONValue,
163
+ ListDirectoryTool,
164
+ MAX_TOOL_RESULT_CHARS,
165
+ McpApprovalPolicy,
166
+ ReadFileTool,
167
+ ReadImageTool,
168
+ ReadSkillTool,
169
+ RememberTool,
170
+ SearchFilesTool,
171
+ ShellApprovalPolicy,
172
+ FileWriteApprovalPolicy,
173
+ ShellTool,
174
+ SubagentTool,
175
+ JobControlTool,
176
+ UpdatePlanTool,
177
+ Tool,
178
+ ToolCall,
179
+ ToolCatalog,
180
+ ToolConfig,
181
+ ToolDefinition,
182
+ ToolError,
183
+ ToolExecutionContext,
184
+ ToolOutput,
185
+ ToolPolicy,
186
+ ToolResult,
187
+ ToolSet,
188
+ WebSearchTool,
189
+ WebFetchTool,
190
+ WriteFileTool,
191
+ builtin_catalog,
192
+ load_tool_config,
193
+ resolve_image,
194
+ resolve_readable_path,
195
+ )
196
+ from .mcp import (
197
+ McpConfig,
198
+ McpServerConfig,
199
+ McpTool,
200
+ McpToolConfig,
201
+ load_mcp_config,
202
+ load_mcp_server_map,
203
+ merge_mcp_servers,
204
+ namespace_mcp_servers,
205
+ )
206
+ from .workspace import Workspace
207
+ from .workspace_instructions import WorkspaceInstruction, WorkspaceInstructions
208
+ from .turn_control import (
209
+ AgentCancelled,
210
+ TurnControl,
211
+ UserSteer,
212
+ UserSteeringMailbox,
213
+ )
214
+
215
+ __all__ = [
216
+ "Agent",
217
+ "ApplyPatchTool",
218
+ "AgentCancelled",
219
+ "AgentConfig",
220
+ "AgentEvent",
221
+ "AgentRunResult",
222
+ "AnalyzeImageTool",
223
+ "AskUserTool",
224
+ "CacheUsage",
225
+ "AssistantMessageDeltaEvent",
226
+ "AssistantMessageEvent",
227
+ "ModelCompletedEvent",
228
+ "CompressionCompletedEvent",
229
+ "UnitCompletedEvent",
230
+ "CommandExecutionResult",
231
+ "CommandCancelled",
232
+ "CommandOutputSpool",
233
+ "CommandExecutor",
234
+ "ExecutionAuthority",
235
+ "ExecutionRouter",
236
+ "ExecutionScope",
237
+ "ResolvedExecution",
238
+ "APPROVAL_REQUIRED_AUTHORITY",
239
+ "FULL_ACCESS_AUTHORITY",
240
+ "WORKSPACE_ACCESS_AUTHORITY",
241
+ "WORKSPACE_ONLY_AUTHORITY",
242
+ "FilesystemAccess",
243
+ "CompositeToolPolicy",
244
+ "ComputerApprovalPolicy",
245
+ "ComputerScreenshotTool",
246
+ "ComputerActionTool",
247
+ "Content",
248
+ "ContentPart",
249
+ "AttachmentPart",
250
+ "ContextWindow",
251
+ "ContextWindowEvent",
252
+ "ContextCompressionConfig",
253
+ "ContextManager",
254
+ "ContextWindowExceededError",
255
+ "DEFAULT_TOOL_RESULT_PREVIEW_CHARS",
256
+ "DirectorySkillSource",
257
+ "EditFileTool",
258
+ "GeneratedImage",
259
+ "GenerateImageTool",
260
+ "ImageInfo",
261
+ "ImageGenerator",
262
+ "ImagePart",
263
+ "FilePart",
264
+ "HostCommandExecutor",
265
+ "platform_shell_launcher",
266
+ "JobCancelled",
267
+ "JobContext",
268
+ "JobHandle",
269
+ "JobManager",
270
+ "JobResult",
271
+ "JobSnapshot",
272
+ "JobControlTool",
273
+ "JobStatusEvent",
274
+ "HookCompletedEvent",
275
+ "JobUpdate",
276
+ "CancellationToken",
277
+ "JSONValue",
278
+ "JsonlSessionStore",
279
+ "SessionInUseError",
280
+ "LLMProvider",
281
+ "LLMRequest",
282
+ "LLMResponse",
283
+ "ListDirectoryTool",
284
+ "LinuxSandboxBackend",
285
+ "MAX_IMAGE_BYTES",
286
+ "MAX_PLAN_STEP_OUTCOME_CHARS",
287
+ "MAX_TOOL_RESULT_CHARS",
288
+ "MemoryCandidate",
289
+ "MemoryConfig",
290
+ "MemoryContext",
291
+ "MemoryDocument",
292
+ "MemoryManager",
293
+ "MemoryReconciler",
294
+ "MemoryStore",
295
+ "MacOSSandboxBackend",
296
+ "McpApprovalPolicy",
297
+ "McpConfig",
298
+ "McpServerConfig",
299
+ "McpTool",
300
+ "McpToolConfig",
301
+ "Message",
302
+ "MessageOrigin",
303
+ "NetworkAccess",
304
+ "PermissionController",
305
+ "PermissionPreset",
306
+ "PlanManager",
307
+ "PlanSnapshot",
308
+ "PlanStep",
309
+ "PlanStepStatus",
310
+ "ProviderCapabilities",
311
+ "ProviderError",
312
+ "ProviderRequestConfig",
313
+ "ProviderProtocolError",
314
+ "ProviderRequestError",
315
+ "ProviderStreamError",
316
+ "ProcessIsolation",
317
+ "ReadFileTool",
318
+ "ReadImageTool",
319
+ "ReadSkillTool",
320
+ "RememberTool",
321
+ "ReasoningDeltaEvent",
322
+ "RuntimeErrorInfo",
323
+ "SandboxBackend",
324
+ "SandboxedCommandExecutor",
325
+ "SandboxPolicy",
326
+ "ShellLauncher",
327
+ "SUPPORTED_IMAGE_MIME_TYPES",
328
+ "SearchFilesTool",
329
+ "Session",
330
+ "Skill",
331
+ "SkillConfig",
332
+ "SkillLoader",
333
+ "SkillLocation",
334
+ "SkillRegistry",
335
+ "SkillSource",
336
+ "ShellApprovalPolicy",
337
+ "FileWriteApprovalPolicy",
338
+ "ShellTool",
339
+ "SubagentRole",
340
+ "SubagentRoleConfig",
341
+ "SubagentRoleRegistry",
342
+ "SubagentRuntime",
343
+ "SubagentTool",
344
+ "TemporaryDirectoryMode",
345
+ "TextPart",
346
+ "TokenUsage",
347
+ "Tool",
348
+ "ToolBatchStartedEvent",
349
+ "ToolBatchExecutor",
350
+ "ToolCall",
351
+ "ToolCallEvent",
352
+ "ToolCallLimitExceededError",
353
+ "ToolCatalog",
354
+ "ToolConfig",
355
+ "ToolDefinition",
356
+ "ToolError",
357
+ "ToolExecutionContext",
358
+ "ToolMediaEvent",
359
+ "ToolOutput",
360
+ "ToolPolicy",
361
+ "ToolResult",
362
+ "ToolResultEvent",
363
+ "ToolResultNormalizer",
364
+ "TurnControl",
365
+ "ToolSet",
366
+ "UnsupportedImageError",
367
+ "UpdatePlanTool",
368
+ "UserSteer",
369
+ "UserSteerAppliedEvent",
370
+ "UserSteeringMailbox",
371
+ "WebFetchTool",
372
+ "WebSearchTool",
373
+ "WindowsSandboxBackend",
374
+ "platform_workspace_sandbox_backend",
375
+ "WriteFileTool",
376
+ "AgentTurnAction",
377
+ "CronTrigger",
378
+ "IntervalTrigger",
379
+ "OneShotTrigger",
380
+ "Schedule",
381
+ "ScheduleUpdateInput",
382
+ "parse_end_at_input",
383
+ "parse_schedule_enabled_input",
384
+ "parse_schedule_id_input",
385
+ "parse_schedule_prompt_input",
386
+ "parse_schedule_update_input",
387
+ "parse_trigger_input",
388
+ "trigger_to_dict",
389
+ "ScheduledRun",
390
+ "SchedulerService",
391
+ "Workspace",
392
+ "WorkspaceInstruction",
393
+ "WorkspaceInstructions",
394
+ "builtin_catalog",
395
+ "estimate_image_tokens",
396
+ "image_extension",
397
+ "load_agent_config",
398
+ "load_mcp_config",
399
+ "load_mcp_server_map",
400
+ "merge_mcp_servers",
401
+ "namespace_mcp_servers",
402
+ "load_tool_config",
403
+ "message_to_dict",
404
+ "probe_image",
405
+ "plan_snapshot_to_dict",
406
+ "resolve_image",
407
+ "resolve_readable_path",
408
+ "runtime_error_info",
409
+ "skill_aware_tool_names",
410
+ "vision_aware_tool_names",
411
+ ]
@@ -0,0 +1,84 @@
1
+ """Descriptor-relative filesystem operations for the file tools."""
2
+
3
+ import errno
4
+ import os
5
+ import shutil
6
+ import stat
7
+ from typing import BinaryIO
8
+ from uuid import uuid4
9
+
10
+
11
+ _DIRECTORY = getattr(os, "O_PATH", os.O_RDONLY) | os.O_DIRECTORY | os.O_NOFOLLOW
12
+
13
+
14
+ def open_root(anchor: str) -> int:
15
+ return os.open(anchor, _DIRECTORY)
16
+
17
+
18
+ def close(directory: int) -> None:
19
+ os.close(directory)
20
+
21
+
22
+ def open_directory(parent: int, name: str) -> int:
23
+ return os.open(name, _DIRECTORY, dir_fd=parent)
24
+
25
+
26
+ def mkdir(parent: int, name: str) -> None:
27
+ os.mkdir(name, dir_fd=parent)
28
+
29
+
30
+ def mode(parent: int, name: str) -> int:
31
+ result = os.stat(name, dir_fd=parent, follow_symlinks=False).st_mode
32
+ if stat.S_ISLNK(result):
33
+ raise OSError(errno.ELOOP, "file path changed to a symbolic link", name)
34
+ return result
35
+
36
+
37
+ def open_read(parent: int, name: str) -> int:
38
+ descriptor = os.open(
39
+ name, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=parent,
40
+ )
41
+ try:
42
+ if not stat.S_ISREG(os.fstat(descriptor).st_mode):
43
+ raise OSError(errno.EINVAL, "path must be a regular file", name)
44
+ return descriptor
45
+ except BaseException:
46
+ os.close(descriptor)
47
+ raise
48
+
49
+
50
+ def write(
51
+ parent: int, name: str, data: bytes | BinaryIO, *, replace: bool, permissions: int | None
52
+ ) -> None:
53
+ temporary = f".nosis-{uuid4().hex}.tmp"
54
+ descriptor = os.open(
55
+ temporary, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600, dir_fd=parent,
56
+ )
57
+ try:
58
+ with os.fdopen(descriptor, "wb") as file:
59
+ if isinstance(data, bytes):
60
+ file.write(data)
61
+ else:
62
+ shutil.copyfileobj(data, file)
63
+ file.flush()
64
+ if permissions is not None:
65
+ os.fchmod(file.fileno(), permissions)
66
+ os.fsync(file.fileno())
67
+ if replace:
68
+ os.replace(temporary, name, src_dir_fd=parent, dst_dir_fd=parent)
69
+ temporary = None
70
+ else:
71
+ os.link(
72
+ temporary, name, src_dir_fd=parent, dst_dir_fd=parent,
73
+ follow_symlinks=False,
74
+ )
75
+ finally:
76
+ if temporary is not None:
77
+ try:
78
+ os.unlink(temporary, dir_fd=parent)
79
+ except FileNotFoundError:
80
+ pass
81
+
82
+
83
+ def unlink(parent: int, name: str) -> None:
84
+ os.unlink(name, dir_fd=parent)