workday-daemon 0.7.3 → 0.9.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 +0 -1
- package/dist/cli.js +6 -66
- package/dist/cli.js.map +1 -1
- package/dist/collectors/git-client.d.ts +27 -1
- package/dist/collectors/git-client.js +94 -0
- package/dist/collectors/git-client.js.map +1 -1
- package/dist/collectors/git-tracker.d.ts +2 -2
- package/dist/collectors/git-tracker.js +14 -3
- package/dist/collectors/git-tracker.js.map +1 -1
- package/dist/collectors/ledger-collector.d.ts +13 -0
- package/dist/collectors/ledger-collector.js +73 -0
- package/dist/collectors/ledger-collector.js.map +1 -0
- package/dist/core/commit-ledger.d.ts +46 -0
- package/dist/core/commit-ledger.js +173 -0
- package/dist/core/commit-ledger.js.map +1 -0
- package/dist/core/config.d.ts +0 -2
- package/dist/core/config.js +0 -20
- package/dist/core/config.js.map +1 -1
- package/dist/core/constants.d.ts +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/daily-log.d.ts +11 -26
- package/dist/core/daily-log.js +15 -80
- package/dist/core/daily-log.js.map +1 -1
- package/dist/core/session-tracker.d.ts +18 -16
- package/dist/core/session-tracker.js +96 -57
- package/dist/core/session-tracker.js.map +1 -1
- package/dist/core/status-renderer.js +8 -19
- package/dist/core/status-renderer.js.map +1 -1
- package/dist/core/types.d.ts +65 -11
- package/dist/core/types.js +1 -0
- package/dist/core/types.js.map +1 -1
- package/dist/daemon.d.ts +0 -1
- package/dist/daemon.js +2 -11
- package/dist/daemon.js.map +1 -1
- package/dist/http-server.d.ts +0 -2
- package/dist/http-server.js +5 -61
- package/dist/http-server.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reflog entries fetched per tick. Far above any realistic number of branch
|
|
3
|
+
* operations between two polls (or across a same-day daemon restart) — when
|
|
4
|
+
* the stored pointer still falls outside this window, the collector degrades
|
|
5
|
+
* to a resync instead of replaying.
|
|
6
|
+
*/
|
|
7
|
+
const REFLOG_WINDOW = 200;
|
|
8
|
+
/**
|
|
9
|
+
* Builds the per-tick LedgerUpdate for a repo: seeds a fresh ledger when no
|
|
10
|
+
* session context exists yet, otherwise turns branch-reflog entries since
|
|
11
|
+
* the stored pointer into old→new transitions with full commit metadata.
|
|
12
|
+
*
|
|
13
|
+
* Everything is computed relative to the default branch: commits reachable
|
|
14
|
+
* from it are never "added" (upstream work entering via merge/rebase) and
|
|
15
|
+
* never "removed" (own work merged upstream survives squashes of the local
|
|
16
|
+
* branch).
|
|
17
|
+
*/
|
|
18
|
+
export async function collectLedgerUpdate(gitClient, repoPath, branch, mergeBaseSha, defaultBranchRef, query) {
|
|
19
|
+
const reflog = await gitClient.getBranchReflog(repoPath, branch, REFLOG_WINDOW);
|
|
20
|
+
if (reflog.length === 0) {
|
|
21
|
+
// No branch reflog (core.logAllRefUpdates off) — ledger can't work here.
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const currentPointer = { sha: reflog[0].sha, ts: reflog[0].ts };
|
|
25
|
+
if (query === null || query.branch !== branch || query.pointer === null) {
|
|
26
|
+
return buildSeed(gitClient, repoPath, mergeBaseSha, currentPointer);
|
|
27
|
+
}
|
|
28
|
+
// Newest occurrence of the stored pointer. Entries above it are unprocessed.
|
|
29
|
+
const pointerIndex = reflog.findIndex(e => e.sha === query.pointer.sha && e.ts === query.pointer.ts);
|
|
30
|
+
if (pointerIndex === -1) {
|
|
31
|
+
// Pointer fell out of the window (long downtime / reflog expired) —
|
|
32
|
+
// rebuild flags from the current branch state instead of replaying.
|
|
33
|
+
return buildResync(gitClient, repoPath, mergeBaseSha, defaultBranchRef, query, currentPointer);
|
|
34
|
+
}
|
|
35
|
+
const transitions = [];
|
|
36
|
+
let oldSha = query.pointer.sha;
|
|
37
|
+
for (let i = pointerIndex - 1; i >= 0; i--) {
|
|
38
|
+
const entry = reflog[i];
|
|
39
|
+
if (entry.sha !== oldSha) {
|
|
40
|
+
const removedShas = await gitClient.revListShas(repoPath, oldSha, [entry.sha, defaultBranchRef]);
|
|
41
|
+
const addedShas = await gitClient.revListShas(repoPath, entry.sha, [oldSha, defaultBranchRef]);
|
|
42
|
+
const added = await gitClient.getCommitsMeta(repoPath, addedShas);
|
|
43
|
+
transitions.push({ ts: entry.ts, removedShas, added });
|
|
44
|
+
}
|
|
45
|
+
oldSha = entry.sha;
|
|
46
|
+
}
|
|
47
|
+
return { kind: 'transitions', transitions, pointer: currentPointer };
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Fresh ledger: all commits currently on the branch (vs merge-base). The
|
|
51
|
+
* SessionTracker marks them pre-session at apply time — a new session always
|
|
52
|
+
* starts counting from zero.
|
|
53
|
+
*/
|
|
54
|
+
async function buildSeed(gitClient, repoPath, mergeBaseSha, pointer) {
|
|
55
|
+
const shas = await gitClient.revListShas(repoPath, 'HEAD', [mergeBaseSha]);
|
|
56
|
+
const commits = await gitClient.getCommitsMeta(repoPath, shas);
|
|
57
|
+
return { kind: 'seed', commits, pointer };
|
|
58
|
+
}
|
|
59
|
+
async function buildResync(gitClient, repoPath, mergeBaseSha, defaultBranchRef, query, pointer) {
|
|
60
|
+
const liveShas = await gitClient.revListShas(repoPath, 'HEAD', [mergeBaseSha]);
|
|
61
|
+
const liveSet = new Set(liveShas);
|
|
62
|
+
const mergedShas = [];
|
|
63
|
+
for (const sha of query.knownShas) {
|
|
64
|
+
if (!liveSet.has(sha) && await gitClient.isAncestor(repoPath, sha, defaultBranchRef)) {
|
|
65
|
+
mergedShas.push(sha);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const known = new Set(query.knownShas);
|
|
69
|
+
const unknownShas = liveShas.filter(sha => !known.has(sha));
|
|
70
|
+
const unknownCommits = await gitClient.getCommitsMeta(repoPath, unknownShas);
|
|
71
|
+
return { kind: 'resync', liveShas, mergedShas, unknownCommits, pointer };
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=ledger-collector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger-collector.js","sourceRoot":"","sources":["../../src/collectors/ledger-collector.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,SAAoB,EACpB,QAAgB,EAChB,MAAc,EACd,YAAoB,EACpB,gBAAwB,EACxB,KAAyB;IAEzB,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;IAChF,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,yEAAyE;QACzE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,cAAc,GAAkB,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAE/E,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QACxE,OAAO,SAAS,CAAC,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;IACtE,CAAC;IAED,6EAA6E;IAC7E,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CACnC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,CAAC,OAAQ,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,OAAQ,CAAC,EAAE,CAChE,CAAC;IACF,IAAI,YAAY,KAAK,CAAC,CAAC,EAAE,CAAC;QACxB,oEAAoE;QACpE,oEAAoE;QACpE,OAAO,WAAW,CAAC,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,gBAAgB,E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exact accounting of "how many commits did this session
|
|
4
|
+
* actually produce", robust to any git operation happening between polls.
|
|
5
|
+
*
|
|
6
|
+
* The 30-second poll can never reconstruct events from counter samples:
|
|
7
|
+
* commit + squash inside one tick shows a net jump of 0 or +1. So instead
|
|
8
|
+
* of counting, the ledger tracks commit *identities* and replays the branch
|
|
9
|
+
* reflog — a complete, persistent journal of every branch-tip move — one
|
|
10
|
+
* transition at a time. Each transition is small and unambiguous.
|
|
11
|
+
*
|
|
12
|
+
* The counter is strictly session-scoped: a fresh session starts at zero,
|
|
13
|
+
* seeded with everything already on the branch as pre-session, and nothing
|
|
14
|
+
* done outside a session (daemon down, session closed) is ever counted.
|
|
15
|
+
*
|
|
16
|
+
* Rewrite matching cascade for a commit that appears in a transition:
|
|
17
|
+
* 0. Known SHA → resurrect (reset back to an old tip).
|
|
18
|
+
* 1. Tree match → squash: the new commit's tree equals the tree
|
|
19
|
+
* of a commit removed earlier; it absorbs the whole chain removed in
|
|
20
|
+
* that same transition and inherits sessionCreated as OR over the
|
|
21
|
+
* chain. This is why squashing a session commit INTO a pre-session
|
|
22
|
+
* commit keeps the counter (the session's work survived, inside a
|
|
23
|
+
* rewritten commit), while squashing two session commits drops 2 → 1.
|
|
24
|
+
* 2. (authorEmail, authorTs) match → rebase pick / amend / reword: git
|
|
25
|
+
* preserves the author timestamp through these, so the rewritten
|
|
26
|
+
* commit inherits the original's membership. Rebasing pre-session
|
|
27
|
+
* commits does NOT count them (committer ts is fresh but the author
|
|
28
|
+
* identity says "old").
|
|
29
|
+
* 3. No match → genuinely new commit; counts when its
|
|
30
|
+
* committer timestamp falls after the session started (`isSessionTs`).
|
|
31
|
+
*
|
|
32
|
+
* Commits merged into the default branch never appear as "removed" (the
|
|
33
|
+
* collector excludes ^defaultRef), so merged work stays counted — it is
|
|
34
|
+
* the most real work of all.
|
|
35
|
+
*/
|
|
36
|
+
/** Number of live commits created within this session. */
|
|
37
|
+
export declare function countSessionCommits(state: CommitLedgerState): number;
|
|
38
|
+
/**
|
|
39
|
+
* Apply one poll's ledger update. `countsAsSession(meta)` decides whether an
|
|
40
|
+
* unmatched commit was created by this session — typically: committer
|
|
41
|
+
* timestamp after the session opened (minus a small slack, so the commit
|
|
42
|
+
* that itself triggered the session counts) and not already accounted for
|
|
43
|
+
* by an earlier session's ledger.
|
|
44
|
+
*/
|
|
45
|
+
export declare function applyLedgerUpdate(state: CommitLedgerState, update: LedgerUpdate, countsAsSession: (meta: CommitMeta) => boolean): void;
|
|
46
|
+
export declare function createEmptyLedger(): CommitLedgerState;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Commit ledger — exact accounting of "how many commits did this session
|
|
3
|
+
* actually produce", robust to any git operation happening between polls.
|
|
4
|
+
*
|
|
5
|
+
* The 30-second poll can never reconstruct events from counter samples:
|
|
6
|
+
* commit + squash inside one tick shows a net jump of 0 or +1. So instead
|
|
7
|
+
* of counting, the ledger tracks commit *identities* and replays the branch
|
|
8
|
+
* reflog — a complete, persistent journal of every branch-tip move — one
|
|
9
|
+
* transition at a time. Each transition is small and unambiguous.
|
|
10
|
+
*
|
|
11
|
+
* The counter is strictly session-scoped: a fresh session starts at zero,
|
|
12
|
+
* seeded with everything already on the branch as pre-session, and nothing
|
|
13
|
+
* done outside a session (daemon down, session closed) is ever counted.
|
|
14
|
+
*
|
|
15
|
+
* Rewrite matching cascade for a commit that appears in a transition:
|
|
16
|
+
* 0. Known SHA → resurrect (reset back to an old tip).
|
|
17
|
+
* 1. Tree match → squash: the new commit's tree equals the tree
|
|
18
|
+
* of a commit removed earlier; it absorbs the whole chain removed in
|
|
19
|
+
* that same transition and inherits sessionCreated as OR over the
|
|
20
|
+
* chain. This is why squashing a session commit INTO a pre-session
|
|
21
|
+
* commit keeps the counter (the session's work survived, inside a
|
|
22
|
+
* rewritten commit), while squashing two session commits drops 2 → 1.
|
|
23
|
+
* 2. (authorEmail, authorTs) match → rebase pick / amend / reword: git
|
|
24
|
+
* preserves the author timestamp through these, so the rewritten
|
|
25
|
+
* commit inherits the original's membership. Rebasing pre-session
|
|
26
|
+
* commits does NOT count them (committer ts is fresh but the author
|
|
27
|
+
* identity says "old").
|
|
28
|
+
* 3. No match → genuinely new commit; counts when its
|
|
29
|
+
* committer timestamp falls after the session started (`isSessionTs`).
|
|
30
|
+
*
|
|
31
|
+
* Commits merged into the default branch never appear as "removed" (the
|
|
32
|
+
* collector excludes ^defaultRef), so merged work stays counted — it is
|
|
33
|
+
* the most real work of all.
|
|
34
|
+
*/
|
|
35
|
+
/** Number of live commits created within this session. */
|
|
36
|
+
export function countSessionCommits(state) {
|
|
37
|
+
let count = 0;
|
|
38
|
+
for (const commit of state.commits) {
|
|
39
|
+
if (commit.live && commit.sessionCreated)
|
|
40
|
+
count++;
|
|
41
|
+
}
|
|
42
|
+
return count;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Apply one poll's ledger update. `countsAsSession(meta)` decides whether an
|
|
46
|
+
* unmatched commit was created by this session — typically: committer
|
|
47
|
+
* timestamp after the session opened (minus a small slack, so the commit
|
|
48
|
+
* that itself triggered the session counts) and not already accounted for
|
|
49
|
+
* by an earlier session's ledger.
|
|
50
|
+
*/
|
|
51
|
+
export function applyLedgerUpdate(state, update, countsAsSession) {
|
|
52
|
+
switch (update.kind) {
|
|
53
|
+
case 'seed':
|
|
54
|
+
seedLedger(state, update.commits, countsAsSession);
|
|
55
|
+
break;
|
|
56
|
+
case 'transitions':
|
|
57
|
+
for (const transition of update.transitions) {
|
|
58
|
+
applyTransition(state, transition, countsAsSession);
|
|
59
|
+
}
|
|
60
|
+
break;
|
|
61
|
+
case 'resync':
|
|
62
|
+
applyResync(state, update.liveShas, update.mergedShas, update.unknownCommits, countsAsSession);
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
state.pointer = update.pointer;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Seed a fresh ledger from the commits currently on the branch. Everything
|
|
69
|
+
* already there is pre-session (counter starts at zero) — except commits
|
|
70
|
+
* landing within the slack window right before the session opened, i.e. the
|
|
71
|
+
* commit that itself triggered the session.
|
|
72
|
+
*/
|
|
73
|
+
function seedLedger(state, commits, countsAsSession) {
|
|
74
|
+
for (const meta of commits) {
|
|
75
|
+
if (findCommit(state, meta.sha))
|
|
76
|
+
continue;
|
|
77
|
+
state.commits.push(newLedgerCommit(meta, meta.parentCount < 2 && countsAsSession(meta)));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function applyTransition(state, transition, countsAsSession) {
|
|
81
|
+
const seq = ++state.seq;
|
|
82
|
+
// 1. Commits that left the branch (and are not on the default branch).
|
|
83
|
+
for (const sha of transition.removedShas) {
|
|
84
|
+
const entry = findCommit(state, sha);
|
|
85
|
+
if (entry && entry.live) {
|
|
86
|
+
entry.live = false;
|
|
87
|
+
entry.removedAtSeq = seq;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// 2. Commits that entered the branch, parent-first.
|
|
91
|
+
for (const meta of transition.added) {
|
|
92
|
+
const known = findCommit(state, meta.sha);
|
|
93
|
+
if (known) {
|
|
94
|
+
// Resurrect: reset back onto a previously-seen tip.
|
|
95
|
+
known.live = true;
|
|
96
|
+
known.removedAtSeq = null;
|
|
97
|
+
known.absorbedBy = null;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (meta.parentCount >= 2) {
|
|
101
|
+
// Merge commits are recorded but never counted as created work.
|
|
102
|
+
state.commits.push(newLedgerCommit(meta, false));
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
const pool = matchPool(state);
|
|
106
|
+
// Cascade 1: tree match → squash of the chain removed in one transition.
|
|
107
|
+
const treeMatch = pool.find(c => c.tree === meta.tree);
|
|
108
|
+
if (treeMatch) {
|
|
109
|
+
const chain = pool.filter(c => c.removedAtSeq === treeMatch.removedAtSeq);
|
|
110
|
+
const inherited = chain.some(c => c.sessionCreated);
|
|
111
|
+
for (const absorbed of chain)
|
|
112
|
+
absorbed.absorbedBy = meta.sha;
|
|
113
|
+
state.commits.push(newLedgerCommit(meta, inherited));
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
// Cascade 2: author identity match → rebase pick / amend / reword.
|
|
117
|
+
const authorMatch = pool.find(c => c.authorEmail === meta.authorEmail && c.authorTs === meta.authorTs);
|
|
118
|
+
if (authorMatch) {
|
|
119
|
+
authorMatch.absorbedBy = meta.sha;
|
|
120
|
+
state.commits.push(newLedgerCommit(meta, authorMatch.sessionCreated));
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
// Cascade 3: genuinely new commit. The countsAsSession test keeps
|
|
124
|
+
// commits resurrected from outside the session (e.g. reset --hard onto
|
|
125
|
+
// a tip built while the daemon was down) out of the counter.
|
|
126
|
+
state.commits.push(newLedgerCommit(meta, countsAsSession(meta)));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Pointer fell out of the reflog window — rebuild flags from current state
|
|
131
|
+
* instead of replaying. Known commits: live when still on the branch OR
|
|
132
|
+
* merged into the default branch. Unknown commits on the branch are adopted
|
|
133
|
+
* with the committer-timestamp session test (no lineage available).
|
|
134
|
+
*/
|
|
135
|
+
function applyResync(state, liveShas, mergedShas, unknownCommits, countsAsSession) {
|
|
136
|
+
const live = new Set(liveShas);
|
|
137
|
+
const merged = new Set(mergedShas);
|
|
138
|
+
for (const commit of state.commits) {
|
|
139
|
+
if (live.has(commit.sha)) {
|
|
140
|
+
commit.live = true;
|
|
141
|
+
commit.removedAtSeq = null;
|
|
142
|
+
commit.absorbedBy = null;
|
|
143
|
+
}
|
|
144
|
+
else if (!merged.has(commit.sha)) {
|
|
145
|
+
commit.live = false;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
seedLedger(state, unknownCommits, countsAsSession);
|
|
149
|
+
}
|
|
150
|
+
/** Gone-but-unabsorbed commits — the pool rewrite matching runs against. */
|
|
151
|
+
function matchPool(state) {
|
|
152
|
+
return state.commits.filter(c => !c.live && c.absorbedBy === null);
|
|
153
|
+
}
|
|
154
|
+
function findCommit(state, sha) {
|
|
155
|
+
return state.commits.find(c => c.sha === sha);
|
|
156
|
+
}
|
|
157
|
+
function newLedgerCommit(meta, sessionCreated) {
|
|
158
|
+
return {
|
|
159
|
+
sha: meta.sha,
|
|
160
|
+
tree: meta.tree,
|
|
161
|
+
authorEmail: meta.authorEmail,
|
|
162
|
+
authorTs: meta.authorTs,
|
|
163
|
+
committerTs: meta.committerTs,
|
|
164
|
+
sessionCreated,
|
|
165
|
+
live: true,
|
|
166
|
+
removedAtSeq: null,
|
|
167
|
+
absorbedBy: null,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
export function createEmptyLedger() {
|
|
171
|
+
return { commits: [], pointer: null, seq: 0 };
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=commit-ledger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit-ledger.js","sourceRoot":"","sources":["../../src/core/commit-ledger.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,0DAA0D;AAC1D,MAAM,UAAU,mBAAmB,CAAC,KAAwB;IAC1D,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,MAAM,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QACnC,IAAI,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,cAAc;YAAE,KAAK,EAAE,CAAC;IACpD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAwB,EACxB,MAAoB,EACpB,eAA8C;IAE9C,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,MAAM;YACT,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;YACnD,MAAM;QACR,KAAK,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AAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC;AACrE,CAAC;AAED,SAAS,UAAU,CAAC,KAAwB,EAAE,GAAW;IACvD,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;AAChD,CAAC;AAED,SAAS,eAAe,CAAC,IAAgB,EAAE,cAAuB;IAChE,OAAO;QACL,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,cAAc;QACd,IAAI,EAAE,IAAI;QACV,YAAY,EAAE,IAAI;QAClB,UAAU,EAAE,IAAI;KACjB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;AAChD,CAAC"}
|
package/dist/core/config.d.ts
CHANGED
|
@@ -36,7 +36,5 @@ export declare function formatDate(timestamp: number, timezone: string): string;
|
|
|
36
36
|
* dayBoundaryHour is 24h format (e.g. 4 = 04:00 AM).
|
|
37
37
|
*/
|
|
38
38
|
export declare function computeWorkingDate(timestamp: number, dayBoundaryHour: number, timezone: string): string;
|
|
39
|
-
/** Build ISO timestamp from date + hour:minute in timezone */
|
|
40
|
-
export declare function buildTimestamp(date: string, hour: number, minute: number, timezone: string): string;
|
|
41
39
|
/** Extract task key from branch name. Returns null for generic/foreign branches. */
|
|
42
40
|
export declare function extractTask(branch: string, taskPattern: string, developer: string, genericBranches: readonly string[]): string | null;
|
package/dist/core/config.js
CHANGED
|
@@ -250,26 +250,6 @@ export function computeWorkingDate(timestamp, dayBoundaryHour, timezone) {
|
|
|
250
250
|
}
|
|
251
251
|
return formatDate(timestamp, timezone);
|
|
252
252
|
}
|
|
253
|
-
/** Build ISO timestamp from date + hour:minute in timezone */
|
|
254
|
-
export function buildTimestamp(date, hour, minute, timezone) {
|
|
255
|
-
const [year, month, day] = date.split('-').map(Number);
|
|
256
|
-
const guess = new Date(Date.UTC(year, month - 1, day, hour, minute, 0));
|
|
257
|
-
const parts = new Intl.DateTimeFormat('en-US', {
|
|
258
|
-
timeZone: timezone,
|
|
259
|
-
hour: 'numeric',
|
|
260
|
-
hour12: false,
|
|
261
|
-
minute: 'numeric',
|
|
262
|
-
}).formatToParts(guess);
|
|
263
|
-
const hourPart = parts.find(p => p.type === 'hour');
|
|
264
|
-
const minutePart = parts.find(p => p.type === 'minute');
|
|
265
|
-
if (!hourPart || !minutePart)
|
|
266
|
-
throw new Error(`Failed to parse time in timezone ${timezone}`);
|
|
267
|
-
const actualHour = parseInt(hourPart.value);
|
|
268
|
-
const actualMinute = parseInt(minutePart.value);
|
|
269
|
-
const h = actualHour === 24 ? 0 : actualHour;
|
|
270
|
-
const diffMs = ((hour - h) * 60 + (minute - actualMinute)) * 60_000;
|
|
271
|
-
return new Date(guess.getTime() + diffMs).toISOString();
|
|
272
|
-
}
|
|
273
253
|
/** Extract task key from branch name. Returns null for generic/foreign branches. */
|
|
274
254
|
export function extractTask(branch, taskPattern, developer, genericBranches) {
|
|
275
255
|
if (/^[0-9a-f]{7,40}$/.test(branch))
|
package/dist/core/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAA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C,SAAS,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7C,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;IACpD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACjC,CAAC"}
|
package/dist/core/constants.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare const BACKUP_EXTENSION = ".bak";
|
|
|
7
7
|
export declare const DAEMON_SCRIPT_TS = "daemon.ts";
|
|
8
8
|
export declare const DAEMON_SCRIPT_JS = "daemon.js";
|
|
9
9
|
export declare const DEFAULT_API_PORT = 9213;
|
|
10
|
-
export declare const API_VERSION =
|
|
10
|
+
export declare const API_VERSION = 7;
|
|
11
11
|
export declare const NPM_PACKAGE_NAME = "workday-daemon";
|
|
12
12
|
export declare const NPM_REGISTRY_LATEST_URL = "https://registry.npmjs.org/workday-daemon/latest";
|
|
13
13
|
/** Registry check timeout — fail fast, the next scheduled check will retry */
|
package/dist/core/constants.js
CHANGED
|
@@ -15,7 +15,7 @@ export const DEFAULT_API_PORT = 9213;
|
|
|
15
15
|
// pick it up (they re-check every 6h), THEN npm-publish the daemon —
|
|
16
16
|
// a tray with the old exact-match check meeting a newer apiVersion would
|
|
17
17
|
// reinstall-loop the daemon.
|
|
18
|
-
export const API_VERSION =
|
|
18
|
+
export const API_VERSION = 7;
|
|
19
19
|
// ─── Auto-update ────────────────────────────────────────────────────────
|
|
20
20
|
export const NPM_PACKAGE_NAME = 'workday-daemon';
|
|
21
21
|
export const NPM_REGISTRY_LATEST_URL = `https://registry.npmjs.org/${NPM_PACKAGE_NAME}/latest`;
|
package/dist/core/daily-log.d.ts
CHANGED
|
@@ -41,31 +41,30 @@ export declare function resolveSessionTarget(log: DailyLog, target: string): Ses
|
|
|
41
41
|
export declare function computeManualMinutes(session: Session): number;
|
|
42
42
|
/** Effective duration including manual adjustments (ms) */
|
|
43
43
|
export declare function computeFullEffectiveDuration(session: Session): number;
|
|
44
|
-
/** Resolve dayStart timestamp using priority chain: manualStart → dayStartedAt → first session */
|
|
45
|
-
export declare function computeDayStart(log: DailyLog, config: AppConfig): number;
|
|
46
44
|
/**
|
|
47
|
-
* UI-only resolver for the day-start indicator.
|
|
48
|
-
*
|
|
49
|
-
* hide the indicator until the user either marks it manually or the first
|
|
50
|
-
* session reaches ACTIVE.
|
|
45
|
+
* UI-only resolver for the day-start indicator. Returns null when no session
|
|
46
|
+
* has reached ACTIVE yet, so the client hides the indicator until then.
|
|
51
47
|
*
|
|
52
|
-
* The
|
|
48
|
+
* The result is the EARLIEST `activatedAt` across all sessions (first
|
|
53
49
|
* CONFIRMED work), NOT `sessions[0]`. Array order follows repo discovery,
|
|
54
50
|
* so the first entry may be a session that activated much later — anchoring
|
|
55
|
-
* to it would push the indicator past the real start.
|
|
56
|
-
* upper-bound logic in `setDayManualStart`.
|
|
51
|
+
* to it would push the indicator past the real start.
|
|
57
52
|
*/
|
|
58
53
|
export declare function resolveUiDayStart(log: DailyLog): string | null;
|
|
59
54
|
/** Compute day end timestamp (next day boundary) */
|
|
60
55
|
export declare function computeDayEnd(date: string, dayBoundaryHour: number, timezone: string): number;
|
|
61
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Budget v2: the full physical day window (boundary hour → next boundary
|
|
58
|
+
* hour, ~24h). Depends only on log.date and config — never on sessions,
|
|
59
|
+
* dayStartedAt or the daemon lifecycle, so restarts mid-day don't shrink it.
|
|
60
|
+
* On DST transition days the window is honestly 23/25h — the physical day
|
|
61
|
+
* length, not a bug.
|
|
62
|
+
*/
|
|
62
63
|
export declare function computeBudgetMs(log: DailyLog, config: AppConfig): number;
|
|
63
64
|
/** Sum of all manual entries' minutes (ms) */
|
|
64
65
|
export declare function computeTotalManualEntryMs(log: DailyLog): number;
|
|
65
66
|
/** Sum of all sessions' full effective duration + manual entries (ms) */
|
|
66
67
|
export declare function computeTotalClaimedMs(log: DailyLog): number;
|
|
67
|
-
/** Check if day budget is exhausted */
|
|
68
|
-
export declare function isBudgetExhausted(log: DailyLog, config: AppConfig): boolean;
|
|
69
68
|
/** Remaining budget in ms, clamped >= 0 */
|
|
70
69
|
export declare function getRemainingBudgetMs(log: DailyLog, config: AppConfig): number;
|
|
71
70
|
/** Compute per-session active intervals (pauses excluded, no cross-session merge). */
|
|
@@ -96,19 +95,5 @@ export declare function editManualEntry(log: DailyLog, id: string, patch: {
|
|
|
96
95
|
description?: string;
|
|
97
96
|
activity?: string;
|
|
98
97
|
}, config: AppConfig): void;
|
|
99
|
-
/**
|
|
100
|
-
* Set manual day start. Passing null clears the override.
|
|
101
|
-
*
|
|
102
|
-
* Rules:
|
|
103
|
-
* - Lower bound: schedule.start (the tracking-window start hour).
|
|
104
|
-
* - Upper bound: the earliest session's `activatedAt` (first CONFIRMED work).
|
|
105
|
-
* Real logged activity wins — the user may only shift the start earlier, never
|
|
106
|
-
* past the moment real work began. We anchor to `activatedAt`, NOT `startedAt`:
|
|
107
|
-
* a PENDING session's `startedAt` is just when the daemon first saw the branch
|
|
108
|
-
* (often the moment the tracker launched), not when work actually started.
|
|
109
|
-
* - If no session has activated yet there is no confirmed activity to anchor to,
|
|
110
|
-
* so the only constraint is that the start cannot be in the future.
|
|
111
|
-
*/
|
|
112
|
-
export declare function setDayManualStart(log: DailyLog, isoTimestamp: string | null, config: AppConfig): void;
|
|
113
98
|
/** Add signal with deduplication for diff_dynamics (same repo, accumulate deltas) */
|
|
114
99
|
export declare function addSignal(log: DailyLog, signal: Signal, deduplicationSeconds: number): void;
|
package/dist/core/daily-log.js
CHANGED
|
@@ -43,7 +43,6 @@ export function createEmptyLog(date, config) {
|
|
|
43
43
|
date,
|
|
44
44
|
status: DayStatus.Draft,
|
|
45
45
|
dayType: determineDayType(date, config),
|
|
46
|
-
manualStart: null,
|
|
47
46
|
dayStartedAt: null,
|
|
48
47
|
sessions: [],
|
|
49
48
|
signals: [],
|
|
@@ -308,37 +307,16 @@ export function computeManualMinutes(session) {
|
|
|
308
307
|
export function computeFullEffectiveDuration(session) {
|
|
309
308
|
return computeEffectiveDuration(session) + computeManualMinutes(session) * MS_PER_MINUTE;
|
|
310
309
|
}
|
|
311
|
-
/** Resolve dayStart timestamp using priority chain: manualStart → dayStartedAt → first session */
|
|
312
|
-
export function computeDayStart(log, config) {
|
|
313
|
-
if (log.manualStart) {
|
|
314
|
-
return new Date(log.manualStart).getTime();
|
|
315
|
-
}
|
|
316
|
-
if (log.dayStartedAt) {
|
|
317
|
-
return new Date(log.dayStartedAt).getTime();
|
|
318
|
-
}
|
|
319
|
-
// Fallback: first activated session
|
|
320
|
-
for (const s of log.sessions) {
|
|
321
|
-
if (s.activatedAt)
|
|
322
|
-
return new Date(s.activatedAt).getTime();
|
|
323
|
-
}
|
|
324
|
-
// No sessions yet — use day boundary start (date + dayBoundaryHour in timezone)
|
|
325
|
-
return parseDateWithHour(log.date, config.schedule.end, config.timezone);
|
|
326
|
-
}
|
|
327
310
|
/**
|
|
328
|
-
* UI-only resolver for the day-start indicator.
|
|
329
|
-
*
|
|
330
|
-
* hide the indicator until the user either marks it manually or the first
|
|
331
|
-
* session reaches ACTIVE.
|
|
311
|
+
* UI-only resolver for the day-start indicator. Returns null when no session
|
|
312
|
+
* has reached ACTIVE yet, so the client hides the indicator until then.
|
|
332
313
|
*
|
|
333
|
-
* The
|
|
314
|
+
* The result is the EARLIEST `activatedAt` across all sessions (first
|
|
334
315
|
* CONFIRMED work), NOT `sessions[0]`. Array order follows repo discovery,
|
|
335
316
|
* so the first entry may be a session that activated much later — anchoring
|
|
336
|
-
* to it would push the indicator past the real start.
|
|
337
|
-
* upper-bound logic in `setDayManualStart`.
|
|
317
|
+
* to it would push the indicator past the real start.
|
|
338
318
|
*/
|
|
339
319
|
export function resolveUiDayStart(log) {
|
|
340
|
-
if (log.manualStart)
|
|
341
|
-
return log.manualStart;
|
|
342
320
|
let earliest = null;
|
|
343
321
|
for (const s of log.sessions) {
|
|
344
322
|
if (!s.activatedAt)
|
|
@@ -357,9 +335,15 @@ export function computeDayEnd(date, dayBoundaryHour, timezone) {
|
|
|
357
335
|
const nextDateStr = `${nextDay.getUTCFullYear()}-${String(nextDay.getUTCMonth() + 1).padStart(2, '0')}-${String(nextDay.getUTCDate()).padStart(2, '0')}`;
|
|
358
336
|
return parseDateWithHour(nextDateStr, dayBoundaryHour, timezone);
|
|
359
337
|
}
|
|
360
|
-
/**
|
|
338
|
+
/**
|
|
339
|
+
* Budget v2: the full physical day window (boundary hour → next boundary
|
|
340
|
+
* hour, ~24h). Depends only on log.date and config — never on sessions,
|
|
341
|
+
* dayStartedAt or the daemon lifecycle, so restarts mid-day don't shrink it.
|
|
342
|
+
* On DST transition days the window is honestly 23/25h — the physical day
|
|
343
|
+
* length, not a bug.
|
|
344
|
+
*/
|
|
361
345
|
export function computeBudgetMs(log, config) {
|
|
362
|
-
const dayStart =
|
|
346
|
+
const dayStart = parseDateWithHour(log.date, config.schedule.end, config.timezone);
|
|
363
347
|
const dayEnd = computeDayEnd(log.date, config.schedule.end, config.timezone);
|
|
364
348
|
return Math.max(0, dayEnd - dayStart);
|
|
365
349
|
}
|
|
@@ -372,10 +356,6 @@ export function computeTotalClaimedMs(log) {
|
|
|
372
356
|
const sessionsMs = log.sessions.reduce((sum, s) => sum + computeFullEffectiveDuration(s), 0);
|
|
373
357
|
return sessionsMs + computeTotalManualEntryMs(log);
|
|
374
358
|
}
|
|
375
|
-
/** Check if day budget is exhausted */
|
|
376
|
-
export function isBudgetExhausted(log, config) {
|
|
377
|
-
return computeTotalClaimedMs(log) >= computeBudgetMs(log, config);
|
|
378
|
-
}
|
|
379
359
|
/** Remaining budget in ms, clamped >= 0 */
|
|
380
360
|
export function getRemainingBudgetMs(log, config) {
|
|
381
361
|
return Math.max(0, computeBudgetMs(log, config) - computeTotalClaimedMs(log));
|
|
@@ -441,7 +421,7 @@ export function addManualAdjustment(log, sessionId, minutes, reason, config) {
|
|
|
441
421
|
const budget = computeBudgetMs(log, config);
|
|
442
422
|
if (currentClaimed + addMs > budget) {
|
|
443
423
|
const remainMinutes = Math.floor(getRemainingBudgetMs(log, config) / MS_PER_MINUTE);
|
|
444
|
-
throw new Error(`Exceeds day
|
|
424
|
+
throw new Error(`Exceeds 24h day window. Remaining: ${remainMinutes}m.`);
|
|
445
425
|
}
|
|
446
426
|
if (!session.manualAdjustments) {
|
|
447
427
|
session.manualAdjustments = [];
|
|
@@ -499,7 +479,7 @@ export function addManualEntry(log, input, config) {
|
|
|
499
479
|
const addMs = input.minutes * MS_PER_MINUTE;
|
|
500
480
|
if (computeTotalClaimedMs(log) + addMs > computeBudgetMs(log, config)) {
|
|
501
481
|
const remainMinutes = Math.floor(getRemainingBudgetMs(log, config) / MS_PER_MINUTE);
|
|
502
|
-
throw new Error(`Exceeds day
|
|
482
|
+
throw new Error(`Exceeds 24h day window. Remaining: ${remainMinutes}m.`);
|
|
503
483
|
}
|
|
504
484
|
unsealForEdit(log);
|
|
505
485
|
if (!log.manualEntries)
|
|
@@ -533,7 +513,7 @@ export function editManualEntry(log, id, patch, config) {
|
|
|
533
513
|
const deltaMs = (patch.minutes - entry.minutes) * MS_PER_MINUTE;
|
|
534
514
|
if (deltaMs > 0 && computeTotalClaimedMs(log) + deltaMs > computeBudgetMs(log, config)) {
|
|
535
515
|
const remainMinutes = Math.floor(getRemainingBudgetMs(log, config) / MS_PER_MINUTE);
|
|
536
|
-
throw new Error(`Exceeds day
|
|
516
|
+
throw new Error(`Exceeds 24h day window. Remaining: ${remainMinutes}m.`);
|
|
537
517
|
}
|
|
538
518
|
entry.minutes = patch.minutes;
|
|
539
519
|
}
|
|
@@ -551,51 +531,6 @@ export function editManualEntry(log, id, patch, config) {
|
|
|
551
531
|
}
|
|
552
532
|
unsealForEdit(log);
|
|
553
533
|
}
|
|
554
|
-
/**
|
|
555
|
-
* Set manual day start. Passing null clears the override.
|
|
556
|
-
*
|
|
557
|
-
* Rules:
|
|
558
|
-
* - Lower bound: schedule.start (the tracking-window start hour).
|
|
559
|
-
* - Upper bound: the earliest session's `activatedAt` (first CONFIRMED work).
|
|
560
|
-
* Real logged activity wins — the user may only shift the start earlier, never
|
|
561
|
-
* past the moment real work began. We anchor to `activatedAt`, NOT `startedAt`:
|
|
562
|
-
* a PENDING session's `startedAt` is just when the daemon first saw the branch
|
|
563
|
-
* (often the moment the tracker launched), not when work actually started.
|
|
564
|
-
* - If no session has activated yet there is no confirmed activity to anchor to,
|
|
565
|
-
* so the only constraint is that the start cannot be in the future.
|
|
566
|
-
*/
|
|
567
|
-
export function setDayManualStart(log, isoTimestamp, config) {
|
|
568
|
-
if (isoTimestamp === null) {
|
|
569
|
-
log.manualStart = null;
|
|
570
|
-
return;
|
|
571
|
-
}
|
|
572
|
-
const newStart = new Date(isoTimestamp).getTime();
|
|
573
|
-
const lowerBound = parseDateWithHour(log.date, config.schedule.start, config.timezone);
|
|
574
|
-
if (newStart < lowerBound) {
|
|
575
|
-
throw new Error(`Cannot start before ${String(config.schedule.start).padStart(2, '0')}:00 (tracking window)`);
|
|
576
|
-
}
|
|
577
|
-
// Upper bound = first CONFIRMED activity (earliest activatedAt), not startedAt.
|
|
578
|
-
let firstActivated = null;
|
|
579
|
-
for (const s of log.sessions) {
|
|
580
|
-
if (!s.activatedAt)
|
|
581
|
-
continue;
|
|
582
|
-
const t = new Date(s.activatedAt).getTime();
|
|
583
|
-
if (firstActivated === null || t < firstActivated)
|
|
584
|
-
firstActivated = t;
|
|
585
|
-
}
|
|
586
|
-
if (firstActivated !== null) {
|
|
587
|
-
if (newStart > firstActivated) {
|
|
588
|
-
const d = new Date(firstActivated);
|
|
589
|
-
const hhmm = `${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}`;
|
|
590
|
-
throw new Error(`Cannot start after the first activity (${hhmm})`);
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
else if (newStart > Date.now()) {
|
|
594
|
-
// No confirmed work yet — only forbid a future start.
|
|
595
|
-
throw new Error('Cannot start in the future');
|
|
596
|
-
}
|
|
597
|
-
log.manualStart = isoTimestamp;
|
|
598
|
-
}
|
|
599
534
|
/** Parse a date string + hour into a timestamp in the given timezone */
|
|
600
535
|
function parseDateWithHour(date, hour, timezone) {
|
|
601
536
|
// Build a date at noon UTC, then adjust by finding the offset
|