handler-ai 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.
- handler_ai-0.1.0.dist-info/METADATA +60 -0
- handler_ai-0.1.0.dist-info/RECORD +234 -0
- handler_ai-0.1.0.dist-info/WHEEL +4 -0
- handler_ai-0.1.0.dist-info/entry_points.txt +6 -0
- handler_cli/__init__.py +1 -0
- handler_cli/account_commands.py +314 -0
- handler_cli/addon_commands.py +128 -0
- handler_cli/agent_commands.py +139 -0
- handler_cli/app_commands.py +175 -0
- handler_cli/app_window.py +85 -0
- handler_cli/automation_commands.py +309 -0
- handler_cli/bridge.py +42 -0
- handler_cli/cli.py +326 -0
- handler_cli/client.py +81 -0
- handler_cli/daemon_commands.py +108 -0
- handler_cli/image_commands.py +102 -0
- handler_cli/inbox_commands.py +33 -0
- handler_cli/output.py +12 -0
- handler_cli/project_commands.py +63 -0
- handler_cli/provider_commands.py +113 -0
- handler_cli/secret_commands.py +64 -0
- handler_cli/session_bridge.py +93 -0
- handler_cli/session_commands.py +485 -0
- handler_cli/setup.py +120 -0
- handler_cli/terminal.py +280 -0
- handler_cli/terminal_client.py +37 -0
- handler_contracts/__init__.py +642 -0
- handler_contracts/account.py +36 -0
- handler_contracts/acp_endpoint.py +69 -0
- handler_contracts/addon.py +147 -0
- handler_contracts/agent_spec.py +75 -0
- handler_contracts/automation.py +285 -0
- handler_contracts/common.py +229 -0
- handler_contracts/control.py +1208 -0
- handler_contracts/harness.py +300 -0
- handler_contracts/miniapp.py +141 -0
- handler_contracts/provider.py +82 -0
- handler_contracts/remote.py +167 -0
- handler_contracts/sandbox.py +199 -0
- handler_contracts/schemas.py +313 -0
- handler_contracts/terminal.py +32 -0
- handler_control/__init__.py +7 -0
- handler_control/access.py +62 -0
- handler_control/accounts.py +279 -0
- handler_control/addon_install.py +268 -0
- handler_control/addons.py +118 -0
- handler_control/agent_state.py +46 -0
- handler_control/agents.py +257 -0
- handler_control/api/__init__.py +137 -0
- handler_control/api/accounts.py +231 -0
- handler_control/api/acp.py +116 -0
- handler_control/api/addons.py +95 -0
- handler_control/api/agents.py +150 -0
- handler_control/api/apps.py +104 -0
- handler_control/api/automations.py +128 -0
- handler_control/api/bindings.py +105 -0
- handler_control/api/builtin_agents.py +22 -0
- handler_control/api/caches.py +79 -0
- handler_control/api/catalog.py +197 -0
- handler_control/api/common.py +205 -0
- handler_control/api/contexts.py +88 -0
- handler_control/api/folders.py +51 -0
- handler_control/api/images.py +164 -0
- handler_control/api/inbox.py +21 -0
- handler_control/api/projects.py +170 -0
- handler_control/api/providers.py +107 -0
- handler_control/api/remote.py +45 -0
- handler_control/api/secrets.py +177 -0
- handler_control/api/sessions.py +192 -0
- handler_control/api/skills.py +270 -0
- handler_control/app_api.py +84 -0
- handler_control/app_http.py +214 -0
- handler_control/app_remote.py +206 -0
- handler_control/apps.py +867 -0
- handler_control/auth.py +48 -0
- handler_control/automation_config.py +255 -0
- handler_control/automations.py +1134 -0
- handler_control/bindings.py +149 -0
- handler_control/builds.py +341 -0
- handler_control/builtin_agents.py +82 -0
- handler_control/caches.py +113 -0
- handler_control/checks.py +287 -0
- handler_control/compose.py +317 -0
- handler_control/config_files.py +41 -0
- handler_control/contexts.py +75 -0
- handler_control/daemon.py +64 -0
- handler_control/data/automation/bin/handler-llm +85 -0
- handler_control/data/automations/env-issues/automation.toml +17 -0
- handler_control/data/automations/env-issues/extract.py +73 -0
- handler_control/data/automations/env-issues/findings.schema.json +28 -0
- handler_control/data/automations/env-issues/prompt.md +19 -0
- handler_control/data/builtin-agents/skill-creator/agent.toml +10 -0
- handler_control/data/builtin-agents/skill-creator/instructions.md +5 -0
- handler_control/data/builtin-agents/skill-creator/skills/handler-skills/SKILL.md +44 -0
- handler_control/data/builtin-agents/skill-creator/skills/skill-creator/LICENSE.txt +202 -0
- handler_control/data/builtin-agents/skill-creator/skills/skill-creator/SKILL.md +485 -0
- handler_control/data/builtin-agents/skill-creator/skills/skill-creator/agents/analyzer.md +274 -0
- handler_control/data/builtin-agents/skill-creator/skills/skill-creator/agents/comparator.md +202 -0
- handler_control/data/builtin-agents/skill-creator/skills/skill-creator/agents/grader.md +223 -0
- handler_control/data/builtin-agents/skill-creator/skills/skill-creator/assets/eval_review.html +146 -0
- handler_control/data/builtin-agents/skill-creator/skills/skill-creator/eval-viewer/generate_review.py +471 -0
- handler_control/data/builtin-agents/skill-creator/skills/skill-creator/eval-viewer/viewer.html +1325 -0
- handler_control/data/builtin-agents/skill-creator/skills/skill-creator/references/schemas.md +430 -0
- handler_control/data/builtin-agents/skill-creator/skills/skill-creator/scripts/__init__.py +0 -0
- handler_control/data/builtin-agents/skill-creator/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- handler_control/data/builtin-agents/skill-creator/skills/skill-creator/scripts/generate_report.py +326 -0
- handler_control/data/builtin-agents/skill-creator/skills/skill-creator/scripts/improve_description.py +247 -0
- handler_control/data/builtin-agents/skill-creator/skills/skill-creator/scripts/package_skill.py +136 -0
- handler_control/data/builtin-agents/skill-creator/skills/skill-creator/scripts/quick_validate.py +103 -0
- handler_control/data/builtin-agents/skill-creator/skills/skill-creator/scripts/run_eval.py +310 -0
- handler_control/data/builtin-agents/skill-creator/skills/skill-creator/scripts/run_loop.py +328 -0
- handler_control/data/builtin-agents/skill-creator/skills/skill-creator/scripts/utils.py +47 -0
- handler_control/data/builtin-agents/skill-review/agent.toml +13 -0
- handler_control/data/builtin-agents/skill-review/instructions.md +30 -0
- handler_control/data/builtin-agents/skill-review/interface.json +83 -0
- handler_control/data/interfaces/llm/v1/interface.toml +17 -0
- handler_control/data/interfaces/llm/v1/tools.json +138 -0
- handler_control/data/templates/README.md +10 -0
- handler_control/data/templates/providers/anthropic-api.toml +18 -0
- handler_control/data/templates/providers/llamacpp.toml +210 -0
- handler_control/data/templates/providers/mistral-api.toml +14 -0
- handler_control/data/templates/providers/ollama.toml +10 -0
- handler_control/data/templates/providers/openai-api.toml +13 -0
- handler_control/data/templates/providers/openrouter.toml +10 -0
- handler_control/desktop.py +68 -0
- handler_control/display.py +62 -0
- handler_control/files.py +23 -0
- handler_control/folders.py +68 -0
- handler_control/git_read.py +39 -0
- handler_control/image_check.py +322 -0
- handler_control/image_updates.py +174 -0
- handler_control/inbox.py +70 -0
- handler_control/interfaces.py +151 -0
- handler_control/knowledge.py +237 -0
- handler_control/launcher.py +356 -0
- handler_control/llm.py +194 -0
- handler_control/migrations/__init__.py +62 -0
- handler_control/policy.py +305 -0
- handler_control/projects.py +266 -0
- handler_control/providers.py +180 -0
- handler_control/relay.py +133 -0
- handler_control/remote.py +888 -0
- handler_control/remote_crypto.py +97 -0
- handler_control/runtime.py +140 -0
- handler_control/sandbox_process.py +224 -0
- handler_control/schedules.py +58 -0
- handler_control/secrets.py +242 -0
- handler_control/service_router.py +180 -0
- handler_control/services.py +92 -0
- handler_control/session_files.py +429 -0
- handler_control/sessions.py +1116 -0
- handler_control/settings.py +129 -0
- handler_control/shortcuts.py +80 -0
- handler_control/skill_scan.py +88 -0
- handler_control/skill_sources.py +61 -0
- handler_control/skills.py +378 -0
- handler_control/terminal.py +79 -0
- handler_control/terminals.py +108 -0
- handler_control/transcript.py +174 -0
- handler_control/web-ui/assets/index-1w5RPsfA.js +190 -0
- handler_control/web-ui/assets/index-dWnzCLzQ.css +1 -0
- handler_control/web-ui/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- handler_control/web-ui/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- handler_control/web-ui/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- handler_control/web-ui/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- handler_control/web-ui/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- handler_control/web-ui/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- handler_control/web-ui/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- handler_control/web-ui/favicon.svg +1 -0
- handler_control/web-ui/index.html +15 -0
- handler_control/webpush.py +90 -0
- handler_control/webui.py +105 -0
- handler_harness/__init__.py +13 -0
- handler_harness/addons.py +129 -0
- handler_harness/catalog.py +116 -0
- handler_harness/cli.py +109 -0
- handler_harness/data/addons/README.md +44 -0
- handler_harness/data/addons/miniapp/Containerfile +20 -0
- handler_harness/data/addons/miniapp/PROVISIONING.md +16 -0
- handler_harness/data/addons/miniapp/addon.toml +16 -0
- handler_harness/data/addons/miniapp/skills/miniapp/SKILL.md +140 -0
- handler_harness/data/addons/miniapp/skills/miniapp/template/.gitignore +2 -0
- handler_harness/data/addons/miniapp/skills/miniapp/template/app.toml +15 -0
- handler_harness/data/addons/miniapp/skills/miniapp/template/server/db.ts +30 -0
- handler_harness/data/addons/miniapp/skills/miniapp/template/server/deno.json +7 -0
- handler_harness/data/addons/miniapp/skills/miniapp/template/server/handler.ts +26 -0
- handler_harness/data/addons/miniapp/skills/miniapp/template/server/main.ts +18 -0
- handler_harness/data/addons/miniapp/skills/miniapp/template/server/main_test.ts +32 -0
- handler_harness/data/addons/miniapp/skills/miniapp/template/server/migrations/001_notes.sql +6 -0
- handler_harness/data/addons/miniapp/skills/miniapp/template/server/routes.ts +32 -0
- handler_harness/data/addons/miniapp/skills/miniapp/template/ui/deno.json +12 -0
- handler_harness/data/addons/miniapp/skills/miniapp/template/ui/index.html +12 -0
- handler_harness/data/addons/miniapp/skills/miniapp/template/ui/src/App.svelte +44 -0
- handler_harness/data/addons/miniapp/skills/miniapp/template/ui/src/api.ts +16 -0
- handler_harness/data/addons/miniapp/skills/miniapp/template/ui/src/app.css +24 -0
- handler_harness/data/addons/miniapp/skills/miniapp/template/ui/src/main.ts +5 -0
- handler_harness/data/addons/miniapp/skills/miniapp/template/ui/vite.config.ts +17 -0
- handler_harness/data/catalog/README.md +12 -0
- handler_harness/data/catalog/playwright/Containerfile +28 -0
- handler_harness/data/catalog/playwright/PROVISIONING.md +53 -0
- handler_harness/data/catalog/playwright/addon.toml +25 -0
- handler_harness/data/catalog/playwright/handler/playwright-mcp-check.mjs +23 -0
- handler_harness/data/catalog/playwright/handler/playwright-mcp.mjs +61 -0
- handler_harness/data/catalog/playwright/skills/browser/SKILL.md +41 -0
- handler_harness/data/catalog/shopify/Containerfile +22 -0
- handler_harness/data/catalog/shopify/PROVISIONING.md +49 -0
- handler_harness/data/catalog/shopify/addon.toml +39 -0
- handler_harness/data/catalog/shopify/skills/shopify/SKILL.md +41 -0
- handler_harness/data/handler-sandbox-env +30 -0
- handler_harness/data/harnesses/README.md +47 -0
- handler_harness/data/harnesses/claude-code/Containerfile +27 -0
- handler_harness/data/harnesses/claude-code/harness.toml +95 -0
- handler_harness/data/harnesses/codex/Containerfile +26 -0
- handler_harness/data/harnesses/codex/harness.toml +103 -0
- handler_harness/data/harnesses/pi/Containerfile +27 -0
- handler_harness/data/harnesses/pi/harness.toml +65 -0
- handler_harness/data/harnesses/vibe/Containerfile +19 -0
- handler_harness/data/harnesses/vibe/harness.toml +96 -0
- handler_harness/data/toolbox/Containerfile +56 -0
- handler_harness/data/toolbox/README.md +24 -0
- handler_harness/data/toolbox/toolbox.toml +41 -0
- handler_harness/images.py +62 -0
- handler_harness/providers.py +300 -0
- handler_harness/render.py +472 -0
- handler_sandbox_podman/__init__.py +1 -0
- handler_sandbox_podman/caches.py +97 -0
- handler_sandbox_podman/check.py +121 -0
- handler_sandbox_podman/cli.py +239 -0
- handler_sandbox_podman/egress.py +118 -0
- handler_sandbox_podman/images.py +199 -0
- handler_sandbox_podman/launch.py +474 -0
- handler_sandbox_podman/podman.py +108 -0
- handler_sandbox_podman/proxy/Containerfile +6 -0
- handler_sandbox_podman/proxy/addon.py +255 -0
|
@@ -0,0 +1,642 @@
|
|
|
1
|
+
"""Reference implementation of the Handler contracts (docs/dev/contracts.md).
|
|
2
|
+
|
|
3
|
+
Each name is imported from its module on first use (PEP 562): `from handler_contracts import
|
|
4
|
+
SandboxSpec` loads sandbox.py and common.py only, so the sandbox executable (A), started for every
|
|
5
|
+
runtime call, does not load the control plane's models. The imports below say what comes from
|
|
6
|
+
where: for type checkers, and read by `__getattr__`.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import ast
|
|
10
|
+
import importlib
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import TYPE_CHECKING
|
|
13
|
+
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from .account import ACCOUNT_API_VERSION, Account
|
|
16
|
+
from .acp_endpoint import (
|
|
17
|
+
ACP_ENDPOINT_API_VERSION,
|
|
18
|
+
ACP_SUBPROTOCOL,
|
|
19
|
+
BEARER_SUBPROTOCOL_PREFIX,
|
|
20
|
+
BLOCKED_AGENT_METHOD_PREFIXES,
|
|
21
|
+
CWD_CHECKED_METHODS,
|
|
22
|
+
DEFAULT_MAX_MESSAGE_BYTES,
|
|
23
|
+
AcpCloseCode,
|
|
24
|
+
PolicyErrorCode,
|
|
25
|
+
PolicyRule,
|
|
26
|
+
SessionErrorCode,
|
|
27
|
+
acp_path,
|
|
28
|
+
session_acp_path,
|
|
29
|
+
)
|
|
30
|
+
from .addon import (
|
|
31
|
+
ADDON_API_VERSION,
|
|
32
|
+
ADDON_VERSION_FILE,
|
|
33
|
+
ADDONS_ROOT,
|
|
34
|
+
BINDING_API_VERSION,
|
|
35
|
+
AddonManifest,
|
|
36
|
+
AddonMcp,
|
|
37
|
+
AddonSecretSlot,
|
|
38
|
+
AddonSlot,
|
|
39
|
+
Binding,
|
|
40
|
+
check_binding,
|
|
41
|
+
)
|
|
42
|
+
from .agent_spec import AgentSpec, HarnessName, NeutralConfig
|
|
43
|
+
from .automation import (
|
|
44
|
+
AUTOMATION_API_VERSION,
|
|
45
|
+
AUTOMATION_FILE,
|
|
46
|
+
DEFAULT_TIMEOUT_SEC,
|
|
47
|
+
MAX_APPEND,
|
|
48
|
+
MAX_LLM_INPUT,
|
|
49
|
+
MAX_LLM_SCHEMA,
|
|
50
|
+
MIN_EVERY_MINUTES,
|
|
51
|
+
Automation,
|
|
52
|
+
AutomationAgentInput,
|
|
53
|
+
AutomationAgentRun,
|
|
54
|
+
AutomationAppCall,
|
|
55
|
+
AutomationAppend,
|
|
56
|
+
AutomationAppended,
|
|
57
|
+
AutomationCheck,
|
|
58
|
+
AutomationDefinitionRequest,
|
|
59
|
+
AutomationEvent,
|
|
60
|
+
AutomationExample,
|
|
61
|
+
AutomationLlmUsage,
|
|
62
|
+
AutomationName,
|
|
63
|
+
AutomationOnly,
|
|
64
|
+
AutomationRun,
|
|
65
|
+
AutomationServices,
|
|
66
|
+
AutomationSubject,
|
|
67
|
+
AutomationView,
|
|
68
|
+
CreateAutomationRequest,
|
|
69
|
+
LlmModel,
|
|
70
|
+
LlmRequest,
|
|
71
|
+
LlmResponse,
|
|
72
|
+
LlmUsage,
|
|
73
|
+
RunState,
|
|
74
|
+
Schedule,
|
|
75
|
+
TryAutomationRequest,
|
|
76
|
+
)
|
|
77
|
+
from .common import (
|
|
78
|
+
ANY_CONTEXT,
|
|
79
|
+
PERMISSION_MODES,
|
|
80
|
+
AbsolutePath,
|
|
81
|
+
AccessContext,
|
|
82
|
+
CacheSharing,
|
|
83
|
+
CommandSecret,
|
|
84
|
+
Confinement,
|
|
85
|
+
ContextColor,
|
|
86
|
+
ContextName,
|
|
87
|
+
EgressEntry,
|
|
88
|
+
Enforcement,
|
|
89
|
+
EnvMap,
|
|
90
|
+
EnvSecret,
|
|
91
|
+
FileContent,
|
|
92
|
+
FileSecret,
|
|
93
|
+
FileSource,
|
|
94
|
+
GeneratedFile,
|
|
95
|
+
HomePath,
|
|
96
|
+
HostPath,
|
|
97
|
+
HttpMcpServer,
|
|
98
|
+
McpServer,
|
|
99
|
+
McpTransport,
|
|
100
|
+
Mount,
|
|
101
|
+
NetworkMode,
|
|
102
|
+
PermissionMode,
|
|
103
|
+
ResourceName,
|
|
104
|
+
Resources,
|
|
105
|
+
SecretPath,
|
|
106
|
+
SecretRef,
|
|
107
|
+
StdioMcpServer,
|
|
108
|
+
StoreSecret,
|
|
109
|
+
egress_target,
|
|
110
|
+
is_within,
|
|
111
|
+
mcp_transport,
|
|
112
|
+
)
|
|
113
|
+
from .control import (
|
|
114
|
+
CONTROL_API_VERSION,
|
|
115
|
+
CONTROL_BASE_PATH,
|
|
116
|
+
DEFAULT_PORT,
|
|
117
|
+
MAX_REQUEST,
|
|
118
|
+
MAX_SCHEMA_BYTES,
|
|
119
|
+
MAX_SKILL_ARCHIVE_BYTES,
|
|
120
|
+
MAX_SKILL_BYTES,
|
|
121
|
+
MAX_SKILL_FILE_BYTES,
|
|
122
|
+
SUBJECT_ROOT,
|
|
123
|
+
TOKEN_FILE_NAME,
|
|
124
|
+
AccountInfo,
|
|
125
|
+
AccountLoginRequest,
|
|
126
|
+
AccountRequest,
|
|
127
|
+
AccountStatus,
|
|
128
|
+
AddAppRequest,
|
|
129
|
+
AddonCatalogEntry,
|
|
130
|
+
AddonInfo,
|
|
131
|
+
AddonInstalled,
|
|
132
|
+
AddonInstallRequest,
|
|
133
|
+
AddonPreview,
|
|
134
|
+
AddonPreviewRequest,
|
|
135
|
+
AddonSlotInfo,
|
|
136
|
+
AdHocAgentRequest,
|
|
137
|
+
Agent,
|
|
138
|
+
AgentInterface,
|
|
139
|
+
AgentModel,
|
|
140
|
+
AgentRequest,
|
|
141
|
+
AgentSettings,
|
|
142
|
+
App,
|
|
143
|
+
AppDeployment,
|
|
144
|
+
AppLink,
|
|
145
|
+
AppLog,
|
|
146
|
+
AppSecret,
|
|
147
|
+
AppSource,
|
|
148
|
+
AppState,
|
|
149
|
+
BindingInfo,
|
|
150
|
+
BindingRequest,
|
|
151
|
+
Build,
|
|
152
|
+
BuildLog,
|
|
153
|
+
BuildState,
|
|
154
|
+
BuiltinAgent,
|
|
155
|
+
CacheFolders,
|
|
156
|
+
CacheInfo,
|
|
157
|
+
CachesInfo,
|
|
158
|
+
CacheSizes,
|
|
159
|
+
CachesRequest,
|
|
160
|
+
Connection,
|
|
161
|
+
ContextInfo,
|
|
162
|
+
ContextRequest,
|
|
163
|
+
CreateDirectoryRequest,
|
|
164
|
+
CreateKnowledgeFolderRequest,
|
|
165
|
+
CreateProjectRequest,
|
|
166
|
+
CreateSessionRequest,
|
|
167
|
+
CreateSkillRequest,
|
|
168
|
+
DeviceScope,
|
|
169
|
+
DirectoryEntry,
|
|
170
|
+
DirectoryListing,
|
|
171
|
+
EgressEvent,
|
|
172
|
+
GlobalCachesInfo,
|
|
173
|
+
HarnessInfo,
|
|
174
|
+
Health,
|
|
175
|
+
ImageUpdates,
|
|
176
|
+
ImageUpdatesRequest,
|
|
177
|
+
InboxMessage,
|
|
178
|
+
InboxStatus,
|
|
179
|
+
KnowledgeFolder,
|
|
180
|
+
KnowledgeFolderView,
|
|
181
|
+
KnowledgeListing,
|
|
182
|
+
KnowledgeNote,
|
|
183
|
+
LoginWindow,
|
|
184
|
+
ModelAccess,
|
|
185
|
+
NetworkFilterInfo,
|
|
186
|
+
PairDeviceRequest,
|
|
187
|
+
PatchAgentRequest,
|
|
188
|
+
PersonName,
|
|
189
|
+
Problem,
|
|
190
|
+
Project,
|
|
191
|
+
ProjectCachesInfo,
|
|
192
|
+
ProjectSettingsRequest,
|
|
193
|
+
ProviderInfo,
|
|
194
|
+
ProviderRequest,
|
|
195
|
+
ProviderTemplate,
|
|
196
|
+
PutSecretRequest,
|
|
197
|
+
RemoteDevice,
|
|
198
|
+
RemoteLight,
|
|
199
|
+
RemotePairing,
|
|
200
|
+
RemoteStatus,
|
|
201
|
+
RequiredHost,
|
|
202
|
+
RevealRequest,
|
|
203
|
+
ScanHit,
|
|
204
|
+
SecretInfo,
|
|
205
|
+
SecretSent,
|
|
206
|
+
Session,
|
|
207
|
+
SessionChanges,
|
|
208
|
+
SessionFile,
|
|
209
|
+
SessionFileChange,
|
|
210
|
+
SessionFolder,
|
|
211
|
+
SessionFolderEntry,
|
|
212
|
+
SessionFound,
|
|
213
|
+
SessionInput,
|
|
214
|
+
SessionLifecycle,
|
|
215
|
+
SessionMount,
|
|
216
|
+
SessionMounts,
|
|
217
|
+
SessionOrigin,
|
|
218
|
+
SessionOutput,
|
|
219
|
+
SessionSubject,
|
|
220
|
+
SetAppPersonsRequest,
|
|
221
|
+
SetAppSecretRequest,
|
|
222
|
+
SetAppShortcutRequest,
|
|
223
|
+
SetKnowledgeRootRequest,
|
|
224
|
+
SetRemoteGatewayRequest,
|
|
225
|
+
SetSessionRemoteRequest,
|
|
226
|
+
SkillFile,
|
|
227
|
+
SkillFileRequest,
|
|
228
|
+
SkillInfo,
|
|
229
|
+
SkillName,
|
|
230
|
+
SkillRequest,
|
|
231
|
+
SkillScan,
|
|
232
|
+
SkillUrlRequest,
|
|
233
|
+
ToolboxContainerfile,
|
|
234
|
+
ToolboxContainerfileUpdate,
|
|
235
|
+
ToolboxInfo,
|
|
236
|
+
WorkFolderInfo,
|
|
237
|
+
WorkFolders,
|
|
238
|
+
WorkFoldersInfo,
|
|
239
|
+
)
|
|
240
|
+
from .harness import (
|
|
241
|
+
HARNESS_API_VERSION,
|
|
242
|
+
HARNESS_LAUNCH_API_VERSION,
|
|
243
|
+
IMAGE_VERSION_FILE,
|
|
244
|
+
CacheDeclaration,
|
|
245
|
+
CacheName,
|
|
246
|
+
ConfigFileSlot,
|
|
247
|
+
HarnessDescriptor,
|
|
248
|
+
HarnessLaunch,
|
|
249
|
+
LoginRecipe,
|
|
250
|
+
PermissionMapping,
|
|
251
|
+
SessionDefaults,
|
|
252
|
+
StateSlot,
|
|
253
|
+
TerminalCommand,
|
|
254
|
+
ToolboxManifest,
|
|
255
|
+
)
|
|
256
|
+
from .miniapp import (
|
|
257
|
+
API_PREFIX,
|
|
258
|
+
APP_API_SOCKET,
|
|
259
|
+
APP_CODE_DIR,
|
|
260
|
+
APP_HOME,
|
|
261
|
+
APP_RUN_DIR,
|
|
262
|
+
APP_SOCKET,
|
|
263
|
+
HEALTH_PATH,
|
|
264
|
+
MANIFEST_FILE,
|
|
265
|
+
MINIAPP_API_VERSION,
|
|
266
|
+
PERSON_HEADER,
|
|
267
|
+
RUNTIME_IMAGE,
|
|
268
|
+
AppName,
|
|
269
|
+
MiniAppFile,
|
|
270
|
+
MiniAppManifest,
|
|
271
|
+
MiniAppNeeds,
|
|
272
|
+
MiniAppServer,
|
|
273
|
+
MiniAppUi,
|
|
274
|
+
)
|
|
275
|
+
from .provider import PROTOCOLS, PROVIDER_API_VERSION, Protocol, Provider, ProviderModel
|
|
276
|
+
from .remote import (
|
|
277
|
+
REMOTE_API_VERSION,
|
|
278
|
+
AgentList,
|
|
279
|
+
AppHttpAnswer,
|
|
280
|
+
AppHttpParams,
|
|
281
|
+
AppList,
|
|
282
|
+
AppUi,
|
|
283
|
+
AppUiParams,
|
|
284
|
+
ClosedNotice,
|
|
285
|
+
DetachParams,
|
|
286
|
+
InboxList,
|
|
287
|
+
PushKey,
|
|
288
|
+
PushSubscribeParams,
|
|
289
|
+
PushSubscription,
|
|
290
|
+
RemoteAgent,
|
|
291
|
+
RemoteProject,
|
|
292
|
+
SessionList,
|
|
293
|
+
SharedApp,
|
|
294
|
+
SharedApps,
|
|
295
|
+
SharedSession,
|
|
296
|
+
StartedSession,
|
|
297
|
+
StartSessionParams,
|
|
298
|
+
)
|
|
299
|
+
from .sandbox import (
|
|
300
|
+
CA_BUNDLE,
|
|
301
|
+
CA_ENV,
|
|
302
|
+
DISPLAY_ENV,
|
|
303
|
+
SANDBOX_API_VERSION,
|
|
304
|
+
FilteredNetwork,
|
|
305
|
+
ImageInfo,
|
|
306
|
+
ImageMount,
|
|
307
|
+
Injection,
|
|
308
|
+
NetworkPolicy,
|
|
309
|
+
NoNetwork,
|
|
310
|
+
OpenNetwork,
|
|
311
|
+
ProxyImage,
|
|
312
|
+
RuntimeCheck,
|
|
313
|
+
RuntimeCheckItem,
|
|
314
|
+
SandboxExit,
|
|
315
|
+
SandboxSpec,
|
|
316
|
+
SandboxUser,
|
|
317
|
+
WaylandDisplay,
|
|
318
|
+
)
|
|
319
|
+
from .terminal import (
|
|
320
|
+
TerminalStart,
|
|
321
|
+
TerminalStarted,
|
|
322
|
+
terminal_path,
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
__all__ = [
|
|
327
|
+
"ACCOUNT_API_VERSION",
|
|
328
|
+
"ACP_ENDPOINT_API_VERSION",
|
|
329
|
+
"ACP_SUBPROTOCOL",
|
|
330
|
+
"ADDONS_ROOT",
|
|
331
|
+
"ADDON_API_VERSION",
|
|
332
|
+
"ADDON_VERSION_FILE",
|
|
333
|
+
"ANY_CONTEXT",
|
|
334
|
+
"API_PREFIX",
|
|
335
|
+
"APP_API_SOCKET",
|
|
336
|
+
"APP_CODE_DIR",
|
|
337
|
+
"APP_HOME",
|
|
338
|
+
"APP_RUN_DIR",
|
|
339
|
+
"APP_SOCKET",
|
|
340
|
+
"AUTOMATION_API_VERSION",
|
|
341
|
+
"AUTOMATION_FILE",
|
|
342
|
+
"BEARER_SUBPROTOCOL_PREFIX",
|
|
343
|
+
"BINDING_API_VERSION",
|
|
344
|
+
"BLOCKED_AGENT_METHOD_PREFIXES",
|
|
345
|
+
"CA_BUNDLE",
|
|
346
|
+
"CA_ENV",
|
|
347
|
+
"CONTROL_API_VERSION",
|
|
348
|
+
"CONTROL_BASE_PATH",
|
|
349
|
+
"CWD_CHECKED_METHODS",
|
|
350
|
+
"DEFAULT_MAX_MESSAGE_BYTES",
|
|
351
|
+
"DEFAULT_PORT",
|
|
352
|
+
"DEFAULT_TIMEOUT_SEC",
|
|
353
|
+
"DISPLAY_ENV",
|
|
354
|
+
"HARNESS_API_VERSION",
|
|
355
|
+
"HARNESS_LAUNCH_API_VERSION",
|
|
356
|
+
"HEALTH_PATH",
|
|
357
|
+
"IMAGE_VERSION_FILE",
|
|
358
|
+
"MANIFEST_FILE",
|
|
359
|
+
"MAX_APPEND",
|
|
360
|
+
"MAX_LLM_INPUT",
|
|
361
|
+
"MAX_LLM_SCHEMA",
|
|
362
|
+
"MAX_REQUEST",
|
|
363
|
+
"MAX_SCHEMA_BYTES",
|
|
364
|
+
"MAX_SKILL_ARCHIVE_BYTES",
|
|
365
|
+
"MAX_SKILL_BYTES",
|
|
366
|
+
"MAX_SKILL_FILE_BYTES",
|
|
367
|
+
"MINIAPP_API_VERSION",
|
|
368
|
+
"MIN_EVERY_MINUTES",
|
|
369
|
+
"PERMISSION_MODES",
|
|
370
|
+
"PERSON_HEADER",
|
|
371
|
+
"PROTOCOLS",
|
|
372
|
+
"PROVIDER_API_VERSION",
|
|
373
|
+
"REMOTE_API_VERSION",
|
|
374
|
+
"RUNTIME_IMAGE",
|
|
375
|
+
"SANDBOX_API_VERSION",
|
|
376
|
+
"SUBJECT_ROOT",
|
|
377
|
+
"TOKEN_FILE_NAME",
|
|
378
|
+
"AbsolutePath",
|
|
379
|
+
"AccessContext",
|
|
380
|
+
"Account",
|
|
381
|
+
"AccountInfo",
|
|
382
|
+
"AccountLoginRequest",
|
|
383
|
+
"AccountRequest",
|
|
384
|
+
"AccountStatus",
|
|
385
|
+
"AcpCloseCode",
|
|
386
|
+
"AdHocAgentRequest",
|
|
387
|
+
"AddAppRequest",
|
|
388
|
+
"AddonCatalogEntry",
|
|
389
|
+
"AddonInfo",
|
|
390
|
+
"AddonInstallRequest",
|
|
391
|
+
"AddonInstalled",
|
|
392
|
+
"AddonManifest",
|
|
393
|
+
"AddonMcp",
|
|
394
|
+
"AddonPreview",
|
|
395
|
+
"AddonPreviewRequest",
|
|
396
|
+
"AddonSecretSlot",
|
|
397
|
+
"AddonSlot",
|
|
398
|
+
"AddonSlotInfo",
|
|
399
|
+
"Agent",
|
|
400
|
+
"AgentInterface",
|
|
401
|
+
"AgentList",
|
|
402
|
+
"AgentModel",
|
|
403
|
+
"AgentRequest",
|
|
404
|
+
"AgentSettings",
|
|
405
|
+
"AgentSpec",
|
|
406
|
+
"App",
|
|
407
|
+
"AppDeployment",
|
|
408
|
+
"AppHttpAnswer",
|
|
409
|
+
"AppHttpParams",
|
|
410
|
+
"AppLink",
|
|
411
|
+
"AppList",
|
|
412
|
+
"AppLog",
|
|
413
|
+
"AppName",
|
|
414
|
+
"AppSecret",
|
|
415
|
+
"AppSource",
|
|
416
|
+
"AppState",
|
|
417
|
+
"AppUi",
|
|
418
|
+
"AppUiParams",
|
|
419
|
+
"Automation",
|
|
420
|
+
"AutomationAgentInput",
|
|
421
|
+
"AutomationAgentRun",
|
|
422
|
+
"AutomationAppCall",
|
|
423
|
+
"AutomationAppend",
|
|
424
|
+
"AutomationAppended",
|
|
425
|
+
"AutomationCheck",
|
|
426
|
+
"AutomationDefinitionRequest",
|
|
427
|
+
"AutomationEvent",
|
|
428
|
+
"AutomationExample",
|
|
429
|
+
"AutomationLlmUsage",
|
|
430
|
+
"AutomationName",
|
|
431
|
+
"AutomationOnly",
|
|
432
|
+
"AutomationRun",
|
|
433
|
+
"AutomationServices",
|
|
434
|
+
"AutomationSubject",
|
|
435
|
+
"AutomationView",
|
|
436
|
+
"Binding",
|
|
437
|
+
"BindingInfo",
|
|
438
|
+
"BindingRequest",
|
|
439
|
+
"Build",
|
|
440
|
+
"BuildLog",
|
|
441
|
+
"BuildState",
|
|
442
|
+
"BuiltinAgent",
|
|
443
|
+
"CacheDeclaration",
|
|
444
|
+
"CacheFolders",
|
|
445
|
+
"CacheInfo",
|
|
446
|
+
"CacheName",
|
|
447
|
+
"CacheSharing",
|
|
448
|
+
"CacheSizes",
|
|
449
|
+
"CachesInfo",
|
|
450
|
+
"CachesRequest",
|
|
451
|
+
"ClosedNotice",
|
|
452
|
+
"CommandSecret",
|
|
453
|
+
"ConfigFileSlot",
|
|
454
|
+
"Confinement",
|
|
455
|
+
"Connection",
|
|
456
|
+
"ContextColor",
|
|
457
|
+
"ContextInfo",
|
|
458
|
+
"ContextName",
|
|
459
|
+
"ContextRequest",
|
|
460
|
+
"CreateAutomationRequest",
|
|
461
|
+
"CreateDirectoryRequest",
|
|
462
|
+
"CreateKnowledgeFolderRequest",
|
|
463
|
+
"CreateProjectRequest",
|
|
464
|
+
"CreateSessionRequest",
|
|
465
|
+
"CreateSkillRequest",
|
|
466
|
+
"DetachParams",
|
|
467
|
+
"DeviceScope",
|
|
468
|
+
"DirectoryEntry",
|
|
469
|
+
"DirectoryListing",
|
|
470
|
+
"EgressEntry",
|
|
471
|
+
"EgressEvent",
|
|
472
|
+
"Enforcement",
|
|
473
|
+
"EnvMap",
|
|
474
|
+
"EnvSecret",
|
|
475
|
+
"FileContent",
|
|
476
|
+
"FileSecret",
|
|
477
|
+
"FileSource",
|
|
478
|
+
"FilteredNetwork",
|
|
479
|
+
"GeneratedFile",
|
|
480
|
+
"GlobalCachesInfo",
|
|
481
|
+
"HarnessDescriptor",
|
|
482
|
+
"HarnessInfo",
|
|
483
|
+
"HarnessLaunch",
|
|
484
|
+
"HarnessName",
|
|
485
|
+
"Health",
|
|
486
|
+
"HomePath",
|
|
487
|
+
"HostPath",
|
|
488
|
+
"HttpMcpServer",
|
|
489
|
+
"ImageInfo",
|
|
490
|
+
"ImageMount",
|
|
491
|
+
"ImageUpdates",
|
|
492
|
+
"ImageUpdatesRequest",
|
|
493
|
+
"InboxList",
|
|
494
|
+
"InboxMessage",
|
|
495
|
+
"InboxStatus",
|
|
496
|
+
"Injection",
|
|
497
|
+
"KnowledgeFolder",
|
|
498
|
+
"KnowledgeFolderView",
|
|
499
|
+
"KnowledgeListing",
|
|
500
|
+
"KnowledgeNote",
|
|
501
|
+
"LlmModel",
|
|
502
|
+
"LlmRequest",
|
|
503
|
+
"LlmResponse",
|
|
504
|
+
"LlmUsage",
|
|
505
|
+
"LoginRecipe",
|
|
506
|
+
"LoginWindow",
|
|
507
|
+
"McpServer",
|
|
508
|
+
"McpTransport",
|
|
509
|
+
"MiniAppFile",
|
|
510
|
+
"MiniAppManifest",
|
|
511
|
+
"MiniAppNeeds",
|
|
512
|
+
"MiniAppServer",
|
|
513
|
+
"MiniAppUi",
|
|
514
|
+
"ModelAccess",
|
|
515
|
+
"Mount",
|
|
516
|
+
"NetworkFilterInfo",
|
|
517
|
+
"NetworkMode",
|
|
518
|
+
"NetworkPolicy",
|
|
519
|
+
"NeutralConfig",
|
|
520
|
+
"NoNetwork",
|
|
521
|
+
"OpenNetwork",
|
|
522
|
+
"PairDeviceRequest",
|
|
523
|
+
"PatchAgentRequest",
|
|
524
|
+
"PermissionMapping",
|
|
525
|
+
"PermissionMode",
|
|
526
|
+
"PersonName",
|
|
527
|
+
"PolicyErrorCode",
|
|
528
|
+
"PolicyRule",
|
|
529
|
+
"Problem",
|
|
530
|
+
"Project",
|
|
531
|
+
"ProjectCachesInfo",
|
|
532
|
+
"ProjectSettingsRequest",
|
|
533
|
+
"Protocol",
|
|
534
|
+
"Provider",
|
|
535
|
+
"ProviderInfo",
|
|
536
|
+
"ProviderModel",
|
|
537
|
+
"ProviderRequest",
|
|
538
|
+
"ProviderTemplate",
|
|
539
|
+
"ProxyImage",
|
|
540
|
+
"PushKey",
|
|
541
|
+
"PushSubscribeParams",
|
|
542
|
+
"PushSubscription",
|
|
543
|
+
"PutSecretRequest",
|
|
544
|
+
"RemoteAgent",
|
|
545
|
+
"RemoteDevice",
|
|
546
|
+
"RemoteLight",
|
|
547
|
+
"RemotePairing",
|
|
548
|
+
"RemoteProject",
|
|
549
|
+
"RemoteStatus",
|
|
550
|
+
"RequiredHost",
|
|
551
|
+
"ResourceName",
|
|
552
|
+
"Resources",
|
|
553
|
+
"RevealRequest",
|
|
554
|
+
"RunState",
|
|
555
|
+
"RuntimeCheck",
|
|
556
|
+
"RuntimeCheckItem",
|
|
557
|
+
"SandboxExit",
|
|
558
|
+
"SandboxSpec",
|
|
559
|
+
"SandboxUser",
|
|
560
|
+
"ScanHit",
|
|
561
|
+
"Schedule",
|
|
562
|
+
"SecretInfo",
|
|
563
|
+
"SecretPath",
|
|
564
|
+
"SecretRef",
|
|
565
|
+
"SecretSent",
|
|
566
|
+
"Session",
|
|
567
|
+
"SessionChanges",
|
|
568
|
+
"SessionDefaults",
|
|
569
|
+
"SessionErrorCode",
|
|
570
|
+
"SessionFile",
|
|
571
|
+
"SessionFileChange",
|
|
572
|
+
"SessionFolder",
|
|
573
|
+
"SessionFolderEntry",
|
|
574
|
+
"SessionFound",
|
|
575
|
+
"SessionInput",
|
|
576
|
+
"SessionLifecycle",
|
|
577
|
+
"SessionList",
|
|
578
|
+
"SessionMount",
|
|
579
|
+
"SessionMounts",
|
|
580
|
+
"SessionOrigin",
|
|
581
|
+
"SessionOutput",
|
|
582
|
+
"SessionSubject",
|
|
583
|
+
"SetAppPersonsRequest",
|
|
584
|
+
"SetAppSecretRequest",
|
|
585
|
+
"SetAppShortcutRequest",
|
|
586
|
+
"SetKnowledgeRootRequest",
|
|
587
|
+
"SetRemoteGatewayRequest",
|
|
588
|
+
"SetSessionRemoteRequest",
|
|
589
|
+
"SharedApp",
|
|
590
|
+
"SharedApps",
|
|
591
|
+
"SharedSession",
|
|
592
|
+
"SkillFile",
|
|
593
|
+
"SkillFileRequest",
|
|
594
|
+
"SkillInfo",
|
|
595
|
+
"SkillName",
|
|
596
|
+
"SkillRequest",
|
|
597
|
+
"SkillScan",
|
|
598
|
+
"SkillUrlRequest",
|
|
599
|
+
"StartSessionParams",
|
|
600
|
+
"StartedSession",
|
|
601
|
+
"StateSlot",
|
|
602
|
+
"StdioMcpServer",
|
|
603
|
+
"StoreSecret",
|
|
604
|
+
"TerminalCommand",
|
|
605
|
+
"TerminalStart",
|
|
606
|
+
"TerminalStarted",
|
|
607
|
+
"ToolboxContainerfile",
|
|
608
|
+
"ToolboxContainerfileUpdate",
|
|
609
|
+
"ToolboxInfo",
|
|
610
|
+
"ToolboxManifest",
|
|
611
|
+
"TryAutomationRequest",
|
|
612
|
+
"WaylandDisplay",
|
|
613
|
+
"WorkFolderInfo",
|
|
614
|
+
"WorkFolders",
|
|
615
|
+
"WorkFoldersInfo",
|
|
616
|
+
"acp_path",
|
|
617
|
+
"check_binding",
|
|
618
|
+
"egress_target",
|
|
619
|
+
"is_within",
|
|
620
|
+
"mcp_transport",
|
|
621
|
+
"session_acp_path",
|
|
622
|
+
"terminal_path",
|
|
623
|
+
]
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
_modules: dict[str, str] = {} # exported name → its module, from the imports above
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
def __getattr__(name: str) -> object:
|
|
630
|
+
if not _modules:
|
|
631
|
+
tree = ast.parse(Path(__file__).read_text())
|
|
632
|
+
_modules.update(
|
|
633
|
+
(alias.asname or alias.name, node.module or "")
|
|
634
|
+
for node in ast.walk(tree)
|
|
635
|
+
if isinstance(node, ast.ImportFrom) and node.level == 1
|
|
636
|
+
for alias in node.names
|
|
637
|
+
)
|
|
638
|
+
if name not in _modules:
|
|
639
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
640
|
+
value = getattr(importlib.import_module(f".{_modules[name]}", __name__), name)
|
|
641
|
+
globals()[name] = value # found directly next time
|
|
642
|
+
return value
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""Contract E — Account (`handler.account/v1`): a subscription a harness logs in with (Claude Pro, a
|
|
2
|
+
ChatGPT plan). One file per account in `~/.config/handler-ai/accounts/<name>.toml`, written
|
|
3
|
+
through the Control API (D.9) or by hand. Its login (its harness's `[login]`, contract B): a token
|
|
4
|
+
login's `token` is a reference to the token the person gave (handler's secret store, or where they
|
|
5
|
+
keep it); a file login's credential file is kept by handler, not in this file."""
|
|
6
|
+
|
|
7
|
+
import tomllib
|
|
8
|
+
from typing import Annotated, Literal
|
|
9
|
+
|
|
10
|
+
from pydantic import Field
|
|
11
|
+
|
|
12
|
+
from .common import AccessContext, SecretRef, StrictDocument
|
|
13
|
+
|
|
14
|
+
ACCOUNT_API_VERSION = "handler.account/v1"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class Account(StrictDocument):
|
|
18
|
+
api_version: Literal["handler.account/v1"]
|
|
19
|
+
harness: Annotated[str, Field(min_length=1)]
|
|
20
|
+
description: str | None = None
|
|
21
|
+
# its subscription's plan, one of its harness's `login.plans` (e.g. "pro"): told to the
|
|
22
|
+
# harness, which cannot learn it from a token login
|
|
23
|
+
plan: Annotated[str, Field(min_length=1)] | None = None
|
|
24
|
+
# its harness may use the account's own connectors (claude.ai MCP servers), where it has
|
|
25
|
+
# some (B.1 accountConnectors): they reach whatever the account connected
|
|
26
|
+
connectors: bool = False
|
|
27
|
+
# a token login's token (E2): `{secret = "accounts/<name>/token"}` when pasted through handler,
|
|
28
|
+
# or where the person keeps it (`env`, `file`, `command`); none until logged in
|
|
29
|
+
token: SecretRef | None = None
|
|
30
|
+
# the project contexts it may be used in (D.19): their names, or `any`; none: only in
|
|
31
|
+
# projects without a context and outside projects
|
|
32
|
+
contexts: list[AccessContext] = []
|
|
33
|
+
|
|
34
|
+
@classmethod
|
|
35
|
+
def from_toml(cls, text: str) -> "Account":
|
|
36
|
+
return cls.model_validate(tomllib.loads(text))
|