@teeras/afterhours 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +101 -15
- package/dist/activity.d.ts +15 -1
- package/dist/activity.d.ts.map +1 -1
- package/dist/activity.js +76 -1
- package/dist/activity.js.map +1 -1
- package/dist/autosync.d.ts +22 -0
- package/dist/autosync.d.ts.map +1 -0
- package/dist/autosync.js +85 -0
- package/dist/autosync.js.map +1 -0
- package/dist/cli.js +112 -9
- package/dist/cli.js.map +1 -1
- package/dist/cloud.d.ts +5 -0
- package/dist/cloud.d.ts.map +1 -1
- package/dist/cloud.js +10 -2
- package/dist/cloud.js.map +1 -1
- package/dist/collect.d.ts +3 -1
- package/dist/collect.d.ts.map +1 -1
- package/dist/collect.js +8 -7
- package/dist/collect.js.map +1 -1
- package/dist/detect.d.ts.map +1 -1
- package/dist/detect.js +35 -6
- package/dist/detect.js.map +1 -1
- package/dist/hooks.d.ts +29 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +196 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +9 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/install.d.ts +25 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +155 -0
- package/dist/install.js.map +1 -0
- package/dist/moments.d.ts +21 -0
- package/dist/moments.d.ts.map +1 -0
- package/dist/moments.js +52 -0
- package/dist/moments.js.map +1 -0
- package/dist/off.d.ts +24 -0
- package/dist/off.d.ts.map +1 -0
- package/dist/off.js +36 -0
- package/dist/off.js.map +1 -0
- package/dist/privacy.d.ts +8 -0
- package/dist/privacy.d.ts.map +1 -1
- package/dist/privacy.js +26 -1
- package/dist/privacy.js.map +1 -1
- package/dist/qr.d.ts +29 -0
- package/dist/qr.d.ts.map +1 -0
- package/dist/qr.js +92 -0
- package/dist/qr.js.map +1 -0
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +38 -1
- package/dist/render.js.map +1 -1
- package/dist/report.d.ts.map +1 -1
- package/dist/report.js +82 -1
- package/dist/report.js.map +1 -1
- package/dist/runtime.d.ts +18 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +70 -0
- package/dist/runtime.js.map +1 -0
- package/dist/secret.d.ts +9 -0
- package/dist/secret.d.ts.map +1 -0
- package/dist/secret.js +32 -0
- package/dist/secret.js.map +1 -0
- package/dist/setup.d.ts +18 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +155 -0
- package/dist/setup.js.map +1 -0
- package/dist/sources/claude.d.ts.map +1 -1
- package/dist/sources/claude.js +141 -18
- package/dist/sources/claude.js.map +1 -1
- package/dist/sources/codex.d.ts.map +1 -1
- package/dist/sources/codex.js +209 -18
- package/dist/sources/codex.js.map +1 -1
- package/dist/sources/cursor.d.ts.map +1 -1
- package/dist/sources/cursor.js +1 -0
- package/dist/sources/cursor.js.map +1 -1
- package/dist/sources/gemini.d.ts.map +1 -1
- package/dist/sources/gemini.js +73 -8
- package/dist/sources/gemini.js.map +1 -1
- package/dist/types.d.ts +61 -6
- package/dist/types.d.ts.map +1 -1
- package/llms-install.md +29 -0
- package/package.json +3 -2
package/dist/sources/gemini.js
CHANGED
|
@@ -1,17 +1,83 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { emptySource, inWindow, timestamp } from "../activity.js";
|
|
3
|
+
import { addToken, delegationEpisode, emptySource, finishSource, inWindow, opaqueEpisodeId, optionalFiniteNumber, timestamp, } from "../activity.js";
|
|
4
4
|
import { isDirectory, recentFiles } from "../files.js";
|
|
5
|
-
import { record } from "./shared.js";
|
|
5
|
+
import { parseLines, record } from "./shared.js";
|
|
6
6
|
export const geminiSource = {
|
|
7
7
|
id: "gemini-cli",
|
|
8
8
|
name: "Gemini CLI",
|
|
9
|
-
|
|
9
|
+
version: "gemini-cli-v2",
|
|
10
|
+
collect({ home, sinceMs, untilMs, episodeKeySecret }) {
|
|
10
11
|
const root = join(home, ".gemini");
|
|
11
12
|
const source = emptySource("gemini-cli", "Gemini CLI", isDirectory(root));
|
|
12
13
|
if (!source.configured)
|
|
13
14
|
return source;
|
|
14
15
|
const sessionIds = new Set();
|
|
16
|
+
const events = [];
|
|
17
|
+
for (const path of recentFiles(join(root, "tmp"), sinceMs, (name) => name.startsWith("session-") && name.endsWith(".jsonl"))) {
|
|
18
|
+
let rows;
|
|
19
|
+
try {
|
|
20
|
+
rows = parseLines(readFileSync(path, "utf8"));
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
const metadata = rows.find((row) => typeof row.sessionId === "string");
|
|
26
|
+
const sessionId = typeof metadata?.sessionId === "string" && metadata.sessionId.length <= 200
|
|
27
|
+
? metadata.sessionId
|
|
28
|
+
: path;
|
|
29
|
+
const sessionEvents = [];
|
|
30
|
+
const sessionTokens = { input: null, cached: null, output: null, reasoning: null };
|
|
31
|
+
let modelFamily = null;
|
|
32
|
+
for (const row of rows) {
|
|
33
|
+
const at = timestamp(row.timestamp);
|
|
34
|
+
if (at == null || !inWindow(at, sinceMs, untilMs))
|
|
35
|
+
continue;
|
|
36
|
+
if (row.type === "user")
|
|
37
|
+
sessionEvents.push({ at, kind: "human" });
|
|
38
|
+
if (row.type !== "gemini")
|
|
39
|
+
continue;
|
|
40
|
+
sessionEvents.push({ at, kind: "agent" });
|
|
41
|
+
const tokens = record(row.tokens);
|
|
42
|
+
if (tokens) {
|
|
43
|
+
const input = optionalFiniteNumber(tokens.input);
|
|
44
|
+
const cached = optionalFiniteNumber(tokens.cached);
|
|
45
|
+
const output = optionalFiniteNumber(tokens.output);
|
|
46
|
+
const reasoning = optionalFiniteNumber(tokens.thoughts);
|
|
47
|
+
source.tokens.input = addToken(source.tokens.input, input);
|
|
48
|
+
source.tokens.cached = addToken(source.tokens.cached, cached);
|
|
49
|
+
source.tokens.output = addToken(source.tokens.output, output);
|
|
50
|
+
source.tokens.reasoning = addToken(source.tokens.reasoning, reasoning);
|
|
51
|
+
sessionTokens.input = addToken(sessionTokens.input, input);
|
|
52
|
+
sessionTokens.cached = addToken(sessionTokens.cached, cached);
|
|
53
|
+
sessionTokens.output = addToken(sessionTokens.output, output);
|
|
54
|
+
sessionTokens.reasoning = addToken(sessionTokens.reasoning, reasoning);
|
|
55
|
+
}
|
|
56
|
+
if (typeof row.model === "string" && /^[a-z0-9][a-z0-9._:-]{0,79}$/i.test(row.model)) {
|
|
57
|
+
modelFamily = row.model;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (sessionEvents.length === 0)
|
|
61
|
+
continue;
|
|
62
|
+
const id = opaqueEpisodeId(episodeKeySecret, "gemini-cli", sessionId);
|
|
63
|
+
if (sessionIds.has(id))
|
|
64
|
+
continue;
|
|
65
|
+
sessionIds.add(id);
|
|
66
|
+
events.push(...sessionEvents);
|
|
67
|
+
const episode = delegationEpisode({
|
|
68
|
+
id,
|
|
69
|
+
adapterVersion: "gemini-cli-v2",
|
|
70
|
+
events: sessionEvents,
|
|
71
|
+
tokens: sessionTokens,
|
|
72
|
+
untilMs,
|
|
73
|
+
confidence: "medium",
|
|
74
|
+
modelFamily,
|
|
75
|
+
});
|
|
76
|
+
if (episode)
|
|
77
|
+
source.episodes.push(episode);
|
|
78
|
+
}
|
|
79
|
+
// Older Gemini CLI builds expose only session-level logs. Preserve honest
|
|
80
|
+
// coverage without inventing turns or attention measurements.
|
|
15
81
|
for (const path of recentFiles(join(root, "tmp"), sinceMs, (name) => name === "logs.json")) {
|
|
16
82
|
let rows;
|
|
17
83
|
try {
|
|
@@ -27,14 +93,13 @@ export const geminiSource = {
|
|
|
27
93
|
const at = timestamp(row?.timestamp);
|
|
28
94
|
if (at == null || !inWindow(at, sinceMs, untilMs))
|
|
29
95
|
continue;
|
|
30
|
-
if (typeof row?.sessionId === "string")
|
|
31
|
-
sessionIds.add(row.sessionId);
|
|
96
|
+
if (typeof row?.sessionId === "string") {
|
|
97
|
+
sessionIds.add(opaqueEpisodeId(episodeKeySecret, "gemini-cli", row.sessionId));
|
|
98
|
+
}
|
|
32
99
|
}
|
|
33
100
|
}
|
|
34
101
|
source.sessions = sessionIds.size;
|
|
35
|
-
|
|
36
|
-
source.fidelity = "sessions";
|
|
37
|
-
return source;
|
|
102
|
+
return finishSource(source, events, events.length > 0 ? "activity" : "sessions");
|
|
38
103
|
},
|
|
39
104
|
};
|
|
40
105
|
//# sourceMappingURL=gemini.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini.js","sourceRoot":"","sources":["../../src/sources/gemini.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,
|
|
1
|
+
{"version":3,"file":"gemini.js","sourceRoot":"","sources":["../../src/sources/gemini.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,QAAQ,EACR,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,eAAe,EACf,oBAAoB,EACpB,SAAS,GAEV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,CAAC,MAAM,YAAY,GAAkB;IACzC,EAAE,EAAE,YAAY;IAChB,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,eAAe;IACxB,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE;QAClD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,SAAS,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WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,WAAW,CAAC,EAAE,CAAC;YAC3F,IAAI,IAAa,CAAC;YAClB,IAAI,CAAC;gBACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;YAChD,CAAC;YAAC,MAAM,CAAC;gBACP,SAAS;YACX,CAAC;YACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;gBAAE,SAAS;YACnC,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE,CAAC;gBACzB,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;gBAC1B,MAAM,EAAE,GAAG,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;gBACrC,IAAI,EAAE,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC;oBAAE,SAAS;gBAC5D,IAAI,OAAO,GAAG,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC;oBACvC,UAAU,CAAC,GAAG,CAAC,eAAe,CAAC,gBAAgB,EAAE,YAAY,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;gBACjF,CAAC;YACH,CAAC;QACH,CAAC;QAED,MAAM,CAAC,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC;QAClC,OAAO,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IACnF,CAAC;CACF,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -2,10 +2,39 @@
|
|
|
2
2
|
export type SourceId = string;
|
|
3
3
|
export type Fidelity = "activity" | "sessions" | "detected" | "none";
|
|
4
4
|
export interface TokenCounts {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
/** Null means the source did not expose this counter. Zero means observed none. */
|
|
6
|
+
input: number | null;
|
|
7
|
+
cached: number | null;
|
|
8
|
+
output: number | null;
|
|
9
|
+
reasoning: number | null;
|
|
10
|
+
}
|
|
11
|
+
export type EpisodeConfidence = "high" | "medium" | "low";
|
|
12
|
+
export type EpisodeStatus = "open" | "observed_end";
|
|
13
|
+
/**
|
|
14
|
+
* A content-free unit of human supervision. The opaque id is HMAC-derived
|
|
15
|
+
* locally from the source session and cannot be reversed into a path.
|
|
16
|
+
*/
|
|
17
|
+
export interface DelegationEpisode {
|
|
18
|
+
id: string;
|
|
19
|
+
startedAt: string;
|
|
20
|
+
endedAt: string;
|
|
21
|
+
localDate: string;
|
|
22
|
+
localStartHour: number;
|
|
23
|
+
status: EpisodeStatus;
|
|
24
|
+
confidence: EpisodeConfidence;
|
|
25
|
+
metricVersion: "delegation-episode-v1";
|
|
26
|
+
adapterVersion: string;
|
|
27
|
+
modelFamily: string | null;
|
|
28
|
+
agentTurns: number;
|
|
29
|
+
humanCheckIns: number;
|
|
30
|
+
humanReEntries: number;
|
|
31
|
+
agentActiveMinutes: number;
|
|
32
|
+
humanAttentionMinutes: number;
|
|
33
|
+
longestAutonomousRunMinutes: number;
|
|
34
|
+
approvalRequests: number | null;
|
|
35
|
+
failureEvents: number | null;
|
|
36
|
+
reworkEvents: number | null;
|
|
37
|
+
tokens: TokenCounts;
|
|
9
38
|
}
|
|
10
39
|
export interface ActivityBucket {
|
|
11
40
|
/** ISO timestamp at the beginning of a local clock hour. */
|
|
@@ -28,6 +57,7 @@ export interface SourceSnapshot {
|
|
|
28
57
|
humanCheckIns: number;
|
|
29
58
|
tokens: TokenCounts;
|
|
30
59
|
buckets: ActivityBucket[];
|
|
60
|
+
episodes: DelegationEpisode[];
|
|
31
61
|
}
|
|
32
62
|
export interface DataBoundary {
|
|
33
63
|
mode: "local-first";
|
|
@@ -37,7 +67,11 @@ export interface DataBoundary {
|
|
|
37
67
|
"local date and hour",
|
|
38
68
|
"event kinds",
|
|
39
69
|
"session counts",
|
|
40
|
-
"token counters"
|
|
70
|
+
"token counters",
|
|
71
|
+
"content-free delegation episodes",
|
|
72
|
+
"measurement provenance and missingness",
|
|
73
|
+
"agent and model family",
|
|
74
|
+
"approval and lifecycle signals"
|
|
41
75
|
];
|
|
42
76
|
neverRetained: readonly [
|
|
43
77
|
"prompt text",
|
|
@@ -49,7 +83,7 @@ export interface DataBoundary {
|
|
|
49
83
|
];
|
|
50
84
|
}
|
|
51
85
|
export interface AfterhoursSnapshot {
|
|
52
|
-
schemaVersion:
|
|
86
|
+
schemaVersion: 3;
|
|
53
87
|
generatedAt: string;
|
|
54
88
|
since: string;
|
|
55
89
|
until: string;
|
|
@@ -59,22 +93,43 @@ export interface AfterhoursSnapshot {
|
|
|
59
93
|
export interface SourceAdapter {
|
|
60
94
|
id: SourceId;
|
|
61
95
|
name: string;
|
|
96
|
+
version: string;
|
|
62
97
|
collect(input: CollectInput): SourceSnapshot;
|
|
63
98
|
}
|
|
64
99
|
export interface CollectInput {
|
|
65
100
|
home: string;
|
|
66
101
|
sinceMs: number;
|
|
67
102
|
untilMs: number;
|
|
103
|
+
/** Secret material used only to make source session identifiers opaque. */
|
|
104
|
+
episodeKeySecret: string;
|
|
105
|
+
}
|
|
106
|
+
/** The daily payoff: today's numbers against the person's own typical day. */
|
|
107
|
+
export interface AfterhoursToday {
|
|
108
|
+
localDate: string;
|
|
109
|
+
lifeReturnedMinutes: number;
|
|
110
|
+
agentActiveMinutes: number;
|
|
111
|
+
humanAttentionMinutes: number;
|
|
112
|
+
longestRunMinutes: number;
|
|
113
|
+
longestRunSource: string | null;
|
|
68
114
|
}
|
|
69
115
|
export interface AfterhoursReport {
|
|
116
|
+
/** Clock time returned: agent wall-clock coverage minus supervised time. */
|
|
70
117
|
lifeReturnedMinutes: number;
|
|
118
|
+
/** Total agent work observed. Exceeds the clock when sessions run in parallel. */
|
|
71
119
|
agentActiveMinutes: number;
|
|
120
|
+
/** Hours of the day that had agent activity, counting each hour once. */
|
|
121
|
+
agentWallClockMinutes: number;
|
|
122
|
+
/** Agent work divided by clock time — how many ran at once. Null with no activity. */
|
|
123
|
+
parallelRatio: number | null;
|
|
72
124
|
humanAttentionMinutes: number;
|
|
73
125
|
afterHoursCheckIns: number;
|
|
74
126
|
protectedNights: number;
|
|
75
127
|
observedNights: number;
|
|
76
128
|
agentTurns: number;
|
|
77
129
|
humanCheckIns: number;
|
|
130
|
+
today: AfterhoursToday;
|
|
131
|
+
/** Median of other observed days in the window; null on the first measured day. */
|
|
132
|
+
baselineLifeReturnedMinutes: number | null;
|
|
78
133
|
nextMove: string;
|
|
79
134
|
}
|
|
80
135
|
export interface DetectedAgent {
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;AAErE,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;AAErE,MAAM,WAAW,WAAW;IAC1B,mFAAmF;IACnF,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED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mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,gBAAgB;IAC/B,4EAA4E;IAC5E,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kFAAkF;IAClF,kBAAkB,EAAE,MAAM,CAAC;IAC3B,yEAAyE;IACzE,qBAAqB,EAAE,MAAM,CAAC;IAC9B,sFAAsF;IACtF,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,eAAe,CAAC;IACvB,mFAAmF;IACnF,2BAA2B,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,QAAQ,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,WAAW,GAAG,kBAAkB,CAAC;IAC7C,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
package/llms-install.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Installing Teeras Afterhours (instructions for AI agents)
|
|
2
|
+
|
|
3
|
+
You are likely a coding agent (Claude Code, Codex, Gemini CLI, or similar)
|
|
4
|
+
installing this package for your user. Follow these steps:
|
|
5
|
+
|
|
6
|
+
1. Run: `npx @teeras/afterhours setup`
|
|
7
|
+
2. The command prints a short code and a `teeras.com` link. **Relay both to
|
|
8
|
+
your user verbatim** — they open the link on any device (their phone is
|
|
9
|
+
ideal), enter the code, and sign in with Google. The command waits and
|
|
10
|
+
finishes on its own.
|
|
11
|
+
3. If your harness needs structured output, run `npx @teeras/afterhours setup --json`
|
|
12
|
+
and relay the `userCode` and `verificationUri` fields from the `code` event.
|
|
13
|
+
4. After it completes, tell your user: their AI-life balance report is on
|
|
14
|
+
https://teeras.com and the Teeras iOS app, and it updates automatically
|
|
15
|
+
while they work — no further commands needed.
|
|
16
|
+
|
|
17
|
+
Privacy, for you and your user: this tool retains counts only. Prompts, code,
|
|
18
|
+
model output, repository names, working directories, and file paths are never
|
|
19
|
+
read into the sync payload, never uploaded, and never logged. `npx
|
|
20
|
+
@teeras/afterhours privacy` prints the machine-readable boundary.
|
|
21
|
+
|
|
22
|
+
Setup is idempotent — re-running it repairs hooks and refreshes the
|
|
23
|
+
connection. It installs lifecycle hooks for Claude Code and Codex when found,
|
|
24
|
+
which record content-free session signals locally.
|
|
25
|
+
|
|
26
|
+
To undo the install, tell your user to run `npx @teeras/afterhours off` — it
|
|
27
|
+
removes the Teeras hook entries and the local runtime, leaving every other
|
|
28
|
+
hook and their account untouched (`trs logout` separately disconnects the
|
|
29
|
+
account).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teeras/afterhours",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Private AI-life balance and usage analytics for Codex, Claude Code, Gemini CLI, Cursor, and other coding agents.",
|
|
5
5
|
"homepage": "https://teeras.com",
|
|
6
6
|
"keywords": [
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
32
|
"dist",
|
|
33
|
-
"README.md"
|
|
33
|
+
"README.md",
|
|
34
|
+
"llms-install.md"
|
|
34
35
|
],
|
|
35
36
|
"publishConfig": {
|
|
36
37
|
"access": "public"
|