ChatTask 0.1.3__tar.gz → 0.1.5__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.
- {chattask-0.1.3/src/ChatTask.egg-info → chattask-0.1.5}/PKG-INFO +13 -1
- {chattask-0.1.3 → chattask-0.1.5}/README.md +10 -0
- {chattask-0.1.3 → chattask-0.1.5}/pyproject.toml +2 -2
- {chattask-0.1.3 → chattask-0.1.5/src/ChatTask.egg-info}/PKG-INFO +13 -1
- {chattask-0.1.3 → chattask-0.1.5}/src/ChatTask.egg-info/SOURCES.txt +8 -0
- {chattask-0.1.3 → chattask-0.1.5}/src/ChatTask.egg-info/requires.txt +2 -0
- {chattask-0.1.3 → chattask-0.1.5}/src/chattask/__init__.py +3 -3
- {chattask-0.1.3 → chattask-0.1.5}/src/chattask/auth.py +5 -1
- {chattask-0.1.3 → chattask-0.1.5}/src/chattask/cli.py +133 -0
- {chattask-0.1.3 → chattask-0.1.5}/src/chattask/codex_tasks.py +136 -9
- {chattask-0.1.3 → chattask-0.1.5}/src/chattask/config.py +6 -1
- chattask-0.1.5/src/chattask/durable.py +808 -0
- chattask-0.1.5/src/chattask/durable_archive.py +90 -0
- chattask-0.1.5/src/chattask/durable_research.py +67 -0
- chattask-0.1.5/src/chattask/overleaf_native.mjs +279 -0
- chattask-0.1.5/src/chattask/research.py +631 -0
- chattask-0.1.5/src/chattask/research_compiler.py +161 -0
- chattask-0.1.5/src/chattask/research_discovery.py +76 -0
- {chattask-0.1.3 → chattask-0.1.5}/src/chattask/service.py +45 -2
- {chattask-0.1.3 → chattask-0.1.5}/src/chattask/settings.py +47 -2
- {chattask-0.1.3 → chattask-0.1.5}/src/chattask/web.py +212 -10
- {chattask-0.1.3 → chattask-0.1.5}/src/chattask/web_static/app.js +244 -0
- {chattask-0.1.3 → chattask-0.1.5}/src/chattask/web_static/index.html +62 -0
- {chattask-0.1.3 → chattask-0.1.5}/src/chattask/web_static/style.css +1 -0
- {chattask-0.1.3 → chattask-0.1.5}/src/chattask/workflow.py +1 -1
- chattask-0.1.5/src/chattask/workspace_analysis.py +579 -0
- {chattask-0.1.3 → chattask-0.1.5}/tests/test_version.py +1 -1
- {chattask-0.1.3 → chattask-0.1.5}/LICENSE +0 -0
- {chattask-0.1.3 → chattask-0.1.5}/setup.cfg +0 -0
- {chattask-0.1.3 → chattask-0.1.5}/src/ChatTask.egg-info/dependency_links.txt +0 -0
- {chattask-0.1.3 → chattask-0.1.5}/src/ChatTask.egg-info/entry_points.txt +0 -0
- {chattask-0.1.3 → chattask-0.1.5}/src/ChatTask.egg-info/top_level.txt +0 -0
- {chattask-0.1.3 → chattask-0.1.5}/src/chattask/agent_tasks.py +0 -0
- {chattask-0.1.3 → chattask-0.1.5}/src/chattask/broker.py +0 -0
- {chattask-0.1.3 → chattask-0.1.5}/src/chattask/executor.py +0 -0
- {chattask-0.1.3 → chattask-0.1.5}/src/chattask/package_plan.py +0 -0
- {chattask-0.1.3 → chattask-0.1.5}/src/chattask/package_publication.py +0 -0
- {chattask-0.1.3 → chattask-0.1.5}/src/chattask/package_service.py +0 -0
- {chattask-0.1.3 → chattask-0.1.5}/src/chattask/package_template.py +0 -0
- {chattask-0.1.3 → chattask-0.1.5}/src/chattask/package_validation.py +0 -0
- {chattask-0.1.3 → chattask-0.1.5}/src/chattask/release.py +0 -0
- {chattask-0.1.3 → chattask-0.1.5}/src/chattask/source.py +0 -0
- {chattask-0.1.3 → chattask-0.1.5}/src/chattask/tool_client.py +0 -0
- {chattask-0.1.3 → chattask-0.1.5}/tests/test_cli.py +0 -0
- {chattask-0.1.3 → chattask-0.1.5}/tests/test_docs_deployment.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ChatTask
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: ChatTask: a ChatArch Python package.
|
|
5
5
|
Author-email: ChatArch <rex@chatarch.org>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -23,6 +23,8 @@ Requires-Dist: packaging<27,>=24
|
|
|
23
23
|
Requires-Dist: tomli<3,>=2; python_version < "3.11"
|
|
24
24
|
Provides-Extra: dev
|
|
25
25
|
Requires-Dist: build; extra == "dev"
|
|
26
|
+
Requires-Dist: setuptools>=61.0; extra == "dev"
|
|
27
|
+
Requires-Dist: wheel; extra == "dev"
|
|
26
28
|
Requires-Dist: pytest; extra == "dev"
|
|
27
29
|
Requires-Dist: twine; extra == "dev"
|
|
28
30
|
Provides-Extra: web
|
|
@@ -53,8 +55,18 @@ ChatTask 从 0.1.0 版本起提供可复用的任务模板、受信 Git 源码
|
|
|
53
55
|
|
|
54
56
|
ChatTask 的主模型是 **任务 → Codex + Sandbox → 结果**。任务说明和所选镜像决定工作内容;发包只是示例,不是执行器的固定步骤。当前源码提供 `chattask run` 和受站点登录保护的 `/api/agent/tasks`,结果保存原生事件、产物摘要和 Sandbox 回收证据。镜像预装 infra,运行时 env 只注入服务端选择的模型/工具凭据;优先使用短期受限网关,不把原始 GitHub/PyPI 凭据交给 guest。参见[通用任务、Python 发包模板与网关边界](docs/tasks.md)。源码能力不等于 PyPI 或线上已更新。
|
|
55
57
|
|
|
58
|
+
### 长期任务候选
|
|
59
|
+
|
|
60
|
+
“长期任务”视图和 `chattask task` 命令保存稳定 Task 与逐轮 Run;独立 `chattask worker --env-profile site --operator operator` 处理队列。每轮保存受限的工作区与原生 Codex 会话检查点,后续轮次在新 Sandbox 原生接续。暂停是排队前或本轮结束时的协作式操作。生产部署须单独核验真实镜像、网关、原服务和浏览器;详见[长期任务合约](docs/tasks.md#长期任务候选)。
|
|
61
|
+
|
|
62
|
+
显式选择 `research` 时,可提交已核对来源记录,也可通过受限的 arXiv 摘要自动检索创建;后者只保存摘要,不代表读过论文全文。受信 worker 在本轮原生执行及清理通过后,将 `result/research/main.tex` 等文件发布到配置的原 Overleaf 工程并核对源码;PDF 由独立隔离容器使用原服务镜像和只读公共 TeX 工具链编译,PDF/源码回读归入本轮产物。未知外部写入或编译清理结果保持阻塞,需显式同操作核对。普通开发任务不依赖 Overleaf 配置。
|
|
63
|
+
|
|
56
64
|
## 从源码使用
|
|
57
65
|
|
|
66
|
+
### Workspace 材料分析
|
|
67
|
+
|
|
68
|
+
从 0.1.4 起,受信 Workspace 可创建资料快照、单独确认运行,并回读真实模型生成的摘要校验报告。Task 页面「材料分析」显示任务来源与 Run 历史。这是只读材料执行器,不调用工具或读取宿主文件,也不会把报告完成标成原建议完成;配置、认证与 HTTP 合约见[材料分析接入](docs/workspace.md)。
|
|
69
|
+
|
|
58
70
|
```bash
|
|
59
71
|
python -m pip install -e '.[web,dev]'
|
|
60
72
|
chattask --tree
|
|
@@ -13,8 +13,18 @@ ChatTask 从 0.1.0 版本起提供可复用的任务模板、受信 Git 源码
|
|
|
13
13
|
|
|
14
14
|
ChatTask 的主模型是 **任务 → Codex + Sandbox → 结果**。任务说明和所选镜像决定工作内容;发包只是示例,不是执行器的固定步骤。当前源码提供 `chattask run` 和受站点登录保护的 `/api/agent/tasks`,结果保存原生事件、产物摘要和 Sandbox 回收证据。镜像预装 infra,运行时 env 只注入服务端选择的模型/工具凭据;优先使用短期受限网关,不把原始 GitHub/PyPI 凭据交给 guest。参见[通用任务、Python 发包模板与网关边界](docs/tasks.md)。源码能力不等于 PyPI 或线上已更新。
|
|
15
15
|
|
|
16
|
+
### 长期任务候选
|
|
17
|
+
|
|
18
|
+
“长期任务”视图和 `chattask task` 命令保存稳定 Task 与逐轮 Run;独立 `chattask worker --env-profile site --operator operator` 处理队列。每轮保存受限的工作区与原生 Codex 会话检查点,后续轮次在新 Sandbox 原生接续。暂停是排队前或本轮结束时的协作式操作。生产部署须单独核验真实镜像、网关、原服务和浏览器;详见[长期任务合约](docs/tasks.md#长期任务候选)。
|
|
19
|
+
|
|
20
|
+
显式选择 `research` 时,可提交已核对来源记录,也可通过受限的 arXiv 摘要自动检索创建;后者只保存摘要,不代表读过论文全文。受信 worker 在本轮原生执行及清理通过后,将 `result/research/main.tex` 等文件发布到配置的原 Overleaf 工程并核对源码;PDF 由独立隔离容器使用原服务镜像和只读公共 TeX 工具链编译,PDF/源码回读归入本轮产物。未知外部写入或编译清理结果保持阻塞,需显式同操作核对。普通开发任务不依赖 Overleaf 配置。
|
|
21
|
+
|
|
16
22
|
## 从源码使用
|
|
17
23
|
|
|
24
|
+
### Workspace 材料分析
|
|
25
|
+
|
|
26
|
+
从 0.1.4 起,受信 Workspace 可创建资料快照、单独确认运行,并回读真实模型生成的摘要校验报告。Task 页面「材料分析」显示任务来源与 Run 历史。这是只读材料执行器,不调用工具或读取宿主文件,也不会把报告完成标成原建议完成;配置、认证与 HTTP 合约见[材料分析接入](docs/workspace.md)。
|
|
27
|
+
|
|
18
28
|
```bash
|
|
19
29
|
python -m pip install -e '.[web,dev]'
|
|
20
30
|
chattask --tree
|
|
@@ -26,7 +26,7 @@ Documentation = "https://arch.gh.wzhecnu.cn/ChatTask/"
|
|
|
26
26
|
chattask = "chattask.cli:main"
|
|
27
27
|
|
|
28
28
|
[project.optional-dependencies]
|
|
29
|
-
dev = ["build", "pytest", "twine"]
|
|
29
|
+
dev = ["build", "setuptools>=61.0", "wheel", "pytest", "twine"]
|
|
30
30
|
web = ["fastapi>=0.133,<0.143", "uvicorn>=0.41,<0.55", "ChatLogin[web]>=0.2.0,<0.3.0", "ChatPyPI>=0.2.14,<0.3.0", "ChatGH>=0.2.14,<0.3.0"]
|
|
31
31
|
docs = ["mkdocs>=1.6,<2.0", "mkdocs-material>=9.5,<9.7", "mkdocs-static-i18n>=1.2,<2.0", "mike>=2.0,<3.0"]
|
|
32
32
|
|
|
@@ -43,4 +43,4 @@ where = ["src"]
|
|
|
43
43
|
include-package-data = true
|
|
44
44
|
|
|
45
45
|
[tool.setuptools.package-data]
|
|
46
|
-
chattask = ["web_static/*.html", "web_static/*.css", "web_static/*.js"]
|
|
46
|
+
chattask = ["web_static/*.html", "web_static/*.css", "web_static/*.js", "overleaf_native.mjs"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ChatTask
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: ChatTask: a ChatArch Python package.
|
|
5
5
|
Author-email: ChatArch <rex@chatarch.org>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -23,6 +23,8 @@ Requires-Dist: packaging<27,>=24
|
|
|
23
23
|
Requires-Dist: tomli<3,>=2; python_version < "3.11"
|
|
24
24
|
Provides-Extra: dev
|
|
25
25
|
Requires-Dist: build; extra == "dev"
|
|
26
|
+
Requires-Dist: setuptools>=61.0; extra == "dev"
|
|
27
|
+
Requires-Dist: wheel; extra == "dev"
|
|
26
28
|
Requires-Dist: pytest; extra == "dev"
|
|
27
29
|
Requires-Dist: twine; extra == "dev"
|
|
28
30
|
Provides-Extra: web
|
|
@@ -53,8 +55,18 @@ ChatTask 从 0.1.0 版本起提供可复用的任务模板、受信 Git 源码
|
|
|
53
55
|
|
|
54
56
|
ChatTask 的主模型是 **任务 → Codex + Sandbox → 结果**。任务说明和所选镜像决定工作内容;发包只是示例,不是执行器的固定步骤。当前源码提供 `chattask run` 和受站点登录保护的 `/api/agent/tasks`,结果保存原生事件、产物摘要和 Sandbox 回收证据。镜像预装 infra,运行时 env 只注入服务端选择的模型/工具凭据;优先使用短期受限网关,不把原始 GitHub/PyPI 凭据交给 guest。参见[通用任务、Python 发包模板与网关边界](docs/tasks.md)。源码能力不等于 PyPI 或线上已更新。
|
|
55
57
|
|
|
58
|
+
### 长期任务候选
|
|
59
|
+
|
|
60
|
+
“长期任务”视图和 `chattask task` 命令保存稳定 Task 与逐轮 Run;独立 `chattask worker --env-profile site --operator operator` 处理队列。每轮保存受限的工作区与原生 Codex 会话检查点,后续轮次在新 Sandbox 原生接续。暂停是排队前或本轮结束时的协作式操作。生产部署须单独核验真实镜像、网关、原服务和浏览器;详见[长期任务合约](docs/tasks.md#长期任务候选)。
|
|
61
|
+
|
|
62
|
+
显式选择 `research` 时,可提交已核对来源记录,也可通过受限的 arXiv 摘要自动检索创建;后者只保存摘要,不代表读过论文全文。受信 worker 在本轮原生执行及清理通过后,将 `result/research/main.tex` 等文件发布到配置的原 Overleaf 工程并核对源码;PDF 由独立隔离容器使用原服务镜像和只读公共 TeX 工具链编译,PDF/源码回读归入本轮产物。未知外部写入或编译清理结果保持阻塞,需显式同操作核对。普通开发任务不依赖 Overleaf 配置。
|
|
63
|
+
|
|
56
64
|
## 从源码使用
|
|
57
65
|
|
|
66
|
+
### Workspace 材料分析
|
|
67
|
+
|
|
68
|
+
从 0.1.4 起,受信 Workspace 可创建资料快照、单独确认运行,并回读真实模型生成的摘要校验报告。Task 页面「材料分析」显示任务来源与 Run 历史。这是只读材料执行器,不调用工具或读取宿主文件,也不会把报告完成标成原建议完成;配置、认证与 HTTP 合约见[材料分析接入](docs/workspace.md)。
|
|
69
|
+
|
|
58
70
|
```bash
|
|
59
71
|
python -m pip install -e '.[web,dev]'
|
|
60
72
|
chattask --tree
|
|
@@ -14,19 +14,27 @@ src/chattask/broker.py
|
|
|
14
14
|
src/chattask/cli.py
|
|
15
15
|
src/chattask/codex_tasks.py
|
|
16
16
|
src/chattask/config.py
|
|
17
|
+
src/chattask/durable.py
|
|
18
|
+
src/chattask/durable_archive.py
|
|
19
|
+
src/chattask/durable_research.py
|
|
17
20
|
src/chattask/executor.py
|
|
21
|
+
src/chattask/overleaf_native.mjs
|
|
18
22
|
src/chattask/package_plan.py
|
|
19
23
|
src/chattask/package_publication.py
|
|
20
24
|
src/chattask/package_service.py
|
|
21
25
|
src/chattask/package_template.py
|
|
22
26
|
src/chattask/package_validation.py
|
|
23
27
|
src/chattask/release.py
|
|
28
|
+
src/chattask/research.py
|
|
29
|
+
src/chattask/research_compiler.py
|
|
30
|
+
src/chattask/research_discovery.py
|
|
24
31
|
src/chattask/service.py
|
|
25
32
|
src/chattask/settings.py
|
|
26
33
|
src/chattask/source.py
|
|
27
34
|
src/chattask/tool_client.py
|
|
28
35
|
src/chattask/web.py
|
|
29
36
|
src/chattask/workflow.py
|
|
37
|
+
src/chattask/workspace_analysis.py
|
|
30
38
|
src/chattask/web_static/app.js
|
|
31
39
|
src/chattask/web_static/index.html
|
|
32
40
|
src/chattask/web_static/style.css
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""ChatTask: explicit task execution, sessions and an optional browser adapter."""
|
|
2
2
|
|
|
3
|
-
__version__ = "0.1.
|
|
3
|
+
__version__ = "0.1.5"
|
|
4
4
|
__all__ = ["__version__", "TaskService", "TaskSettings", "create_app", "state_paths", "WorkflowService", "TaskStore"]
|
|
5
5
|
|
|
6
6
|
|
|
@@ -17,9 +17,9 @@ def __getattr__(name):
|
|
|
17
17
|
raise AttributeError(name)
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
def create_app(settings=None, *, service=None, workflow=None, agent_tasks=None):
|
|
20
|
+
def create_app(settings=None, *, service=None, workflow=None, agent_tasks=None, analysis=None, auth_adapter=None, durable_tasks=None):
|
|
21
21
|
from .web import create_app as factory
|
|
22
|
-
return factory(settings, service=service, workflow=workflow, agent_tasks=agent_tasks)
|
|
22
|
+
return factory(settings, service=service, workflow=workflow, agent_tasks=agent_tasks, analysis=analysis, auth_adapter=auth_adapter, durable_tasks=durable_tasks)
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
def state_paths(*, home=None):
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""Optional shared ChatLogin adapter; no second authentication protocol."""
|
|
2
|
+
import json
|
|
2
3
|
from urllib.parse import urlsplit
|
|
3
4
|
from chatlogin import PasswordBackend,Principal,SessionManager,MemorySessionStore,hash_password
|
|
4
5
|
from chatlogin.fastapi import CookieSettings,FastAPIAuth
|
|
@@ -8,7 +9,10 @@ from chatlogin.ui import LoginUI
|
|
|
8
9
|
def create_auth(settings):
|
|
9
10
|
if not settings.username or not settings.password:
|
|
10
11
|
raise ValueError('Web serving requires CHATTASK_LOGIN_USERNAME and CHATTASK_LOGIN_PASSWORD')
|
|
11
|
-
|
|
12
|
+
users={settings.username:(Principal('site-operator','站点管理员'),hash_password(settings.password))}
|
|
13
|
+
for entry in json.loads(settings.login_users_json or '[]'):
|
|
14
|
+
users[entry['username']]=(Principal(entry['principal_id'],entry['display_name']),hash_password(entry['password']))
|
|
15
|
+
backend=PasswordBackend(users)
|
|
12
16
|
return FastAPIAuth(backend,SessionManager(MemorySessionStore(max_sessions=128),instance='chattask',ttl=86400),
|
|
13
17
|
origin=settings.origin,cookie=CookieSettings(name='sandbox_site_session',secure=urlsplit(settings.origin).scheme=='https'),
|
|
14
18
|
ui=LoginUI(title='Sandbox',subtitle='任务实验台 · 使用统一站点账号登录后,运行任务或继续一个环境。',
|
|
@@ -98,6 +98,139 @@ def run_command(instructions,instructions_file,image_profile,request_id,input_ta
|
|
|
98
98
|
if result['status']!='completed':raise click.exceptions.Exit(1)
|
|
99
99
|
|
|
100
100
|
|
|
101
|
+
def _durable_service(env_profile):
|
|
102
|
+
from .settings import load_settings
|
|
103
|
+
from .durable import configured_service
|
|
104
|
+
return configured_service(load_settings(profile=env_profile))
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def _durable_call(operation, env_profile, owner, *args):
|
|
108
|
+
import json
|
|
109
|
+
from .durable import DurableConflict
|
|
110
|
+
try:
|
|
111
|
+
result = getattr(_durable_service(env_profile), operation)(owner, *args)
|
|
112
|
+
except (KeyError, ValueError, OSError, DurableConflict) as exc:
|
|
113
|
+
raise click.ClickException(str(exc)) from exc
|
|
114
|
+
click.echo(json.dumps(result, ensure_ascii=False))
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
@main.group(name='task')
|
|
118
|
+
def task_group():
|
|
119
|
+
"""Control private long-term Tasks; rounds execute in a separate worker."""
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
@task_group.command(name='create')
|
|
123
|
+
@click.argument('instructions')
|
|
124
|
+
@click.option('--image-profile', required=True)
|
|
125
|
+
@click.option('--workflow', type=click.Choice(['development','research']), default='development', show_default=True)
|
|
126
|
+
@click.option('--sources-file', type=click.Path(exists=True, dir_okay=False, path_type=str), help='JSON array of caller-verified research source records.')
|
|
127
|
+
@click.option('--request-id', required=True)
|
|
128
|
+
@click.option('--owner', required=True, help='Trusted local principal identity.')
|
|
129
|
+
@click.option('-e', '--env-profile', default=None)
|
|
130
|
+
def durable_create(instructions, image_profile, workflow, sources_file, request_id, owner, env_profile):
|
|
131
|
+
"""Queue the first round of a long-term Task."""
|
|
132
|
+
import json
|
|
133
|
+
from pathlib import Path
|
|
134
|
+
body={'instructions': instructions, 'image_profile': image_profile, 'request_id': request_id, 'workflow': workflow}
|
|
135
|
+
if sources_file:
|
|
136
|
+
try:body['source_records']=json.loads(Path(sources_file).read_text(encoding='utf-8'))
|
|
137
|
+
except (OSError,ValueError) as exc:raise click.ClickException('invalid research sources JSON file') from exc
|
|
138
|
+
_durable_call('create', env_profile, owner, body)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
@task_group.command(name='list')
|
|
142
|
+
@click.option('--owner', required=True)
|
|
143
|
+
@click.option('-e', '--env-profile', default=None)
|
|
144
|
+
def durable_list(owner, env_profile):
|
|
145
|
+
"""List Tasks visible to a trusted local principal."""
|
|
146
|
+
_durable_call('list', env_profile, owner)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
@task_group.command(name='show')
|
|
150
|
+
@click.argument('task_id')
|
|
151
|
+
@click.option('--owner', required=True)
|
|
152
|
+
@click.option('-e', '--env-profile', default=None)
|
|
153
|
+
def durable_show(task_id, owner, env_profile):
|
|
154
|
+
"""Show a Task and its immutable round history."""
|
|
155
|
+
import json
|
|
156
|
+
try:
|
|
157
|
+
service = _durable_service(env_profile)
|
|
158
|
+
click.echo(json.dumps({'task': service.get(owner, task_id), 'runs': service.runs(owner, task_id)}, ensure_ascii=False))
|
|
159
|
+
except (KeyError, ValueError, OSError) as exc:
|
|
160
|
+
raise click.ClickException(str(exc)) from exc
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
@task_group.command(name='resume')
|
|
164
|
+
@click.argument('task_id')
|
|
165
|
+
@click.argument('instructions')
|
|
166
|
+
@click.option('--request-id', required=True)
|
|
167
|
+
@click.option('--acknowledge-unknown', is_flag=True, help='Confirm inspection of interrupted round and external side effects.')
|
|
168
|
+
@click.option('--sources-file', type=click.Path(exists=True, dir_okay=False, path_type=str), help='Optional new caller-verified research source records.')
|
|
169
|
+
@click.option('--owner', required=True)
|
|
170
|
+
@click.option('-e', '--env-profile', default=None)
|
|
171
|
+
def durable_resume(task_id, instructions, request_id, acknowledge_unknown, sources_file, owner, env_profile):
|
|
172
|
+
"""Queue an explicit new native Codex round from a verified checkpoint."""
|
|
173
|
+
import json
|
|
174
|
+
from pathlib import Path
|
|
175
|
+
body={'request_id': request_id, 'instructions': instructions, 'acknowledge_unknown': acknowledge_unknown}
|
|
176
|
+
if sources_file:
|
|
177
|
+
try:body['source_records']=json.loads(Path(sources_file).read_text(encoding='utf-8'))
|
|
178
|
+
except (OSError,ValueError) as exc:raise click.ClickException('invalid research sources JSON file') from exc
|
|
179
|
+
_durable_call('resume', env_profile, owner, task_id, body)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
@task_group.command(name='pause')
|
|
183
|
+
@click.argument('task_id')
|
|
184
|
+
@click.option('--request-id', required=True)
|
|
185
|
+
@click.option('--owner', required=True)
|
|
186
|
+
@click.option('-e', '--env-profile', default=None)
|
|
187
|
+
def durable_pause(task_id, request_id, owner, env_profile):
|
|
188
|
+
"""Pause queued work now or request a cooperative end-of-round pause."""
|
|
189
|
+
_durable_call('pause', env_profile, owner, task_id, {'request_id': request_id})
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
@task_group.command(name='complete')
|
|
193
|
+
@click.argument('task_id')
|
|
194
|
+
@click.option('--request-id', required=True)
|
|
195
|
+
@click.option('--owner', required=True)
|
|
196
|
+
@click.option('-e', '--env-profile', default=None)
|
|
197
|
+
def durable_complete(task_id, request_id, owner, env_profile):
|
|
198
|
+
"""Mark an inactive long-term Task complete; history remains available."""
|
|
199
|
+
_durable_call('complete', env_profile, owner, task_id, {'request_id': request_id})
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
@task_group.command(name='reconcile-research')
|
|
203
|
+
@click.argument('task_id')
|
|
204
|
+
@click.option('--request-id', required=True)
|
|
205
|
+
@click.option('--acknowledge-unknown', is_flag=True,
|
|
206
|
+
help='Confirm inspection of the original project before retrying the same operation identity.')
|
|
207
|
+
@click.option('--owner', required=True)
|
|
208
|
+
@click.option('-e', '--env-profile', default=None)
|
|
209
|
+
def durable_reconcile_research(task_id, request_id, acknowledge_unknown, owner, env_profile):
|
|
210
|
+
"""Queue explicit same-round Research readback/reconciliation."""
|
|
211
|
+
_durable_call('reconcile_research', env_profile, owner, task_id,
|
|
212
|
+
{'request_id': request_id, 'acknowledge_unknown': acknowledge_unknown})
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
@main.command(name='worker')
|
|
216
|
+
@click.option('--once', is_flag=True, help='Claim at most one queued round, then exit.')
|
|
217
|
+
@click.option('--operator', required=True, help='Trusted local operator starting this single writer.')
|
|
218
|
+
@click.option('-e', '--env-profile', required=True, help='Named ChatEnv runtime configuration.')
|
|
219
|
+
def durable_worker(once, operator, env_profile):
|
|
220
|
+
"""Run the independent durable queue executor under a process-held lock."""
|
|
221
|
+
import asyncio, json
|
|
222
|
+
from .settings import load_settings
|
|
223
|
+
from .durable import run_worker
|
|
224
|
+
if not operator.strip():
|
|
225
|
+
raise click.UsageError('nonempty --operator required')
|
|
226
|
+
try:
|
|
227
|
+
result = asyncio.run(run_worker(load_settings(profile=env_profile), once=once))
|
|
228
|
+
except (ValueError, OSError, RuntimeError) as exc:
|
|
229
|
+
raise click.ClickException(str(exc)) from exc
|
|
230
|
+
if once:
|
|
231
|
+
click.echo(json.dumps(result, ensure_ascii=False))
|
|
232
|
+
|
|
233
|
+
|
|
101
234
|
|
|
102
235
|
@main.group(name='package')
|
|
103
236
|
def package_group():
|
|
@@ -11,6 +11,7 @@ import json
|
|
|
11
11
|
import re
|
|
12
12
|
import shlex
|
|
13
13
|
import tarfile
|
|
14
|
+
import uuid
|
|
14
15
|
from urllib.parse import urlsplit
|
|
15
16
|
from opensandbox.models.execd import RunCommandOpts
|
|
16
17
|
from .service import TaskService
|
|
@@ -73,6 +74,19 @@ with tarfile.open('/workspace/result.tar.gz','w:gz') as archive:
|
|
|
73
74
|
print(json.dumps({'files':len(files),'bytes':total}))
|
|
74
75
|
'''
|
|
75
76
|
|
|
77
|
+
|
|
78
|
+
def native_resume_argv(common, model, session_id, help_text, root_help):
|
|
79
|
+
"""Build only the flags confirmed by the installed guest CLI help."""
|
|
80
|
+
try:
|
|
81
|
+
uuid.UUID(session_id)
|
|
82
|
+
except (ValueError, TypeError, AttributeError) as exc:
|
|
83
|
+
raise ValueError('invalid native Codex session id') from exc
|
|
84
|
+
if not all(flag in help_text for flag in ('SESSION_ID','--json','--output-last-message','--model','--skip-git-repo-check')) or not all(flag in root_help for flag in ('--cd','--sandbox')):
|
|
85
|
+
raise RuntimeError('guest Codex lacks required native resume flags')
|
|
86
|
+
return [*common,'--sandbox','danger-full-access','--cd','/workspace/work','exec','resume',
|
|
87
|
+
'--skip-git-repo-check','--model',model,'--json',
|
|
88
|
+
'--output-last-message','/workspace/agent-final.md',session_id,'-']
|
|
89
|
+
|
|
76
90
|
class CodexTaskExecutor:
|
|
77
91
|
def __init__(self,task_service,runtime:CodexRuntime,*,gateway=None,hosts=None):
|
|
78
92
|
self.task_service=task_service;self.runtime=runtime;self.images=dict(runtime.images)
|
|
@@ -86,8 +100,52 @@ class CodexTaskExecutor:
|
|
|
86
100
|
raise ValueError('conflicting trusted postprocessor')
|
|
87
101
|
self.postprocessors[mode]=selected
|
|
88
102
|
|
|
103
|
+
async def execute_durable(self,task,run,checkpoint,save_checkpoint,progress):
|
|
104
|
+
"""Internal-only invocation; public generic create cannot supply these fields."""
|
|
105
|
+
from .durable_archive import validate_checkpoint
|
|
106
|
+
if checkpoint is not None:
|
|
107
|
+
validate_checkpoint(checkpoint, expected=task['checkpoint'], session_id=run['session_id'])
|
|
108
|
+
instructions=run['instructions']
|
|
109
|
+
if run.get('workflow')=='research':
|
|
110
|
+
from .research import research_instructions
|
|
111
|
+
instructions=(research_instructions(task['goal'],run['source_records'],followup=run['number']>1)
|
|
112
|
+
+'\nPlace every result/research path under /workspace/result/research. '
|
|
113
|
+
'Only the provided, caller-verified source records are available; do not claim autonomous discovery.\n'
|
|
114
|
+
+'CURRENT ROUND REQUEST:\n'+instructions)
|
|
115
|
+
invocation={'id':run['id'],'instructions':instructions,
|
|
116
|
+
'image_profile':task['image_profile'],
|
|
117
|
+
'_durable':{'checkpoint':checkpoint,'session_id':run['session_id'],
|
|
118
|
+
'save_checkpoint':save_checkpoint}}
|
|
119
|
+
return await self.execute(invocation,progress,lambda: False)
|
|
120
|
+
|
|
121
|
+
async def reconcile_durable(self,run):
|
|
122
|
+
"""Allow a new writer only after exact owned-container absence and lease closure."""
|
|
123
|
+
sandbox_id, receipt = run.get('sandbox_id'), run.get('runtime_receipt')
|
|
124
|
+
if not run.get('phase') and (not sandbox_id or not isinstance(receipt,dict)):
|
|
125
|
+
return False
|
|
126
|
+
try:
|
|
127
|
+
finder=getattr(self.task_service,'find_run_sandboxes',None)
|
|
128
|
+
if finder is not None:
|
|
129
|
+
# Controller metadata catches a created Sandbox whose response/id was lost.
|
|
130
|
+
if await finder(run['id']):return False
|
|
131
|
+
elif not sandbox_id or not isinstance(receipt,dict):
|
|
132
|
+
return False
|
|
133
|
+
if sandbox_id:
|
|
134
|
+
matched=[container for container in self.task_service.docker.containers.list(all=True)
|
|
135
|
+
if container.name=='sandbox-'+sandbox_id]
|
|
136
|
+
if matched:return False
|
|
137
|
+
if self.gateway:
|
|
138
|
+
closed=await asyncio.to_thread(self.gateway.close,run['id'])
|
|
139
|
+
if closed!={'closed':True}:
|
|
140
|
+
return False
|
|
141
|
+
return True
|
|
142
|
+
except Exception:
|
|
143
|
+
return False
|
|
144
|
+
|
|
89
145
|
async def execute(self,task,update,cancelled):
|
|
90
146
|
runtime=self.runtime
|
|
147
|
+
durable=task.get('_durable')
|
|
148
|
+
model_quiescent=False
|
|
91
149
|
lease=None
|
|
92
150
|
capability=task.get('capability') or {}
|
|
93
151
|
mode=capability.get('mode','generic')
|
|
@@ -96,12 +154,18 @@ class CodexTaskExecutor:
|
|
|
96
154
|
raise ValueError('read-only verification requires gateway, trusted hook and approved input')
|
|
97
155
|
service=None
|
|
98
156
|
sandbox=cfg=None;outcome={'ok':False,'artifacts':[],'cleanup':{'container_absent':True,'not_created':True}}
|
|
157
|
+
sandbox_create_attempted=False
|
|
99
158
|
async with self.task_service.lock:
|
|
100
|
-
|
|
101
|
-
plan=capability.get('plan')
|
|
102
|
-
if mode=='verify':plan={**plan,'verification_of':capability['source_task_id']}
|
|
103
|
-
lease=await asyncio.to_thread(self.gateway.create,task['id'],mode,plan)
|
|
159
|
+
gateway_intent=False
|
|
104
160
|
try:
|
|
161
|
+
if self.gateway:
|
|
162
|
+
if durable:
|
|
163
|
+
await update({'phase':'gateway_intent'})
|
|
164
|
+
gateway_intent=True
|
|
165
|
+
plan=capability.get('plan')
|
|
166
|
+
if mode=='verify':plan={**plan,'verification_of':capability['source_task_id']}
|
|
167
|
+
lease=await asyncio.to_thread(self.gateway.create,task['id'],mode,plan)
|
|
168
|
+
if durable:await update({'phase':'gateway_created'})
|
|
105
169
|
if lease is not None:
|
|
106
170
|
if mode=='verify':
|
|
107
171
|
runtime=replace(runtime,tool_base_url=lease.tool_base_url,tool_access_token=lease.tool_access_token)
|
|
@@ -110,19 +174,44 @@ class CodexTaskExecutor:
|
|
|
110
174
|
tool_base_url=lease.tool_base_url,tool_access_token=lease.tool_access_token)
|
|
111
175
|
service=TaskService(replace(self.task_service.settings,image=self.images[task['image_profile']]),docker_client=self.task_service.docker)
|
|
112
176
|
await update({'index':0,'status':'running'})
|
|
113
|
-
|
|
177
|
+
if durable:await update({'phase':'sandbox_intent'})
|
|
178
|
+
create_options={'ttl_seconds':(120 if mode=='verify' else runtime.seconds)+(hook[1] if hook else 0)+120}
|
|
179
|
+
if durable:create_options['durable_run_id']=task['id']
|
|
180
|
+
if durable:outcome['cleanup']={'container_absent':False,'creation_outcome_unknown':True}
|
|
181
|
+
sandbox_create_attempted=True
|
|
182
|
+
sandbox,cfg,details=await service.create(**create_options)
|
|
114
183
|
outcome.update(sandbox_id=sandbox.id,runtime=details,cleanup={'container_absent':False})
|
|
115
|
-
|
|
184
|
+
if durable:
|
|
185
|
+
await update({'phase':'sandbox_created','sandbox_id':sandbox.id,'runtime':details})
|
|
186
|
+
async def command(argv,seconds=30,cwd='/workspace',full_stdout_limit=None):
|
|
187
|
+
nonlocal model_quiescent
|
|
116
188
|
env=runtime.guest_env()
|
|
117
189
|
if mode=='verify':env.pop('CHATTASK_CODEX_API_KEY',None)
|
|
118
190
|
output=await asyncio.wait_for(sandbox.commands.run(shlex.join(argv),opts=RunCommandOpts(
|
|
119
191
|
timeout=timedelta(seconds=seconds),working_directory=cwd,envs=env)),seconds+10)
|
|
120
192
|
receipt=service.output(output)
|
|
193
|
+
if argv[:2]==['sh','-c'] and 'codex' in argv[2]:
|
|
194
|
+
model_quiescent=True
|
|
121
195
|
for key in ['stdout','stderr','error']:
|
|
122
196
|
if isinstance(receipt.get(key),str):receipt[key]=runtime.redact(receipt[key])
|
|
123
197
|
if receipt['exit_code']!=0 or receipt.get('error'):raise RuntimeError('guest command failed: '+(receipt.get('stderr') or receipt.get('stdout') or str(receipt.get('error')))[:1800])
|
|
198
|
+
if full_stdout_limit is not None:
|
|
199
|
+
# CLI help is a trusted guest probe. Ordinary receipts stay diagnostic-sized.
|
|
200
|
+
chunks=[];size=0
|
|
201
|
+
for log in output.logs.stdout:
|
|
202
|
+
piece=log.text
|
|
203
|
+
size+=len(piece.encode('utf-8'))+(1 if chunks else 0)
|
|
204
|
+
if size>full_stdout_limit:raise RuntimeError('guest Codex help exceeds 16 KiB')
|
|
205
|
+
chunks.append(piece)
|
|
206
|
+
receipt['stdout']=runtime.redact('\n'.join(chunks))
|
|
124
207
|
return receipt
|
|
125
208
|
await command(['mkdir','-p','/workspace/work','/workspace/result','/workspace/codex-home','/workspace/home'],cwd='/')
|
|
209
|
+
if durable and durable['checkpoint'] is not None:
|
|
210
|
+
from .durable_archive import validate_checkpoint
|
|
211
|
+
validate_checkpoint(durable['checkpoint'],session_id=durable['session_id'],
|
|
212
|
+
known_tokens=(runtime.access_token,runtime.tool_access_token))
|
|
213
|
+
await sandbox.files.write_file('/workspace/checkpoint.tar.gz',durable['checkpoint'],mode=600)
|
|
214
|
+
await command(['tar','-xzf','/workspace/checkpoint.tar.gz','-C','/workspace'])
|
|
126
215
|
if self.hosts:
|
|
127
216
|
lines=''.join(ip+' '+host+'\n' for host,ip in sorted(self.hosts.items()))
|
|
128
217
|
await command(['python','-c','from pathlib import Path; p=Path("/etc/hosts"); p.open("a").write('+repr(lines)+')'])
|
|
@@ -156,10 +245,18 @@ class CodexTaskExecutor:
|
|
|
156
245
|
'-c','model_providers.task.env_key="CHATTASK_CODEX_API_KEY"',
|
|
157
246
|
'-c','model_providers.task.base_url='+json.dumps(runtime.base_url),
|
|
158
247
|
'-c','model_providers.task.request_max_retries=1','-c','model_providers.task.stream_max_retries=1',
|
|
159
|
-
'-c','model_reasoning_effort="xhigh"'
|
|
160
|
-
|
|
248
|
+
'-c','model_reasoning_effort="xhigh"']
|
|
249
|
+
if durable and durable['session_id']:
|
|
250
|
+
help_text=(await command(['codex','exec','resume','--help'],full_stdout_limit=16*1024))['stdout']
|
|
251
|
+
root_help=(await command(['codex','--help'],full_stdout_limit=16*1024))['stdout']
|
|
252
|
+
argv=native_resume_argv(argv,runtime.model,durable['session_id'],help_text,root_help)
|
|
253
|
+
else:
|
|
254
|
+
argv+=['exec','--skip-git-repo-check','--sandbox','danger-full-access',
|
|
255
|
+
'--model',runtime.model,'--cd','/workspace/work','--json',
|
|
256
|
+
'--output-last-message','/workspace/agent-final.md','-']
|
|
161
257
|
shell=shlex.join(argv)+' < /workspace/task-prompt.txt > /workspace/agent-events.jsonl 2> /workspace/agent-stderr.txt'
|
|
162
258
|
await command(['sh','-c',shell],seconds=runtime.seconds)
|
|
259
|
+
model_quiescent=True
|
|
163
260
|
events=runtime.redact(await sandbox.files.read_file('/workspace/agent-events.jsonl'))
|
|
164
261
|
session=None;completed=False;failed=False
|
|
165
262
|
for line in events.splitlines():
|
|
@@ -170,11 +267,14 @@ class CodexTaskExecutor:
|
|
|
170
267
|
if event.get('type')=='turn.failed':failed=True
|
|
171
268
|
except ValueError:pass
|
|
172
269
|
outcome['codex_session_id']=session
|
|
270
|
+
if durable and durable['session_id'] and session!=durable['session_id']:
|
|
271
|
+
raise RuntimeError('native resumed thread id changed')
|
|
173
272
|
# Preserve the native transcript even if action/readiness verification fails.
|
|
174
273
|
self._artifact(outcome,'codex.events.jsonl',events.encode()[:1024*1024])
|
|
175
274
|
final=runtime.redact(await sandbox.files.read_file('/workspace/agent-final.md'))
|
|
176
275
|
marker=await sandbox.files.read_file('/workspace/agent-started.txt')
|
|
177
276
|
if not session or not completed or failed or not marker.strip() or not final.strip():raise RuntimeError('Codex execution did not meet the native completion/write contract')
|
|
277
|
+
outcome['native_turn_completed']=True
|
|
178
278
|
if cancelled():raise RuntimeError('task cancellation requested')
|
|
179
279
|
outcome['final']=final[:16000]
|
|
180
280
|
self._artifact(outcome,'result.md',final.encode()[:1000000])
|
|
@@ -197,11 +297,38 @@ class CodexTaskExecutor:
|
|
|
197
297
|
if any(secret and (secret.encode() in body or base64.b64encode(secret.encode()) in body) for secret in (runtime.access_token,runtime.tool_access_token)):raise RuntimeError('task credential appeared in results')
|
|
198
298
|
self._artifact(outcome,'result.tar.gz',data)
|
|
199
299
|
await update({'index':1 if mode=='verify' else 2,'status':'passed','receipt':json.loads(collection['stdout'])})
|
|
300
|
+
if durable:
|
|
301
|
+
from .durable_archive import CAPTURE_SCRIPT,validate_checkpoint
|
|
302
|
+
await sandbox.files.write_file('/workspace/capture_checkpoint.py',CAPTURE_SCRIPT,mode=600)
|
|
303
|
+
await command(['python','/workspace/capture_checkpoint.py'])
|
|
304
|
+
checkpoint_data=await sandbox.files.read_bytes('/workspace/checkpoint.tar.gz')
|
|
305
|
+
validate_checkpoint(checkpoint_data,known_tokens=(runtime.access_token,runtime.tool_access_token),
|
|
306
|
+
session_id=outcome['codex_session_id'])
|
|
307
|
+
await durable['save_checkpoint'](checkpoint_data,outcome['codex_session_id'])
|
|
200
308
|
if mode=='verify':
|
|
201
309
|
outcome['final']='Read-only trusted publication verification passed.'
|
|
202
310
|
outcome['ok']=True
|
|
203
311
|
except Exception as exc:
|
|
204
312
|
outcome['error']=runtime.redact(str(exc))[:1800]
|
|
313
|
+
if durable and not gateway_intent and lease is None and sandbox is None and not sandbox_create_attempted:
|
|
314
|
+
outcome['cleanup']={'not_created':True,'container_absent':True}
|
|
315
|
+
outcome['credential_closure']={'not_created':True}
|
|
316
|
+
if durable and model_quiescent and sandbox is not None and not outcome.get('codex_session_id'):
|
|
317
|
+
try:
|
|
318
|
+
partial=await sandbox.files.read_file('/workspace/agent-events.jsonl')
|
|
319
|
+
for line in partial.splitlines():
|
|
320
|
+
event=json.loads(line)
|
|
321
|
+
if event.get('type')=='thread.started':outcome['codex_session_id']=event.get('thread_id')
|
|
322
|
+
except Exception:pass
|
|
323
|
+
if durable and model_quiescent and sandbox is not None and outcome.get('codex_session_id') and not any(a['name']=='result.tar.gz' for a in outcome['artifacts']):
|
|
324
|
+
try:
|
|
325
|
+
from .durable_archive import CAPTURE_SCRIPT,validate_checkpoint
|
|
326
|
+
await sandbox.files.write_file('/workspace/capture_checkpoint.py',CAPTURE_SCRIPT,mode=600)
|
|
327
|
+
await command(['python','/workspace/capture_checkpoint.py'])
|
|
328
|
+
checkpoint_data=await sandbox.files.read_bytes('/workspace/checkpoint.tar.gz')
|
|
329
|
+
validate_checkpoint(checkpoint_data,known_tokens=(runtime.access_token,runtime.tool_access_token),session_id=outcome['codex_session_id'])
|
|
330
|
+
await durable['save_checkpoint'](checkpoint_data,outcome['codex_session_id'])
|
|
331
|
+
except Exception:pass
|
|
205
332
|
if sandbox is not None and mode!='verify':
|
|
206
333
|
if not any(a['name']=='codex.events.jsonl' for a in outcome['artifacts']):
|
|
207
334
|
try:
|
|
@@ -217,7 +344,7 @@ class CodexTaskExecutor:
|
|
|
217
344
|
outcome['cleanup']={'requested':True,'container_absent':not any(c.name=='sandbox-'+sandbox.id for c in service.docker.containers.list(all=True))}
|
|
218
345
|
except Exception:outcome['cleanup']={'requested':True,'container_absent':False}
|
|
219
346
|
if not outcome['cleanup']['container_absent']:outcome['ok']=False
|
|
220
|
-
if lease is not None:
|
|
347
|
+
if lease is not None or gateway_intent:
|
|
221
348
|
try:
|
|
222
349
|
closed=await asyncio.to_thread(self.gateway.close,task['id'])
|
|
223
350
|
if closed!={'closed':True}:raise ValueError('lease closure unconfirmed')
|
|
@@ -15,6 +15,11 @@ class ChatTaskConfig(BaseEnvConfig):
|
|
|
15
15
|
CHATTASK_WEB_ORIGIN = EnvField('CHATTASK_WEB_ORIGIN', default='http://127.0.0.1:8000', desc='Fixed canonical browser origin.')
|
|
16
16
|
CHATTASK_LOGIN_USERNAME = EnvField('CHATTASK_LOGIN_USERNAME', desc='Explicit fixed site account; no built-in production account.')
|
|
17
17
|
CHATTASK_LOGIN_PASSWORD = EnvField('CHATTASK_LOGIN_PASSWORD', desc='Site password verified through ChatLogin.', is_sensitive=True)
|
|
18
|
+
CHATTASK_LOGIN_USERS_JSON = EnvField('CHATTASK_LOGIN_USERS_JSON', desc='Optional sensitive JSON list of additional named ChatLogin principals for isolated candidate use.', is_sensitive=True)
|
|
19
|
+
CHATTASK_RESEARCH_OVERLEAF_CONTAINER = EnvField('CHATTASK_RESEARCH_OVERLEAF_CONTAINER', desc='Optional operator-selected original Overleaf container for trusted Research rounds.')
|
|
20
|
+
CHATTASK_RESEARCH_OVERLEAF_ORIGIN = EnvField('CHATTASK_RESEARCH_OVERLEAF_ORIGIN', desc='Optional HTTPS browser origin of the original Overleaf service.')
|
|
21
|
+
CHATTASK_WORKSPACE_KEY = EnvField('CHATTASK_WORKSPACE_KEY', desc='Scoped service key for the workspace integration routes only.', is_sensitive=True)
|
|
22
|
+
CHATTASK_ANALYSIS_PROFILE = EnvField('CHATTASK_ANALYSIS_PROFILE', desc='Reference to an existing ChatEnv OpenAI profile for provided-material analysis; no model credential is duplicated.')
|
|
18
23
|
|
|
19
24
|
CHATTASK_CODEX_BASE_URL = EnvField('CHATTASK_CODEX_BASE_URL', desc='Configured model gateway base, with its API prefix.')
|
|
20
25
|
CHATTASK_CODEX_API_KEY = EnvField('CHATTASK_CODEX_API_KEY', desc='Runtime task/model access token; injected into guest processes, never baked into images.', is_sensitive=True)
|
|
@@ -31,7 +36,7 @@ class ChatTaskConfig(BaseEnvConfig):
|
|
|
31
36
|
@classmethod
|
|
32
37
|
def test(cls):
|
|
33
38
|
fields=cls.get_fields()
|
|
34
|
-
for key in ['CHATTASK_SANDBOX_API_KEY','CHATTASK_LOGIN_PASSWORD','CHATTASK_GATEWAY_CLIENT_TOKEN']:
|
|
39
|
+
for key in ['CHATTASK_SANDBOX_API_KEY','CHATTASK_LOGIN_PASSWORD','CHATTASK_LOGIN_USERS_JSON','CHATTASK_GATEWAY_CLIENT_TOKEN','CHATTASK_WORKSPACE_KEY']:
|
|
35
40
|
if not fields[key].is_sensitive:
|
|
36
41
|
raise RuntimeError('ChatTask secret-field contract failed')
|
|
37
42
|
print('ChatTask schema registered; sensitive fields are masked. This check does not execute a workload.')
|