@indigoai-us/hq-cli 5.345.246 → 5.345.248
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/CHANGELOG.md +63 -0
- package/assets/lanes-hooks/hq-lanes-drain.sh +1 -1
- package/contracts/host-canary-release.json +14 -0
- package/dist/command-catalog.generated.d.ts +1116 -3
- package/dist/command-catalog.generated.js +1373 -3
- package/dist/command-registration-plan.d.ts +6 -0
- package/dist/command-registration-plan.js +1 -0
- package/dist/commands/install-global.d.ts +15 -0
- package/dist/commands/install-global.js +98 -4
- package/dist/commands/lanes-hold.js +7 -7
- package/dist/commands/lanes-resume.js +2 -2
- package/dist/commands/lanes-review.js +1 -1
- package/dist/commands/lanes-session-start.d.ts +1 -1
- package/dist/commands/lanes-session-start.js +3 -3
- package/dist/commands/lanes-shared.d.ts +1 -1
- package/dist/commands/lanes.d.ts +2 -2
- package/dist/commands/lanes.js +50 -50
- package/dist/commands/mcp-registration.d.ts +17 -0
- package/dist/commands/mcp-registration.js +119 -0
- package/dist/commands/mesh.d.ts +25 -0
- package/dist/commands/mesh.js +48 -8
- package/dist/commands/ontology-graph.d.ts +62 -0
- package/dist/commands/ontology-graph.js +439 -0
- package/dist/commands/pkg-install.js +1 -1
- package/dist/commands/reindex.js +1 -1
- package/dist/index.js +1 -1
- package/dist/lanes-monitor-check-argv.d.ts +1 -1
- package/dist/lanes-monitor-check-argv.js +1 -1
- package/dist/lanes-monitor-check-fast.d.ts +1 -1
- package/dist/lanes-monitor-check-fast.js +1 -1
- package/dist/lanes-session-start-argv.d.ts +1 -1
- package/dist/lanes-session-start-argv.js +1 -1
- package/dist/lib/capacity/sign-in.d.ts +1 -1
- package/dist/lib/capacity/sign-in.js +1 -1
- package/dist/lib/daemon/hook-requests-conduct-link.js +2 -2
- package/dist/lib/daemon/lanes-monitor-state.d.ts +2 -2
- package/dist/lib/daemon/lanes-monitor-state.js +2 -2
- package/dist/lib/daemon/merge-sections.d.ts +3 -3
- package/dist/lib/daemon/merge-sections.js +7 -7
- package/dist/lib/daemon/remote-control-pools.js +1 -1
- package/dist/lib/daemon/run.js +1 -1
- package/dist/lib/daemon/state-file.d.ts +1 -1
- package/dist/lib/daemon/state-file.js +1 -1
- package/dist/lib/doctor/checks/antigravity-wiring.d.ts +21 -0
- package/dist/lib/doctor/checks/antigravity-wiring.js +75 -0
- package/dist/lib/doctor/checks/anywhere.js +30 -0
- package/dist/lib/doctor/checks/runtime-probe.js +13 -0
- package/dist/lib/doctor/platform.d.ts +1 -1
- package/dist/lib/doctor/platform.js +5 -0
- package/dist/lib/doctor/registry.js +3 -0
- package/dist/lib/flag-snapshot-file.d.ts +2 -0
- package/dist/lib/flag-snapshot-file.js +118 -48
- package/dist/lib/hook-engine/canary-gate.d.ts +57 -3
- package/dist/lib/hook-engine/canary-gate.js +138 -6
- package/dist/lib/hook-engine/coverage.d.ts +91 -0
- package/dist/lib/hook-engine/coverage.js +184 -0
- package/dist/lib/hot-channels/graph-context.d.ts +105 -0
- package/dist/lib/hot-channels/graph-context.js +377 -0
- package/dist/lib/hot-channels/signals-pass.js +27 -1
- package/dist/lib/install/antigravity-targets.d.ts +39 -0
- package/dist/lib/install/antigravity-targets.js +122 -0
- package/dist/lib/lanes/claude-credential.d.ts +1 -1
- package/dist/lib/lanes/claude-credential.js +1 -1
- package/dist/lib/lanes/delivery-core.d.ts +1 -1
- package/dist/lib/lanes/delivery-core.js +1 -1
- package/dist/lib/lanes/delivery.d.ts +10 -10
- package/dist/lib/lanes/delivery.js +8 -8
- package/dist/lib/lanes/dropbox.d.ts +1 -1
- package/dist/lib/lanes/dropbox.js +1 -1
- package/dist/lib/lanes/hooks-install.js +2 -2
- package/dist/lib/lanes/index.d.ts +1 -1
- package/dist/lib/lanes/index.js +1 -1
- package/dist/lib/lanes/monitor.js +1 -1
- package/dist/lib/lanes/quota-notice.js +1 -1
- package/dist/lib/lanes/quota.d.ts +1 -1
- package/dist/lib/lanes/quota.js +1 -1
- package/dist/lib/lanes/repo-merge-hold.d.ts +2 -2
- package/dist/lib/lanes/repo-merge-hold.js +2 -2
- package/dist/lib/lanes/spawn.d.ts +4 -4
- package/dist/lib/lanes/spawn.js +5 -5
- package/dist/lib/mesh/live/company-flag-refresh.d.ts +61 -0
- package/dist/lib/mesh/live/company-flag-refresh.js +159 -0
- package/dist/lib/mesh/live/company-reporting-gaps.d.ts +61 -0
- package/dist/lib/mesh/live/company-reporting-gaps.js +238 -0
- package/dist/lib/mesh/live/daemon/duplicate-unit.d.ts +156 -0
- package/dist/lib/mesh/live/daemon/duplicate-unit.js +616 -0
- package/dist/lib/mesh/live/daemon/run.d.ts +13 -0
- package/dist/lib/mesh/live/daemon/run.js +35 -2
- package/dist/lib/mesh/live/direct-drain.js +1 -1
- package/dist/lib/mesh/live/emit.d.ts +3 -0
- package/dist/lib/mesh/live/emit.js +32 -9
- package/dist/lib/mesh/live/flush.d.ts +3 -0
- package/dist/lib/mesh/live/flush.js +115 -32
- package/dist/lib/mesh/live/liveness-carry.d.ts +1 -1
- package/dist/lib/mesh/live/liveness-carry.js +1 -1
- package/dist/lib/mesh/live/reporting-privacy.d.ts +119 -3
- package/dist/lib/mesh/live/reporting-privacy.js +235 -11
- package/dist/lib/mesh/live/spool.d.ts +17 -2
- package/dist/lib/mesh/live/spool.js +22 -6
- package/dist/lib/ontology-graph/legacy/coverage.d.ts +67 -0
- package/dist/lib/ontology-graph/legacy/coverage.js +192 -0
- package/dist/lib/ontology-graph/legacy/index.d.ts +199 -0
- package/dist/lib/ontology-graph/legacy/index.js +1150 -0
- package/dist/lib/ontology-graph/legacy/parse.d.ts +49 -0
- package/dist/lib/ontology-graph/legacy/parse.js +126 -0
- package/dist/lib/ontology-graph/legacy/report.d.ts +14 -0
- package/dist/lib/ontology-graph/legacy/report.js +254 -0
- package/dist/lib/ontology-graph/legacy/verb-map.d.ts +35 -0
- package/dist/lib/ontology-graph/legacy/verb-map.js +84 -0
- package/dist/lib/ontology-graph/lint/checks.d.ts +140 -0
- package/dist/lib/ontology-graph/lint/checks.js +717 -0
- package/dist/lib/ontology-graph/lint/coverage.d.ts +106 -0
- package/dist/lib/ontology-graph/lint/coverage.js +241 -0
- package/dist/lib/ontology-graph/lint/daily-job.d.ts +259 -0
- package/dist/lib/ontology-graph/lint/daily-job.js +595 -0
- package/dist/lib/ontology-graph/lint/index.d.ts +65 -0
- package/dist/lib/ontology-graph/lint/index.js +176 -0
- package/dist/lib/ontology-graph/model/files.d.ts +20 -0
- package/dist/lib/ontology-graph/model/files.js +89 -0
- package/dist/lib/ontology-graph/model/index.d.ts +65 -0
- package/dist/lib/ontology-graph/model/index.js +100 -0
- package/dist/lib/ontology-graph/model/pass-tasks.d.ts +156 -0
- package/dist/lib/ontology-graph/model/pass-tasks.js +345 -0
- package/dist/lib/ontology-graph/model/pass.d.ts +109 -0
- package/dist/lib/ontology-graph/model/pass.js +958 -0
- package/dist/lib/ontology-graph/model/runner.d.ts +50 -0
- package/dist/lib/ontology-graph/model/runner.js +160 -0
- package/dist/lib/ontology-graph/model/step.d.ts +195 -0
- package/dist/lib/ontology-graph/model/step.js +523 -0
- package/dist/lib/ontology-graph/model/tasks.d.ts +183 -0
- package/dist/lib/ontology-graph/model/tasks.js +349 -0
- package/dist/lib/ontology-graph/not-implemented.d.ts +5 -0
- package/dist/lib/ontology-graph/not-implemented.js +8 -0
- package/dist/lib/ontology-graph/org/compare.d.ts +28 -0
- package/dist/lib/ontology-graph/org/compare.js +239 -0
- package/dist/lib/ontology-graph/org/derive.d.ts +65 -0
- package/dist/lib/ontology-graph/org/derive.js +352 -0
- package/dist/lib/ontology-graph/org/index.d.ts +73 -0
- package/dist/lib/ontology-graph/org/index.js +513 -0
- package/dist/lib/ontology-graph/org/load.d.ts +31 -0
- package/dist/lib/ontology-graph/org/load.js +476 -0
- package/dist/lib/ontology-graph/org/role.d.ts +38 -0
- package/dist/lib/ontology-graph/org/role.js +268 -0
- package/dist/lib/ontology-graph/org/structure.d.ts +63 -0
- package/dist/lib/ontology-graph/org/structure.js +437 -0
- package/dist/lib/ontology-graph/org/text.d.ts +95 -0
- package/dist/lib/ontology-graph/org/text.js +315 -0
- package/dist/lib/ontology-graph/org/types.d.ts +452 -0
- package/dist/lib/ontology-graph/org/types.js +80 -0
- package/dist/lib/ontology-graph/pages/index.d.ts +64 -0
- package/dist/lib/ontology-graph/pages/index.js +193 -0
- package/dist/lib/ontology-graph/pages/render.d.ts +142 -0
- package/dist/lib/ontology-graph/pages/render.js +682 -0
- package/dist/lib/ontology-graph/proposals/apply.d.ts +109 -0
- package/dist/lib/ontology-graph/proposals/apply.js +468 -0
- package/dist/lib/ontology-graph/proposals/group.d.ts +63 -0
- package/dist/lib/ontology-graph/proposals/group.js +232 -0
- package/dist/lib/ontology-graph/proposals/index.d.ts +173 -0
- package/dist/lib/ontology-graph/proposals/index.js +474 -0
- package/dist/lib/ontology-graph/proposals/model.d.ts +162 -0
- package/dist/lib/ontology-graph/proposals/model.js +196 -0
- package/dist/lib/ontology-graph/proposals/org-chart.d.ts +82 -0
- package/dist/lib/ontology-graph/proposals/org-chart.js +340 -0
- package/dist/lib/ontology-graph/read/brief.d.ts +26 -0
- package/dist/lib/ontology-graph/read/brief.js +251 -0
- package/dist/lib/ontology-graph/read/graph-index.d.ts +76 -0
- package/dist/lib/ontology-graph/read/graph-index.js +198 -0
- package/dist/lib/ontology-graph/read/index.d.ts +59 -0
- package/dist/lib/ontology-graph/read/index.js +792 -0
- package/dist/lib/ontology-graph/read/member.d.ts +7 -0
- package/dist/lib/ontology-graph/read/member.js +34 -0
- package/dist/lib/ontology-graph/read/names.d.ts +44 -0
- package/dist/lib/ontology-graph/read/names.js +292 -0
- package/dist/lib/ontology-graph/read/reader-setting.d.ts +19 -0
- package/dist/lib/ontology-graph/read/reader-setting.js +62 -0
- package/dist/lib/ontology-graph/read/test-graph.d.ts +37 -0
- package/dist/lib/ontology-graph/read/test-graph.js +150 -0
- package/dist/lib/ontology-graph/replay/buffered-store.d.ts +33 -0
- package/dist/lib/ontology-graph/replay/buffered-store.js +50 -0
- package/dist/lib/ontology-graph/replay/config.d.ts +41 -0
- package/dist/lib/ontology-graph/replay/config.js +105 -0
- package/dist/lib/ontology-graph/replay/engine.d.ts +100 -0
- package/dist/lib/ontology-graph/replay/engine.js +1174 -0
- package/dist/lib/ontology-graph/replay/extractors.d.ts +59 -0
- package/dist/lib/ontology-graph/replay/extractors.js +1555 -0
- package/dist/lib/ontology-graph/replay/index.d.ts +90 -0
- package/dist/lib/ontology-graph/replay/index.js +220 -0
- package/dist/lib/ontology-graph/replay/listing-manifest.d.ts +66 -0
- package/dist/lib/ontology-graph/replay/listing-manifest.js +242 -0
- package/dist/lib/ontology-graph/replay/member.d.ts +19 -0
- package/dist/lib/ontology-graph/replay/member.js +65 -0
- package/dist/lib/ontology-graph/replay/mentions.d.ts +58 -0
- package/dist/lib/ontology-graph/replay/mentions.js +239 -0
- package/dist/lib/ontology-graph/replay/readers.d.ts +98 -0
- package/dist/lib/ontology-graph/replay/readers.js +1251 -0
- package/dist/lib/ontology-graph/replay/rules.d.ts +127 -0
- package/dist/lib/ontology-graph/replay/rules.js +374 -0
- package/dist/lib/ontology-graph/replay/scope.d.ts +35 -0
- package/dist/lib/ontology-graph/replay/scope.js +115 -0
- package/dist/lib/ontology-graph/replay/transcripts.d.ts +39 -0
- package/dist/lib/ontology-graph/replay/transcripts.js +224 -0
- package/dist/lib/ontology-graph/replay/util.d.ts +55 -0
- package/dist/lib/ontology-graph/replay/util.js +256 -0
- package/dist/lib/ontology-graph/resolve/entity-index.d.ts +159 -0
- package/dist/lib/ontology-graph/resolve/entity-index.js +652 -0
- package/dist/lib/ontology-graph/resolve/index.d.ts +113 -0
- package/dist/lib/ontology-graph/resolve/index.js +214 -0
- package/dist/lib/ontology-graph/resolve/machine.d.ts +34 -0
- package/dist/lib/ontology-graph/resolve/machine.js +95 -0
- package/dist/lib/ontology-graph/resolve/normalize.d.ts +35 -0
- package/dist/lib/ontology-graph/resolve/normalize.js +124 -0
- package/dist/lib/ontology-graph/resolve/org-chart.d.ts +107 -0
- package/dist/lib/ontology-graph/resolve/org-chart.js +578 -0
- package/dist/lib/ontology-graph/resolve/org-layer.d.ts +78 -0
- package/dist/lib/ontology-graph/resolve/org-layer.js +159 -0
- package/dist/lib/ontology-graph/resolve/org-seed.d.ts +141 -0
- package/dist/lib/ontology-graph/resolve/org-seed.js +631 -0
- package/dist/lib/ontology-graph/resolve/org-sources.d.ts +165 -0
- package/dist/lib/ontology-graph/resolve/org-sources.js +634 -0
- package/dist/lib/ontology-graph/resolve/roster.d.ts +76 -0
- package/dist/lib/ontology-graph/resolve/roster.js +226 -0
- package/dist/lib/ontology-graph/resolve/seed.d.ts +267 -0
- package/dist/lib/ontology-graph/resolve/seed.js +1198 -0
- package/dist/lib/ontology-graph/resolve/upsert.d.ts +58 -0
- package/dist/lib/ontology-graph/resolve/upsert.js +139 -0
- package/dist/lib/ontology-graph/resolve/writer.d.ts +128 -0
- package/dist/lib/ontology-graph/resolve/writer.js +351 -0
- package/dist/lib/ontology-graph/schema/authority.d.ts +73 -0
- package/dist/lib/ontology-graph/schema/authority.js +157 -0
- package/dist/lib/ontology-graph/schema/default-schema.d.ts +10 -0
- package/dist/lib/ontology-graph/schema/default-schema.js +242 -0
- package/dist/lib/ontology-graph/schema/grammar.d.ts +57 -0
- package/dist/lib/ontology-graph/schema/grammar.js +409 -0
- package/dist/lib/ontology-graph/schema/index.d.ts +12 -0
- package/dist/lib/ontology-graph/schema/index.js +10 -0
- package/dist/lib/ontology-graph/schema/validate.d.ts +13 -0
- package/dist/lib/ontology-graph/schema/validate.js +132 -0
- package/dist/lib/ontology-graph/store/files.d.ts +34 -0
- package/dist/lib/ontology-graph/store/files.js +207 -0
- package/dist/lib/ontology-graph/store/fs.d.ts +30 -0
- package/dist/lib/ontology-graph/store/fs.js +101 -0
- package/dist/lib/ontology-graph/store/graph-store.d.ts +14 -0
- package/dist/lib/ontology-graph/store/graph-store.js +520 -0
- package/dist/lib/ontology-graph/store/index.d.ts +18 -0
- package/dist/lib/ontology-graph/store/index.js +15 -0
- package/dist/lib/ontology-graph/store/ingest.d.ts +37 -0
- package/dist/lib/ontology-graph/store/ingest.js +323 -0
- package/dist/lib/ontology-graph/store/paths.d.ts +114 -0
- package/dist/lib/ontology-graph/store/paths.js +232 -0
- package/dist/lib/ontology-graph/types.d.ts +1183 -0
- package/dist/lib/ontology-graph/types.js +131 -0
- package/dist/lib/secret-scan/gitleaks-rules.generated.js +1 -1
- package/dist/utils/frontmatter.d.ts +14 -0
- package/dist/utils/frontmatter.js +18 -0
- package/dist/utils/interactive-caller.js +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { originTier } from "../schema/index.js";
|
|
2
|
+
import { roleWindow } from "./role.js";
|
|
3
|
+
import { readTitle } from "./text.js";
|
|
4
|
+
import { AREA_LABEL } from "./types.js";
|
|
5
|
+
const percent = (share) => `${Math.round(share * 100)}%`;
|
|
6
|
+
/** A stated title below this confidence is listed, and is too weak to hold the observed role against. */
|
|
7
|
+
export const TITLE_MIN_CONF = 0.5;
|
|
8
|
+
function tier(claim) {
|
|
9
|
+
if (claim.via === "org-chart-confirmed")
|
|
10
|
+
return 0;
|
|
11
|
+
// The draft weighs every file that states a title; a confident draft line outranks a single low-authority row.
|
|
12
|
+
if (claim.via === "org-chart-draft")
|
|
13
|
+
return claim.conf >= 0.5 ? 2.5 : 6;
|
|
14
|
+
if (claim.via === "member-note")
|
|
15
|
+
return 7;
|
|
16
|
+
try {
|
|
17
|
+
return originTier(claim.by);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return 5;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/** Strongest first: confirmed by a person, then by authority of origin, open before closed, then confidence. */
|
|
24
|
+
export function rankClaims(claims) {
|
|
25
|
+
return [...claims].sort((a, b) => Number(b.open) - Number(a.open) || tier(a) - tier(b) || b.conf - a.conf || (a.value < b.value ? -1 : 1));
|
|
26
|
+
}
|
|
27
|
+
export function describeClaim(claim) {
|
|
28
|
+
const how = claim.via === "org-chart-draft" ? "the unconfirmed org chart draft" : claim.via === "org-chart-confirmed" ? "the confirmed org chart" : claim.via === "member-note" ? "the member's own notes" : `a ${claim.by} row`;
|
|
29
|
+
return { text: `"${claim.value}" from ${how}${claim.open ? "" : ` (closed${claim.to ? ` ${claim.to}` : ""})`}, confidence ${claim.conf.toFixed(2)}`, src: String(claim.src) };
|
|
30
|
+
}
|
|
31
|
+
/** The person who most clearly directs `person`, when one direction clearly outweighs the other. */
|
|
32
|
+
export function primaryDirector(directs, person) {
|
|
33
|
+
return directs.filter((edge) => edge.to === person && edge.asymmetric).sort((a, b) => b.score - a.score)[0] ?? null;
|
|
34
|
+
}
|
|
35
|
+
export function buildDisagreements(input) {
|
|
36
|
+
const { graph, people, directs, owners } = input;
|
|
37
|
+
const out = [];
|
|
38
|
+
const nameOf = (ref) => graph.people.get(ref)?.name ?? ref;
|
|
39
|
+
for (const person of people) {
|
|
40
|
+
const claims = graph.stated.get(person.ref) ?? [];
|
|
41
|
+
const titles = rankClaims(claims.filter((claim) => claim.field === "title" || claim.field === "role"));
|
|
42
|
+
const openTitles = titles.filter((claim) => claim.open);
|
|
43
|
+
const window = roleWindow(person.windows);
|
|
44
|
+
const profile = person.windows[window];
|
|
45
|
+
const recent = person.windows["90d"];
|
|
46
|
+
const year = person.windows["365d"];
|
|
47
|
+
const roleExamples = Object.values(person.examples).flat().slice(0, 4);
|
|
48
|
+
const outgoing = directs.filter((edge) => edge.from === person.ref && edge.asymmetric);
|
|
49
|
+
if (person.actsInternal) {
|
|
50
|
+
out.push({
|
|
51
|
+
kind: "acts_internal_not_on_roster",
|
|
52
|
+
subject: person.ref,
|
|
53
|
+
subjectName: person.name,
|
|
54
|
+
stated: "Not on the roster of workspace members",
|
|
55
|
+
observed: person.role.line,
|
|
56
|
+
note: `${person.name} is not on the roster, but acts like a team member: ${year.counts.commits} commits, ${year.counts.meetings_attended} meetings and ${year.counts.action_items + year.counts.decisions + year.counts.commitments} actions, decisions or commitments in the last 365 days, last seen ${person.coverage.lastSeen ?? "never"}.` +
|
|
57
|
+
(person.maybe.length > 0 ? ` The name may be a variant of ${person.maybe.map(nameOf).join(" or ")}; the graph has not resolved which, so nothing was merged.` : ""),
|
|
58
|
+
statedEvidence: [],
|
|
59
|
+
observedEvidence: roleExamples,
|
|
60
|
+
interest: Math.min(10, year.evidence / 20) * (recent.evidence > 0 ? 1 : 0.4) * (person.maybe.length > 0 ? 0.5 : 1),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (person.onRoster && person.windows.all.evidence === 0) {
|
|
64
|
+
out.push({
|
|
65
|
+
kind: "on_roster_no_activity",
|
|
66
|
+
subject: person.ref,
|
|
67
|
+
subjectName: person.name,
|
|
68
|
+
stated: `On the roster${openTitles[0] ? `, stated as "${openTitles[0].value}"` : ""}`,
|
|
69
|
+
observed: "No row in this view names them as doing anything",
|
|
70
|
+
note: `${person.name} is on the roster and nothing in the rows this view may read shows them acting. That can be missing coverage on this machine as much as inactivity.`,
|
|
71
|
+
statedEvidence: openTitles.slice(0, 2).map(describeClaim),
|
|
72
|
+
observedEvidence: [],
|
|
73
|
+
interest: 2,
|
|
74
|
+
});
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
const distinct = [...new Map(openTitles.filter((claim) => claim.via === "row").map((claim) => [claim.value.toLowerCase(), claim])).values()];
|
|
78
|
+
if (distinct.length >= 2) {
|
|
79
|
+
out.push({
|
|
80
|
+
kind: "conflicting_titles",
|
|
81
|
+
subject: person.ref,
|
|
82
|
+
subjectName: person.name,
|
|
83
|
+
stated: distinct.map((claim) => `"${claim.value}"`).join(", "),
|
|
84
|
+
observed: person.role.line,
|
|
85
|
+
note: `${distinct.length} different titles are stated for ${person.name} and all are open. The observed role does not pick one.`,
|
|
86
|
+
statedEvidence: distinct.slice(0, 4).map(describeClaim),
|
|
87
|
+
observedEvidence: roleExamples.slice(0, 2),
|
|
88
|
+
interest: 1 + distinct.length * 0.5,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
const best = openTitles[0] ?? titles[0];
|
|
92
|
+
if (!best) {
|
|
93
|
+
if (recent.evidence >= 10 && !person.actsInternal) {
|
|
94
|
+
out.push({
|
|
95
|
+
kind: "activity_without_title",
|
|
96
|
+
subject: person.ref,
|
|
97
|
+
subjectName: person.name,
|
|
98
|
+
stated: "No title or role stated in any row",
|
|
99
|
+
observed: person.role.line,
|
|
100
|
+
note: `${person.name} has no stated title, and ${Math.round(recent.evidence)} pieces of evidence in the last 90 days show what they do.`,
|
|
101
|
+
statedEvidence: [],
|
|
102
|
+
observedEvidence: roleExamples,
|
|
103
|
+
interest: Math.min(6, recent.evidence / 15),
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
const reading = readTitle(best.value);
|
|
109
|
+
const areas = person.role.mainAreas;
|
|
110
|
+
const top = areas[0];
|
|
111
|
+
if (year.evidence === 0 && person.windows.all.evidence > 0) {
|
|
112
|
+
out.push({
|
|
113
|
+
kind: "title_without_activity",
|
|
114
|
+
subject: person.ref,
|
|
115
|
+
subjectName: person.name,
|
|
116
|
+
stated: `"${best.value}"`,
|
|
117
|
+
observed: `Nothing visible in the last 365 days (last seen ${person.coverage.lastSeen ?? "never"})`,
|
|
118
|
+
note: `The title "${best.value}" is ${best.open ? "open" : "closed"}, and no row in the last 365 days shows ${person.name} acting.`,
|
|
119
|
+
statedEvidence: [describeClaim(best)],
|
|
120
|
+
observedEvidence: roleExamples.slice(0, 2),
|
|
121
|
+
interest: 3,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
else if (profile.evidence >= 10 && top && best.conf >= TITLE_MIN_CONF) {
|
|
125
|
+
const statedShare = reading.areas.reduce((sum, area) => sum + profile.areas[area], 0);
|
|
126
|
+
if (reading.areas.length > 0 && !reading.areas.includes(top.area) && top.share >= 0.4 && statedShare < 0.2) {
|
|
127
|
+
out.push({
|
|
128
|
+
kind: "title_vs_observed",
|
|
129
|
+
subject: person.ref,
|
|
130
|
+
subjectName: person.name,
|
|
131
|
+
stated: `"${best.value}"`,
|
|
132
|
+
observed: person.role.line,
|
|
133
|
+
note: `The title "${best.value}" points at ${reading.areas.map((area) => AREA_LABEL[area]).join(" and ")}, which is ${percent(statedShare)} of the visible work. ${percent(top.share)} of it is ${AREA_LABEL[top.area]}.`,
|
|
134
|
+
statedEvidence: [describeClaim(best)],
|
|
135
|
+
observedEvidence: roleExamples,
|
|
136
|
+
interest: Math.min(10, (profile.evidence / 20) * (top.share - statedShare) * 4),
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
else if (reading.light && recent.evidence >= 20) {
|
|
140
|
+
out.push({
|
|
141
|
+
kind: "title_vs_observed",
|
|
142
|
+
subject: person.ref,
|
|
143
|
+
subjectName: person.name,
|
|
144
|
+
stated: `"${best.value}"`,
|
|
145
|
+
observed: person.role.line,
|
|
146
|
+
note: `"${best.value}" reads as an arm's-length role, and ${Math.round(recent.evidence)} pieces of evidence in the last 90 days show ${person.name} working day to day.`,
|
|
147
|
+
statedEvidence: [describeClaim(best)],
|
|
148
|
+
observedEvidence: roleExamples,
|
|
149
|
+
interest: Math.min(8, recent.evidence / 15),
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
else if (reading.leads && outgoing.length === 0 && year.counts.decisions < 3 && year.evidence >= 15) {
|
|
153
|
+
out.push({
|
|
154
|
+
kind: "title_vs_observed",
|
|
155
|
+
subject: person.ref,
|
|
156
|
+
subjectName: person.name,
|
|
157
|
+
stated: `"${best.value}"`,
|
|
158
|
+
observed: person.role.line,
|
|
159
|
+
note: `"${best.value}" says ${person.name} leads others. No row shows anyone taking direction from them, and they are named as deciding ${year.counts.decisions} things in the last 365 days.`,
|
|
160
|
+
statedEvidence: [describeClaim(best)],
|
|
161
|
+
observedEvidence: roleExamples,
|
|
162
|
+
interest: Math.min(6, year.evidence / 30),
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (!reading.leads && outgoing.length >= 2 && best.conf >= TITLE_MIN_CONF) {
|
|
167
|
+
out.push({
|
|
168
|
+
kind: "title_vs_observed",
|
|
169
|
+
subject: person.ref,
|
|
170
|
+
subjectName: person.name,
|
|
171
|
+
stated: `"${best.value}"`,
|
|
172
|
+
observed: `Directs ${outgoing.map((edge) => nameOf(edge.to)).join(", ")}`,
|
|
173
|
+
note: `"${best.value}" does not say ${person.name} leads anyone, and ${outgoing.length} people are observed taking direction from them.`,
|
|
174
|
+
statedEvidence: [describeClaim(best)],
|
|
175
|
+
observedEvidence: outgoing.flatMap((edge) => edge.examples.slice(0, 1)).slice(0, 4),
|
|
176
|
+
interest: Math.min(8, outgoing.reduce((sum, edge) => sum + edge.score, 0)),
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
// Stated manager versus who is observed directing them.
|
|
181
|
+
const managers = rankClaims(claims.filter((claim) => claim.field === "manager" && claim.open));
|
|
182
|
+
const director = primaryDirector(directs, person.ref);
|
|
183
|
+
const stated = managers[0];
|
|
184
|
+
if (director && (!stated || stated.target !== director.from)) {
|
|
185
|
+
const same = stated?.target ? directs.find((edge) => edge.from === stated.target && edge.to === person.ref) : undefined;
|
|
186
|
+
out.push({
|
|
187
|
+
kind: "manager_vs_director",
|
|
188
|
+
subject: person.ref,
|
|
189
|
+
subjectName: person.name,
|
|
190
|
+
stated: stated ? `Manager: ${stated.value}` : "No manager stated",
|
|
191
|
+
observed: `Takes direction from ${nameOf(director.from)} (${director.counts.all} instances, confidence ${director.conf.toFixed(2)})`,
|
|
192
|
+
note: stated
|
|
193
|
+
? `The stated manager of ${person.name} is ${stated.value}${stated.via === "org-chart-draft" ? " (an unconfirmed draft line)" : ""}. The rows show ${nameOf(director.from)} assigning, approving or deciding their work ${director.counts.all} times${same ? `, and ${stated.value} doing so ${same.counts.all} times` : `, and none where ${stated.value} does`}.`
|
|
194
|
+
: `No manager is stated for ${person.name}. The rows show ${nameOf(director.from)} assigning, approving or deciding their work ${director.counts.all} times.`,
|
|
195
|
+
statedEvidence: stated ? [describeClaim(stated)] : [],
|
|
196
|
+
observedEvidence: director.examples,
|
|
197
|
+
interest: Math.min(10, director.score * (stated ? 1.5 : 0.8) * director.conf * 2),
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
for (const owner of owners) {
|
|
202
|
+
const lead = owner.candidates[0];
|
|
203
|
+
if (owner.listed.length === 0 && owner.verdict === "clear" && lead) {
|
|
204
|
+
out.push({
|
|
205
|
+
kind: "owner_vs_de_facto",
|
|
206
|
+
subject: owner.subject,
|
|
207
|
+
subjectName: owner.subjectName,
|
|
208
|
+
stated: "No owner listed",
|
|
209
|
+
observed: `${nameOf(lead.person)} does most of the decisive activity (${percent(lead.share)})`,
|
|
210
|
+
note: `${owner.subjectName} (${owner.kind}) lists no owner. In the last 90 days ${nameOf(lead.person)} holds ${percent(lead.share)} of the decisions, action items and commitments on it across ${owner.events} events.`,
|
|
211
|
+
statedEvidence: [],
|
|
212
|
+
observedEvidence: lead.examples,
|
|
213
|
+
interest: Math.min(5, (owner.events / 12) * lead.share),
|
|
214
|
+
});
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
if (owner.listed.length === 0 || owner.agrees !== false)
|
|
218
|
+
continue;
|
|
219
|
+
const first = owner.candidates[0];
|
|
220
|
+
if (!first)
|
|
221
|
+
continue;
|
|
222
|
+
const listed = rankClaims(owner.listed)[0];
|
|
223
|
+
const listedShare = owner.candidates.find((candidate) => candidate.person === listed.target)?.share ?? 0;
|
|
224
|
+
const observed = owner.verdict === "clear" ? nameOf(first.person) : owner.candidates.slice(0, 2).map((candidate) => nameOf(candidate.person)).join(" and ");
|
|
225
|
+
out.push({
|
|
226
|
+
kind: listedShare === 0 ? "owner_listed_no_activity" : "owner_vs_de_facto",
|
|
227
|
+
subject: owner.subject,
|
|
228
|
+
subjectName: owner.subjectName,
|
|
229
|
+
stated: `Listed owner: ${listed.value}`,
|
|
230
|
+
observed: `${observed} ${owner.verdict === "clear" ? "does" : "share"} most of the decisive activity (${percent(first.share)} for ${nameOf(first.person)})`,
|
|
231
|
+
note: `${owner.subjectName} (${owner.kind}) lists ${listed.value} as owner. In the last 90 days ${observed} ${owner.verdict === "clear" ? "holds" : "hold"} the decisions, action items and commitments on it; ${listed.value} has ${percent(listedShare)} of that activity across ${owner.events} events.`,
|
|
232
|
+
statedEvidence: [describeClaim(listed)],
|
|
233
|
+
observedEvidence: first.examples,
|
|
234
|
+
interest: Math.min(10, (owner.events / 6) * (first.share - listedShare) * 2),
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
return out.sort((a, b) => b.interest - a.interest || (a.subject < b.subject ? -1 : 1));
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=compare.js.map
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observed org chart: who did what, and the per-person activity profile.
|
|
3
|
+
*
|
|
4
|
+
* Step 1 turns the graph into acts: one record per thing a named person did
|
|
5
|
+
* (committed, decided, took an action item, led a meeting, started a thread,
|
|
6
|
+
* handed work to someone). An act is attributed only when the row says who:
|
|
7
|
+
* an edge (`decided`, `attended`), a commit row on the person, or a line that
|
|
8
|
+
* starts with the person's name. A row merely filed on a person's page is not
|
|
9
|
+
* an act of that person.
|
|
10
|
+
*
|
|
11
|
+
* Step 2 counts acts per person over the rolling windows, with the skew
|
|
12
|
+
* weights applied: the member's own sessions and trackers never count as
|
|
13
|
+
* evidence about anyone else.
|
|
14
|
+
*/
|
|
15
|
+
import type { EntityRef, IsoDate, SourceRef } from "../types.js";
|
|
16
|
+
import { NameIndex } from "./text.js";
|
|
17
|
+
import { type ActivityKind, type Area, type Coverage, type DirectEvidence, type Example, type OrgGraph, type OrgWindow, type SourceClass, type WindowProfile } from "./types.js";
|
|
18
|
+
export interface Act {
|
|
19
|
+
person: EntityRef;
|
|
20
|
+
/** Null: the row tells what area the person works in but is not one of the counted kinds. */
|
|
21
|
+
kind: ActivityKind | null;
|
|
22
|
+
date: IsoDate;
|
|
23
|
+
text: string;
|
|
24
|
+
src: SourceRef;
|
|
25
|
+
cls: SourceClass;
|
|
26
|
+
/** Commits in the row; 1 for everything else. */
|
|
27
|
+
count: number;
|
|
28
|
+
/** Projects and customers the act is about. */
|
|
29
|
+
subjects: EntityRef[];
|
|
30
|
+
repo?: string;
|
|
31
|
+
meeting?: EntityRef;
|
|
32
|
+
/** First day a row covers when it sums a span of days (a repository rollup). */
|
|
33
|
+
spanFrom?: IsoDate;
|
|
34
|
+
/** A commit week that lists only housekeeping subjects: probably a script under the person's name. */
|
|
35
|
+
automated?: boolean;
|
|
36
|
+
/** Area evidence: the areas and how much this act says about them. */
|
|
37
|
+
areas: Partial<Record<Area, number>>;
|
|
38
|
+
areaWeight: number;
|
|
39
|
+
}
|
|
40
|
+
export interface Derived {
|
|
41
|
+
acts: Act[];
|
|
42
|
+
directs: DirectEvidence[];
|
|
43
|
+
names: NameIndex;
|
|
44
|
+
/** Subjects named by so many decisions that sharing one says nothing. */
|
|
45
|
+
genericSubjects: Set<EntityRef>;
|
|
46
|
+
}
|
|
47
|
+
/** How much of a decision's wording an action item must share before it counts as carrying that decision out. */
|
|
48
|
+
export declare const CARRIES_OUT_SIMILARITY = 0.15;
|
|
49
|
+
/** The weight of a class as evidence about `person`. */
|
|
50
|
+
export declare function profileWeight(cls: SourceClass, person: EntityRef, member: EntityRef | null): number;
|
|
51
|
+
export declare function deriveActs(graph: OrgGraph): Derived;
|
|
52
|
+
export declare function windowStart(window: OrgWindow, asOf: IsoDate): IsoDate | null;
|
|
53
|
+
export declare function inWindow(date: IsoDate, window: OrgWindow, asOf: IsoDate): boolean;
|
|
54
|
+
/** An act counts in a window when it happened in it; a row that sums a span of days counts only when the whole span is inside. */
|
|
55
|
+
export declare function actInWindow(item: Pick<Act, "date" | "spanFrom">, window: OrgWindow, asOf: IsoDate): boolean;
|
|
56
|
+
export declare function subjectName(graph: OrgGraph, ref: string): string;
|
|
57
|
+
/** The activity profile of one person in one window. `acts` are that person's acts only. */
|
|
58
|
+
export declare function buildWindowProfile(graph: OrgGraph, person: EntityRef, acts: readonly Act[], window: OrgWindow): WindowProfile;
|
|
59
|
+
export declare function classWords(cls: SourceClass): string;
|
|
60
|
+
/** How much evidence stands behind a person, and from which source classes. */
|
|
61
|
+
export declare function buildCoverage(graph: OrgGraph, person: EntityRef, acts: readonly Act[]): Coverage;
|
|
62
|
+
/** The most recent cited rows behind each kind of activity. */
|
|
63
|
+
export declare function buildExamples(acts: readonly Act[], perKind?: number): Partial<Record<ActivityKind, Example[]>>;
|
|
64
|
+
export declare function allWindows<T>(build: (window: OrgWindow) => T): Record<OrgWindow, T>;
|
|
65
|
+
//# sourceMappingURL=derive.d.ts.map
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { DECISION_DIRECTS, NameIndex, addDays, areasOf, clip, continuesWithSecondOwner, directHits, excerptAt, similarity, looksAutomated, namesSubject, ownsAction, saysLed, saysPresented, } from "./text.js";
|
|
2
|
+
import { ACTIVITY_KINDS, AREAS, ORG_WINDOWS, SKEW_WEIGHTS, WINDOW_DAYS, } from "./types.js";
|
|
3
|
+
const DIRECT_TYPES = new Set(["action_item", "decision", "participant_contribution", "summary", "commitment", "key_point", "question"]);
|
|
4
|
+
/** How much one act says about the person's area of work. */
|
|
5
|
+
const AREA_WEIGHT = { decision: 1, action: 1, commitment: 1, contribution: 0.5, thread: 0.5, question: 0.3, attended: 0.3, external: 0.6, session: 0.5 };
|
|
6
|
+
/** How much of a decision's wording an action item must share before it counts as carrying that decision out. */
|
|
7
|
+
export const CARRIES_OUT_SIMILARITY = 0.15;
|
|
8
|
+
/** A subject more than this share of all decisions are about is too broad to tie two people together. */
|
|
9
|
+
const GENERIC_SUBJECT_SHARE = 0.12;
|
|
10
|
+
/** The weight of a class as evidence about `person`. */
|
|
11
|
+
export function profileWeight(cls, person, member) {
|
|
12
|
+
return person === member ? SKEW_WEIGHTS[cls].self : SKEW_WEIGHTS[cls].others;
|
|
13
|
+
}
|
|
14
|
+
/** A row filed on more subjects than this is tied only to the ones its own text names. */
|
|
15
|
+
const SUBJECTS_WITHOUT_NAMING = 2;
|
|
16
|
+
/**
|
|
17
|
+
* The projects and customers a row is about. A row filed on many subjects
|
|
18
|
+
* (a meeting digest files every decision of the meeting on everything the
|
|
19
|
+
* meeting touched) counts only for the subjects its own text names.
|
|
20
|
+
*/
|
|
21
|
+
function subjectsOf(graph, projects, companies, text) {
|
|
22
|
+
const out = [...projects.filter((ref) => graph.projects.has(ref))];
|
|
23
|
+
for (const ref of companies) {
|
|
24
|
+
const node = graph.companies.get(ref);
|
|
25
|
+
if (node && node.isCustomer && !node.isSelf)
|
|
26
|
+
out.push(ref);
|
|
27
|
+
}
|
|
28
|
+
if (text === undefined || out.length <= SUBJECTS_WITHOUT_NAMING)
|
|
29
|
+
return out;
|
|
30
|
+
return out.filter((ref) => namesSubject(text, subjectName(graph, ref)) || namesSubject(text, ref.slice(ref.indexOf("/") + 1).replace(/-/g, " ")));
|
|
31
|
+
}
|
|
32
|
+
export function deriveActs(graph) {
|
|
33
|
+
const names = new NameIndex(graph.people.values());
|
|
34
|
+
const acts = [];
|
|
35
|
+
const directs = [];
|
|
36
|
+
const member = graph.member;
|
|
37
|
+
const act = (value) => {
|
|
38
|
+
acts.push({ count: 1, areas: {}, areaWeight: 0, ...value });
|
|
39
|
+
};
|
|
40
|
+
const direct = (kind, from, to, date, src, text, cls) => {
|
|
41
|
+
if (from === to || !graph.people.has(from) || !graph.people.has(to))
|
|
42
|
+
return;
|
|
43
|
+
directs.push({ kind, from, to, date, src, text: clip(text), cls });
|
|
44
|
+
act({ person: from, kind: kind === "approves" || kind === "signoff" || kind === "reviews" ? "approvals_given" : "directions_given", date, text, src, cls, subjects: [] });
|
|
45
|
+
act({ person: to, kind: "directions_received", date, text, src, cls, subjects: [] });
|
|
46
|
+
};
|
|
47
|
+
// Commits.
|
|
48
|
+
// A commit is engineering work; what it is for comes from the repository name and the commit subjects.
|
|
49
|
+
for (const commit of graph.commits) {
|
|
50
|
+
const automated = looksAutomated(commit.text);
|
|
51
|
+
const about = areasOf(`${commit.repo.replace(/[-_]/g, " ")}. ${commit.text.slice(commit.text.indexOf(": ") + 1)}`);
|
|
52
|
+
delete about.engineering;
|
|
53
|
+
const others = Object.entries(about);
|
|
54
|
+
const total = others.reduce((sum, [, share]) => sum + share, 0);
|
|
55
|
+
const areas = { engineering: others.length > 0 ? 0.5 : 1 };
|
|
56
|
+
for (const [area, share] of others)
|
|
57
|
+
areas[area] = (0.5 * share) / total;
|
|
58
|
+
act({
|
|
59
|
+
person: commit.person, kind: "commits", date: commit.date, text: commit.text, src: commit.src, cls: "code", count: commit.count,
|
|
60
|
+
subjects: commit.project ? [commit.project] : [], repo: commit.repo, areas, areaWeight: Math.min(5, Math.log2(1 + commit.count)) * (automated ? 0.1 : 1),
|
|
61
|
+
...(automated ? { automated } : {}),
|
|
62
|
+
...(commit.spanFrom ? { spanFrom: commit.spanFrom } : {}),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
// Decisions: the `decided` edge names who decided.
|
|
66
|
+
const subjectUse = new Map();
|
|
67
|
+
for (const decision of graph.decisions.values())
|
|
68
|
+
for (const ref of decision.about)
|
|
69
|
+
subjectUse.set(ref, (subjectUse.get(ref) ?? 0) + 1);
|
|
70
|
+
const genericSubjects = new Set();
|
|
71
|
+
for (const [ref, used] of subjectUse)
|
|
72
|
+
if (graph.decisions.size >= 20 && used / graph.decisions.size > GENERIC_SUBJECT_SHARE)
|
|
73
|
+
genericSubjects.add(ref);
|
|
74
|
+
for (const decision of graph.decisions.values()) {
|
|
75
|
+
const subjects = subjectsOf(graph, decision.about, decision.about, decision.statement);
|
|
76
|
+
for (const person of decision.deciders) {
|
|
77
|
+
act({
|
|
78
|
+
person, kind: "decisions", date: decision.date, text: decision.statement, src: decision.src, cls: decision.cls, subjects,
|
|
79
|
+
...(decision.meeting ? { meeting: decision.meeting } : {}), areas: areasOf(decision.statement), areaWeight: AREA_WEIGHT.decision,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
// "Hassaan is directed to ...": the decision tells a named person what to do.
|
|
83
|
+
const lead = names.lead(decision.statement, decision.deciders);
|
|
84
|
+
if (lead && DECISION_DIRECTS.test(lead.rest)) {
|
|
85
|
+
for (const decider of decision.deciders)
|
|
86
|
+
if (decider !== lead.ref)
|
|
87
|
+
direct("decides_for", decider, lead.ref, decision.date, decision.src, decision.statement, decision.cls);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// Meetings: attendance from the edges.
|
|
91
|
+
const external = (ref) => {
|
|
92
|
+
const person = graph.people.get(ref);
|
|
93
|
+
return person !== undefined && !person.onRoster;
|
|
94
|
+
};
|
|
95
|
+
const meetingText = new Map();
|
|
96
|
+
for (const event of graph.events) {
|
|
97
|
+
if (event.type !== "summary")
|
|
98
|
+
continue;
|
|
99
|
+
for (const meeting of event.meetings)
|
|
100
|
+
if (!meetingText.has(meeting))
|
|
101
|
+
meetingText.set(meeting, event.text);
|
|
102
|
+
}
|
|
103
|
+
for (const meeting of graph.meetings.values()) {
|
|
104
|
+
if (meeting.attendees.length < 2)
|
|
105
|
+
continue;
|
|
106
|
+
const outside = meeting.attendees.some(external);
|
|
107
|
+
const subjects = subjectsOf(graph, meeting.about, meeting.about);
|
|
108
|
+
const text = meetingText.get(meeting.ref) ?? meeting.title;
|
|
109
|
+
const summaryAreas = areasOf(`${meeting.title}. ${text}`);
|
|
110
|
+
const areas = Object.keys(summaryAreas).length > 0 ? summaryAreas : outside ? { customer: 0.5, sales: 0.5 } : {};
|
|
111
|
+
for (const person of meeting.attendees) {
|
|
112
|
+
act({
|
|
113
|
+
person, kind: "meetings_attended", date: meeting.date, text: `${meeting.title} (${meeting.attendees.length} people)`, src: meeting.src, cls: "meeting", subjects,
|
|
114
|
+
meeting: meeting.ref, areas, areaWeight: outside ? AREA_WEIGHT.external : AREA_WEIGHT.attended,
|
|
115
|
+
});
|
|
116
|
+
if (outside && !external(person))
|
|
117
|
+
act({ person, kind: "external_meetings", date: meeting.date, text: `${meeting.title}: ${clip(text, 120)}`, src: meeting.src, cls: "meeting", subjects, meeting: meeting.ref });
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
// Timeline rows: the line names its actor.
|
|
121
|
+
const led = new Set();
|
|
122
|
+
for (const event of graph.events) {
|
|
123
|
+
const subjects = subjectsOf(graph, event.projects, event.companies, event.text);
|
|
124
|
+
const meeting = event.meetings[0];
|
|
125
|
+
const common = { date: event.date, text: event.text, src: event.src, cls: event.cls, subjects, ...(meeting ? { meeting } : {}) };
|
|
126
|
+
if (event.cls === "member-session") {
|
|
127
|
+
if (member && event.type === "session" && event.people.includes(member))
|
|
128
|
+
act({ person: member, kind: "own_sessions", ...common, areas: areasOf(event.text), areaWeight: AREA_WEIGHT.session });
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
if (event.cls === "member-tracker") {
|
|
132
|
+
if (member && event.people.includes(member))
|
|
133
|
+
act({ person: member, kind: "own_tracker", ...common });
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
if (event.cls === "member-note" || event.cls === "legacy")
|
|
137
|
+
continue;
|
|
138
|
+
if (event.type === "slack") {
|
|
139
|
+
const body = event.text.replace(/^#[^:\s]+:\s*/, "");
|
|
140
|
+
const lead = names.lead(body, event.people);
|
|
141
|
+
if (lead)
|
|
142
|
+
act({ person: lead.ref, kind: "threads_started", ...common, areas: areasOf(body), areaWeight: AREA_WEIGHT.thread });
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
const lead = DIRECT_TYPES.has(event.type) ? names.lead(event.text, event.people) : null;
|
|
146
|
+
if (event.type === "action_item" && lead) {
|
|
147
|
+
const owners = [];
|
|
148
|
+
if (ownsAction(lead.rest))
|
|
149
|
+
owners.push(lead.ref);
|
|
150
|
+
else if (continuesWithSecondOwner(lead.rest)) {
|
|
151
|
+
const second = names.lead(lead.rest.replace(/^\s*(?:and|&|,)\s+/i, ""), event.people);
|
|
152
|
+
if (second && ownsAction(second.rest))
|
|
153
|
+
owners.push(lead.ref, second.ref);
|
|
154
|
+
}
|
|
155
|
+
for (const person of owners)
|
|
156
|
+
act({ person, kind: "action_items", ...common, areas: areasOf(event.text), areaWeight: AREA_WEIGHT.action });
|
|
157
|
+
}
|
|
158
|
+
else if (event.type === "commitment" && lead) {
|
|
159
|
+
act({ person: lead.ref, kind: "commitments", ...common, areas: areasOf(event.text), areaWeight: AREA_WEIGHT.commitment });
|
|
160
|
+
}
|
|
161
|
+
else if (event.type === "participant_contribution" && lead) {
|
|
162
|
+
const where = meeting ?? `${event.date}|${event.src}`;
|
|
163
|
+
if (saysLed(lead.rest) && !led.has(`${lead.ref}|${where}`)) {
|
|
164
|
+
led.add(`${lead.ref}|${where}`);
|
|
165
|
+
act({ person: lead.ref, kind: "meetings_led", ...common });
|
|
166
|
+
}
|
|
167
|
+
if (saysPresented(lead.rest))
|
|
168
|
+
act({ person: lead.ref, kind: "presented", ...common });
|
|
169
|
+
act({ person: lead.ref, kind: null, ...common, areas: areasOf(event.text), areaWeight: AREA_WEIGHT.contribution });
|
|
170
|
+
}
|
|
171
|
+
else if (event.type === "question" && lead && /^\s*(?:\([^)]*\)\s*)?(?:asked|asks|asking|questioned|raised|wondered|inquired)\b/i.test(lead.rest)) {
|
|
172
|
+
act({ person: lead.ref, kind: "questions", ...common, areas: areasOf(event.text), areaWeight: AREA_WEIGHT.question });
|
|
173
|
+
}
|
|
174
|
+
if (DIRECT_TYPES.has(event.type) && SKEW_WEIGHTS[event.cls].structure > 0) {
|
|
175
|
+
const mentions = names.mentions(event.text, event.people);
|
|
176
|
+
if (mentions.length > 0) {
|
|
177
|
+
const owner = event.type === "action_item" || event.type === "commitment" ? (lead?.ref ?? null) : null;
|
|
178
|
+
for (const hit of directHits(event.text, owner, mentions))
|
|
179
|
+
direct(hit.kind, hit.from, hit.to, event.date, event.src, excerptAt(event.text, hit.at), event.cls);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
// A decision made in a meeting, and an action item from the same meeting on the same subject owned by someone else.
|
|
184
|
+
const decisionsByMeeting = new Map();
|
|
185
|
+
for (const item of acts) {
|
|
186
|
+
if (item.kind !== "decisions" || !item.meeting)
|
|
187
|
+
continue;
|
|
188
|
+
decisionsByMeeting.set(item.meeting, [...(decisionsByMeeting.get(item.meeting) ?? []), item]);
|
|
189
|
+
}
|
|
190
|
+
const carried = new Set();
|
|
191
|
+
for (const item of [...acts]) {
|
|
192
|
+
if (item.kind !== "action_items" || !item.meeting)
|
|
193
|
+
continue;
|
|
194
|
+
for (const decision of decisionsByMeeting.get(item.meeting) ?? []) {
|
|
195
|
+
if (decision.person === item.person)
|
|
196
|
+
continue;
|
|
197
|
+
const shared = decision.subjects.find((ref) => !genericSubjects.has(ref) && item.subjects.includes(ref));
|
|
198
|
+
const key = `${decision.person}|${item.person}|${item.meeting}`;
|
|
199
|
+
// Same meeting and same subject is not enough: the action has to echo the decision's own words.
|
|
200
|
+
if (!shared || carried.has(key) || similarity(decision.text, item.text) < CARRIES_OUT_SIMILARITY)
|
|
201
|
+
continue;
|
|
202
|
+
carried.add(key);
|
|
203
|
+
directs.push({ kind: "carries_out", from: decision.person, to: item.person, date: item.date, src: item.src, text: clip(`Decision: ${clip(decision.text, 90)} / Action: ${item.text}`, 220), cls: item.cls });
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return { acts, directs, names, genericSubjects };
|
|
207
|
+
}
|
|
208
|
+
// ---------------------------------------------------------------------------
|
|
209
|
+
// Profiles
|
|
210
|
+
// ---------------------------------------------------------------------------
|
|
211
|
+
export function windowStart(window, asOf) {
|
|
212
|
+
const days = WINDOW_DAYS[window];
|
|
213
|
+
return days === null ? null : addDays(asOf, -days);
|
|
214
|
+
}
|
|
215
|
+
export function inWindow(date, window, asOf) {
|
|
216
|
+
const from = windowStart(window, asOf);
|
|
217
|
+
return date <= asOf && (from === null || date > from);
|
|
218
|
+
}
|
|
219
|
+
/** An act counts in a window when it happened in it; a row that sums a span of days counts only when the whole span is inside. */
|
|
220
|
+
export function actInWindow(item, window, asOf) {
|
|
221
|
+
if (!inWindow(item.date, window, asOf))
|
|
222
|
+
return false;
|
|
223
|
+
const from = windowStart(window, asOf);
|
|
224
|
+
return item.spanFrom === undefined || from === null || item.spanFrom > from;
|
|
225
|
+
}
|
|
226
|
+
const emptyCounts = () => Object.fromEntries(ACTIVITY_KINDS.map((kind) => [kind, 0]));
|
|
227
|
+
const emptyAreas = () => Object.fromEntries(AREAS.map((area) => [area, 0]));
|
|
228
|
+
function top(counts, nameOf, limit) {
|
|
229
|
+
return [...counts]
|
|
230
|
+
.sort((a, b) => b[1] - a[1] || (a[0] < b[0] ? -1 : 1))
|
|
231
|
+
.slice(0, limit)
|
|
232
|
+
.map(([ref, count]) => ({ ref, name: nameOf(ref), count: Math.round(count * 10) / 10 }));
|
|
233
|
+
}
|
|
234
|
+
export function subjectName(graph, ref) {
|
|
235
|
+
return graph.projects.get(ref)?.name ?? graph.companies.get(ref)?.name ?? graph.people.get(ref)?.name ?? ref.slice(ref.indexOf("/") + 1);
|
|
236
|
+
}
|
|
237
|
+
/** The activity profile of one person in one window. `acts` are that person's acts only. */
|
|
238
|
+
export function buildWindowProfile(graph, person, acts, window) {
|
|
239
|
+
const counts = emptyCounts();
|
|
240
|
+
const areaSum = emptyAreas();
|
|
241
|
+
const repos = new Map();
|
|
242
|
+
const projects = new Map();
|
|
243
|
+
const customers = new Map();
|
|
244
|
+
const byClass = {};
|
|
245
|
+
let evidence = 0;
|
|
246
|
+
let areaWeight = 0;
|
|
247
|
+
for (const item of acts) {
|
|
248
|
+
if (!actInWindow(item, window, graph.asOf))
|
|
249
|
+
continue;
|
|
250
|
+
const weight = profileWeight(item.cls, person, graph.member);
|
|
251
|
+
if (weight <= 0)
|
|
252
|
+
continue;
|
|
253
|
+
if (item.kind)
|
|
254
|
+
counts[item.kind] += item.count;
|
|
255
|
+
byClass[item.cls] = (byClass[item.cls] ?? 0) + 1;
|
|
256
|
+
evidence += weight;
|
|
257
|
+
for (const area of AREAS) {
|
|
258
|
+
const share = item.areas[area];
|
|
259
|
+
if (share === undefined)
|
|
260
|
+
continue;
|
|
261
|
+
areaSum[area] += share * item.areaWeight * weight;
|
|
262
|
+
areaWeight += share * item.areaWeight * weight;
|
|
263
|
+
}
|
|
264
|
+
if (item.repo)
|
|
265
|
+
repos.set(item.repo, (repos.get(item.repo) ?? 0) + item.count);
|
|
266
|
+
// Sessions are the member's alone, so they never rank what a person works on against other people.
|
|
267
|
+
if (item.kind === "own_sessions" || item.kind === "own_tracker" || item.kind === "directions_received")
|
|
268
|
+
continue;
|
|
269
|
+
for (const ref of item.subjects) {
|
|
270
|
+
const target = graph.companies.has(ref) ? customers : projects;
|
|
271
|
+
target.set(ref, (target.get(ref) ?? 0) + (item.kind === "commits" ? Math.min(3, item.count * 0.2) : 1));
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
const areas = emptyAreas();
|
|
275
|
+
if (areaWeight > 0)
|
|
276
|
+
for (const area of AREAS)
|
|
277
|
+
areas[area] = areaSum[area] / areaWeight;
|
|
278
|
+
return {
|
|
279
|
+
window,
|
|
280
|
+
from: windowStart(window, graph.asOf),
|
|
281
|
+
to: graph.asOf,
|
|
282
|
+
counts,
|
|
283
|
+
areas,
|
|
284
|
+
areaWeight: Math.round(areaWeight * 10) / 10,
|
|
285
|
+
repos: top(repos, (ref) => ref, 5),
|
|
286
|
+
projects: top(projects, (ref) => subjectName(graph, ref), 6),
|
|
287
|
+
customers: top(customers, (ref) => subjectName(graph, ref), 6),
|
|
288
|
+
byClass,
|
|
289
|
+
evidence: Math.round(evidence * 10) / 10,
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
const CLASS_WORDS = {
|
|
293
|
+
code: "commit records",
|
|
294
|
+
board: "the project board",
|
|
295
|
+
document: "documents",
|
|
296
|
+
meeting: "meetings",
|
|
297
|
+
thread: "channel threads",
|
|
298
|
+
signal: "signals",
|
|
299
|
+
record: "records",
|
|
300
|
+
legacy: "the old ontology",
|
|
301
|
+
"member-dm": "the member's own direct messages",
|
|
302
|
+
"member-session": "the member's own sessions",
|
|
303
|
+
"member-tracker": "the member's own trackers",
|
|
304
|
+
"member-note": "the member's own notes",
|
|
305
|
+
};
|
|
306
|
+
export function classWords(cls) {
|
|
307
|
+
return CLASS_WORDS[cls];
|
|
308
|
+
}
|
|
309
|
+
/** How much evidence stands behind a person, and from which source classes. */
|
|
310
|
+
export function buildCoverage(graph, person, acts) {
|
|
311
|
+
const byClass = {};
|
|
312
|
+
let events = 0;
|
|
313
|
+
let skewed = 0;
|
|
314
|
+
let first = null;
|
|
315
|
+
let last = null;
|
|
316
|
+
for (const item of acts) {
|
|
317
|
+
if (profileWeight(item.cls, person, graph.member) <= 0)
|
|
318
|
+
continue;
|
|
319
|
+
events += 1;
|
|
320
|
+
byClass[item.cls] = (byClass[item.cls] ?? 0) + 1;
|
|
321
|
+
if (item.cls.startsWith("member-"))
|
|
322
|
+
skewed += 1;
|
|
323
|
+
if (first === null || item.date < first)
|
|
324
|
+
first = item.date;
|
|
325
|
+
if (last === null || item.date > last)
|
|
326
|
+
last = item.date;
|
|
327
|
+
}
|
|
328
|
+
const parts = Object.entries(byClass).sort((a, b) => b[1] - a[1]).map(([cls, count]) => `${count} from ${CLASS_WORDS[cls]}`);
|
|
329
|
+
const share = events > 0 ? skewed / events : 0;
|
|
330
|
+
const line = events === 0
|
|
331
|
+
? "No evidence in the rows this view may read."
|
|
332
|
+
: `${events} pieces of evidence, ${first} to ${last}: ${parts.join(", ")}.${share > 0 ? ` ${Math.round(share * 100)}% exists only because this graph was built on this member's machine.` : ""}`;
|
|
333
|
+
return { events, byClass, memberSkewShare: Math.round(share * 100) / 100, firstSeen: first, lastSeen: last, line };
|
|
334
|
+
}
|
|
335
|
+
/** The most recent cited rows behind each kind of activity. */
|
|
336
|
+
export function buildExamples(acts, perKind = 3) {
|
|
337
|
+
const out = {};
|
|
338
|
+
const sorted = [...acts].sort((a, b) => (a.date !== b.date ? (a.date > b.date ? -1 : 1) : a.src < b.src ? -1 : 1));
|
|
339
|
+
for (const item of sorted) {
|
|
340
|
+
if (!item.kind)
|
|
341
|
+
continue;
|
|
342
|
+
const list = (out[item.kind] ??= []);
|
|
343
|
+
if (list.length >= perKind || list.some((example) => example.src === item.src))
|
|
344
|
+
continue;
|
|
345
|
+
list.push({ date: item.date, text: clip(item.text), src: item.src, cls: item.cls });
|
|
346
|
+
}
|
|
347
|
+
return out;
|
|
348
|
+
}
|
|
349
|
+
export function allWindows(build) {
|
|
350
|
+
return Object.fromEntries(ORG_WINDOWS.map((window) => [window, build(window)]));
|
|
351
|
+
}
|
|
352
|
+
//# sourceMappingURL=derive.js.map
|