@burdenoff/microfe-timecampus 2026.1107.1 → 2026.1107.2
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/dist/generated/wspace-operations.d.ts +73 -0
- package/dist/generated/wspace-operations.d.ts.map +1 -1
- package/dist/generated/wspace-operations.js +1352 -1306
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.js +9 -7
- package/dist/generated/wspace-types.js.map +1 -1
- package/dist/index.js +7 -7
- package/dist/timecampus/index.js +7 -7
- package/dist/timecampus/pages/settings/IdleDetectionCard.d.ts +12 -0
- package/dist/timecampus/pages/settings/IdleDetectionCard.d.ts.map +1 -0
- package/dist/timecampus/pages/settings/IdleDetectionCard.js +127 -0
- package/dist/timecampus/pages/settings/IdleDetectionCard.js.map +1 -0
- package/dist/timecampus/pages/settings/PrivacySettingsPage.d.ts.map +1 -1
- package/dist/timecampus/pages/settings/PrivacySettingsPage.js +101 -88
- package/dist/timecampus/pages/settings/PrivacySettingsPage.js.map +1 -1
- package/dist/timecampus/pages/settings/idleDetection.d.ts +38 -0
- package/dist/timecampus/pages/settings/idleDetection.d.ts.map +1 -0
- package/dist/timecampus/pages/settings/idleDetection.js +45 -0
- package/dist/timecampus/pages/settings/idleDetection.js.map +1 -0
- package/dist/timecampus/pages/timeline/timelineProvenance.d.ts +1 -1
- package/dist/timecampus/pages/timeline/timelineProvenance.d.ts.map +1 -1
- package/dist/timecampus/pages/timeline/timelineProvenance.js +4 -0
- package/dist/timecampus/pages/timeline/timelineProvenance.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Idle-detection choices for the privacy settings page (BOFF-4210).
|
|
3
|
+
*
|
|
4
|
+
* The TimeCampus desktop app notices when you stop using the keyboard and
|
|
5
|
+
* mouse. After the threshold, the stretch you were away is cut out of the
|
|
6
|
+
* activity it captured, and is either shown as an away block on your
|
|
7
|
+
* timeline or left out entirely.
|
|
8
|
+
*/
|
|
9
|
+
export type IdleAction = "MARK_AWAY" | "DISCARD";
|
|
10
|
+
export interface ThresholdOption {
|
|
11
|
+
value: string;
|
|
12
|
+
minutes: number;
|
|
13
|
+
label: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const MIN_THRESHOLD_MINUTES = 1;
|
|
16
|
+
export declare const MAX_THRESHOLD_MINUTES = 60;
|
|
17
|
+
export declare const DEFAULT_THRESHOLD_MINUTES = 5;
|
|
18
|
+
export declare const IDLE_ACTION_OPTIONS: ReadonlyArray<{
|
|
19
|
+
value: IdleAction;
|
|
20
|
+
label: string;
|
|
21
|
+
detail: string;
|
|
22
|
+
}>;
|
|
23
|
+
export declare function thresholdLabel(minutes: number): string;
|
|
24
|
+
/**
|
|
25
|
+
* The thresholds to offer, including the current value when it is not a
|
|
26
|
+
* preset (set from the API), so the select never misreports it.
|
|
27
|
+
*/
|
|
28
|
+
export declare function thresholdOptions(current: number | null): ThresholdOption[];
|
|
29
|
+
/** Parse a `<select>` value back to minutes; null when it is not valid. */
|
|
30
|
+
export declare function parseThresholdValue(value: string): number | null;
|
|
31
|
+
export declare function isIdleAction(value: string): value is IdleAction;
|
|
32
|
+
/** One line describing the current settings, for the card header. */
|
|
33
|
+
export declare function idleSummary(settings: {
|
|
34
|
+
enabled: boolean;
|
|
35
|
+
thresholdMinutes: number;
|
|
36
|
+
idleAction: IdleAction;
|
|
37
|
+
}): string;
|
|
38
|
+
//# sourceMappingURL=idleDetection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"idleDetection.d.ts","sourceRoot":"","sources":["../../../../src/timecampus/pages/settings/idleDetection.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,SAAS,CAAC;AAEjD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,qBAAqB,IAAI,CAAC;AACvC,eAAO,MAAM,qBAAqB,KAAK,CAAC;AACxC,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAI3C,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC;IAC9C,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAWA,CAAC;AAEF,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGtD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,eAAe,EAAE,CAiB1E;AAED,2EAA2E;AAC3E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOhE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,UAAU,CAE/D;AAED,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,QAAQ,EAAE;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC;CACxB,GAAG,MAAM,CAQT"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var e = [
|
|
2
|
+
1,
|
|
3
|
+
2,
|
|
4
|
+
3,
|
|
5
|
+
5,
|
|
6
|
+
10,
|
|
7
|
+
15,
|
|
8
|
+
30,
|
|
9
|
+
60
|
|
10
|
+
], t = [{
|
|
11
|
+
value: "MARK_AWAY",
|
|
12
|
+
label: "Show it as away time",
|
|
13
|
+
detail: "An away block appears on your timeline where you stepped out."
|
|
14
|
+
}, {
|
|
15
|
+
value: "DISCARD",
|
|
16
|
+
label: "Leave it out",
|
|
17
|
+
detail: "Away time is dropped; your timeline shows a gap."
|
|
18
|
+
}];
|
|
19
|
+
function n(e) {
|
|
20
|
+
return e === 60 ? "1 hour" : e === 1 ? "1 minute" : `${e} minutes`;
|
|
21
|
+
}
|
|
22
|
+
function r(t) {
|
|
23
|
+
let r = [...e];
|
|
24
|
+
return t != null && Number.isInteger(t) && t >= 1 && t <= 60 && !r.includes(t) && (r.push(t), r.sort((e, t) => e - t)), r.map((e) => ({
|
|
25
|
+
value: String(e),
|
|
26
|
+
minutes: e,
|
|
27
|
+
label: n(e)
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
function i(e) {
|
|
31
|
+
let t = Number.parseInt(e, 10);
|
|
32
|
+
return Number.isInteger(t) && t >= 1 && t <= 60 ? t : null;
|
|
33
|
+
}
|
|
34
|
+
function a(e) {
|
|
35
|
+
return e === "MARK_AWAY" || e === "DISCARD";
|
|
36
|
+
}
|
|
37
|
+
function o(e) {
|
|
38
|
+
if (!e.enabled) return "Off: the desktop app keeps capturing while you are away from the keyboard.";
|
|
39
|
+
let t = n(e.thresholdMinutes);
|
|
40
|
+
return e.idleAction === "MARK_AWAY" ? `On: after ${t} without keyboard or mouse input, the time is shown as away.` : `On: after ${t} without keyboard or mouse input, the time is left out.`;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { t as IDLE_ACTION_OPTIONS, o as idleSummary, a as isIdleAction, i as parseThresholdValue, n as thresholdLabel, r as thresholdOptions };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=idleDetection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"idleDetection.js","names":[],"sources":["../../../../src/timecampus/pages/settings/idleDetection.ts"],"sourcesContent":["/**\n * Idle-detection choices for the privacy settings page (BOFF-4210).\n *\n * The TimeCampus desktop app notices when you stop using the keyboard and\n * mouse. After the threshold, the stretch you were away is cut out of the\n * activity it captured, and is either shown as an away block on your\n * timeline or left out entirely.\n */\n\nexport type IdleAction = \"MARK_AWAY\" | \"DISCARD\";\n\nexport interface ThresholdOption {\n value: string;\n minutes: number;\n label: string;\n}\n\nexport const MIN_THRESHOLD_MINUTES = 1;\nexport const MAX_THRESHOLD_MINUTES = 60;\nexport const DEFAULT_THRESHOLD_MINUTES = 5;\n\nconst PRESET_MINUTES = [1, 2, 3, 5, 10, 15, 30, 60] as const;\n\nexport const IDLE_ACTION_OPTIONS: ReadonlyArray<{\n value: IdleAction;\n label: string;\n detail: string;\n}> = [\n {\n value: \"MARK_AWAY\",\n label: \"Show it as away time\",\n detail: \"An away block appears on your timeline where you stepped out.\",\n },\n {\n value: \"DISCARD\",\n label: \"Leave it out\",\n detail: \"Away time is dropped; your timeline shows a gap.\",\n },\n];\n\nexport function thresholdLabel(minutes: number): string {\n if (minutes === 60) return \"1 hour\";\n return minutes === 1 ? \"1 minute\" : `${minutes} minutes`;\n}\n\n/**\n * The thresholds to offer, including the current value when it is not a\n * preset (set from the API), so the select never misreports it.\n */\nexport function thresholdOptions(current: number | null): ThresholdOption[] {\n const minutes: number[] = [...PRESET_MINUTES];\n if (\n current != null &&\n Number.isInteger(current) &&\n current >= MIN_THRESHOLD_MINUTES &&\n current <= MAX_THRESHOLD_MINUTES &&\n !minutes.includes(current)\n ) {\n minutes.push(current);\n minutes.sort((a, b) => a - b);\n }\n return minutes.map((m) => ({\n value: String(m),\n minutes: m,\n label: thresholdLabel(m),\n }));\n}\n\n/** Parse a `<select>` value back to minutes; null when it is not valid. */\nexport function parseThresholdValue(value: string): number | null {\n const minutes = Number.parseInt(value, 10);\n return Number.isInteger(minutes) &&\n minutes >= MIN_THRESHOLD_MINUTES &&\n minutes <= MAX_THRESHOLD_MINUTES\n ? minutes\n : null;\n}\n\nexport function isIdleAction(value: string): value is IdleAction {\n return value === \"MARK_AWAY\" || value === \"DISCARD\";\n}\n\n/** One line describing the current settings, for the card header. */\nexport function idleSummary(settings: {\n enabled: boolean;\n thresholdMinutes: number;\n idleAction: IdleAction;\n}): string {\n if (!settings.enabled) {\n return \"Off: the desktop app keeps capturing while you are away from the keyboard.\";\n }\n const after = thresholdLabel(settings.thresholdMinutes);\n return settings.idleAction === \"MARK_AWAY\"\n ? `On: after ${after} without keyboard or mouse input, the time is shown as away.`\n : `On: after ${after} without keyboard or mouse input, the time is left out.`;\n}\n"],"mappings":"AAqBA,IAAM,IAAiB;CAAC;CAAG;CAAG;CAAG;CAAG;CAAI;CAAI;CAAI;AAAE,GAErC,IAIR,CACH;CACE,OAAO;CACP,OAAO;CACP,QAAQ;AACV,GACA;CACE,OAAO;CACP,OAAO;CACP,QAAQ;AACV,CACF;AAEA,SAAgB,EAAe,GAAyB;CAEtD,OADI,MAAY,KAAW,WACpB,MAAY,IAAI,aAAa,GAAG,EAAQ;AACjD;AAMA,SAAgB,EAAiB,GAA2C;CAC1E,IAAM,IAAoB,CAAC,GAAG,CAAc;CAW5C,OATE,KAAW,QACX,OAAO,UAAU,CAAO,KACxB,KAAA,KACA,KAAA,MACA,CAAC,EAAQ,SAAS,CAAO,MAEzB,EAAQ,KAAK,CAAO,GACpB,EAAQ,MAAM,GAAG,MAAM,IAAI,CAAC,IAEvB,EAAQ,KAAK,OAAO;EACzB,OAAO,OAAO,CAAC;EACf,SAAS;EACT,OAAO,EAAe,CAAC;CACzB,EAAE;AACJ;AAGA,SAAgB,EAAoB,GAA8B;CAChE,IAAM,IAAU,OAAO,SAAS,GAAO,EAAE;CACzC,OAAO,OAAO,UAAU,CAAO,KAC7B,KAAA,KACA,KAAA,KACE,IACA;AACN;AAEA,SAAgB,EAAa,GAAoC;CAC/D,OAAO,MAAU,eAAe,MAAU;AAC5C;AAGA,SAAgB,EAAY,GAIjB;CACT,IAAI,CAAC,EAAS,SACZ,OAAO;CAET,IAAM,IAAQ,EAAe,EAAS,gBAAgB;CACtD,OAAO,EAAS,eAAe,cAC3B,aAAa,EAAM,gEACnB,aAAa,EAAM;AACzB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* How a timeline segment came by its category (BOFF-3899). The service writes
|
|
3
|
-
* `categorySource` lowercase ('auto' | 'user' | 'channel' | 'ai'); an AI
|
|
3
|
+
* `categorySource` lowercase ('auto' | 'user' | 'channel' | 'ai' | 'idle'); an AI
|
|
4
4
|
* decision also carries the model's confidence (0..1) and the
|
|
5
5
|
* "provider:model" that made it. Pure so the labels are unit-tested.
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timelineProvenance.d.ts","sourceRoot":"","sources":["../../../../src/timecampus/pages/timeline/timelineProvenance.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,sBAAsB;IACrC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,iBAAiB;IAChC,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,IAAI,EAAE,OAAO,CAAC;CACf;
|
|
1
|
+
{"version":3,"file":"timelineProvenance.d.ts","sourceRoot":"","sources":["../../../../src/timecampus/pages/timeline/timelineProvenance.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,sBAAsB;IACrC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,iBAAiB;IAChC,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,IAAI,EAAE,OAAO,CAAC;CACf;AAwBD,0EAA0E;AAC1E,eAAO,MAAM,sBAAsB,8HAC0F,CAAC;AAE9H,+EAA+E;AAC/E,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACpC,MAAM,GAAG,IAAI,CAKf;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,sBAAsB,GAC9B,iBAAiB,GAAG,IAAI,CA0B1B;AAED,wEAAwE;AACxE,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,aAAa,CAAC,sBAAsB,CAAC,GAC9C,OAAO,CAIT"}
|
|
@@ -11,6 +11,10 @@ var e = {
|
|
|
11
11
|
channel: {
|
|
12
12
|
label: "From channel rules",
|
|
13
13
|
detail: "Categorized by the capture channel that sent this activity."
|
|
14
|
+
},
|
|
15
|
+
idle: {
|
|
16
|
+
label: "Away from keyboard",
|
|
17
|
+
detail: "The desktop app saw no keyboard or mouse input, so this time is shown as away rather than work. Change this in Privacy settings."
|
|
14
18
|
}
|
|
15
19
|
}, t = "AI can get this wrong. Pick another category to correct it, and TimeCampus will use your choice for this app from now on.";
|
|
16
20
|
function n(e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timelineProvenance.js","names":[],"sources":["../../../../src/timecampus/pages/timeline/timelineProvenance.ts"],"sourcesContent":["/**\n * How a timeline segment came by its category (BOFF-3899). The service writes\n * `categorySource` lowercase ('auto' | 'user' | 'channel' | 'ai'); an AI\n * decision also carries the model's confidence (0..1) and the\n * \"provider:model\" that made it. Pure so the labels are unit-tested.\n */\n\nexport interface SegmentProvenanceInput {\n categorySource?: string | null;\n categoryConfidence?: number | null;\n categoryModel?: string | null;\n}\n\nexport interface SegmentProvenance {\n /** Short text shown next to the category chip. */\n label: string;\n /** Longer explanation for the hover title / screen readers. */\n detail: string;\n /** True when a model, not a rule or the user, chose the category. */\n isAi: boolean;\n}\n\nconst SOURCE_PROVENANCE: Record<string, Omit<SegmentProvenance, \"isAi\">> = {\n auto: {\n label: \"Auto-categorized\",\n detail: \"Categorized by TimeCampus's built-in app rules.\",\n },\n user: {\n label: \"You set this\",\n detail:\n \"You chose this category. TimeCampus applies your correction to this app from now on.\",\n },\n channel: {\n label: \"From channel rules\",\n detail: \"Categorized by the capture channel that sent this activity.\",\n },\n};\n\n/** The disclaimer shown with AI-decided categories (AI readiness 5.3). */\nexport const AI_CATEGORY_DISCLAIMER =\n \"AI can get this wrong. Pick another category to correct it, and TimeCampus will use your choice for this app from now on.\";\n\n/** Whole-percent confidence, or null when the value is missing or unusable. */\nexport function confidencePercent(\n confidence: number | null | undefined,\n): number | null {\n if (typeof confidence !== \"number\" || !Number.isFinite(confidence)) {\n return null;\n }\n return Math.round(Math.min(1, Math.max(0, confidence)) * 100);\n}\n\nexport function segmentProvenance(\n segment: SegmentProvenanceInput,\n): SegmentProvenance | null {\n const source = segment.categorySource?.trim().toLowerCase();\n if (!source) return null;\n\n if (source === \"ai\") {\n const percent = confidencePercent(segment.categoryConfidence);\n const label =\n percent === null\n ? \"Categorized by AI\"\n : `Categorized by AI · ${percent}% confident`;\n const model = segment.categoryModel?.trim();\n const decidedBy = model ? `Decided by ${model}.` : \"Decided by a model.\";\n return {\n label,\n detail: `${decidedBy} ${AI_CATEGORY_DISCLAIMER}`,\n isAi: true,\n };\n }\n\n const known = SOURCE_PROVENANCE[source];\n if (known) return { ...known, isAi: false };\n return {\n label: segment.categorySource ?? source,\n detail: `Category source: ${segment.categorySource ?? source}.`,\n isAi: false,\n };\n}\n\n/** True when at least one segment's category was decided by a model. */\nexport function hasAiCategorizedSegment(\n segments: ReadonlyArray<SegmentProvenanceInput>,\n): boolean {\n return segments.some(\n (segment) => segment.categorySource?.trim().toLowerCase() === \"ai\",\n );\n}\n"],"mappings":";AAsBA,IAAM,IAAqE;CACzE,MAAM;EACJ,OAAO;EACP,QAAQ;CACV;CACA,MAAM;EACJ,OAAO;EACP,QACE;CACJ;CACA,SAAS;EACP,OAAO;EACP,QAAQ;CACV;AACF,GAGa,IACX;AAGF,SAAgB,EACd,GACe;CAIf,OAHI,OAAO,KAAe,YAAY,CAAC,OAAO,SAAS,CAAU,IACxD,OAEF,KAAK,MAAM,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,CAAU,CAAC,IAAI,GAAG;AAC9D;AAEA,SAAgB,EACd,GAC0B;CAC1B,IAAM,IAAS,EAAQ,gBAAgB,KAAK,CAAC,CAAC,YAAY;CAC1D,IAAI,CAAC,GAAQ,OAAO;CAEpB,IAAI,MAAW,MAAM;EACnB,IAAM,IAAU,EAAkB,EAAQ,kBAAkB,GACtD,IACJ,MAAY,OACR,sBACA,uBAAuB,EAAQ,cAC/B,IAAQ,EAAQ,eAAe,KAAK;EAE1C,OAAO;GACL;GACA,QAAQ,GAHQ,IAAQ,cAAc,EAAM,KAAK,sBAG5B,GAAG;GACxB,MAAM;EACR;CACF;CAEA,IAAM,IAAQ,EAAkB;CAEhC,OADI,IAAc;EAAE,GAAG;EAAO,MAAM;CAAM,IACnC;EACL,OAAO,EAAQ,kBAAkB;EACjC,QAAQ,oBAAoB,EAAQ,kBAAkB,EAAO;EAC7D,MAAM;CACR;AACF;AAGA,SAAgB,EACd,GACS;CACT,OAAO,EAAS,MACb,MAAY,EAAQ,gBAAgB,KAAK,CAAC,CAAC,YAAY,MAAM,IAChE;AACF"}
|
|
1
|
+
{"version":3,"file":"timelineProvenance.js","names":[],"sources":["../../../../src/timecampus/pages/timeline/timelineProvenance.ts"],"sourcesContent":["/**\n * How a timeline segment came by its category (BOFF-3899). The service writes\n * `categorySource` lowercase ('auto' | 'user' | 'channel' | 'ai' | 'idle'); an AI\n * decision also carries the model's confidence (0..1) and the\n * \"provider:model\" that made it. Pure so the labels are unit-tested.\n */\n\nexport interface SegmentProvenanceInput {\n categorySource?: string | null;\n categoryConfidence?: number | null;\n categoryModel?: string | null;\n}\n\nexport interface SegmentProvenance {\n /** Short text shown next to the category chip. */\n label: string;\n /** Longer explanation for the hover title / screen readers. */\n detail: string;\n /** True when a model, not a rule or the user, chose the category. */\n isAi: boolean;\n}\n\nconst SOURCE_PROVENANCE: Record<string, Omit<SegmentProvenance, \"isAi\">> = {\n auto: {\n label: \"Auto-categorized\",\n detail: \"Categorized by TimeCampus's built-in app rules.\",\n },\n user: {\n label: \"You set this\",\n detail:\n \"You chose this category. TimeCampus applies your correction to this app from now on.\",\n },\n channel: {\n label: \"From channel rules\",\n detail: \"Categorized by the capture channel that sent this activity.\",\n },\n // BOFF-4210: an away block the desktop app's idle detection recorded.\n idle: {\n label: \"Away from keyboard\",\n detail:\n \"The desktop app saw no keyboard or mouse input, so this time is shown as away rather than work. Change this in Privacy settings.\",\n },\n};\n\n/** The disclaimer shown with AI-decided categories (AI readiness 5.3). */\nexport const AI_CATEGORY_DISCLAIMER =\n \"AI can get this wrong. Pick another category to correct it, and TimeCampus will use your choice for this app from now on.\";\n\n/** Whole-percent confidence, or null when the value is missing or unusable. */\nexport function confidencePercent(\n confidence: number | null | undefined,\n): number | null {\n if (typeof confidence !== \"number\" || !Number.isFinite(confidence)) {\n return null;\n }\n return Math.round(Math.min(1, Math.max(0, confidence)) * 100);\n}\n\nexport function segmentProvenance(\n segment: SegmentProvenanceInput,\n): SegmentProvenance | null {\n const source = segment.categorySource?.trim().toLowerCase();\n if (!source) return null;\n\n if (source === \"ai\") {\n const percent = confidencePercent(segment.categoryConfidence);\n const label =\n percent === null\n ? \"Categorized by AI\"\n : `Categorized by AI · ${percent}% confident`;\n const model = segment.categoryModel?.trim();\n const decidedBy = model ? `Decided by ${model}.` : \"Decided by a model.\";\n return {\n label,\n detail: `${decidedBy} ${AI_CATEGORY_DISCLAIMER}`,\n isAi: true,\n };\n }\n\n const known = SOURCE_PROVENANCE[source];\n if (known) return { ...known, isAi: false };\n return {\n label: segment.categorySource ?? source,\n detail: `Category source: ${segment.categorySource ?? source}.`,\n isAi: false,\n };\n}\n\n/** True when at least one segment's category was decided by a model. */\nexport function hasAiCategorizedSegment(\n segments: ReadonlyArray<SegmentProvenanceInput>,\n): boolean {\n return segments.some(\n (segment) => segment.categorySource?.trim().toLowerCase() === \"ai\",\n );\n}\n"],"mappings":";AAsBA,IAAM,IAAqE;CACzE,MAAM;EACJ,OAAO;EACP,QAAQ;CACV;CACA,MAAM;EACJ,OAAO;EACP,QACE;CACJ;CACA,SAAS;EACP,OAAO;EACP,QAAQ;CACV;CAEA,MAAM;EACJ,OAAO;EACP,QACE;CACJ;AACF,GAGa,IACX;AAGF,SAAgB,EACd,GACe;CAIf,OAHI,OAAO,KAAe,YAAY,CAAC,OAAO,SAAS,CAAU,IACxD,OAEF,KAAK,MAAM,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,CAAU,CAAC,IAAI,GAAG;AAC9D;AAEA,SAAgB,EACd,GAC0B;CAC1B,IAAM,IAAS,EAAQ,gBAAgB,KAAK,CAAC,CAAC,YAAY;CAC1D,IAAI,CAAC,GAAQ,OAAO;CAEpB,IAAI,MAAW,MAAM;EACnB,IAAM,IAAU,EAAkB,EAAQ,kBAAkB,GACtD,IACJ,MAAY,OACR,sBACA,uBAAuB,EAAQ,cAC/B,IAAQ,EAAQ,eAAe,KAAK;EAE1C,OAAO;GACL;GACA,QAAQ,GAHQ,IAAQ,cAAc,EAAM,KAAK,sBAG5B,GAAG;GACxB,MAAM;EACR;CACF;CAEA,IAAM,IAAQ,EAAkB;CAEhC,OADI,IAAc;EAAE,GAAG;EAAO,MAAM;CAAM,IACnC;EACL,OAAO,EAAQ,kBAAkB;EACjC,QAAQ,oBAAoB,EAAQ,kBAAkB,EAAO;EAC7D,MAAM;CACR;AACF;AAGA,SAAgB,EACd,GACS;CACT,OAAO,EAAS,MACb,MAAY,EAAQ,gBAAgB,KAAK,CAAC,CAAC,YAAY,MAAM,IAChE;AACF"}
|
package/package.json
CHANGED