@zq-silk/yui 2.3.0 → 2.4.0
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.
- package/README.md +15 -1
- package/dist/artifacts/artifactCapability.js +39 -10
- package/dist/artifacts/imageMetadata.js +120 -0
- package/dist/artifacts/managedGit.js +7 -4
- package/dist/artifacts/taskArtifactRepository.js +6 -0
- package/dist/cli/commandCatalog.js +17 -8
- package/dist/cli/invocationAuthority.js +1 -1
- package/dist/commands/executionAuditCommands.js +5 -0
- package/dist/commands/globalRoleCommands.js +41 -3
- package/dist/commands/projectCommands.js +89 -94
- package/dist/commands/roleSkillValidation.js +4 -8
- package/dist/commands/taskCommands.js +25 -2
- package/dist/commands/taskUsageCommand.js +38 -0
- package/dist/context/roleSessionContext.js +18 -2
- package/dist/context/runContextPack.js +5 -1
- package/dist/context/sessionBootstrapManifest.js +10 -1
- package/dist/context/skillCatalog.js +108 -0
- package/dist/context/skillPackage.js +161 -0
- package/dist/context/taskContext.js +3 -2
- package/dist/context/taskSearch.js +127 -0
- package/dist/controlPlaneCli.js +25 -20
- package/dist/controller/fileSchedulerStoreAdapter.js +32 -6
- package/dist/controller/jobControl.js +2 -0
- package/dist/controller/nativeHostInput.js +37 -0
- package/dist/controller/runtime.js +93 -2
- package/dist/controller/runtimeEventInbox.js +2 -2
- package/dist/controller/runtimeEventProcessor.js +3 -3
- package/dist/doctor/doctor.js +10 -0
- package/dist/execution/reviewMainRun.js +1 -0
- package/dist/execution/workItemMainRun.js +1 -0
- package/dist/executor/codexConfigConflict.js +6 -4
- package/dist/executor/effectiveLaunch.js +24 -1
- package/dist/executor/fileRoleLaunchPlanner.js +13 -5
- package/dist/integration/gitIntegrationService.js +7 -12
- package/dist/integration/integrationSourceApplication.js +4 -2
- package/dist/job/httpPreview.js +61 -0
- package/dist/job/jobRunner.js +12 -2
- package/dist/kernel/builtinCapabilities.js +3 -1
- package/dist/message/message.js +15 -1
- package/dist/output/rolePresentation.js +4 -1
- package/dist/repository/executionLaneGitSnapshot.js +2 -1
- package/dist/repository/gitCompatibility.js +62 -0
- package/dist/repository/gitWorkspace.js +48 -71
- package/dist/repository/gitWorktreeInventory.js +121 -0
- package/dist/repository/project.js +74 -25
- package/dist/resources/resourceDiscovery.js +2 -2
- package/dist/resources/resourceGc.js +7 -4
- package/dist/resources/resourceRegistrar.js +2 -1
- package/dist/runtime/agentEndpoint.js +8 -0
- package/dist/runtime/agentHost.js +170 -3
- package/dist/runtime/codexAppServerRuntime.js +1 -1
- package/dist/runtime/codexNativeAccess.js +175 -0
- package/dist/runtime/controlledCodexTui.js +116 -0
- package/dist/runtime/publicReply.js +23 -0
- package/dist/runtime/runtimeObservation.js +48 -0
- package/dist/runtime/structuredProviderHost.js +16 -7
- package/dist/runtime/taskCostMetrics.js +133 -0
- package/dist/runtime/taskUsageMetrics.js +11 -2
- package/dist/runtime/taskUsageQuery.js +38 -0
- package/dist/scheduler/taskExecutionProjection.js +2 -0
- package/dist/scheduler/taskObservabilityProjection.js +9 -1
- package/dist/storage/homeLayout.js +13 -0
- package/dist/storage/sqliteSchema.js +44 -0
- package/dist/storage/sqliteStore.js +53 -0
- package/dist/storage/storageVersions.js +1 -1
- package/dist/storage/storeRpc.js +2 -0
- package/dist/storage/taskSearch.js +35 -0
- package/dist/storage/upgrade/projectKnowledgeMigration.js +52 -0
- package/dist/task/ordinaryArchive.js +42 -0
- package/dist/tmux/tmuxManager.js +8 -8
- package/dist/web/assets/assetManifest.js +11 -51
- package/dist/web/assets/client/app/catalog.js +215 -0
- package/dist/web/assets/client/app/main.js +148 -0
- package/dist/web/assets/client/app/selection.js +139 -0
- package/dist/web/assets/client/app/settings.js +326 -0
- package/dist/web/assets/client/app/taskView.js +280 -0
- package/dist/web/assets/client/domain/context.js +96 -0
- package/dist/web/assets/client/domain/records.js +126 -0
- package/dist/web/assets/client/domain/runs.js +119 -0
- package/dist/web/assets/client/domain/taskForms.js +197 -0
- package/dist/web/assets/client/domain/vocab.js +69 -0
- package/dist/web/assets/client/domain/work.js +116 -0
- package/dist/web/assets/client/i18n/en.js +900 -0
- package/dist/web/assets/client/i18n/zh-CN.js +898 -0
- package/dist/web/assets/client/index.js +114 -0
- package/dist/web/assets/client/layout/resizer.js +37 -0
- package/dist/web/assets/client/layout/router.js +35 -0
- package/dist/web/assets/client/layout/shortcuts.js +45 -0
- package/dist/web/assets/client/layout/sizing.js +95 -0
- package/dist/web/assets/client/layout/workspace.js +247 -0
- package/dist/web/assets/client/{api.js → lib/api.js} +20 -4
- package/dist/web/assets/client/{dom.js → lib/dom.js} +24 -12
- package/dist/web/assets/client/{format.js → lib/format.js} +7 -0
- package/dist/web/assets/client/lib/i18n.js +54 -0
- package/dist/web/assets/client/lib/markdown.js +167 -0
- package/dist/web/assets/client/lib/prefs.js +28 -0
- package/dist/web/assets/client/lib/theme.js +68 -0
- package/dist/web/assets/client/ui/containers.js +101 -0
- package/dist/web/assets/client/ui/controls.js +51 -0
- package/dist/web/assets/client/ui/forms.js +48 -0
- package/dist/web/assets/client/ui/metrics.js +137 -0
- package/dist/web/assets/client/ui/primitives.js +92 -0
- package/dist/web/assets/client/ui/text.js +33 -0
- package/dist/web/assets/client/ui/toast.js +12 -0
- package/dist/web/assets/client/views/bodySearch.js +172 -0
- package/dist/web/assets/client/views/createTask.js +85 -0
- package/dist/web/assets/client/views/dock/conversation.js +612 -0
- package/dist/web/assets/client/views/dock/discussion.js +173 -0
- package/dist/web/assets/client/views/dock/preview.js +129 -0
- package/dist/web/assets/client/views/dock/terminal.js +199 -0
- package/dist/web/assets/client/views/globalInput.js +67 -0
- package/dist/web/assets/client/{overview.js → views/overview.js} +61 -51
- package/dist/web/assets/client/{sidebar.js → views/sidebar.js} +56 -62
- package/dist/web/assets/client/views/skills.js +152 -0
- package/dist/web/assets/client/views/task/actions.js +36 -0
- package/dist/web/assets/client/views/task/delivery.js +185 -0
- package/dist/web/assets/client/views/task/deliveryResults.js +159 -0
- package/dist/web/assets/client/views/task/files.js +272 -0
- package/dist/web/assets/client/views/task/observation.js +153 -0
- package/dist/web/assets/client/views/task/overview.js +161 -0
- package/dist/web/assets/client/views/task/page.js +131 -0
- package/dist/web/assets/client/views/task/records.js +163 -0
- package/dist/web/assets/client/views/task/runtime.js +130 -0
- package/dist/web/assets/client/views/task/timeline.js +190 -0
- package/dist/web/assets/shared/geometry.js +19 -0
- package/dist/web/assets/shared/taskTabs.js +8 -0
- package/dist/web/assets/shared/themes.js +93 -0
- package/dist/web/assets/shell/dialogs.js +63 -0
- package/dist/web/assets/shell/dock.js +40 -0
- package/dist/web/assets/shell/index.js +40 -0
- package/dist/web/assets/shell/settings.js +34 -0
- package/dist/web/assets/shell/sidebar.js +45 -0
- package/dist/web/assets/styles/index.js +41 -0
- package/dist/web/assets/styles/{responsive.js → layout/responsive.js} +10 -10
- package/dist/web/assets/styles/{layout.js → layout/workspace.js} +17 -24
- package/dist/web/assets/styles/markdown.js +22 -3
- package/dist/web/assets/styles/tokens.js +10 -63
- package/dist/web/assets/styles/ui/controls.js +76 -0
- package/dist/web/assets/styles/ui/forms.js +46 -0
- package/dist/web/assets/styles/ui/surfaces.js +122 -0
- package/dist/web/assets/styles/views/delivery.js +29 -0
- package/dist/web/assets/styles/views/dock.js +71 -0
- package/dist/web/assets/styles/views/page.js +32 -0
- package/dist/web/assets/styles/views/records.js +70 -0
- package/dist/web/assets/styles/views/settings.js +26 -0
- package/dist/web/assets/styles/views/sidebar.js +74 -0
- package/dist/web/assets/styles/views/task.js +80 -0
- package/dist/web/assets/styles/views/terminal.js +38 -0
- package/dist/web/taskPreviews.js +205 -0
- package/dist/web/tmuxWebTerminal.js +16 -9
- package/dist/web/webConversation.js +373 -0
- package/dist/web/webMaterials.js +155 -0
- package/dist/web/webServer.js +295 -18
- package/dist/web/webSettings.js +331 -0
- package/dist/web/webSkills.js +86 -0
- package/dist/web/webSnapshot.js +40 -8
- package/dist/web/webTaskSurface.js +106 -8
- package/dist/workspace/gitChangeSetCapture.js +3 -1
- package/docs/managed-turn-and-session-runtime.md +9 -0
- package/docs/managed-turn-and-session-runtime.zh-CN.md +7 -0
- package/docs/release-workflow.md +28 -0
- package/docs/release-workflow.zh-CN.md +21 -0
- package/docs/storage-baseline.md +38 -1
- package/docs/storage-baseline.zh-CN.md +22 -0
- package/docs/task-discovery.md +28 -0
- package/docs/testing/verification-levels.md +2 -2
- package/i18n/README.zh-CN.md +1 -1
- package/package.json +1 -1
- package/dist/web/assets/client/app.js +0 -808
- package/dist/web/assets/client/components.js +0 -477
- package/dist/web/assets/client/detail.js +0 -379
- package/dist/web/assets/client/dock.js +0 -309
- package/dist/web/assets/client/evidence.js +0 -364
- package/dist/web/assets/client/forms.js +0 -230
- package/dist/web/assets/client/i18n.js +0 -1277
- package/dist/web/assets/client/markdown.js +0 -114
- package/dist/web/assets/client/records.js +0 -198
- package/dist/web/assets/client/sections.js +0 -349
- package/dist/web/assets/client/theme.js +0 -71
- package/dist/web/assets/shell.js +0 -161
- package/dist/web/assets/styles/components.js +0 -216
- package/dist/web/assets/styles/views.js +0 -309
- /package/dist/web/assets/{icons.js → shared/icons.js} +0 -0
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
export const DETAIL_SCRIPT = String.raw `
|
|
2
|
-
// Task detail: header, section tabs and the Overview section. The runtime
|
|
3
|
-
// observation arrives separately from the Context snapshot, so every fact it
|
|
4
|
-
// feeds lives in a [data-slot] that updateObservation() can redraw in place.
|
|
5
|
-
import { h, icon, clear } from "/assets/js/dom.js";
|
|
6
|
-
import { formatDateTime, formatClock, relativeTime } from "/assets/js/format.js";
|
|
7
|
-
import {
|
|
8
|
-
badge, statusBadge, label, tone, card, disclosure, richText, bulletList, emptyState,
|
|
9
|
-
note, button, chip, mono, inputCard, kv, dot, timeTag
|
|
10
|
-
} from "/assets/js/components.js";
|
|
11
|
-
import { entriesOf, valuesOf, totalOf, recordCard, readExact } from "/assets/js/records.js";
|
|
12
|
-
import { renderRuntime, renderRecords } from "/assets/js/sections.js";
|
|
13
|
-
import { renderDelivery } from "/assets/js/evidence.js";
|
|
14
|
-
|
|
15
|
-
// Overview: where it stands. Delivery: what it produced. Runtime: what is
|
|
16
|
-
// live now. Records: what happened. Retired section names stay addressable.
|
|
17
|
-
export const TABS = ["overview", "delivery", "runtime", "records"];
|
|
18
|
-
export const TAB_ALIASES = { work: "delivery", execution: "runtime", history: "records", details: "records" };
|
|
19
|
-
const TAB_ICONS = { overview: "target", delivery: "package", runtime: "pulse", records: "history" };
|
|
20
|
-
const SESSION_GROUPS = ["active", "waiting", "background", "quiet", "diagnostic", "stopped", "unknown", "idle"];
|
|
21
|
-
|
|
22
|
-
export function renderTaskDetail(container, data, t, locale, ctx) {
|
|
23
|
-
clear(container);
|
|
24
|
-
const task = data.task;
|
|
25
|
-
const core = data.core;
|
|
26
|
-
container.dataset.taskId = task.id;
|
|
27
|
-
data.viewState.coreKey = core.coreCursor;
|
|
28
|
-
const page = h("div.page.task-page");
|
|
29
|
-
|
|
30
|
-
// --- Header ----------------------------------------------------------------
|
|
31
|
-
const bar = h("div.task-bar", null,
|
|
32
|
-
h("button.icon-btn.back-btn", { type: "button", "aria-label": t("actions.back"), title: t("actions.back"), onclick: ctx.onBack }, icon("back")),
|
|
33
|
-
h("nav.crumbs", { "aria-label": t("crumbs.label") },
|
|
34
|
-
h("button.crumb", { type: "button", onclick: ctx.onBack }, t("crumbs.tasks")),
|
|
35
|
-
h("span.crumb-sep", { "aria-hidden": "true" }, "/"),
|
|
36
|
-
h("code.crumb-current", null, task.id)),
|
|
37
|
-
h("span.spacer"),
|
|
38
|
-
h("button.btn.btn-ghost.dock-toggle", {
|
|
39
|
-
type: "button", dataset: { dockToggle: "discussion" }, title: t("dock.discussion") + " · D",
|
|
40
|
-
onclick: function () { ctx.showDock("discussion"); }
|
|
41
|
-
}, icon("chat"), h("span", null, t("dock.discussion"))),
|
|
42
|
-
h("button.btn.btn-ghost.dock-toggle", {
|
|
43
|
-
type: "button", dataset: { dockToggle: "session" }, title: t("dock.session"),
|
|
44
|
-
onclick: function () { ctx.showDock("session"); }
|
|
45
|
-
}, icon("terminal"), h("span", null, t("dock.session"))));
|
|
46
|
-
|
|
47
|
-
const meta = h("div.task-meta", null,
|
|
48
|
-
statusBadge(t, "task", "status", task.status),
|
|
49
|
-
h("span", { dataset: { slot: "exec-badge" } }),
|
|
50
|
-
task.priority ? badge(label(t, "priority", task.priority), task.priority === "urgent" || task.priority === "high" ? "accent" : "idle") : null,
|
|
51
|
-
(task.tags || []).map(function (tag) { return chip("#" + tag); }),
|
|
52
|
-
h("span.meta-item", null, icon("clock", "icon-sm"), t("task.updated") + " ", timeTag(task.updatedAt, locale, t)),
|
|
53
|
-
(task.projectBindings || []).length ? h("span.meta-item", null, icon("layers", "icon-sm"),
|
|
54
|
-
task.projectBindings.map(function (binding) { return binding.projectId; }).join(", ")) : null);
|
|
55
|
-
|
|
56
|
-
// Tab counts are current totals from the same bounded read, not samples:
|
|
57
|
-
// open questions, open work items and open execution records.
|
|
58
|
-
const counts = {
|
|
59
|
-
overview: core.attention.openInputs.count,
|
|
60
|
-
delivery: totalOf(core, "work-item"),
|
|
61
|
-
runtime: totalOf(core, "run")
|
|
62
|
-
};
|
|
63
|
-
const tabs = h("nav.tabs", { role: "tablist", "aria-label": t("tabs.label") }, TABS.map(function (tab, index) {
|
|
64
|
-
return h("button.tab", {
|
|
65
|
-
type: "button", role: "tab", id: "tab-" + tab,
|
|
66
|
-
"aria-controls": "panel-" + tab,
|
|
67
|
-
"aria-selected": String(ctx.activeTab === tab),
|
|
68
|
-
tabIndex: ctx.activeTab === tab ? 0 : -1,
|
|
69
|
-
title: t("tabs." + tab) + " · " + (index + 1),
|
|
70
|
-
dataset: { tab: tab },
|
|
71
|
-
onclick: function () { ctx.onTab(tab); }
|
|
72
|
-
}, icon(TAB_ICONS[tab], "icon-sm"), h("span", null, t("tabs." + tab)),
|
|
73
|
-
counts[tab] ? h("span.count" + (tab === "overview" ? ".tone-warn" : ""), null, String(counts[tab])) : null);
|
|
74
|
-
}));
|
|
75
|
-
tabs.addEventListener("keydown", function (event) {
|
|
76
|
-
if (event.key !== "ArrowRight" && event.key !== "ArrowLeft") return;
|
|
77
|
-
event.preventDefault();
|
|
78
|
-
const selected = tabs.querySelector('[aria-selected="true"]');
|
|
79
|
-
const index = TABS.indexOf(selected.dataset.tab);
|
|
80
|
-
const next = TABS[(index + (event.key === "ArrowRight" ? 1 : TABS.length - 1)) % TABS.length];
|
|
81
|
-
ctx.onTab(next);
|
|
82
|
-
const button = tabs.querySelector('[data-tab="' + next + '"]');
|
|
83
|
-
if (button) button.focus();
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
page.append(h("header.task-header", null, bar),
|
|
87
|
-
h("div.task-hero", null, h("h1.task-title", null, task.title), meta),
|
|
88
|
-
h("div.tabs-wrap", null, tabs));
|
|
89
|
-
|
|
90
|
-
// --- Panels ------------------------------------------------------------------
|
|
91
|
-
const panels = {};
|
|
92
|
-
TABS.forEach(function (tab) {
|
|
93
|
-
panels[tab] = h("section.tab-panel", { id: "panel-" + tab, role: "tabpanel", "aria-labelledby": "tab-" + tab, hidden: ctx.activeTab !== tab });
|
|
94
|
-
page.append(panels[tab]);
|
|
95
|
-
});
|
|
96
|
-
renderOverviewPanel(panels.overview, data, t, locale, ctx);
|
|
97
|
-
renderDelivery(panels.delivery, data, t, locale, ctx);
|
|
98
|
-
renderRuntime(panels.runtime, data, t, locale, ctx);
|
|
99
|
-
renderRecords(panels.records, data, t, locale, ctx);
|
|
100
|
-
container.append(page);
|
|
101
|
-
updateObservation(container, data, t, locale, ctx);
|
|
102
|
-
const active = panels[ctx.activeTab];
|
|
103
|
-
if (active && active.onShow) active.onShow();
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// A panel may read on first show (evidence, record pages); it keeps those
|
|
107
|
-
// reads in view state, so showing it again does not repeat them.
|
|
108
|
-
export function selectTab(container, tab) {
|
|
109
|
-
container.querySelectorAll(".tab").forEach(function (button) {
|
|
110
|
-
const active = button.dataset.tab === tab;
|
|
111
|
-
button.setAttribute("aria-selected", String(active));
|
|
112
|
-
button.tabIndex = active ? 0 : -1;
|
|
113
|
-
});
|
|
114
|
-
container.querySelectorAll(".tab-panel").forEach(function (panel) {
|
|
115
|
-
panel.hidden = panel.id !== "panel-" + tab;
|
|
116
|
-
if (!panel.hidden && panel.onShow) panel.onShow();
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// One reading column, top to bottom: where the Task stands now, what needs the
|
|
121
|
-
// user, what it has reported, its goal and its current decisions.
|
|
122
|
-
function renderOverviewPanel(panel, data, t, locale, ctx) {
|
|
123
|
-
const task = data.task;
|
|
124
|
-
const core = data.core;
|
|
125
|
-
// Now: the derived execution status (observation), the open questions and
|
|
126
|
-
// who acts next. drawNow() tints the banner with the status tone.
|
|
127
|
-
const now = card({ className: "now-card" });
|
|
128
|
-
now.body.append(h("div", { dataset: { slot: "now" } }), h("p.next-line", { dataset: { slot: "next" } }));
|
|
129
|
-
panel.append(now);
|
|
130
|
-
|
|
131
|
-
// Needs you: open InputRequests with their answer controls.
|
|
132
|
-
const inputs = entriesOf(core, "input-request").filter(function (entry) { return !entry.omitted && entry.value.status === "open"; });
|
|
133
|
-
const missing = core.attention.openInputs.refs.filter(function (ref) {
|
|
134
|
-
return !inputs.some(function (entry) { return entry.ref.refId === ref.refId; });
|
|
135
|
-
});
|
|
136
|
-
const inputCount = core.attention.openInputs.count;
|
|
137
|
-
if (inputCount) {
|
|
138
|
-
const needs = card({ title: t("overview.needsYou"), icon: "inbox", count: inputCount, className: "needs-card" });
|
|
139
|
-
needs.id = "detail-attention";
|
|
140
|
-
inputs.forEach(function (entry) { needs.body.append(inputCard(entry.value, t, locale, ctx.answerInput)); });
|
|
141
|
-
missing.forEach(function (ref) { needs.body.append(recordCard({ ref: ref, omitted: true }, task.id, t, ctx)); });
|
|
142
|
-
if (inputCount > inputs.length + missing.length) {
|
|
143
|
-
needs.body.append(note(t("overview.moreInputs"), "warn"), h("pre.code-block", null, "yui task input list " + task.id));
|
|
144
|
-
}
|
|
145
|
-
panel.append(needs);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
const progress = progressCard(data, t, locale, ctx);
|
|
149
|
-
const goal = goalCard(data, t, ctx);
|
|
150
|
-
panel.append(progress);
|
|
151
|
-
if (task.status === "draft") panel.append(planningCard(data, t, locale));
|
|
152
|
-
panel.append(goal, decisionsCard(data, t, locale, ctx));
|
|
153
|
-
// The Brief is the Overview's main source; when the bounded read withheld
|
|
154
|
-
// its value, read it exactly once per digest and redraw both cards.
|
|
155
|
-
const briefEntry = entriesOf(core, "task-brief")[0];
|
|
156
|
-
if (briefEntry && briefEntry.omitted) {
|
|
157
|
-
const view = data.viewState;
|
|
158
|
-
view.exact = view.exact || {};
|
|
159
|
-
readExact(briefEntry, task.id, ctx, view.exact).then(function (result) {
|
|
160
|
-
if (!progress.isConnected) return;
|
|
161
|
-
const exact = { ...data, briefValue: result.value };
|
|
162
|
-
progress.replaceWith(progressCard(exact, t, locale, ctx));
|
|
163
|
-
goal.replaceWith(goalCard(exact, t, ctx));
|
|
164
|
-
}, function () {});
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
function briefOf(data) {
|
|
169
|
-
return data.briefValue || valuesOf(data.core, "task-brief")[0];
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
function progressCard(data, t, locale, ctx) {
|
|
173
|
-
const task = data.task;
|
|
174
|
-
const element = card({ title: t("progress.title"), icon: "flag" });
|
|
175
|
-
const working = task.status === "draft" || task.status === "active";
|
|
176
|
-
if (task.completionSummary) element.body.append(richText(t("progress.completion"), task.completionSummary, t, { className: "callout.tone-ok" }));
|
|
177
|
-
if (task.retirementSummary) element.body.append(richText(t("progress.retirement"), task.retirementSummary, t, { className: "callout" }));
|
|
178
|
-
if (task.archiveSummary || task.archiveReason) element.body.append(richText(t("progress.archive"), [task.archiveSummary, task.archiveReason].filter(Boolean).join("\n\n"), t, { className: "callout" }));
|
|
179
|
-
const briefEntry = entriesOf(data.core, "task-brief")[0];
|
|
180
|
-
const brief = briefOf(data);
|
|
181
|
-
if (brief) {
|
|
182
|
-
element.body.append(richText(t(working ? "progress.focus" : "progress.lastFocus"), brief.currentFocus, t));
|
|
183
|
-
element.body.append(richText(t(working ? "progress.report" : "progress.lastReport"), brief.leaderSummary, t, { muted: true }));
|
|
184
|
-
element.body.append(h("p.faint.small", null, t("progress.briefUpdated") + " " + formatDateTime(brief.updatedAt, locale)));
|
|
185
|
-
} else if (briefEntry) element.body.append(recordCard(briefEntry, task.id, t, ctx, { compact: true }));
|
|
186
|
-
else element.body.append(emptyState(t("progress.none")));
|
|
187
|
-
return element;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
function goalCard(data, t, ctx) {
|
|
191
|
-
const task = data.task;
|
|
192
|
-
const brief = briefOf(data);
|
|
193
|
-
const element = card({ title: t("goal.title"), icon: "target" });
|
|
194
|
-
if (brief && brief.objective) element.body.append(richText(null, brief.objective, t));
|
|
195
|
-
if (brief && brief.boundaries && brief.boundaries.length) {
|
|
196
|
-
element.body.append(h("div.prose-block", null, h("h4.prose-label", null, t("goal.boundaries")), bulletList(brief.boundaries)));
|
|
197
|
-
}
|
|
198
|
-
if (brief && brief.technicalApproach) {
|
|
199
|
-
const approach = disclosure(t("goal.approach"), "approach");
|
|
200
|
-
approach.body.append(richText(null, brief.technicalApproach, t));
|
|
201
|
-
element.body.append(approach);
|
|
202
|
-
}
|
|
203
|
-
if (task.description) {
|
|
204
|
-
const requirements = disclosure(t("goal.requirements"), "requirements");
|
|
205
|
-
requirements.body.append(richText(null, task.description, t));
|
|
206
|
-
element.body.append(requirements);
|
|
207
|
-
}
|
|
208
|
-
if (!element.body.childNodes.length) element.body.append(emptyState(t("goal.none")));
|
|
209
|
-
return element;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
function decisionsCard(data, t, locale, ctx) {
|
|
213
|
-
const entries = entriesOf(data.core, "task-decision");
|
|
214
|
-
const active = entries.filter(function (entry) { return !entry.omitted && entry.value.status === "active"; });
|
|
215
|
-
const total = totalOf(data.core, "task-decision");
|
|
216
|
-
const element = card({ id: "detail-decisions", title: t("decisions.title"), icon: "check", count: total || null, hint: t("decisions.hint") });
|
|
217
|
-
active.slice(0, 3).forEach(function (entry) {
|
|
218
|
-
const value = entry.value;
|
|
219
|
-
element.body.append(h("article.decision", null,
|
|
220
|
-
h("header.decision-head", null, dot("ok"), h("strong", null, value.title), timeTag(value.createdAt, locale, t)),
|
|
221
|
-
value.rationale ? richText(null, value.rationale, t, { muted: true, threshold: 260 }) : null));
|
|
222
|
-
});
|
|
223
|
-
if (!active.length) element.body.append(emptyState(t("decisions.none")));
|
|
224
|
-
element.body.append(button(t("decisions.more"), { variant: "link", icon: "chevron", onClick: function () {
|
|
225
|
-
data.viewState.recordsFilter = "decision";
|
|
226
|
-
ctx.onTab("records");
|
|
227
|
-
} }));
|
|
228
|
-
return element;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// A Draft's Leader conversation is its planning Turn. Report the snapshot's
|
|
232
|
-
// real planning facts; a withheld value is reported as withheld, never as
|
|
233
|
-
// "not dispatched".
|
|
234
|
-
function planningCard(data, t, locale) {
|
|
235
|
-
const runEntries = entriesOf(data.core, "run");
|
|
236
|
-
const planning = valuesOf(data.core, "run").filter(function (run) { return run.roleName === "leader" && run.purpose === "planning"; });
|
|
237
|
-
const turn = planning[planning.length - 1] || null;
|
|
238
|
-
const withheld = turn === null && runEntries.some(function (entry) { return entry.omitted; });
|
|
239
|
-
const live = ((data.runtime && data.runtime.roles) || []).find(function (role) { return role.name === "leader"; }) || null;
|
|
240
|
-
const element = card({ title: t("planning.title"), icon: "sparkle", className: "planning-card" });
|
|
241
|
-
element.dataset.planning = turn ? turn.status : withheld ? "withheld" : "not-dispatched";
|
|
242
|
-
element.body.append(note(withheld ? t("planning.withheld") : turn === null ? t("planning.none")
|
|
243
|
-
: turn.status === "active" ? t("planning.open") : t("planning.settled").replace("{status}", turn.status)));
|
|
244
|
-
const environment = turn && turn.effective && turn.effective.executionEnvironment;
|
|
245
|
-
element.body.append(kv([
|
|
246
|
-
[t("planning.run"), turn ? mono(turn.id + " (" + turn.status + ")") : withheld ? t("planning.withheldValue") : t("common.none")],
|
|
247
|
-
[t("planning.providerTerminal"), (turn && turn.result && turn.result.provider && turn.result.provider.status) || t("common.notReported")],
|
|
248
|
-
[t("planning.conversation"), (turn && turn.result && turn.result.provider && turn.result.provider.conversationId) || t("common.notReported")],
|
|
249
|
-
[t("planning.liveSession"), (live && live.runtimeSession && live.runtimeSession.nativeSessionId) || t("planning.notRunning")],
|
|
250
|
-
[t("planning.environment"), (environment && environment.environmentRef) || t("planning.emptyEnvironment")],
|
|
251
|
-
[t("planning.updated"), turn ? formatDateTime((turn.result && turn.result.completedAt) || turn.updatedAt, locale) : t("common.unknown")]
|
|
252
|
-
]));
|
|
253
|
-
return element;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// --- Observation slots -------------------------------------------------------
|
|
257
|
-
export function updateObservation(container, data, t, locale, ctx) {
|
|
258
|
-
const available = data.runtimeStatus === "available" && data.runtime;
|
|
259
|
-
const execution = available ? data.runtime.execution : null;
|
|
260
|
-
const execBadge = container.querySelector('[data-slot="exec-badge"]');
|
|
261
|
-
if (execBadge) {
|
|
262
|
-
clear(execBadge);
|
|
263
|
-
if (execution && execution.status !== data.task.status) execBadge.append(statusBadge(t, "exec", "exec.status", execution.status));
|
|
264
|
-
}
|
|
265
|
-
const now = container.querySelector('[data-slot="now"]');
|
|
266
|
-
if (now && !now.contains(document.activeElement)) drawNow(now, data, execution, t, locale);
|
|
267
|
-
const next = container.querySelector('[data-slot="next"]');
|
|
268
|
-
if (next) {
|
|
269
|
-
clear(next);
|
|
270
|
-
if (execution && !(execution.next.owner === "none" && execution.next.action === "none")) next.append(icon("flag", "icon-sm"), h("span", null, t("now.nextOwner") + " "),
|
|
271
|
-
h("strong", null, label(t, "exec.owner", execution.next.owner)), h("span", null, " · " + label(t, "exec.action", execution.next.action)));
|
|
272
|
-
}
|
|
273
|
-
drawSessions(container, available ? data.runtime.sessions : null, t, locale);
|
|
274
|
-
const raw = container.querySelector('[data-slot="runtime-raw"]');
|
|
275
|
-
if (raw) raw.textContent = available ? JSON.stringify({ roles: data.runtime.roles, runtimeHealth: data.runtime.runtimeHealth }, null, 2) : "";
|
|
276
|
-
const rawStatus = container.querySelector('[data-slot="runtime-status"]');
|
|
277
|
-
if (rawStatus) rawStatus.textContent = t("observation." + data.runtimeStatus) + " · " + formatDateTime(data.runtimeObservedAt, locale);
|
|
278
|
-
container.querySelectorAll("[data-role-status]").forEach(function (slot) {
|
|
279
|
-
const role = available ? (data.runtime.roles || []).find(function (item) { return item.name === slot.dataset.roleStatus; }) : null;
|
|
280
|
-
clear(slot);
|
|
281
|
-
if (role) slot.append(statusBadge(t, "role", "role", role.status));
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
const BANNER_TONES = ["tone-info", "tone-ok", "tone-warn", "tone-bad", "tone-idle", "tone-accent"];
|
|
286
|
-
|
|
287
|
-
function drawNow(slot, data, execution, t, locale) {
|
|
288
|
-
clear(slot);
|
|
289
|
-
const inputCount = data.core.attention.openInputs.count;
|
|
290
|
-
const banner = slot.closest(".now-card");
|
|
291
|
-
if (banner) {
|
|
292
|
-
banner.classList.remove.apply(banner.classList, BANNER_TONES);
|
|
293
|
-
banner.classList.add("tone-" + (execution ? tone("exec", execution.status) : data.runtimeStatus === "unavailable" ? "bad" : "idle"));
|
|
294
|
-
}
|
|
295
|
-
if (!execution) {
|
|
296
|
-
slot.append(h("div.now-head", null,
|
|
297
|
-
badge(t("observation." + data.runtimeStatus), data.runtimeStatus === "unavailable" ? "bad" : "idle", { dot: true }),
|
|
298
|
-
h("span.now-owner", null, inputCount ? t("now.inputs").replace("{count}", String(inputCount)) : t("now.noInputs"))));
|
|
299
|
-
slot.append(h("p.now-note", null, data.runtimeStatus === "waiting" ? t("now.reading") : t("now.unavailable")));
|
|
300
|
-
return;
|
|
301
|
-
}
|
|
302
|
-
const head = h("div.now-head", null,
|
|
303
|
-
statusBadge(t, "exec", "exec.status", execution.status),
|
|
304
|
-
execution.owner === "none" && execution.action === "none" ? null
|
|
305
|
-
: h("span.now-owner", null, label(t, "exec.owner", execution.owner) + " · " + label(t, "exec.action", execution.action)));
|
|
306
|
-
if (execution.activeRuns && execution.activeRuns.length) head.append(badge(execution.activeRuns.length + " " + t("now.activeRuns"), "info"));
|
|
307
|
-
if (execution.monitoring === "stopped") head.append(badge(t("now.monitoringStopped"), "warn"));
|
|
308
|
-
if (execution.failClosed) head.append(badge(t("now.failClosed"), "bad"));
|
|
309
|
-
head.append(h("span.spacer"), h("span.faint.small", { title: formatDateTime(data.runtimeObservedAt, locale) },
|
|
310
|
-
t("now.observed") + " " + formatClock(data.runtimeObservedAt, locale)));
|
|
311
|
-
slot.append(head);
|
|
312
|
-
if (execution.summary) slot.append(h("p.now-summary", null, execution.summary));
|
|
313
|
-
if (execution.reason) slot.append(h("p.now-reason", null, execution.reason));
|
|
314
|
-
const signals = [];
|
|
315
|
-
(execution.attention || []).forEach(function (item) {
|
|
316
|
-
signals.push(h("li.signal-row.tone-warn", null, icon("alert", "icon-sm"),
|
|
317
|
-
h("span.signal-kind", null, label(t, "exec.attention", item.kind)), h("span", null, item.summary),
|
|
318
|
-
item.owner ? h("span.faint.small", null, label(t, "exec.owner", item.owner)) : null));
|
|
319
|
-
});
|
|
320
|
-
(execution.blockers || []).forEach(function (item) {
|
|
321
|
-
signals.push(h("li.signal-row.tone-bad", null, icon("alert", "icon-sm"),
|
|
322
|
-
h("span.signal-kind", null, label(t, "exec.blocker", item.kind)), h("span", null, item.summary),
|
|
323
|
-
h("span.faint.small", null, label(t, "exec.owner", item.owner))));
|
|
324
|
-
});
|
|
325
|
-
const sessions = (data.runtime.sessions && data.runtime.sessions.sessions) || [];
|
|
326
|
-
sessions.filter(function (session) { return session.group === "waiting" && ["user", "permission"].includes(session.waitingReason); })
|
|
327
|
-
.forEach(function (session) {
|
|
328
|
-
signals.push(h("li.signal-row.tone-warn", null, icon("user", "icon-sm"),
|
|
329
|
-
h("span.signal-kind", null, session.roleName), h("span", null, t("now.nativeWait"))));
|
|
330
|
-
});
|
|
331
|
-
if (signals.length) slot.append(h("ul.signal-list", null, signals));
|
|
332
|
-
else slot.append(h("p.now-note", null, inputCount ? t("now.inputs").replace("{count}", String(inputCount)) : t("now.clear")));
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
// Native Session observation, drawn into the Runtime tab: one line per Role,
|
|
336
|
-
// the group counts beside the Roles heading, and the timestamps under
|
|
337
|
-
// Diagnostics. Activity is never delivery progress.
|
|
338
|
-
function drawSessions(container, observation, t, locale) {
|
|
339
|
-
const sessions = observation ? observation.sessions : [];
|
|
340
|
-
container.querySelectorAll("[data-role-session]").forEach(function (slot) {
|
|
341
|
-
clear(slot);
|
|
342
|
-
const session = sessions.find(function (item) { return item.roleName === slot.dataset.roleSession; });
|
|
343
|
-
if (!session) {
|
|
344
|
-
slot.append(h("span.faint.small", null, observation ? t("session.noneRecorded") : t("sessions.unavailable")));
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
|
-
slot.append(h("div.role-session-head", null, dot(tone("session", session.group)),
|
|
348
|
-
h("strong", null, t("session." + session.group)),
|
|
349
|
-
h("span.faint.small", null, session.lastActivityAt ? relativeTime(session.lastActivityAt, locale, t) : t("sessions.unobserved"))));
|
|
350
|
-
if (session.reason) slot.append(h("p.small", null, session.reason));
|
|
351
|
-
if (session.waitingReason) slot.append(h("p.small", null, t("sessions.waitingFor") + " " + session.waitingReason));
|
|
352
|
-
});
|
|
353
|
-
const counts = container.querySelector('[data-slot="session-counts"]');
|
|
354
|
-
if (counts) {
|
|
355
|
-
clear(counts);
|
|
356
|
-
if (observation) SESSION_GROUPS.forEach(function (group) {
|
|
357
|
-
if (observation.counts[group]) counts.append(badge(observation.counts[group] + " " + t("session." + group), tone("session", group), { dot: true }));
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
const facts = container.querySelector('[data-slot="session-facts"]');
|
|
361
|
-
if (facts) {
|
|
362
|
-
clear(facts);
|
|
363
|
-
if (!observation) return;
|
|
364
|
-
facts.append(h("h4.sub-head", null, t("sessions.facts")));
|
|
365
|
-
if (!sessions.length) facts.append(note(t("sessions.none")));
|
|
366
|
-
sessions.forEach(function (session) {
|
|
367
|
-
facts.append(kv([
|
|
368
|
-
[t("sessions.role"), session.roleName],
|
|
369
|
-
[t("sessions.lastActivity"), session.lastActivityAt ? formatDateTime(session.lastActivityAt, locale) : t("sessions.unobserved")],
|
|
370
|
-
[t("sessions.inputUpdated"), formatDateTime(session.sourceUpdatedAt, locale)],
|
|
371
|
-
[t("sessions.operations"), session.operations.length ? session.operations.join(", ") : null],
|
|
372
|
-
[t("sessions.background"), session.background.length ? session.background.map(function (item) { return item.id + " · " + item.execution; }).join(", ") : null],
|
|
373
|
-
[t("sessions.identity"), mono([session.nativeSessionId, session.nativeTurnId, session.attemptId].filter(Boolean).join(" / "))]
|
|
374
|
-
]));
|
|
375
|
-
});
|
|
376
|
-
facts.append(h("p.faint.small", null, t("sessions.scope") + " " + formatDateTime(observation.readAt, locale)));
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
`;
|