robert-github-agent 0.1.0b1__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.
- robert_agent/__init__.py +1 -0
- robert_agent/acceptance.py +394 -0
- robert_agent/acceptance_suite.py +287 -0
- robert_agent/audit_result.py +501 -0
- robert_agent/authorize.py +117 -0
- robert_agent/board.py +538 -0
- robert_agent/chat_status.py +338 -0
- robert_agent/cli/__init__.py +1 -0
- robert_agent/cli/exit_codes.py +5 -0
- robert_agent/cli/main.py +535 -0
- robert_agent/cli/output.py +20 -0
- robert_agent/common.py +6 -0
- robert_agent/controlled_e2e_acceptance.py +394 -0
- robert_agent/daemon.py +607 -0
- robert_agent/daemon_state.py +319 -0
- robert_agent/diagnostics.py +119 -0
- robert_agent/discover.py +775 -0
- robert_agent/dispatch.py +217 -0
- robert_agent/doctor.py +94 -0
- robert_agent/github_api.py +12 -0
- robert_agent/init_config.py +126 -0
- robert_agent/integrations/__init__.py +1 -0
- robert_agent/integrations/openclaw.py +285 -0
- robert_agent/live_discovery_acceptance.py +70 -0
- robert_agent/live_worker_acceptance.py +363 -0
- robert_agent/live_worktree_acceptance.py +344 -0
- robert_agent/loop_engine.py +285 -0
- robert_agent/memory_curator.py +105 -0
- robert_agent/migrate.py +157 -0
- robert_agent/notify.py +74 -0
- robert_agent/paths.py +16 -0
- robert_agent/production_write_canary.py +254 -0
- robert_agent/project_memory.py +503 -0
- robert_agent/publish.py +743 -0
- robert_agent/publish_dedupe_acceptance.py +270 -0
- robert_agent/redaction.py +41 -0
- robert_agent/render_prompt.py +544 -0
- robert_agent/resource_files.py +8 -0
- robert_agent/resources/__init__.py +1 -0
- robert_agent/resources/acceptance-matrix.md +120 -0
- robert_agent/resources/classifier.md +19 -0
- robert_agent/resources/command-matrix.md +38 -0
- robert_agent/resources/config.example.yml +20 -0
- robert_agent/resources/db/migrations/001_legacy_dd_to_robert.sql +14 -0
- robert_agent/resources/db/schema.sql +479 -0
- robert_agent/resources/failure-modes.md +36 -0
- robert_agent/resources/fixtures/actor-permission.json +1 -0
- robert_agent/resources/fixtures/discovery.json +1 -0
- robert_agent/resources/fixtures/redaction.json +1 -0
- robert_agent/resources/fixtures/review-followup.json +1 -0
- robert_agent/resources/fixtures/worker-results.json +1 -0
- robert_agent/resources/fixtures/workstreams.json +1 -0
- robert_agent/resources/github-events.md +77 -0
- robert_agent/resources/kanban-control.md +165 -0
- robert_agent/resources/redaction.md +29 -0
- robert_agent/resources/result-contract.md +56 -0
- robert_agent/resources/routes.yml +82 -0
- robert_agent/resources/schemas/config.schema.json +123 -0
- robert_agent/resources/schemas/event.schema.json +18 -0
- robert_agent/resources/schemas/result.schema.json +99 -0
- robert_agent/resources/schemas/route.schema.json +23 -0
- robert_agent/resources/schemas/snapshot.schema.json +17 -0
- robert_agent/resources/schemas/task.schema.json +15 -0
- robert_agent/resources/trust-model.md +16 -0
- robert_agent/resources/worker-prompt.md +121 -0
- robert_agent/resources/worker-protocol.md +47 -0
- robert_agent/resources/workflow.yml +50 -0
- robert_agent/resources/workstream-model.md +17 -0
- robert_agent/route.py +232 -0
- robert_agent/route_config.py +64 -0
- robert_agent/run_once.py +5375 -0
- robert_agent/runtime_knowledge.py +392 -0
- robert_agent/service.py +161 -0
- robert_agent/skills.py +28 -0
- robert_agent/status.py +1051 -0
- robert_agent/storage.py +376 -0
- robert_agent/summarize.py +100 -0
- robert_agent/supervise.py +72 -0
- robert_agent/usage.py +192 -0
- robert_agent/validate_config.py +616 -0
- robert_agent/wakeup.py +261 -0
- robert_agent/web.py +2893 -0
- robert_agent/web_assets/board.css +255 -0
- robert_agent/web_assets/board.html +165 -0
- robert_agent/web_assets/board.js +660 -0
- robert_agent/web_assets/github-shell.css +122 -0
- robert_agent/web_assets/index.html +103 -0
- robert_agent/web_assets/operations.css +168 -0
- robert_agent/web_assets/workbench.css +131 -0
- robert_agent/web_assets/workbench.js +581 -0
- robert_agent/work_items.py +1016 -0
- robert_agent/workbench.py +701 -0
- robert_agent/worker/__init__.py +1 -0
- robert_agent/worker/heartbeat.py +190 -0
- robert_agent/worker/result.py +321 -0
- robert_agent/worker/snapshot.py +98 -0
- robert_agent/worker_adapters/__init__.py +138 -0
- robert_agent/worker_adapters/cbc.py +68 -0
- robert_agent/worker_adapters/codex.py +56 -0
- robert_agent/worker_adapters/command.py +33 -0
- robert_agent/worker_adapters/tcodex.py +56 -0
- robert_agent/worker_heartbeat.py +6 -0
- robert_agent/worker_result.py +6 -0
- robert_agent/worker_snapshot.py +6 -0
- robert_agent/workstream.py +55 -0
- robert_agent/worktree.py +297 -0
- robert_github_agent-0.1.0b1.dist-info/METADATA +217 -0
- robert_github_agent-0.1.0b1.dist-info/RECORD +111 -0
- robert_github_agent-0.1.0b1.dist-info/WHEEL +4 -0
- robert_github_agent-0.1.0b1.dist-info/entry_points.txt +2 -0
- robert_github_agent-0.1.0b1.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const state = {
|
|
4
|
+
filters: null,
|
|
5
|
+
list: null,
|
|
6
|
+
detail: null,
|
|
7
|
+
selectedId: null,
|
|
8
|
+
listController: null,
|
|
9
|
+
detailController: null,
|
|
10
|
+
refreshTimer: null,
|
|
11
|
+
lastFocusedRow: null,
|
|
12
|
+
hasLoaded: false,
|
|
13
|
+
language: "en",
|
|
14
|
+
theme: "system",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const translations = {
|
|
18
|
+
en: {
|
|
19
|
+
pageTitle: "Robert Workbench", workbenchControls: "Workbench controls", live: "Live",
|
|
20
|
+
theme: "Theme", themeSystem: "System", themeLight: "Light", themeDark: "Dark",
|
|
21
|
+
language: "Language", languageEnglish: "English", languageChinese: "Chinese",
|
|
22
|
+
primaryNavigation: "Primary navigation", navWork: "Work", navBoard: "Board", navHistory: "History",
|
|
23
|
+
navOperations: "Operations", navKnowledge: "Knowledge", workTitle: "Work queue",
|
|
24
|
+
workSubtitle: "Active GitHub work that still needs attention", historyTitle: "History",
|
|
25
|
+
historySubtitle: "Completed, ignored and canceled GitHub work", workSummary: "Work summary",
|
|
26
|
+
needsYou: "needs you", working: "working", waiting: "waiting", searchWork: "Search work",
|
|
27
|
+
workSearchPlaceholder: "Search title, #number or task ID", repository: "Repository",
|
|
28
|
+
allRepositories: "All repositories", actor: "Actor", anyActor: "Any actor", status: "Status",
|
|
29
|
+
activeWork: "Active work", needsAttention: "Needs attention", agentWorking: "Agent working",
|
|
30
|
+
sort: "Sort", priority: "Priority", newest: "Newest", oldest: "Oldest", retry: "Retry",
|
|
31
|
+
githubWorkItems: "GitHub work items", loadMore: "Load more", selectWorkItem: "Select a PR or issue",
|
|
32
|
+
selectWorkItemHelp: "Choose a work item to inspect its current Agent state.",
|
|
33
|
+
workItemDetail: "Work item detail", closeDetail: "Close detail", unknown: "Unknown",
|
|
34
|
+
refreshFailed: "Refresh failed", refreshError: "Could not refresh work: {message}",
|
|
35
|
+
secondsAgo: "{count}s ago", minutesAgo: "{count}m ago", hoursAgo: "{count}h ago", daysAgo: "{count}d ago",
|
|
36
|
+
bucketAttention: "Needs your attention", bucketWorking: "Agent working", bucketWaiting: "Waiting",
|
|
37
|
+
bucketHistory: "History", publishFailed: "publish failed", publishSkipped: "publish skipped",
|
|
38
|
+
taskFailed: "task failed", taskCanceled: "task canceled", workerStale: "worker stale",
|
|
39
|
+
actionRejected: "action rejected", workstreamFailed: "workstream failed",
|
|
40
|
+
waitingForInput: "waiting for input", waitingToPublish: "waiting to publish",
|
|
41
|
+
pendingAudit: "pending audit", active: "active", complete: "complete", publish: "Publish",
|
|
42
|
+
untitledWorkItem: "Untitled GitHub work item", openedBy: "opened by @{actor}", updated: "updated {time}",
|
|
43
|
+
noMatches: "No work matches these filters", noActiveWork: "No active GitHub work needs attention",
|
|
44
|
+
adjustFilters: "Adjust the filters or check History for completed work.",
|
|
45
|
+
mostRecentlyUpdated: "Most recently updated", actionabilityOrder: "Actionability order",
|
|
46
|
+
workItemsLoaded: "{count} work items loaded", whyAttention: "Why this needs attention",
|
|
47
|
+
currentAgentState: "Current agent state", waitingReason: "What the agent is waiting for", outcome: "Outcome",
|
|
48
|
+
workItem: "Work item", noOperatorAction: "No operator action is currently required.",
|
|
49
|
+
discoveredAuthorized: "Discovered and authorized", workstreamRecorded: "Workstream recorded",
|
|
50
|
+
agentExecution: "Agent execution", openGithub: "Open on GitHub ↗", copyTaskId: "Copy task ID",
|
|
51
|
+
copyShareLink: "Copy share link", actions: "Actions", artifacts: "Artifacts", bytes: "{count} bytes",
|
|
52
|
+
preview: "Preview", workItemUnavailable: "Work item unavailable", preparation: "Preparation",
|
|
53
|
+
analysis: "Analysis", planning: "Planning", implementation: "Implementation", verification: "Verification",
|
|
54
|
+
publication: "Publication", handoff: "Handoff", reviewComment: "Review comment",
|
|
55
|
+
prReviewComment: "PR review comment", issueComment: "Issue comment", openPullRequest: "Open pull request",
|
|
56
|
+
createPullRequest: "Create pull request", updatePullRequest: "Update pull request",
|
|
57
|
+
published: "Published", failed: "Failed", succeeded: "Succeeded", completed: "Completed",
|
|
58
|
+
pending: "Pending", skipped: "Skipped", running: "Running", canceled: "Canceled",
|
|
59
|
+
},
|
|
60
|
+
zh: {
|
|
61
|
+
pageTitle: "Robert 工作台", workbenchControls: "工作台控制", live: "实时",
|
|
62
|
+
theme: "主题", themeSystem: "跟随系统", themeLight: "浅色", themeDark: "深色",
|
|
63
|
+
language: "语言", languageEnglish: "English", languageChinese: "中文",
|
|
64
|
+
primaryNavigation: "一级导航", navWork: "工作", navBoard: "任务看板", navHistory: "历史",
|
|
65
|
+
navOperations: "运行状态", navKnowledge: "知识", workTitle: "工作队列",
|
|
66
|
+
workSubtitle: "仍需处理的活跃 GitHub 工作", historyTitle: "历史",
|
|
67
|
+
historySubtitle: "已完成、已忽略和已取消的 GitHub 工作", workSummary: "工作摘要",
|
|
68
|
+
needsYou: "需要你处理", working: "进行中", waiting: "等待中", searchWork: "搜索工作",
|
|
69
|
+
workSearchPlaceholder: "搜索标题、编号或 task ID", repository: "仓库",
|
|
70
|
+
allRepositories: "全部仓库", actor: "发起人", anyActor: "全部发起人", status: "状态",
|
|
71
|
+
activeWork: "活跃工作", needsAttention: "需要处理", agentWorking: "Agent 工作中",
|
|
72
|
+
sort: "排序", priority: "优先级", newest: "最新", oldest: "最早", retry: "重试",
|
|
73
|
+
githubWorkItems: "GitHub 工作项", loadMore: "加载更多", selectWorkItem: "选择一个 PR 或 Issue",
|
|
74
|
+
selectWorkItemHelp: "选择工作项以查看当前 Agent 状态。", workItemDetail: "工作项详情",
|
|
75
|
+
closeDetail: "关闭详情", unknown: "未知", refreshFailed: "刷新失败",
|
|
76
|
+
refreshError: "刷新工作列表失败:{message}", secondsAgo: "{count} 秒前", minutesAgo: "{count} 分钟前",
|
|
77
|
+
hoursAgo: "{count} 小时前", daysAgo: "{count} 天前", bucketAttention: "需要你处理",
|
|
78
|
+
bucketWorking: "Agent 工作中", bucketWaiting: "等待中", bucketHistory: "历史",
|
|
79
|
+
publishFailed: "发布失败", publishSkipped: "已跳过发布", taskFailed: "任务失败",
|
|
80
|
+
taskCanceled: "任务已取消", workerStale: "Worker 心跳过期", actionRejected: "动作被拒绝",
|
|
81
|
+
workstreamFailed: "工作流失败", waitingForInput: "等待输入", waitingToPublish: "等待发布",
|
|
82
|
+
pendingAudit: "等待审计", active: "活跃", complete: "已完成", publish: "发布",
|
|
83
|
+
untitledWorkItem: "未命名的 GitHub 工作项", openedBy: "由 @{actor} 发起", updated: "更新于 {time}",
|
|
84
|
+
noMatches: "没有符合筛选条件的工作", noActiveWork: "暂无需要处理的活跃 GitHub 工作",
|
|
85
|
+
adjustFilters: "调整筛选条件,或在历史中查看已完成工作。", mostRecentlyUpdated: "按最近更新时间",
|
|
86
|
+
actionabilityOrder: "按处理优先级", workItemsLoaded: "已加载 {count} 个工作项",
|
|
87
|
+
whyAttention: "需要处理的原因", currentAgentState: "当前 Agent 状态",
|
|
88
|
+
waitingReason: "Agent 正在等待什么", outcome: "结果", workItem: "工作项",
|
|
89
|
+
noOperatorAction: "当前无需人工操作。", discoveredAuthorized: "已发现并授权",
|
|
90
|
+
workstreamRecorded: "已记录工作流", agentExecution: "Agent 执行", openGithub: "在 GitHub 打开 ↗",
|
|
91
|
+
copyTaskId: "复制 task ID", copyShareLink: "复制分享链接", actions: "操作", artifacts: "产物",
|
|
92
|
+
bytes: "{count} 字节", preview: "预览", workItemUnavailable: "工作项不可用", preparation: "准备",
|
|
93
|
+
analysis: "分析", planning: "规划", implementation: "实现", verification: "验证", publication: "发布",
|
|
94
|
+
handoff: "交接", reviewComment: "评审评论", prReviewComment: "PR 行级评论",
|
|
95
|
+
issueComment: "Issue 评论", openPullRequest: "创建 Pull Request", createPullRequest: "创建 Pull Request",
|
|
96
|
+
updatePullRequest: "更新 Pull Request",
|
|
97
|
+
published: "已发布", failed: "失败", succeeded: "成功", completed: "已完成",
|
|
98
|
+
pending: "待处理", skipped: "已跳过", running: "运行中", canceled: "已取消",
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const bucketLabels = {
|
|
103
|
+
needs_attention: "bucketAttention",
|
|
104
|
+
working: "bucketWorking",
|
|
105
|
+
waiting: "bucketWaiting",
|
|
106
|
+
history: "bucketHistory",
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const reasonLabels = {
|
|
110
|
+
publish_failed: "publishFailed", publish_skipped: "publishSkipped", task_failed: "taskFailed",
|
|
111
|
+
task_canceled: "taskCanceled", worker_stale: "workerStale", github_action_rejected: "actionRejected",
|
|
112
|
+
workstream_failed: "workstreamFailed", waiting_for_user: "waitingForInput",
|
|
113
|
+
waiting_publish: "waitingToPublish", result_pending_audit: "pendingAudit",
|
|
114
|
+
agent_working: "agentWorking", active_workstream: "active", inactive: "complete",
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const phaseLabels = {
|
|
118
|
+
prepare: "preparation", analyze: "analysis", plan: "planning", execute: "implementation",
|
|
119
|
+
verify: "verification", publish: "publication", handoff: "handoff",
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const actionLabels = {
|
|
123
|
+
review_comment: "reviewComment", pr_review_comment: "prReviewComment", issue_comment: "issueComment",
|
|
124
|
+
open_pr: "openPullRequest", create_pr: "createPullRequest", push_existing_pr: "updatePullRequest",
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
function $(id) { return document.getElementById(id); }
|
|
128
|
+
|
|
129
|
+
function t(key, variables = {}) {
|
|
130
|
+
const dictionary = translations[state.language] || translations.en;
|
|
131
|
+
let value = dictionary[key] || translations.en[key] || key;
|
|
132
|
+
Object.entries(variables).forEach(([name, replacement]) => {
|
|
133
|
+
value = value.replaceAll(`{${name}}`, String(replacement));
|
|
134
|
+
});
|
|
135
|
+
return value;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function applyTranslations() {
|
|
139
|
+
document.documentElement.lang = state.language === "zh" ? "zh-CN" : "en";
|
|
140
|
+
document.title = t("pageTitle");
|
|
141
|
+
document.querySelectorAll("[data-i18n]").forEach((element) => {
|
|
142
|
+
element.textContent = t(element.dataset.i18n);
|
|
143
|
+
});
|
|
144
|
+
document.querySelectorAll("[data-i18n-placeholder]").forEach((element) => {
|
|
145
|
+
element.placeholder = t(element.dataset.i18nPlaceholder);
|
|
146
|
+
});
|
|
147
|
+
document.querySelectorAll("[data-i18n-aria]").forEach((element) => {
|
|
148
|
+
element.setAttribute("aria-label", t(element.dataset.i18nAria));
|
|
149
|
+
});
|
|
150
|
+
$("language-select").value = state.language;
|
|
151
|
+
$("theme-select").value = state.theme;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function setLanguage(value) {
|
|
155
|
+
state.language = translations[value] ? value : "en";
|
|
156
|
+
localStorage.setItem("robertLanguage", state.language);
|
|
157
|
+
applyTranslations();
|
|
158
|
+
syncControls();
|
|
159
|
+
if (state.list) renderWorkItems(state.list);
|
|
160
|
+
if (state.detail) renderWorkItemDetail(state.detail);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function node(tag, options = {}, children = []) {
|
|
164
|
+
const element = document.createElement(tag);
|
|
165
|
+
if (options.className) element.className = options.className;
|
|
166
|
+
if (options.text !== undefined) element.textContent = options.text;
|
|
167
|
+
if (options.type) element.type = options.type;
|
|
168
|
+
if (options.href) element.href = options.href;
|
|
169
|
+
if (options.target) element.target = options.target;
|
|
170
|
+
if (options.rel) element.rel = options.rel;
|
|
171
|
+
if (options.title) element.title = options.title;
|
|
172
|
+
if (options.dataset) Object.assign(element.dataset, options.dataset);
|
|
173
|
+
if (options.attributes) {
|
|
174
|
+
Object.entries(options.attributes).forEach(([name, value]) => element.setAttribute(name, value));
|
|
175
|
+
}
|
|
176
|
+
children.filter(Boolean).forEach((child) => element.append(child));
|
|
177
|
+
return element;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function readUrlState() {
|
|
181
|
+
const params = new URLSearchParams(window.location.search);
|
|
182
|
+
const hash = window.location.hash.match(/^#work\/(.+)$/);
|
|
183
|
+
return {
|
|
184
|
+
bucket: params.get("bucket") || "",
|
|
185
|
+
repo: params.get("repo") || "",
|
|
186
|
+
actor: params.get("actor") || "",
|
|
187
|
+
q: params.get("q") || "",
|
|
188
|
+
sort: params.get("sort") || "priority",
|
|
189
|
+
cursor: params.get("cursor") || "",
|
|
190
|
+
selectedId: hash ? decodeURIComponent(hash[1]) : null,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function writeUrlState({ replace = true } = {}) {
|
|
195
|
+
const params = new URLSearchParams();
|
|
196
|
+
["bucket", "repo", "actor", "q", "sort", "cursor"].forEach((name) => {
|
|
197
|
+
const value = state.filters[name];
|
|
198
|
+
if (value && !(name === "sort" && value === "priority")) params.set(name, value);
|
|
199
|
+
});
|
|
200
|
+
const query = params.toString();
|
|
201
|
+
const hash = state.selectedId ? `#work/${encodeURIComponent(state.selectedId)}` : "";
|
|
202
|
+
const url = `${window.location.pathname}${query ? `?${query}` : ""}${hash}`;
|
|
203
|
+
window.history[replace ? "replaceState" : "pushState"](null, "", url);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function listApiUrl() {
|
|
207
|
+
const params = new URLSearchParams();
|
|
208
|
+
["bucket", "repo", "actor", "q", "sort", "cursor"].forEach((name) => {
|
|
209
|
+
const value = state.filters[name];
|
|
210
|
+
if (value && !(name === "sort" && value === "priority")) params.set(name, value);
|
|
211
|
+
});
|
|
212
|
+
params.set("limit", "30");
|
|
213
|
+
return `/api/work-items?${params.toString()}`;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function formatRelative(value) {
|
|
217
|
+
if (!value) return t("unknown");
|
|
218
|
+
const time = new Date(value).getTime();
|
|
219
|
+
if (Number.isNaN(time)) return value;
|
|
220
|
+
const seconds = Math.max(0, Math.floor((Date.now() - time) / 1000));
|
|
221
|
+
if (seconds < 60) return t("secondsAgo", { count: seconds });
|
|
222
|
+
const minutes = Math.floor(seconds / 60);
|
|
223
|
+
if (minutes < 60) return t("minutesAgo", { count: minutes });
|
|
224
|
+
const hours = Math.floor(minutes / 60);
|
|
225
|
+
if (hours < 24) return t("hoursAgo", { count: hours });
|
|
226
|
+
const days = Math.floor(hours / 24);
|
|
227
|
+
return days < 30 ? t("daysAgo", { count: days }) : new Date(value).toLocaleDateString(state.language === "zh" ? "zh-CN" : "en");
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function formatTime(value) {
|
|
231
|
+
if (!value) return "—";
|
|
232
|
+
const date = new Date(value);
|
|
233
|
+
return Number.isNaN(date.getTime()) ? value : date.toLocaleString(state.language === "zh" ? "zh-CN" : "en");
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function reasonLabel(item) { return t(reasonLabels[item.reason_code] || item.reason_code || item.bucket); }
|
|
237
|
+
|
|
238
|
+
function humanize(value) {
|
|
239
|
+
if (!value) return t("unknown");
|
|
240
|
+
const normalized = String(value).toLowerCase();
|
|
241
|
+
if ((translations[state.language] || {})[normalized] || translations.en[normalized]) return t(normalized);
|
|
242
|
+
const text = String(value).replaceAll("_", " ");
|
|
243
|
+
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function showSkeleton() {
|
|
247
|
+
const list = $("work-list");
|
|
248
|
+
list.replaceChildren($("skeleton-template").content.cloneNode(true));
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function showRefreshError(message) {
|
|
252
|
+
$("refresh-error").textContent = t("refreshError", { message });
|
|
253
|
+
$("refresh-notice").hidden = false;
|
|
254
|
+
$("refresh-label").textContent = t("refreshFailed");
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function clearRefreshError() {
|
|
258
|
+
$("refresh-notice").hidden = true;
|
|
259
|
+
$("refresh-label").textContent = t("live");
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function stateIcon(bucket) {
|
|
263
|
+
const symbol = bucket === "needs_attention" ? "!" : bucket === "waiting" ? "◷" : bucket === "history" ? "✓" : "●";
|
|
264
|
+
return node("span", {
|
|
265
|
+
className: `state-icon ${bucket === "needs_attention" ? "attention" : bucket}`,
|
|
266
|
+
text: symbol,
|
|
267
|
+
attributes: { "aria-hidden": "true" },
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function labelFor(item) {
|
|
272
|
+
return node("span", {
|
|
273
|
+
className: `label ${item.bucket === "needs_attention" ? "attention" : item.bucket}`,
|
|
274
|
+
text: reasonLabel(item),
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function signalFor(item) {
|
|
279
|
+
const signals = node("div", { className: "work-signals" });
|
|
280
|
+
if (item.signals.failed_publish_actions) {
|
|
281
|
+
signals.append(node("span", { className: "signal attention" }, [node("i"), node("span", { text: t("publish") })]));
|
|
282
|
+
} else if (item.agent.attempt_status) {
|
|
283
|
+
const live = item.agent.attempt_status === "running";
|
|
284
|
+
signals.append(node("span", { className: `signal ${live ? "success" : ""}` }, [node("i"), node("span", { text: item.agent.attempt_status })]));
|
|
285
|
+
}
|
|
286
|
+
return signals;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function workRow(item) {
|
|
290
|
+
const source = item.source || {};
|
|
291
|
+
const titleLine = node("div", { className: "work-title-line" }, [
|
|
292
|
+
node("strong", { text: source.title || t("untitledWorkItem") }),
|
|
293
|
+
labelFor(item),
|
|
294
|
+
]);
|
|
295
|
+
const meta = node("div", { className: "work-meta" });
|
|
296
|
+
[source.repo_full_name, source.number ? `#${source.number}` : null, source.author_login ? t("openedBy", { actor: source.author_login }) : null].filter(Boolean).forEach((value) => meta.append(node("span", { text: value })));
|
|
297
|
+
if (item.agent.task_id) meta.append(node("code", { text: item.agent.task_id }));
|
|
298
|
+
meta.append(node("span", { text: t("updated", { time: formatRelative(item.updated_at) }) }));
|
|
299
|
+
const row = node("button", {
|
|
300
|
+
className: `work-row ${item.id === state.selectedId ? "selected" : ""}`,
|
|
301
|
+
type: "button",
|
|
302
|
+
dataset: { workstreamId: item.id },
|
|
303
|
+
attributes: { "aria-pressed": item.id === state.selectedId ? "true" : "false" },
|
|
304
|
+
}, [stateIcon(item.bucket), node("span", { className: "work-copy" }, [titleLine, meta]), signalFor(item)]);
|
|
305
|
+
row.addEventListener("click", () => selectWorkItem(item.id, row));
|
|
306
|
+
return row;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function renderFilterOptions(payload) {
|
|
310
|
+
const repoSelect = $("repo-filter");
|
|
311
|
+
const repoOptions = [node("option", { text: t("allRepositories"), attributes: { value: "" } })];
|
|
312
|
+
(payload.repositories || []).forEach((repo) => repoOptions.push(node("option", { text: repo.full_name, attributes: { value: repo.full_name } })));
|
|
313
|
+
repoSelect.replaceChildren(...repoOptions);
|
|
314
|
+
repoSelect.value = state.filters.repo;
|
|
315
|
+
const actorSelect = $("actor-filter");
|
|
316
|
+
const actorOptions = [node("option", { text: t("anyActor"), attributes: { value: "" } })];
|
|
317
|
+
(payload.actors || []).forEach((actor) => actorOptions.push(node("option", { text: `@${actor}`, attributes: { value: actor } })));
|
|
318
|
+
actorSelect.replaceChildren(...actorOptions);
|
|
319
|
+
actorSelect.value = state.filters.actor;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
function renderWorkItems(payload, { append = false } = {}) {
|
|
323
|
+
const list = $("work-list");
|
|
324
|
+
const scrollTop = window.scrollY;
|
|
325
|
+
const items = payload.items || [];
|
|
326
|
+
renderFilterOptions(payload);
|
|
327
|
+
if (!append) list.replaceChildren();
|
|
328
|
+
if (!items.length && !append) {
|
|
329
|
+
list.append(node("div", { className: "empty-state" }, [
|
|
330
|
+
node("h2", { text: state.filters.q || state.filters.repo || state.filters.bucket ? t("noMatches") : t("noActiveWork") }),
|
|
331
|
+
node("p", { text: t("adjustFilters") }),
|
|
332
|
+
]));
|
|
333
|
+
} else {
|
|
334
|
+
const grouped = new Map();
|
|
335
|
+
items.forEach((item) => {
|
|
336
|
+
if (!grouped.has(item.bucket)) grouped.set(item.bucket, []);
|
|
337
|
+
grouped.get(item.bucket).push(item);
|
|
338
|
+
});
|
|
339
|
+
grouped.forEach((group, bucket) => {
|
|
340
|
+
const box = node("section", { className: "box", dataset: { bucket } });
|
|
341
|
+
box.append(node("header", { className: "box-header" }, [
|
|
342
|
+
node("strong", { text: `${t(bucketLabels[bucket] || bucket)} · ${group.length}` }),
|
|
343
|
+
node("span", { text: bucket === "history" ? t("mostRecentlyUpdated") : t("actionabilityOrder") }),
|
|
344
|
+
]));
|
|
345
|
+
group.forEach((item) => box.append(workRow(item)));
|
|
346
|
+
list.append(box);
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
const counts = payload.counts || {};
|
|
350
|
+
$("count-attention").textContent = counts.needs_attention || 0;
|
|
351
|
+
$("count-working").textContent = counts.working || 0;
|
|
352
|
+
$("count-waiting").textContent = counts.waiting || 0;
|
|
353
|
+
$("nav-work-count").textContent = (counts.needs_attention || 0) + (counts.working || 0) + (counts.waiting || 0);
|
|
354
|
+
$("nav-history-count").textContent = counts.history || 0;
|
|
355
|
+
$("pagination").hidden = !payload.next_cursor;
|
|
356
|
+
$("list-status").textContent = t("workItemsLoaded", { count: items.length });
|
|
357
|
+
window.scrollTo({ top: scrollTop });
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function timelineRow(label, time, tone = "") {
|
|
361
|
+
return node("div", { className: `timeline-row ${tone}` }, [
|
|
362
|
+
node("b", { className: "timeline-icon", text: tone === "done" ? "✓" : tone === "failed" ? "!" : "●" }),
|
|
363
|
+
node("span", { text: label }),
|
|
364
|
+
node("time", { text: formatTime(time) }),
|
|
365
|
+
]);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
function detailView(detail, titleId) {
|
|
369
|
+
const source = detail.source || {};
|
|
370
|
+
const stateData = detail.operator_state || {};
|
|
371
|
+
const stateHeading = stateData.bucket === "needs_attention" ? t("whyAttention") : stateData.bucket === "working" ? t("currentAgentState") : stateData.bucket === "waiting" ? t("waitingReason") : t("outcome");
|
|
372
|
+
const root = node("div");
|
|
373
|
+
root.append(node("header", { className: "detail-head" }, [
|
|
374
|
+
node("div", { className: `detail-kicker ${stateData.bucket || ""}`, text: t(bucketLabels[stateData.bucket] || stateData.bucket || "workItem") }),
|
|
375
|
+
node("h2", { text: source.title || t("untitledWorkItem"), attributes: { id: titleId } }),
|
|
376
|
+
node("p", { text: [source.repo_full_name, source.number ? `PR #${source.number}` : null].filter(Boolean).join(" · ") }),
|
|
377
|
+
]));
|
|
378
|
+
root.append(node("section", { className: "detail-section" }, [
|
|
379
|
+
node("h3", { text: stateHeading }),
|
|
380
|
+
node("div", { className: `reason-flash ${stateData.bucket || ""}`, text: stateData.reason_summary || t("noOperatorAction") }),
|
|
381
|
+
]));
|
|
382
|
+
const timeline = node("div", { className: "timeline" });
|
|
383
|
+
const tasks = detail.tasks || [];
|
|
384
|
+
if (tasks.length) timeline.append(timelineRow(t("discoveredAuthorized"), tasks[0].created_at, "done"));
|
|
385
|
+
(detail.phases || []).forEach((phase) => timeline.append(timelineRow(`${t(phaseLabels[phase.phase] || phase.phase)}: ${phase.summary}`, phase.created_at, phase.status === "completed" || phase.status === "succeeded" ? "done" : phase.status === "failed" ? "failed" : "current")));
|
|
386
|
+
(detail.actions || []).forEach((action) => timeline.append(timelineRow(`${t(actionLabels[action.action_type] || action.action_type)}: ${humanize(action.publish_status)}`, action.created_at, action.publish_status === "published" ? "done" : action.safe_error ? "failed" : "current")));
|
|
387
|
+
if (!timeline.children.length) timeline.append(timelineRow(t("workstreamRecorded"), source.updated_at));
|
|
388
|
+
root.append(node("section", { className: "detail-section" }, [node("h3", { text: t("agentExecution") }), timeline]));
|
|
389
|
+
const actions = node("div", { className: "detail-actions" });
|
|
390
|
+
if (source.url) actions.append(node("a", { className: "action-button primary", text: t("openGithub"), href: source.url, target: "_blank", rel: "noopener noreferrer" }));
|
|
391
|
+
const taskId = tasks.length ? tasks[tasks.length - 1].task_id : null;
|
|
392
|
+
if (taskId) {
|
|
393
|
+
const copyTask = node("button", { className: "action-button", text: t("copyTaskId"), type: "button" });
|
|
394
|
+
copyTask.addEventListener("click", () => navigator.clipboard.writeText(taskId));
|
|
395
|
+
actions.append(copyTask);
|
|
396
|
+
}
|
|
397
|
+
const copyLink = node("button", { className: "action-button", text: t("copyShareLink"), type: "button" });
|
|
398
|
+
copyLink.addEventListener("click", () => navigator.clipboard.writeText(window.location.href));
|
|
399
|
+
actions.append(copyLink);
|
|
400
|
+
root.append(node("section", { className: "detail-section" }, [node("h3", { text: t("actions") }), actions]));
|
|
401
|
+
if ((detail.artifacts || []).length) {
|
|
402
|
+
const artifacts = node("div", { className: "artifact-list" });
|
|
403
|
+
detail.artifacts.forEach((artifact) => {
|
|
404
|
+
const href = `/artifact.txt?task_id=${encodeURIComponent(artifact.task_id)}&artifact_type=${encodeURIComponent(artifact.artifact_type)}`;
|
|
405
|
+
artifacts.append(node("a", { className: "artifact-link", href, target: "_blank", rel: "noopener noreferrer" }, [node("span", { text: artifact.artifact_type }), node("small", { text: artifact.bytes ? t("bytes", { count: artifact.bytes }) : t("preview") })]));
|
|
406
|
+
});
|
|
407
|
+
root.append(node("section", { className: "detail-section" }, [node("h3", { text: t("artifacts") }), artifacts]));
|
|
408
|
+
}
|
|
409
|
+
return root;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
function renderWorkItemDetail(detail) {
|
|
413
|
+
state.detail = detail;
|
|
414
|
+
$("detail-panel").replaceChildren(detailView(detail, "detail-title"));
|
|
415
|
+
$("drawer-content").replaceChildren(detailView(detail, "drawer-detail-title"));
|
|
416
|
+
$("drawer-title").textContent = t("workItemDetail");
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
async function loadWorkItems({ append = false, reason = "manual" } = {}) {
|
|
420
|
+
if (reason === "auto" && document.hidden) return;
|
|
421
|
+
if (!state.hasLoaded) showSkeleton();
|
|
422
|
+
if (state.listController) state.listController.abort();
|
|
423
|
+
state.listController = new AbortController();
|
|
424
|
+
try {
|
|
425
|
+
const response = await fetch(listApiUrl(), { cache: "no-store", signal: state.listController.signal });
|
|
426
|
+
const payload = await response.json();
|
|
427
|
+
if (!response.ok) throw new Error(payload.safe_error || `HTTP ${response.status}`);
|
|
428
|
+
if (append && state.list) payload.items = state.list.items.concat(payload.items || []);
|
|
429
|
+
state.list = payload;
|
|
430
|
+
state.hasLoaded = true;
|
|
431
|
+
renderWorkItems(payload, { append: false });
|
|
432
|
+
clearRefreshError();
|
|
433
|
+
if (!state.selectedId && payload.items.length) await selectWorkItem(payload.items[0].id, null, { updateHistory: false, showDrawer: false });
|
|
434
|
+
else if (state.selectedId && payload.items.some((item) => item.id === state.selectedId)) await loadWorkItemDetail(state.selectedId);
|
|
435
|
+
} catch (error) {
|
|
436
|
+
if (error.name !== "AbortError") showRefreshError(error.message);
|
|
437
|
+
} finally {
|
|
438
|
+
$("workbench-app").setAttribute("aria-busy", "false");
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
async function loadWorkItemDetail(workstreamId) {
|
|
443
|
+
if (!workstreamId) return;
|
|
444
|
+
if (state.detailController) state.detailController.abort();
|
|
445
|
+
state.detailController = new AbortController();
|
|
446
|
+
try {
|
|
447
|
+
const response = await fetch(`/api/work-items/${encodeURIComponent(workstreamId)}`, { cache: "no-store", signal: state.detailController.signal });
|
|
448
|
+
const payload = await response.json();
|
|
449
|
+
if (!response.ok) throw new Error(payload.safe_error || `HTTP ${response.status}`);
|
|
450
|
+
renderWorkItemDetail(payload);
|
|
451
|
+
} catch (error) {
|
|
452
|
+
if (error.name === "AbortError") return;
|
|
453
|
+
$("detail-panel").replaceChildren(node("div", { className: "detail-empty" }, [node("h2", { text: t("workItemUnavailable") }), node("p", { text: error.message })]));
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
async function selectWorkItem(workstreamId, row, { updateHistory = true, showDrawer = true } = {}) {
|
|
458
|
+
state.selectedId = workstreamId;
|
|
459
|
+
state.lastFocusedRow = row || document.querySelector(`[data-workstream-id="${CSS.escape(workstreamId)}"]`);
|
|
460
|
+
document.querySelectorAll("[data-workstream-id]").forEach((candidate) => {
|
|
461
|
+
const selected = candidate.dataset.workstreamId === workstreamId;
|
|
462
|
+
candidate.classList.toggle("selected", selected);
|
|
463
|
+
candidate.setAttribute("aria-pressed", selected ? "true" : "false");
|
|
464
|
+
});
|
|
465
|
+
writeUrlState({ replace: !updateHistory });
|
|
466
|
+
await loadWorkItemDetail(workstreamId);
|
|
467
|
+
if (showDrawer && window.matchMedia("(max-width: 900px)").matches) openDetailDrawer();
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
function openDetailDrawer() {
|
|
471
|
+
const drawer = $("detail-drawer");
|
|
472
|
+
$("drawer-scrim").hidden = false;
|
|
473
|
+
drawer.classList.add("open");
|
|
474
|
+
drawer.setAttribute("aria-hidden", "false");
|
|
475
|
+
document.body.classList.add("drawer-open");
|
|
476
|
+
$("drawer-close").focus();
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
function closeDetailDrawer() {
|
|
480
|
+
const drawer = $("detail-drawer");
|
|
481
|
+
drawer.classList.remove("open");
|
|
482
|
+
drawer.setAttribute("aria-hidden", "true");
|
|
483
|
+
$("drawer-scrim").hidden = true;
|
|
484
|
+
document.body.classList.remove("drawer-open");
|
|
485
|
+
if (state.lastFocusedRow) state.lastFocusedRow.focus();
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
function visibleRows() { return Array.from(document.querySelectorAll("[data-workstream-id]")); }
|
|
489
|
+
|
|
490
|
+
function editableTarget(target) {
|
|
491
|
+
return target && (target.matches("input, textarea, select") || target.isContentEditable);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
function handleKeyboardShortcut(event) {
|
|
495
|
+
if (editableTarget(event.target)) {
|
|
496
|
+
if (event.key === "Escape") event.target.blur();
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
if (event.key === "/") { event.preventDefault(); $("work-search").focus(); return; }
|
|
500
|
+
if (event.key === "Escape") { closeDetailDrawer(); return; }
|
|
501
|
+
const rows = visibleRows();
|
|
502
|
+
const index = rows.findIndex((row) => row.dataset.workstreamId === state.selectedId);
|
|
503
|
+
if ((event.key === "j" || event.key === "k") && rows.length) {
|
|
504
|
+
event.preventDefault();
|
|
505
|
+
const delta = event.key === "j" ? 1 : -1;
|
|
506
|
+
const next = rows[Math.max(0, Math.min(rows.length - 1, index + delta))] || rows[0];
|
|
507
|
+
next.focus();
|
|
508
|
+
selectWorkItem(next.dataset.workstreamId, next);
|
|
509
|
+
} else if (event.key === "Enter" && index >= 0) {
|
|
510
|
+
event.preventDefault();
|
|
511
|
+
selectWorkItem(rows[index].dataset.workstreamId, rows[index]);
|
|
512
|
+
} else if (event.key === "g" && index >= 0) {
|
|
513
|
+
const item = state.list && state.list.items.find((candidate) => candidate.id === state.selectedId);
|
|
514
|
+
if (item && item.source.url) window.open(item.source.url, "_blank", "noopener");
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
function syncControls() {
|
|
519
|
+
$("work-search").value = state.filters.q;
|
|
520
|
+
$("bucket-filter").value = state.filters.bucket;
|
|
521
|
+
$("sort-filter").value = state.filters.sort;
|
|
522
|
+
document.querySelector('[data-nav="work"]').classList.toggle("selected", state.filters.bucket !== "history");
|
|
523
|
+
document.querySelector('[data-nav="history"]').classList.toggle("selected", state.filters.bucket === "history");
|
|
524
|
+
$("work-title").textContent = state.filters.bucket === "history" ? t("historyTitle") : t("workTitle");
|
|
525
|
+
$("work-subtitle").textContent = state.filters.bucket === "history" ? t("historySubtitle") : t("workSubtitle");
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
function updateFilters() {
|
|
529
|
+
state.filters.q = $("work-search").value.trim();
|
|
530
|
+
state.filters.repo = $("repo-filter").value;
|
|
531
|
+
state.filters.actor = $("actor-filter").value;
|
|
532
|
+
state.filters.bucket = $("bucket-filter").value;
|
|
533
|
+
state.filters.sort = $("sort-filter").value;
|
|
534
|
+
state.filters.cursor = "";
|
|
535
|
+
state.selectedId = null;
|
|
536
|
+
writeUrlState();
|
|
537
|
+
syncControls();
|
|
538
|
+
loadWorkItems();
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
function applyTheme(choice) {
|
|
542
|
+
state.theme = ["system", "light", "dark"].includes(choice) ? choice : "system";
|
|
543
|
+
const dark = matchMedia("(prefers-color-scheme: dark)").matches;
|
|
544
|
+
document.documentElement.dataset.themeChoice = state.theme;
|
|
545
|
+
document.documentElement.dataset.colorMode = state.theme === "system" ? (dark ? "dark" : "light") : state.theme;
|
|
546
|
+
localStorage.setItem("robertWorkbenchTheme", state.theme);
|
|
547
|
+
$("theme-select").value = state.theme;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
function startAutoRefresh() {
|
|
551
|
+
if (state.refreshTimer) clearInterval(state.refreshTimer);
|
|
552
|
+
state.refreshTimer = setInterval(() => loadWorkItems({ reason: "auto" }), 30000);
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
556
|
+
state.filters = readUrlState();
|
|
557
|
+
state.selectedId = state.filters.selectedId;
|
|
558
|
+
state.language = localStorage.getItem("robertLanguage") || "en";
|
|
559
|
+
state.theme = localStorage.getItem("robertWorkbenchTheme") || "system";
|
|
560
|
+
applyTranslations();
|
|
561
|
+
syncControls();
|
|
562
|
+
applyTheme(state.theme);
|
|
563
|
+
let searchTimer = null;
|
|
564
|
+
$("filter-form").addEventListener("submit", (event) => { event.preventDefault(); updateFilters(); });
|
|
565
|
+
$("work-search").addEventListener("input", () => { clearTimeout(searchTimer); searchTimer = setTimeout(updateFilters, 220); });
|
|
566
|
+
$("repo-filter").addEventListener("change", updateFilters);
|
|
567
|
+
$("actor-filter").addEventListener("change", updateFilters);
|
|
568
|
+
$("bucket-filter").addEventListener("change", updateFilters);
|
|
569
|
+
$("sort-filter").addEventListener("change", updateFilters);
|
|
570
|
+
$("retry-button").addEventListener("click", () => loadWorkItems());
|
|
571
|
+
$("load-more").addEventListener("click", () => { state.filters.cursor = state.list.next_cursor || ""; writeUrlState(); loadWorkItems({ append: true }); });
|
|
572
|
+
$("drawer-close").addEventListener("click", closeDetailDrawer);
|
|
573
|
+
$("drawer-scrim").addEventListener("click", closeDetailDrawer);
|
|
574
|
+
$("theme-select").addEventListener("change", (event) => applyTheme(event.target.value));
|
|
575
|
+
$("language-select").addEventListener("change", (event) => setLanguage(event.target.value));
|
|
576
|
+
window.addEventListener("keydown", handleKeyboardShortcut);
|
|
577
|
+
window.addEventListener("popstate", () => { state.filters = readUrlState(); state.selectedId = state.filters.selectedId; syncControls(); loadWorkItems(); });
|
|
578
|
+
matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => { if (document.documentElement.dataset.themeChoice === "system") applyTheme("system"); });
|
|
579
|
+
loadWorkItems();
|
|
580
|
+
startAutoRefresh();
|
|
581
|
+
});
|