@sixb/agent 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +31 -2
- package/dist/abort.d.ts +6 -0
- package/dist/abort.d.ts.map +1 -0
- package/dist/agent-prompt.d.ts +120 -0
- package/dist/agent-prompt.d.ts.map +1 -0
- package/dist/agent-runtime/errors.d.ts +13 -0
- package/dist/agent-runtime/errors.d.ts.map +1 -0
- package/dist/agent-runtime/preflight.d.ts +18 -0
- package/dist/agent-runtime/preflight.d.ts.map +1 -0
- package/dist/agent-runtime/profile.d.ts +14 -0
- package/dist/agent-runtime/profile.d.ts.map +1 -0
- package/dist/artifacts/layout-check/layout-check.d.ts +87 -0
- package/dist/artifacts/layout-check/layout-check.d.ts.map +1 -0
- package/dist/artifacts/materialize.d.ts +115 -0
- package/dist/artifacts/materialize.d.ts.map +1 -0
- package/dist/artifacts/publish-tool.d.ts +86 -0
- package/dist/artifacts/publish-tool.d.ts.map +1 -0
- package/dist/ask-parent-tool.d.ts +36 -0
- package/dist/ask-parent-tool.d.ts.map +1 -0
- package/dist/attachments.d.ts +68 -0
- package/dist/attachments.d.ts.map +1 -0
- package/dist/child-files.d.ts +96 -0
- package/dist/child-files.d.ts.map +1 -0
- package/dist/child-questions.d.ts +24 -0
- package/dist/child-questions.d.ts.map +1 -0
- package/dist/computer-runner.d.ts +65 -0
- package/dist/computer-runner.d.ts.map +1 -0
- package/dist/context-budget.d.ts +28 -0
- package/dist/context-budget.d.ts.map +1 -0
- package/dist/context-compaction.d.ts +48 -0
- package/dist/context-compaction.d.ts.map +1 -0
- package/dist/conversation-memory.d.ts +21 -0
- package/dist/conversation-memory.d.ts.map +1 -0
- package/dist/errors.d.ts +46 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/execution-plan.d.ts +34 -0
- package/dist/execution-plan.d.ts.map +1 -0
- package/dist/failure.d.ts +14 -0
- package/dist/failure.d.ts.map +1 -0
- package/dist/family-mailbox.d.ts +60 -0
- package/dist/family-mailbox.d.ts.map +1 -0
- package/dist/file-ref.d.ts +6 -0
- package/dist/file-ref.d.ts.map +1 -0
- package/dist/image-attachments.d.ts +34 -0
- package/dist/image-attachments.d.ts.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12168 -0
- package/dist/index.js.map +65 -0
- package/dist/message-authors.d.ts +34 -0
- package/dist/message-authors.d.ts.map +1 -0
- package/dist/message-times.d.ts +8 -0
- package/dist/message-times.d.ts.map +1 -0
- package/dist/model-adapters.d.ts +55 -0
- package/dist/model-adapters.d.ts.map +1 -0
- package/dist/model-lines.d.ts +16 -0
- package/dist/model-lines.d.ts.map +1 -0
- package/dist/requester.d.ts +15 -0
- package/dist/requester.d.ts.map +1 -0
- package/dist/run-agent-turn.d.ts +63 -0
- package/dist/run-agent-turn.d.ts.map +1 -0
- package/dist/run-child.d.ts +77 -0
- package/dist/run-child.d.ts.map +1 -0
- package/dist/run-conversation-turn.d.ts +42 -0
- package/dist/run-conversation-turn.d.ts.map +1 -0
- package/dist/run-credential.d.ts +22 -0
- package/dist/run-credential.d.ts.map +1 -0
- package/dist/run-environment.d.ts +115 -0
- package/dist/run-environment.d.ts.map +1 -0
- package/dist/run-fate.d.ts +15 -0
- package/dist/run-fate.d.ts.map +1 -0
- package/dist/run-sandbox.d.ts +60 -0
- package/dist/run-sandbox.d.ts.map +1 -0
- package/dist/run-subagent.d.ts +51 -0
- package/dist/run-subagent.d.ts.map +1 -0
- package/dist/run-workflow-agent-node.d.ts +41 -0
- package/dist/run-workflow-agent-node.d.ts.map +1 -0
- package/dist/sandbox-api-context.d.ts +34 -0
- package/dist/sandbox-api-context.d.ts.map +1 -0
- package/dist/sandbox-file-registry.d.ts +9 -0
- package/dist/sandbox-file-registry.d.ts.map +1 -0
- package/dist/sandbox-files.d.ts +71 -0
- package/dist/sandbox-files.d.ts.map +1 -0
- package/dist/sandbox-handle.d.ts +15 -0
- package/dist/sandbox-handle.d.ts.map +1 -0
- package/dist/sandbox-readiness.d.ts +8 -0
- package/dist/sandbox-readiness.d.ts.map +1 -0
- package/dist/skills/built-in.d.ts +15 -0
- package/dist/skills/built-in.d.ts.map +1 -0
- package/dist/subagent-continuation.d.ts +27 -0
- package/dist/subagent-continuation.d.ts.map +1 -0
- package/dist/subagent-inbox.d.ts +53 -0
- package/dist/subagent-inbox.d.ts.map +1 -0
- package/dist/subagent-tools.d.ts +282 -0
- package/dist/subagent-tools.d.ts.map +1 -0
- package/dist/thread-context.d.ts +12 -0
- package/dist/thread-context.d.ts.map +1 -0
- package/dist/tools/attachments.d.ts +11 -0
- package/dist/tools/attachments.d.ts.map +1 -0
- package/dist/tools/bash.d.ts +60 -0
- package/dist/tools/bash.d.ts.map +1 -0
- package/dist/tools/model-spec.d.ts +4 -0
- package/dist/tools/model-spec.d.ts.map +1 -0
- package/dist/tools/read.d.ts +43 -0
- package/dist/tools/read.d.ts.map +1 -0
- package/dist/tools/result-media.d.ts +22 -0
- package/dist/tools/result-media.d.ts.map +1 -0
- package/dist/tools/result-output.d.ts +18 -0
- package/dist/tools/result-output.d.ts.map +1 -0
- package/dist/tools/tool-files.d.ts +59 -0
- package/dist/tools/tool-files.d.ts.map +1 -0
- package/dist/tools/view-file.d.ts +40 -0
- package/dist/tools/view-file.d.ts.map +1 -0
- package/dist/tsconfig.json +5 -0
- package/dist/turn-runtime.d.ts +19 -0
- package/dist/turn-runtime.d.ts.map +1 -0
- package/dist/types.d.ts +76 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/workflow-input-attachments.d.ts +18 -0
- package/dist/workflow-input-attachments.d.ts.map +1 -0
- package/package.json +59 -4
- package/src/abort.ts +40 -0
- package/src/agent-prompt.ts +758 -0
- package/src/agent-runtime/errors.ts +44 -0
- package/src/agent-runtime/preflight.ts +314 -0
- package/src/agent-runtime/profile.ts +23 -0
- package/src/artifacts/layout-check/check.cjs +478 -0
- package/src/artifacts/layout-check/layout-check.ts +460 -0
- package/src/artifacts/materialize.ts +380 -0
- package/src/artifacts/publish-tool.ts +700 -0
- package/src/ask-parent-tool.ts +100 -0
- package/src/attachments.ts +850 -0
- package/src/child-files.ts +540 -0
- package/src/child-questions.ts +42 -0
- package/src/computer-runner.ts +284 -0
- package/src/context-budget.ts +161 -0
- package/src/context-compaction.ts +529 -0
- package/src/conversation-memory.ts +45 -0
- package/src/errors.ts +85 -0
- package/src/execution-plan.ts +50 -0
- package/src/failure.ts +71 -0
- package/src/family-mailbox.ts +189 -0
- package/src/file-ref.ts +18 -0
- package/src/image-attachments.ts +322 -0
- package/src/index.ts +54 -0
- package/src/message-authors.ts +77 -0
- package/src/message-times.ts +21 -0
- package/src/model-adapters.ts +227 -0
- package/src/model-lines.ts +28 -0
- package/src/requester.ts +21 -0
- package/src/run-agent-turn.ts +347 -0
- package/src/run-child.ts +319 -0
- package/src/run-conversation-turn.ts +257 -0
- package/src/run-credential.ts +55 -0
- package/src/run-environment.ts +769 -0
- package/src/run-fate.ts +51 -0
- package/src/run-sandbox.ts +63 -0
- package/src/run-subagent.ts +347 -0
- package/src/run-workflow-agent-node.ts +270 -0
- package/src/sandbox-api-context.ts +234 -0
- package/src/sandbox-file-registry.ts +26 -0
- package/src/sandbox-files.ts +326 -0
- package/src/sandbox-handle.ts +19 -0
- package/src/sandbox-readiness.ts +22 -0
- package/src/skills/built-in.ts +183 -0
- package/src/skills/sixb-artifacts/SKILL.md +95 -0
- package/src/skills/sixb-artifacts/canvas.md +104 -0
- package/src/skills/sixb-artifacts/document.md +63 -0
- package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/boards/first-job.html +42 -0
- package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/boards/region.html +29 -0
- package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/boards/shared.css +35 -0
- package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/boards/welcome.html +31 -0
- package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/canvas.json +107 -0
- package/src/skills/sixb-artifacts/examples/canvas/retro/canvas.json +158 -0
- package/src/skills/sixb-artifacts/examples/document/incident-report/document.md +35 -0
- package/src/skills/sixb-artifacts/examples/document/operations-review/document.md +41 -0
- package/src/skills/sixb-artifacts/examples/document/operations-review/figures/restorations.svg +1 -0
- package/src/skills/sixb-artifacts/examples/page/collections-desk/index.html +169 -0
- package/src/skills/sixb-artifacts/examples/page/collections-desk/queries/overdue.json +13 -0
- package/src/skills/sixb-artifacts/examples/page/dispatch-board/data/dispatch.json +234 -0
- package/src/skills/sixb-artifacts/examples/page/dispatch-board/index.html +245 -0
- package/src/skills/sixb-artifacts/examples/page/fleet-planner/data/plan.json +53 -0
- package/src/skills/sixb-artifacts/examples/page/fleet-planner/index.html +462 -0
- package/src/skills/sixb-artifacts/examples/page/service-explorer/data/service.json +276 -0
- package/src/skills/sixb-artifacts/examples/page/service-explorer/index.html +549 -0
- package/src/skills/sixb-artifacts/examples/sheet/overdue-invoices/queries/overdue.json +13 -0
- package/src/skills/sixb-artifacts/examples/sheet/overdue-invoices/workbook.json +30 -0
- package/src/skills/sixb-artifacts/examples/sheet/parts-inventory/sheets/Inventory.csv +13 -0
- package/src/skills/sixb-artifacts/examples/sheet/parts-inventory/sheets/Spend.csv +6 -0
- package/src/skills/sixb-artifacts/examples/sheet/parts-inventory/workbook.json +47 -0
- package/src/skills/sixb-artifacts/examples/sheet/service-metrics/sheets/Quarters.csv +5 -0
- package/src/skills/sixb-artifacts/examples/sheet/service-metrics/sheets/Regions.csv +5 -0
- package/src/skills/sixb-artifacts/examples/sheet/service-metrics/workbook.json +78 -0
- package/src/skills/sixb-artifacts/examples/slides/launch-plan/index.html +63 -0
- package/src/skills/sixb-artifacts/examples/slides/q3-review/index.html +133 -0
- package/src/skills/sixb-artifacts/file.md +17 -0
- package/src/skills/sixb-artifacts/page.md +215 -0
- package/src/skills/sixb-artifacts/queries.md +66 -0
- package/src/skills/sixb-artifacts/references.md +68 -0
- package/src/skills/sixb-artifacts/sheet.md +223 -0
- package/src/skills/sixb-artifacts/slides.md +137 -0
- package/src/skills/sixb-memory/SKILL.md +68 -0
- package/src/skills/text-assets.d.ts +25 -0
- package/src/subagent-continuation.ts +51 -0
- package/src/subagent-inbox.ts +101 -0
- package/src/subagent-tools.ts +1609 -0
- package/src/thread-context.ts +25 -0
- package/src/tools/attachments.ts +28 -0
- package/src/tools/bash.ts +217 -0
- package/src/tools/model-spec.ts +22 -0
- package/src/tools/read.ts +262 -0
- package/src/tools/result-media.ts +147 -0
- package/src/tools/result-output.ts +44 -0
- package/src/tools/tool-files.ts +204 -0
- package/src/tools/view-file.ts +155 -0
- package/src/turn-runtime.ts +33 -0
- package/src/types.ts +79 -0
- package/src/workflow-input-attachments.ts +140 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"quarter": "Q4 2026",
|
|
3
|
+
"weeks": [
|
|
4
|
+
"Oct 5",
|
|
5
|
+
"Oct 12",
|
|
6
|
+
"Oct 19",
|
|
7
|
+
"Oct 26",
|
|
8
|
+
"Nov 2",
|
|
9
|
+
"Nov 9",
|
|
10
|
+
"Nov 16",
|
|
11
|
+
"Nov 23",
|
|
12
|
+
"Nov 30",
|
|
13
|
+
"Dec 7",
|
|
14
|
+
"Dec 14",
|
|
15
|
+
"Dec 21",
|
|
16
|
+
"Dec 28"
|
|
17
|
+
],
|
|
18
|
+
"stormWeek": 6,
|
|
19
|
+
"crewsToday": 24,
|
|
20
|
+
"daysPerWeek": 5,
|
|
21
|
+
"regions": [
|
|
22
|
+
{
|
|
23
|
+
"region": "North",
|
|
24
|
+
"crews": 7,
|
|
25
|
+
"q3Visits": 1882,
|
|
26
|
+
"weekly": [131, 130, 132, 136, 148, 148, 221, 153, 154, 166, 160, 127, 140]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"region": "Harbor",
|
|
30
|
+
"crews": 6,
|
|
31
|
+
"q3Visits": 1385,
|
|
32
|
+
"weekly": [91, 95, 99, 103, 103, 110, 182, 114, 110, 119, 115, 93, 96]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"region": "Keystone",
|
|
36
|
+
"crews": 5,
|
|
37
|
+
"q3Visits": 1189,
|
|
38
|
+
"weekly": [76, 81, 84, 89, 91, 92, 131, 98, 97, 104, 104, 76, 86]
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"region": "Elm Valley",
|
|
42
|
+
"crews": 4,
|
|
43
|
+
"q3Visits": 955,
|
|
44
|
+
"weekly": [66, 69, 66, 71, 70, 77, 107, 75, 81, 83, 77, 64, 70]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"region": "Riverside",
|
|
48
|
+
"crews": 2,
|
|
49
|
+
"q3Visits": 727,
|
|
50
|
+
"weekly": [50, 49, 54, 56, 54, 60, 83, 57, 62, 65, 59, 48, 53]
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Q4 crew capacity planner</title>
|
|
6
|
+
<script src="https://cdn.jsdelivr.net/npm/echarts@5.5.1/dist/echarts.min.js"></script>
|
|
7
|
+
<style>
|
|
8
|
+
:root { --over: #c2410c; --ok: #15803d; }
|
|
9
|
+
html.dark { --over: #fb923c; --ok: #4ade80; }
|
|
10
|
+
|
|
11
|
+
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 32px; margin-bottom: 28px; }
|
|
12
|
+
.head .lede { margin-bottom: 0; }
|
|
13
|
+
|
|
14
|
+
/* A segmented control: one radio per scenario, the checked one raised. */
|
|
15
|
+
.segmented { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--muted); }
|
|
16
|
+
.segmented label { position: relative; margin: 0; }
|
|
17
|
+
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
|
|
18
|
+
.segmented span { display: block; padding: 6px 14px; border-radius: 7px; font-size: 13px; font-weight: 550; line-height: 18px; color: var(--muted-foreground); white-space: nowrap; cursor: pointer; transition: background-color 0.15s, color 0.15s; }
|
|
19
|
+
.segmented input:checked + span { background: var(--card); color: var(--foreground); box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 0 0 1px var(--border); }
|
|
20
|
+
.segmented input:focus-visible + span { outline: 2px solid var(--foreground); outline-offset: 1px; }
|
|
21
|
+
|
|
22
|
+
.layout { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 20px; align-items: start; margin-bottom: 16px; }
|
|
23
|
+
.layout > * { margin: 0; }
|
|
24
|
+
.side { position: sticky; top: 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
|
|
25
|
+
.side h3 { margin: 0; }
|
|
26
|
+
.main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
|
|
27
|
+
.main > .card { margin: 0; }
|
|
28
|
+
@media (max-width: 860px) {
|
|
29
|
+
.layout { grid-template-columns: minmax(0, 1fr); }
|
|
30
|
+
.side { position: static; }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Sliders, filled up to their value. */
|
|
34
|
+
.slider-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
|
|
35
|
+
.slider-head label { margin: 0; }
|
|
36
|
+
.slider-head output { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
|
|
37
|
+
input[type="range"] { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 24px; margin: 0; background: transparent; cursor: pointer; }
|
|
38
|
+
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 999px; background: linear-gradient(to right, var(--foreground) var(--fill), var(--border) var(--fill)); }
|
|
39
|
+
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border: 1px solid var(--border); border-radius: 50%; background: var(--card); box-shadow: 0 1px 3px rgb(0 0 0 / 0.18); }
|
|
40
|
+
input[type="range"]::-moz-range-track { height: 4px; border-radius: 999px; background: var(--border); }
|
|
41
|
+
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--foreground); }
|
|
42
|
+
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border: 1px solid var(--border); border-radius: 50%; background: var(--card); }
|
|
43
|
+
.scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted-foreground); }
|
|
44
|
+
|
|
45
|
+
/* A switch: a checkbox drawn as a track and a knob. */
|
|
46
|
+
.switch { display: flex; align-items: center; gap: 10px; margin: 0; font-weight: 500; cursor: pointer; }
|
|
47
|
+
.switch input { position: absolute; opacity: 0; pointer-events: none; }
|
|
48
|
+
.switch .track { flex: none; position: relative; width: 36px; height: 22px; border-radius: 999px; background: var(--border); transition: background-color 0.15s; }
|
|
49
|
+
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--card); box-shadow: 0 1px 2px rgb(0 0 0 / 0.25); transition: transform 0.15s; }
|
|
50
|
+
.switch input:checked + .track { background: var(--foreground); }
|
|
51
|
+
.switch input:checked + .track::after { transform: translateX(14px); }
|
|
52
|
+
.switch input:focus-visible + .track { outline: 2px solid var(--foreground); outline-offset: 2px; }
|
|
53
|
+
.switch small { display: block; font-weight: 400; }
|
|
54
|
+
|
|
55
|
+
/* Region chips, each with its series' swatch. */
|
|
56
|
+
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
57
|
+
.chip { position: relative; margin: 0; }
|
|
58
|
+
.chip input { position: absolute; opacity: 0; pointer-events: none; }
|
|
59
|
+
.chip span { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 0 11px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); font-size: 13px; font-weight: 500; cursor: pointer; transition: opacity 0.15s; }
|
|
60
|
+
.chip span::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: var(--swatch); }
|
|
61
|
+
.chip input:not(:checked) + span { opacity: 0.45; text-decoration: line-through; }
|
|
62
|
+
.chip input:focus-visible + span { outline: 2px solid var(--foreground); outline-offset: 1px; }
|
|
63
|
+
|
|
64
|
+
.stat .value.over { color: var(--over); }
|
|
65
|
+
.stat .value.ok { color: var(--ok); }
|
|
66
|
+
|
|
67
|
+
.chart-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 8px; }
|
|
68
|
+
.chart-head h3 { margin: 0; }
|
|
69
|
+
.key { display: flex; gap: 14px; font-size: 12px; color: var(--muted-foreground); }
|
|
70
|
+
.key span { display: inline-flex; align-items: center; gap: 6px; }
|
|
71
|
+
.key i { width: 14px; height: 0; border-top: 2px dashed var(--over); }
|
|
72
|
+
.key b { margin-right: -3px; color: var(--over); font-weight: 600; }
|
|
73
|
+
#chart { height: 340px; }
|
|
74
|
+
@media (max-width: 640px) { #chart { height: 280px; } }
|
|
75
|
+
|
|
76
|
+
td:first-child { white-space: nowrap; }
|
|
77
|
+
td .swatch { display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 3px; background: var(--swatch); }
|
|
78
|
+
.gap { font-weight: 600; }
|
|
79
|
+
.gap.over { color: var(--over); }
|
|
80
|
+
.gap.ok { color: var(--ok); }
|
|
81
|
+
.spark { display: block; width: 120px; height: 28px; }
|
|
82
|
+
.spark path { fill: none; stroke: var(--foreground); stroke-width: 1.5; }
|
|
83
|
+
.spark .area { fill: var(--muted); stroke: none; }
|
|
84
|
+
.spark circle { fill: var(--over); }
|
|
85
|
+
@media (max-width: 640px) { .trend { display: none; } }
|
|
86
|
+
</style>
|
|
87
|
+
</head>
|
|
88
|
+
<body>
|
|
89
|
+
<main>
|
|
90
|
+
<header class="head">
|
|
91
|
+
<div>
|
|
92
|
+
<p class="eyebrow">Q4 2026 · Field service</p>
|
|
93
|
+
<h1>Crew capacity planner</h1>
|
|
94
|
+
<p class="lede">Crews next quarter's visits need, week by week, against the crews we have. Pick a scenario or move the assumptions; every number follows.</p>
|
|
95
|
+
</div>
|
|
96
|
+
<div class="segmented" role="radiogroup" aria-label="Scenario">
|
|
97
|
+
<label><input type="radio" name="scenario" value="base" checked><span>Base</span></label>
|
|
98
|
+
<label><input type="radio" name="scenario" value="busy"><span>Busy winter</span></label>
|
|
99
|
+
<label><input type="radio" name="scenario" value="storm"><span>Storm season</span></label>
|
|
100
|
+
</div>
|
|
101
|
+
</header>
|
|
102
|
+
|
|
103
|
+
<div class="grid">
|
|
104
|
+
<div class="card stat"><div class="label">Visits forecast</div><div class="value" id="visits">–</div><div class="delta" id="visits-note">–</div></div>
|
|
105
|
+
<div class="card stat"><div class="label">Crews needed at peak</div><div class="value" id="peak">–</div><div class="delta" id="peak-note">–</div></div>
|
|
106
|
+
<div class="card stat"><div class="label">Crews available</div><div class="value" id="capacity">–</div><div class="delta" id="capacity-note">–</div></div>
|
|
107
|
+
<div class="card stat"><div class="label">At peak</div><div class="value" id="gap">–</div><div class="delta" id="gap-note">–</div></div>
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
<div class="layout">
|
|
111
|
+
<form class="card side" id="inputs">
|
|
112
|
+
<h3>Assumptions</h3>
|
|
113
|
+
<div>
|
|
114
|
+
<div class="slider-head"><label for="growth">Visit growth on Q3</label><output id="growth-out" for="growth"></output></div>
|
|
115
|
+
<input id="growth" type="range" min="-10" max="40" step="1">
|
|
116
|
+
<div class="scale"><span>−10%</span><span>+40%</span></div>
|
|
117
|
+
</div>
|
|
118
|
+
<div>
|
|
119
|
+
<div class="slider-head"><label for="pace">Visits per crew per day</label><output id="pace-out" for="pace"></output></div>
|
|
120
|
+
<input id="pace" type="range" min="3" max="7" step="0.25">
|
|
121
|
+
<div class="scale"><span>3</span><span>7</span></div>
|
|
122
|
+
</div>
|
|
123
|
+
<div>
|
|
124
|
+
<div class="slider-head"><label for="overtime">Overtime allowed</label><output id="overtime-out" for="overtime"></output></div>
|
|
125
|
+
<input id="overtime" type="range" min="0" max="25" step="5">
|
|
126
|
+
<div class="scale"><span>None</span><span>25%</span></div>
|
|
127
|
+
</div>
|
|
128
|
+
<div>
|
|
129
|
+
<div class="slider-head"><label for="contractors">Contract crews</label><output id="contractors-out" for="contractors"></output></div>
|
|
130
|
+
<input id="contractors" type="range" min="0" max="8" step="1">
|
|
131
|
+
<div class="scale"><span>0</span><span>8</span></div>
|
|
132
|
+
</div>
|
|
133
|
+
<label class="switch"><input id="storms" type="checkbox"><span class="track"></span><span>Storm season<small class="muted">Visits +25% from mid-November</small></span></label>
|
|
134
|
+
<div>
|
|
135
|
+
<label>Regions</label>
|
|
136
|
+
<div class="chips" id="regions"></div>
|
|
137
|
+
</div>
|
|
138
|
+
<div class="row"><button type="button" class="secondary" id="reset">Reset to base</button></div>
|
|
139
|
+
</form>
|
|
140
|
+
|
|
141
|
+
<div class="main">
|
|
142
|
+
<div class="card">
|
|
143
|
+
<div class="chart-head">
|
|
144
|
+
<h3>Crews needed by week</h3>
|
|
145
|
+
<div class="key"><span><i></i>Crews available</span><span><b>Red</b> weeks fall short</span></div>
|
|
146
|
+
</div>
|
|
147
|
+
<div id="chart" role="img" aria-label="Crews needed each week of Q4 by region, against crews available"></div>
|
|
148
|
+
</div>
|
|
149
|
+
<div class="card">
|
|
150
|
+
<h3>By region</h3>
|
|
151
|
+
<div class="table-scroll">
|
|
152
|
+
<table>
|
|
153
|
+
<thead><tr><th>Region</th><th class="num">Q4 visits</th><th class="num">Crews today</th><th class="num">Needed at peak</th><th class="num">Gap</th><th class="trend">Crews by week</th></tr></thead>
|
|
154
|
+
<tbody id="table"></tbody>
|
|
155
|
+
</table>
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
<p class="note">Source: field service records, Q3 2026, and the Q4 visit forecast. A crew works 5 days a week; overtime adds to every crew, contract crews to the whole fleet.</p>
|
|
162
|
+
</main>
|
|
163
|
+
|
|
164
|
+
<script>
|
|
165
|
+
const SCENARIOS = {
|
|
166
|
+
base: { growth: 8, pace: 5, overtime: 10, contractors: 0, storms: false },
|
|
167
|
+
busy: { growth: 18, pace: 5, overtime: 15, contractors: 2, storms: false },
|
|
168
|
+
storm: { growth: 8, pace: 5, overtime: 15, contractors: 2, storms: true },
|
|
169
|
+
}
|
|
170
|
+
const STORM_WEEKS = 6
|
|
171
|
+
const number = new Intl.NumberFormat("en-US")
|
|
172
|
+
const one = new Intl.NumberFormat("en-US", { maximumFractionDigits: 1 })
|
|
173
|
+
const field = (id) => document.getElementById(id)
|
|
174
|
+
const reduced = matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
175
|
+
let plan = null
|
|
176
|
+
let chart = null
|
|
177
|
+
|
|
178
|
+
/** The page's colors, read from the theme each time it draws. */
|
|
179
|
+
function palette() {
|
|
180
|
+
const style = getComputedStyle(document.documentElement)
|
|
181
|
+
const read = (name) => style.getPropertyValue(name).trim()
|
|
182
|
+
return {
|
|
183
|
+
foreground: read("--foreground"),
|
|
184
|
+
muted: read("--muted-foreground"),
|
|
185
|
+
border: read("--border"),
|
|
186
|
+
card: read("--card"),
|
|
187
|
+
over: read("--over"),
|
|
188
|
+
font: read("--font-sans"),
|
|
189
|
+
series: [1, 2, 3, 4, 5].map((index) => read(`--chart-${index}`)),
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** Counts a stat up or down to its new value. */
|
|
194
|
+
function tween(element, to, format) {
|
|
195
|
+
const from = Number(element.dataset.value ?? to)
|
|
196
|
+
element.dataset.value = String(to)
|
|
197
|
+
if (reduced || from === to) {
|
|
198
|
+
element.textContent = format(to)
|
|
199
|
+
return
|
|
200
|
+
}
|
|
201
|
+
const start = performance.now()
|
|
202
|
+
const step = (now) => {
|
|
203
|
+
const t = Math.min(1, (now - start) / 380)
|
|
204
|
+
element.textContent = format(from + (to - from) * (1 - (1 - t) ** 3))
|
|
205
|
+
if (t < 1) requestAnimationFrame(step)
|
|
206
|
+
}
|
|
207
|
+
requestAnimationFrame(step)
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function settings() {
|
|
211
|
+
return {
|
|
212
|
+
growth: Number(field("growth").value),
|
|
213
|
+
pace: Number(field("pace").value),
|
|
214
|
+
overtime: Number(field("overtime").value),
|
|
215
|
+
contractors: Number(field("contractors").value),
|
|
216
|
+
storms: field("storms").checked,
|
|
217
|
+
regions: [...document.querySelectorAll("#regions input:checked")].map((input) => input.value),
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function apply(scenario) {
|
|
222
|
+
for (const [name, value] of Object.entries(SCENARIOS[scenario])) {
|
|
223
|
+
if (typeof value === "boolean") field(name).checked = value
|
|
224
|
+
else field(name).value = String(value)
|
|
225
|
+
}
|
|
226
|
+
for (const input of document.querySelectorAll("#regions input")) input.checked = true
|
|
227
|
+
document.querySelector(`input[name="scenario"][value="${scenario}"]`).checked = true
|
|
228
|
+
render()
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** What the reader set last, kept for them with sixb.state: they come back to it. */
|
|
232
|
+
let keeping = null
|
|
233
|
+
function keep() {
|
|
234
|
+
clearTimeout(keeping)
|
|
235
|
+
const scenario = document.querySelector('input[name="scenario"]:checked')?.value ?? null
|
|
236
|
+
keeping = setTimeout(() => {
|
|
237
|
+
sixb.state.set("settings", { ...settings(), scenario }).catch(() => {})
|
|
238
|
+
}, 300)
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function restore(kept) {
|
|
242
|
+
for (const name of ["growth", "pace", "overtime", "contractors"]) {
|
|
243
|
+
if (typeof kept[name] === "number") field(name).value = String(kept[name])
|
|
244
|
+
}
|
|
245
|
+
field("storms").checked = kept.storms === true
|
|
246
|
+
for (const input of document.querySelectorAll("#regions input")) {
|
|
247
|
+
input.checked = !Array.isArray(kept.regions) || kept.regions.includes(input.value)
|
|
248
|
+
}
|
|
249
|
+
for (const input of document.querySelectorAll('input[name="scenario"]')) {
|
|
250
|
+
input.checked = input.value === kept.scenario
|
|
251
|
+
}
|
|
252
|
+
render()
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** Each region's visits and crews needed, week by week, under the settings. */
|
|
256
|
+
function model(s) {
|
|
257
|
+
const perCrewWeek = s.pace * plan.daysPerWeek
|
|
258
|
+
const factor = (week) =>
|
|
259
|
+
(1 + s.growth / 100) * (s.storms && week >= plan.stormWeek && week < plan.stormWeek + STORM_WEEKS ? 1.25 : 1)
|
|
260
|
+
const regions = plan.regions.map((region, index) => {
|
|
261
|
+
const visits = region.weekly.map((value, week) => value * factor(week))
|
|
262
|
+
const weekly = visits.map((value) => value / perCrewWeek)
|
|
263
|
+
return {
|
|
264
|
+
...region,
|
|
265
|
+
index,
|
|
266
|
+
weekly,
|
|
267
|
+
visits: visits.reduce((sum, value) => sum + value, 0),
|
|
268
|
+
peak: Math.max(...weekly),
|
|
269
|
+
on: s.regions.includes(region.region),
|
|
270
|
+
}
|
|
271
|
+
})
|
|
272
|
+
const shown = regions.filter((region) => region.on)
|
|
273
|
+
const needed = plan.weeks.map((_, week) => shown.reduce((sum, region) => sum + region.weekly[week], 0))
|
|
274
|
+
const crewsToday = shown.reduce((sum, region) => sum + region.crews, 0)
|
|
275
|
+
const available = (crewsToday + s.contractors) * (1 + s.overtime / 100)
|
|
276
|
+
return { shown, needed, crewsToday, available }
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function render() {
|
|
280
|
+
if (!plan) return
|
|
281
|
+
const s = settings()
|
|
282
|
+
const m = model(s)
|
|
283
|
+
for (const [id, text] of [
|
|
284
|
+
["growth", `${s.growth > 0 ? "+" : ""}${s.growth}%`],
|
|
285
|
+
["pace", one.format(s.pace)],
|
|
286
|
+
["overtime", s.overtime ? `${s.overtime}%` : "None"],
|
|
287
|
+
["contractors", String(s.contractors)],
|
|
288
|
+
]) {
|
|
289
|
+
const input = field(id)
|
|
290
|
+
field(`${id}-out`).textContent = text
|
|
291
|
+
input.style.setProperty("--fill", `${((input.value - input.min) / (input.max - input.min)) * 100}%`)
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
const visits = m.shown.reduce((sum, region) => sum + region.visits, 0)
|
|
295
|
+
const q3 = m.shown.reduce((sum, region) => sum + region.q3Visits, 0)
|
|
296
|
+
const peak = Math.max(0, ...m.needed)
|
|
297
|
+
const short = m.needed.filter((value) => value > m.available).length
|
|
298
|
+
const gap = m.available - peak
|
|
299
|
+
tween(field("visits"), visits, (value) => number.format(Math.round(value)))
|
|
300
|
+
field("visits-note").textContent = q3
|
|
301
|
+
? `${visits >= q3 ? "+" : "−"}${Math.abs(Math.round((visits / q3 - 1) * 100))}% on Q3`
|
|
302
|
+
: "No regions chosen"
|
|
303
|
+
tween(field("peak"), peak, (value) => one.format(value))
|
|
304
|
+
field("peak-note").textContent = `Week of ${plan.weeks[m.needed.indexOf(peak)] ?? "–"}`
|
|
305
|
+
tween(field("capacity"), m.available, (value) => one.format(value))
|
|
306
|
+
field("capacity-note").textContent =
|
|
307
|
+
`${m.crewsToday} crews${s.contractors ? ` + ${s.contractors} contract` : ""}${s.overtime ? `, ${s.overtime}% overtime` : ""}`
|
|
308
|
+
tween(field("gap"), gap, (value) => `${value < 0 ? "−" : "+"}${one.format(Math.abs(value))} crews`)
|
|
309
|
+
field("gap").className = `value ${gap < 0 ? "over" : "ok"}`
|
|
310
|
+
field("gap-note").textContent = short ? `Short in ${short} of 13 weeks` : "Covered every week"
|
|
311
|
+
|
|
312
|
+
drawChart(m)
|
|
313
|
+
drawTable(m, s)
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
function drawChart(m) {
|
|
317
|
+
if (!window.echarts) {
|
|
318
|
+
field("chart").textContent = "The chart needs cdn.jsdelivr.net, which this page could not reach."
|
|
319
|
+
return
|
|
320
|
+
}
|
|
321
|
+
const p = palette()
|
|
322
|
+
chart ??= echarts.init(field("chart"))
|
|
323
|
+
const short = plan.weeks.filter((_, week) => m.needed[week] > m.available)
|
|
324
|
+
chart.setOption(
|
|
325
|
+
{
|
|
326
|
+
animation: !reduced,
|
|
327
|
+
animationDuration: 350,
|
|
328
|
+
textStyle: { fontFamily: p.font },
|
|
329
|
+
grid: { left: 4, right: 12, top: 28, bottom: 4, containLabel: true },
|
|
330
|
+
tooltip: {
|
|
331
|
+
trigger: "axis",
|
|
332
|
+
axisPointer: { type: "shadow", shadowStyle: { color: p.border, opacity: 0.4 } },
|
|
333
|
+
backgroundColor: p.card,
|
|
334
|
+
borderColor: p.border,
|
|
335
|
+
textStyle: { color: p.foreground, fontFamily: p.font, fontSize: 13 },
|
|
336
|
+
valueFormatter: (value) => one.format(value),
|
|
337
|
+
},
|
|
338
|
+
xAxis: {
|
|
339
|
+
type: "category",
|
|
340
|
+
data: plan.weeks,
|
|
341
|
+
axisTick: { show: false },
|
|
342
|
+
axisLine: { lineStyle: { color: p.border } },
|
|
343
|
+
axisLabel: {
|
|
344
|
+
fontSize: 12,
|
|
345
|
+
hideOverlap: true,
|
|
346
|
+
// A week the crews fall short in is named in the warning color.
|
|
347
|
+
color: (week) => (short.includes(week) ? p.over : p.muted),
|
|
348
|
+
fontWeight: 500,
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
yAxis: {
|
|
352
|
+
type: "value",
|
|
353
|
+
name: "Crews",
|
|
354
|
+
nameTextStyle: { color: p.muted, fontSize: 12, align: "left" },
|
|
355
|
+
splitLine: { lineStyle: { color: p.border } },
|
|
356
|
+
axisLabel: { color: p.muted, fontSize: 12 },
|
|
357
|
+
},
|
|
358
|
+
series: [
|
|
359
|
+
...m.shown.map((region) => ({
|
|
360
|
+
name: region.region,
|
|
361
|
+
type: "bar",
|
|
362
|
+
stack: "crews",
|
|
363
|
+
barMaxWidth: 34,
|
|
364
|
+
itemStyle: { color: p.series[region.index], borderColor: p.card, borderWidth: 1 },
|
|
365
|
+
emphasis: { focus: "series" },
|
|
366
|
+
data: region.weekly.map((value) => Math.round(value * 10) / 10),
|
|
367
|
+
})),
|
|
368
|
+
{
|
|
369
|
+
name: "Crews available",
|
|
370
|
+
type: "line",
|
|
371
|
+
step: "middle",
|
|
372
|
+
symbol: "none",
|
|
373
|
+
z: 5,
|
|
374
|
+
lineStyle: { color: p.over, width: 2, type: [6, 4] },
|
|
375
|
+
data: plan.weeks.map(() => Math.round(m.available * 10) / 10),
|
|
376
|
+
},
|
|
377
|
+
],
|
|
378
|
+
},
|
|
379
|
+
{ replaceMerge: ["series"] }
|
|
380
|
+
)
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/** A region's crews by week as a small line, its peak marked when it outruns its crews. */
|
|
384
|
+
function sparkline(values, limit) {
|
|
385
|
+
const width = 120
|
|
386
|
+
const height = 28
|
|
387
|
+
const top = Math.max(limit, ...values) * 1.05
|
|
388
|
+
const x = (index) => (index / (values.length - 1)) * width
|
|
389
|
+
const y = (value) => height - 3 - (value / top) * (height - 6)
|
|
390
|
+
const line = values.map((value, index) => `${index ? "L" : "M"}${x(index).toFixed(1)},${y(value).toFixed(1)}`).join("")
|
|
391
|
+
const peak = values.indexOf(Math.max(...values))
|
|
392
|
+
const dot = values[peak] > limit ? `<circle cx="${x(peak)}" cy="${y(values[peak])}" r="2.5"></circle>` : ""
|
|
393
|
+
return `<svg class="spark" viewBox="0 0 ${width} ${height}" aria-hidden="true"><path class="area" d="${line}L${width},${height}L0,${height}Z"></path><path d="${line}"></path>${dot}</svg>`
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
function drawTable(m, s) {
|
|
397
|
+
field("table").replaceChildren(
|
|
398
|
+
...m.shown.map((region) => {
|
|
399
|
+
const capacity = region.crews * (1 + s.overtime / 100)
|
|
400
|
+
const gap = capacity - region.peak
|
|
401
|
+
const row = document.createElement("tr")
|
|
402
|
+
row.style.setProperty("--swatch", `var(--chart-${region.index + 1})`)
|
|
403
|
+
row.innerHTML = `
|
|
404
|
+
<td><span class="swatch"></span></td>
|
|
405
|
+
<td class="num">${number.format(Math.round(region.visits))}</td>
|
|
406
|
+
<td class="num">${region.crews}</td>
|
|
407
|
+
<td class="num">${one.format(region.peak)}</td>
|
|
408
|
+
<td class="num gap ${gap < 0 ? "over" : "ok"}">${gap < 0 ? "−" : "+"}${one.format(Math.abs(gap))}</td>
|
|
409
|
+
<td class="trend">${sparkline(region.weekly, capacity)}</td>`
|
|
410
|
+
row.cells[0].append(region.region)
|
|
411
|
+
return row
|
|
412
|
+
})
|
|
413
|
+
)
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
field("inputs").addEventListener("input", (event) => {
|
|
417
|
+
// A moved assumption is no longer the scenario it started from.
|
|
418
|
+
if (event.target.name !== "scenario" && event.target.closest("#regions") === null) {
|
|
419
|
+
for (const input of document.querySelectorAll('input[name="scenario"]')) input.checked = false
|
|
420
|
+
}
|
|
421
|
+
render()
|
|
422
|
+
keep()
|
|
423
|
+
})
|
|
424
|
+
for (const input of document.querySelectorAll('input[name="scenario"]')) {
|
|
425
|
+
input.addEventListener("change", () => {
|
|
426
|
+
apply(input.value)
|
|
427
|
+
keep()
|
|
428
|
+
})
|
|
429
|
+
}
|
|
430
|
+
field("reset").addEventListener("click", () => {
|
|
431
|
+
apply("base")
|
|
432
|
+
clearTimeout(keeping)
|
|
433
|
+
sixb.state.delete("settings").catch(() => {})
|
|
434
|
+
})
|
|
435
|
+
// A chart on a canvas keeps the colors it was drawn in: draw it again in the new theme.
|
|
436
|
+
addEventListener("sixb:theme", render)
|
|
437
|
+
new ResizeObserver(() => chart?.resize()).observe(field("chart"))
|
|
438
|
+
|
|
439
|
+
fetch("data/plan.json")
|
|
440
|
+
.then((response) => response.json())
|
|
441
|
+
.then((data) => {
|
|
442
|
+
plan = data
|
|
443
|
+
field("regions").replaceChildren(
|
|
444
|
+
...plan.regions.map((region, index) => {
|
|
445
|
+
const chip = document.createElement("label")
|
|
446
|
+
chip.className = "chip"
|
|
447
|
+
chip.style.setProperty("--swatch", `var(--chart-${index + 1})`)
|
|
448
|
+
chip.innerHTML = `<input type="checkbox" checked><span></span>`
|
|
449
|
+
chip.querySelector("input").value = region.region
|
|
450
|
+
chip.querySelector("span").textContent = region.region
|
|
451
|
+
return chip
|
|
452
|
+
})
|
|
453
|
+
)
|
|
454
|
+
// Where the reader left it, or the base plan the first time.
|
|
455
|
+
return sixb.state
|
|
456
|
+
.get("settings")
|
|
457
|
+
.catch(() => undefined)
|
|
458
|
+
.then((kept) => (kept ? restore(kept) : apply("base")))
|
|
459
|
+
})
|
|
460
|
+
</script>
|
|
461
|
+
</body>
|
|
462
|
+
</html>
|