@knpkv/jcf-web 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/LICENSE +21 -0
- package/README.md +315 -0
- package/dist/client/assets/AgentSettingsPanel-NhTzwiq6.js +1 -0
- package/dist/client/assets/Schema-DUFTUil2.js +2 -0
- package/dist/client/assets/UrlParams-ZN2s8OM_.js +6 -0
- package/dist/client/assets/agentSettings-nw9lCgBQ.js +1 -0
- package/dist/client/assets/api-BQCWhiKV.js +4 -0
- package/dist/client/assets/decoding-CebF86HD.js +1 -0
- package/dist/client/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dist/client/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
- package/dist/client/assets/index-Ch0W9DhA.css +1 -0
- package/dist/client/assets/index-N2vhoKYl.js +51 -0
- package/dist/client/assets/rolldown-runtime-hePW80VL.js +1 -0
- package/dist/client/assets/transport-AcByYfLh.js +1 -0
- package/dist/client/index.html +19 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +32 -0
- package/dist/main.js.map +1 -0
- package/dist/server/Api.d.ts +789 -0
- package/dist/server/Api.js +98 -0
- package/dist/server/Api.js.map +1 -0
- package/dist/server/Confirm.d.ts +94 -0
- package/dist/server/Confirm.js +243 -0
- package/dist/server/Confirm.js.map +1 -0
- package/dist/server/Handlers.d.ts +14 -0
- package/dist/server/Handlers.js +157 -0
- package/dist/server/Handlers.js.map +1 -0
- package/dist/server/HttpApplication.d.ts +7 -0
- package/dist/server/HttpApplication.js +62 -0
- package/dist/server/HttpApplication.js.map +1 -0
- package/dist/server/OwnerSession.d.ts +62 -0
- package/dist/server/OwnerSession.js +219 -0
- package/dist/server/OwnerSession.js.map +1 -0
- package/dist/server/RowDescriptions.d.ts +19 -0
- package/dist/server/RowDescriptions.js +42 -0
- package/dist/server/RowDescriptions.js.map +1 -0
- package/dist/server/SavedEntryOperations.d.ts +27 -0
- package/dist/server/SavedEntryOperations.js +171 -0
- package/dist/server/SavedEntryOperations.js.map +1 -0
- package/dist/server/Server.d.ts +13 -0
- package/dist/server/Server.js +29 -0
- package/dist/server/Server.js.map +1 -0
- package/dist/server/WeekPlan.d.ts +110 -0
- package/dist/server/WeekPlan.js +258 -0
- package/dist/server/WeekPlan.js.map +1 -0
- package/dist/server/WeekPlans.d.ts +30 -0
- package/dist/server/WeekPlans.js +190 -0
- package/dist/server/WeekPlans.js.map +1 -0
- package/dist/server/WeekRead.d.ts +435 -0
- package/dist/server/WeekRead.js +189 -0
- package/dist/server/WeekRead.js.map +1 -0
- package/dist/shared/contracts.d.ts +901 -0
- package/dist/shared/contracts.js +365 -0
- package/dist/shared/contracts.js.map +1 -0
- package/dist/shared/writePlanning.d.ts +6 -0
- package/dist/shared/writePlanning.js +19 -0
- package/dist/shared/writePlanning.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The HTTP contract of the week view.
|
|
3
|
+
*
|
|
4
|
+
* **Mental model**
|
|
5
|
+
*
|
|
6
|
+
* - **Reads and reviewed writes.** `week` shows what each system holds, what the sessions say is
|
|
7
|
+
* missing, and what could not be placed. Description suggestions reuse that scan's evidence;
|
|
8
|
+
* confirmation, manual entry and saved-entry update requests write provider time.
|
|
9
|
+
* - **The server owns expected state.** Confirmations name retained row evidence. Saved-entry edits
|
|
10
|
+
* name a retained provider entry; the engine rechecks that snapshot before updating it.
|
|
11
|
+
* - **Edits are explicit.** Confirmations may override amount, Issue Key and note. Saved-entry edits
|
|
12
|
+
* change time and exact description. Generating a description never saves it.
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
import { Schema } from "effect";
|
|
17
|
+
/** A local calendar day, `YYYY-MM-DD` — the unit every bucket in jcf is keyed by. */
|
|
18
|
+
export const Day = Schema.String.pipe(Schema.check(Schema.isPattern(/^\d{4}-\d{2}-\d{2}$/)));
|
|
19
|
+
/**
|
|
20
|
+
* An Issue Key as Jira writes them. Checked here as well as in the engine so a malformed override
|
|
21
|
+
* is refused at the boundary, before it can become a Clockify description nothing can read back.
|
|
22
|
+
*/
|
|
23
|
+
export const TicketKey = Schema.String.pipe(Schema.check(Schema.isPattern(/^[A-Z][A-Z0-9]{1,9}-\d{1,6}$/)));
|
|
24
|
+
/** Seconds of work: whole, positive, and under a day. */
|
|
25
|
+
export const WorkSeconds = Schema.Number.pipe(Schema.check(Schema.isInt(), Schema.isBetween({ maximum: 24 * 60 * 60, minimum: 1 })));
|
|
26
|
+
/** Free text a person typed, bounded so a description cannot be used to write a novel into Jira. */
|
|
27
|
+
export const Note = Schema.String.pipe(Schema.check(Schema.isMaxLength(500)));
|
|
28
|
+
/** Request a row-level note from the scan's retained evidence, without reading sessions again. */
|
|
29
|
+
export const DescribeRowRequest = Schema.Struct({ planId: Schema.String, rowId: Schema.String });
|
|
30
|
+
/** A suggestion for review, never an instruction to write it to a provider. */
|
|
31
|
+
export const DescribeRowResponse = Schema.Struct({
|
|
32
|
+
planId: Schema.String,
|
|
33
|
+
rowId: Schema.String,
|
|
34
|
+
note: Schema.NullOr(Note)
|
|
35
|
+
});
|
|
36
|
+
/** Whole provider entry, retained on every visible slice. Description includes provider prefixes. */
|
|
37
|
+
export const SavedEntry = Schema.Struct({
|
|
38
|
+
/** Opaque retained snapshot handle. Send unchanged when saving; use the returned handle afterward. */
|
|
39
|
+
revision: Schema.String,
|
|
40
|
+
id: Schema.String,
|
|
41
|
+
source: Schema.Literals(["jira", "clockify"]),
|
|
42
|
+
ticketKey: Schema.NullOr(Schema.String),
|
|
43
|
+
startMs: Schema.Number,
|
|
44
|
+
endMs: Schema.Number,
|
|
45
|
+
description: Schema.NullOr(Schema.String)
|
|
46
|
+
});
|
|
47
|
+
export const DescribeSavedEntryRequest = Schema.Struct({
|
|
48
|
+
planId: Schema.String,
|
|
49
|
+
source: SavedEntry.fields.source,
|
|
50
|
+
entryId: Schema.String
|
|
51
|
+
});
|
|
52
|
+
export const DescribeSavedEntryResponse = Schema.Struct({
|
|
53
|
+
...DescribeSavedEntryRequest.fields,
|
|
54
|
+
note: Schema.NullOr(Note),
|
|
55
|
+
sessionCount: Schema.Number
|
|
56
|
+
});
|
|
57
|
+
/** Server resolves the expected entry; the client can change only its interval and exact description. */
|
|
58
|
+
export const UpdateSavedEntryRequest = Schema.Struct({
|
|
59
|
+
...DescribeSavedEntryRequest.fields,
|
|
60
|
+
revision: SavedEntry.fields.revision,
|
|
61
|
+
startMs: Schema.Number.pipe(Schema.check(Schema.isInt(), Schema.isBetween({ minimum: 0, maximum: 8640000000000000 }))),
|
|
62
|
+
endMs: Schema.Number.pipe(Schema.check(Schema.isInt(), Schema.isBetween({ minimum: 0, maximum: 8640000000000000 }))),
|
|
63
|
+
description: Schema.String.pipe(Schema.check(Schema.isMaxLength(32000)))
|
|
64
|
+
});
|
|
65
|
+
export const UpdateSavedEntryResponse = Schema.Struct({ planId: Schema.String, entry: SavedEntry });
|
|
66
|
+
export class ApiError extends Schema.TaggedError()("ApiError", {
|
|
67
|
+
message: Schema.String
|
|
68
|
+
}) {
|
|
69
|
+
}
|
|
70
|
+
export class UnauthorizedApiError extends Schema.TaggedError()("UnauthorizedApiError", { message: Schema.String }, { httpApiStatus: 401 }) {
|
|
71
|
+
}
|
|
72
|
+
export class ForbiddenApiError extends Schema.TaggedError()("ForbiddenApiError", { message: Schema.String }, { httpApiStatus: 403 }) {
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The plan a confirmation names is gone, or the row in it is.
|
|
76
|
+
*
|
|
77
|
+
* Separate from a rejected write because the repair is different and the browser can do it without
|
|
78
|
+
* asking anyone: re-read the week and offer the row again.
|
|
79
|
+
*/
|
|
80
|
+
export class PlanExpiredError extends Schema.TaggedError()("PlanExpiredError", { message: Schema.String }, { httpApiStatus: 409 }) {
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The write was refused on its own terms — an amount past what the evidence supports, an Issue Key
|
|
84
|
+
* the engine will not write. `maxSeconds` is present when a cap is what refused it, so the browser
|
|
85
|
+
* can say what the ceiling is rather than only that there is one.
|
|
86
|
+
*/
|
|
87
|
+
export class ProposalRejectedError extends Schema.TaggedError()("ProposalRejectedError", { message: Schema.String, maxSeconds: Schema.optional(Schema.Number) }, { httpApiStatus: 422 }) {
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* One stretch of credited work: when it happened, and what it is worth.
|
|
91
|
+
*
|
|
92
|
+
* Epoch milliseconds because the browser draws these on a grid, and `seconds` because a block is
|
|
93
|
+
* what a person accepts on its own — `seconds` is its share of the row, which on time worked in
|
|
94
|
+
* parallel is less than the interval it spans.
|
|
95
|
+
*/
|
|
96
|
+
export const ProposalBlock = Schema.Struct({
|
|
97
|
+
/** Normalized seconds this source block already supplied to each provider, including corrected-ticket writes. */
|
|
98
|
+
consumed: Schema.Struct({ clockify: Schema.Number, jira: Schema.Number }),
|
|
99
|
+
/** A provider-specific safety hold, never a consumed-seconds estimate. */
|
|
100
|
+
clockifyRefusal: Schema.optionalKey(Schema.Literal("unlinked-overlap")),
|
|
101
|
+
endMs: Schema.Number,
|
|
102
|
+
seconds: Schema.Number,
|
|
103
|
+
startMs: Schema.Number,
|
|
104
|
+
/** Stable source-cluster identity; rendered starts may move as overlapping work grows. */
|
|
105
|
+
sourceStartMs: Schema.optional(Schema.Number)
|
|
106
|
+
});
|
|
107
|
+
/** Which evidence placed a row on its Issue Key. */
|
|
108
|
+
export const AttributionSignal = Schema.Literals(["branch", "path", "standing", "agent", "none"]);
|
|
109
|
+
/**
|
|
110
|
+
* Which systems a week is about.
|
|
111
|
+
*
|
|
112
|
+
* One name rather than two booleans in the query string, because "neither" is not a week anyone
|
|
113
|
+
* asked for. A side that is out is not read, not proposed for, and not written to — so a week with
|
|
114
|
+
* `only=jira` never touches Clockify at all.
|
|
115
|
+
*/
|
|
116
|
+
export const WeekScope = Schema.Literals(["both", "clockify", "jira"]);
|
|
117
|
+
/** Which systems a single write may touch. Defaults to the scope the week was read under. */
|
|
118
|
+
export const WriteTargets = Schema.Struct({
|
|
119
|
+
clockify: Schema.Boolean,
|
|
120
|
+
jira: Schema.Boolean
|
|
121
|
+
});
|
|
122
|
+
/** When recorded time happened, and which system says so. */
|
|
123
|
+
export const RecordedInterval = Schema.Struct({
|
|
124
|
+
entry: Schema.optionalKey(SavedEntry),
|
|
125
|
+
endMs: Schema.Number,
|
|
126
|
+
source: Schema.Literals(["clockify", "jira"]),
|
|
127
|
+
startMs: Schema.Number
|
|
128
|
+
});
|
|
129
|
+
/**
|
|
130
|
+
* What a row's sessions say, and what accepting it would write.
|
|
131
|
+
*
|
|
132
|
+
* `maxSeconds` is the credited evidence: the ceiling on an edited amount. Editing below it is a
|
|
133
|
+
* person saying the evidence overstates the work; editing above it would be the tool inventing
|
|
134
|
+
* hours, which is the one thing every rule here exists to prevent.
|
|
135
|
+
*/
|
|
136
|
+
export const RowProposal = Schema.Struct({
|
|
137
|
+
activeSeconds: Schema.Number,
|
|
138
|
+
/**
|
|
139
|
+
* The stretches behind this row, ascending. They sum to `maxSeconds`, and a confirmation may name
|
|
140
|
+
* a subset of them by position — which is how a morning gets written without the afternoon.
|
|
141
|
+
*/
|
|
142
|
+
blocks: Schema.Array(ProposalBlock),
|
|
143
|
+
clockifyDelta: Schema.Number,
|
|
144
|
+
confidence: Schema.NullOr(Schema.Number),
|
|
145
|
+
jiraDelta: Schema.Number,
|
|
146
|
+
maxSeconds: Schema.Number,
|
|
147
|
+
sessionCount: Schema.Number,
|
|
148
|
+
signal: AttributionSignal
|
|
149
|
+
});
|
|
150
|
+
/**
|
|
151
|
+
* One `(Issue Key, day)` cell of the week.
|
|
152
|
+
*
|
|
153
|
+
* Rows exist for time that is only recorded, only evidenced, or both — a day tracked with a Timer
|
|
154
|
+
* has no proposal, and a day nobody logged has no allocated seconds. Which is the point of showing
|
|
155
|
+
* them together.
|
|
156
|
+
*/
|
|
157
|
+
export const WeekRow = Schema.Struct({
|
|
158
|
+
clockifyDescription: Schema.NullOr(Schema.String),
|
|
159
|
+
clockifySeconds: Schema.Number,
|
|
160
|
+
day: Day,
|
|
161
|
+
/**
|
|
162
|
+
* When the recorded time happened — the entries behind the totals, so a week can be drawn as a
|
|
163
|
+
* calendar. Empty when the systems reported no usable interval, never fabricated from the total.
|
|
164
|
+
*/
|
|
165
|
+
intervals: Schema.Array(RecordedInterval),
|
|
166
|
+
jiraSeconds: Schema.Number,
|
|
167
|
+
proposal: Schema.optional(RowProposal),
|
|
168
|
+
rowId: Schema.String,
|
|
169
|
+
ticketKey: Schema.String,
|
|
170
|
+
/**
|
|
171
|
+
* The issue title, or null when Jira could not be asked — logged out, unreachable, or out of
|
|
172
|
+
* scope for this week. Null is "unknown", never "untitled": an Issue Key alone is a lookup nobody
|
|
173
|
+
* can do six months later, so it is worth saying when it is missing.
|
|
174
|
+
*/
|
|
175
|
+
ticketTitle: Schema.NullOr(Schema.String)
|
|
176
|
+
});
|
|
177
|
+
/** Hours that happened on a day and no signal could place, with the directories behind them. */
|
|
178
|
+
export const UnattributedDay = Schema.Struct({
|
|
179
|
+
cwds: Schema.Array(Schema.String),
|
|
180
|
+
day: Day,
|
|
181
|
+
seconds: Schema.Number,
|
|
182
|
+
sessionCount: Schema.Number
|
|
183
|
+
});
|
|
184
|
+
/** Attributed by a Coding Agent below the confidence floor: shown so the hours stay visible. */
|
|
185
|
+
export const WithheldRow = Schema.Struct({
|
|
186
|
+
confidence: Schema.NullOr(Schema.Number),
|
|
187
|
+
day: Day,
|
|
188
|
+
seconds: Schema.Number,
|
|
189
|
+
ticketKey: Schema.String,
|
|
190
|
+
ticketTitle: Schema.NullOr(Schema.String)
|
|
191
|
+
});
|
|
192
|
+
/**
|
|
193
|
+
* Hours a signal placed on a ticket Jira says belongs to somebody else.
|
|
194
|
+
*
|
|
195
|
+
* Reported rather than proposed, and reported rather than dropped: a branch cannot tell authoring
|
|
196
|
+
* from reviewing, so this is usually a pull request you read — and occasionally your own work on a
|
|
197
|
+
* colleague's ticket, which is what `assignee` and the override are for.
|
|
198
|
+
*/
|
|
199
|
+
export const NotMineRow = Schema.Struct({
|
|
200
|
+
/** Who Jira says owns it, or null when it is unassigned. */
|
|
201
|
+
assignee: Schema.NullOr(Schema.String),
|
|
202
|
+
day: Day,
|
|
203
|
+
seconds: Schema.Number,
|
|
204
|
+
signal: AttributionSignal,
|
|
205
|
+
ticketKey: Schema.String,
|
|
206
|
+
ticketTitle: Schema.NullOr(Schema.String)
|
|
207
|
+
});
|
|
208
|
+
/** A day withheld from proposals, with the reason, so it never reads as "nothing to log". */
|
|
209
|
+
export const ExcludedDay = Schema.Struct({
|
|
210
|
+
day: Day,
|
|
211
|
+
reason: Schema.String
|
|
212
|
+
});
|
|
213
|
+
export const WeekPlan = Schema.Struct({
|
|
214
|
+
/**
|
|
215
|
+
* True when a Coding Agent was needed and could not be reached. The deterministic rows are still
|
|
216
|
+
* complete; what is missing is only the placement of sessions no branch or path could place.
|
|
217
|
+
*/
|
|
218
|
+
attributorAvailable: Schema.Boolean,
|
|
219
|
+
attributorCalls: Schema.Number,
|
|
220
|
+
days: Schema.Array(Day),
|
|
221
|
+
excludedDays: Schema.Array(ExcludedDay),
|
|
222
|
+
monday: Day,
|
|
223
|
+
/** Names the server-held evidence a confirmation refers to. */
|
|
224
|
+
planId: Schema.String,
|
|
225
|
+
rows: Schema.Array(WeekRow),
|
|
226
|
+
/** Closed Clockify entries without a ticket, excluded from ticket reconciliation. */
|
|
227
|
+
unlinkedClockify: Schema.Array(Schema.Struct({
|
|
228
|
+
entry: Schema.optionalKey(SavedEntry),
|
|
229
|
+
day: Day,
|
|
230
|
+
seconds: Schema.Number,
|
|
231
|
+
description: Schema.NullOr(Schema.String),
|
|
232
|
+
startMs: Schema.Number,
|
|
233
|
+
endMs: Schema.Number
|
|
234
|
+
})),
|
|
235
|
+
sessionCount: Schema.Number,
|
|
236
|
+
/** False for recorded-only weeks. Omitted by older servers means a session scan is available. */
|
|
237
|
+
sessionScanAvailable: Schema.optional(Schema.Boolean),
|
|
238
|
+
/** Which systems this week was read from. A side that is out reports zero because nobody asked. */
|
|
239
|
+
scope: WeekScope,
|
|
240
|
+
/** Zero means nothing is opted in, which is the usual reason for an empty week. */
|
|
241
|
+
sessionRootCount: Schema.Number,
|
|
242
|
+
/** Hours on tickets assigned to somebody else. Empty when ownership is not being enforced. */
|
|
243
|
+
notMine: Schema.Array(NotMineRow),
|
|
244
|
+
/**
|
|
245
|
+
* True when Jira actually answered about who owns these tickets.
|
|
246
|
+
*
|
|
247
|
+
* False means nothing was filtered on ownership, whatever the setting says — a week that quietly
|
|
248
|
+
* hid rows because Jira was unreachable would be a week missing hours with nothing to explain it.
|
|
249
|
+
*/
|
|
250
|
+
ownershipChecked: Schema.Boolean,
|
|
251
|
+
/** Whether this week withheld tickets assigned to other people. */
|
|
252
|
+
ownership: Schema.Literals(["assigned", "any"]),
|
|
253
|
+
unattributed: Schema.Array(UnattributedDay),
|
|
254
|
+
withheld: Schema.Array(WithheldRow)
|
|
255
|
+
});
|
|
256
|
+
/** Authenticated cached view. Missing evidence allows provider-only reads; suggestions require an explicit scan. */
|
|
257
|
+
export const SavedWeek = Schema.Struct({ monday: Day, scope: WeekScope, plan: Schema.NullOr(WeekPlan) });
|
|
258
|
+
/** What one side of a write did. Mirrors `SideOutcome` in the engine. */
|
|
259
|
+
export const SideOutcome = Schema.Union([
|
|
260
|
+
Schema.TaggedStruct("Written", {
|
|
261
|
+
seconds: Schema.Number,
|
|
262
|
+
segments: Schema.optional(Schema.Array(Schema.Struct({ startMs: Schema.Number, endMs: Schema.Number })))
|
|
263
|
+
}),
|
|
264
|
+
Schema.TaggedStruct("PartiallyWritten", {
|
|
265
|
+
seconds: Schema.Number,
|
|
266
|
+
segments: Schema.optional(Schema.Array(Schema.Struct({ startMs: Schema.Number, endMs: Schema.Number }))),
|
|
267
|
+
failure: Schema.Union([
|
|
268
|
+
Schema.TaggedStruct("Refused", { message: Schema.String }),
|
|
269
|
+
Schema.TaggedStruct("NotLoggedIn", {})
|
|
270
|
+
])
|
|
271
|
+
}),
|
|
272
|
+
Schema.TaggedStruct("NothingOwed", {}),
|
|
273
|
+
Schema.TaggedStruct("Skipped", {}),
|
|
274
|
+
Schema.TaggedStruct("Refused", { message: Schema.String }),
|
|
275
|
+
Schema.TaggedStruct("NotLoggedIn", {})
|
|
276
|
+
]);
|
|
277
|
+
/**
|
|
278
|
+
* What a write actually did, in the engine's own words.
|
|
279
|
+
*
|
|
280
|
+
* `lines` is rendered by the engine rather than the browser so a terminal and a page cannot describe
|
|
281
|
+
* the same write differently. `description` is what landed in both systems, returned because it is
|
|
282
|
+
* the text other people will read.
|
|
283
|
+
*/
|
|
284
|
+
export const WriteResult = Schema.Struct({
|
|
285
|
+
clockify: SideOutcome,
|
|
286
|
+
description: Schema.String,
|
|
287
|
+
jira: SideOutcome,
|
|
288
|
+
lines: Schema.Array(Schema.String)
|
|
289
|
+
});
|
|
290
|
+
/**
|
|
291
|
+
* Accept one proposed row, optionally with the amount or the Issue Key overruled.
|
|
292
|
+
*
|
|
293
|
+
* No spans, no credited seconds, no deltas: the server holds the evidence this row was built from
|
|
294
|
+
* and re-reads both systems before writing, so the only numbers a browser can influence are the ones
|
|
295
|
+
* a person is allowed to choose.
|
|
296
|
+
*/
|
|
297
|
+
export const ConfirmPayload = Schema.Struct({
|
|
298
|
+
/**
|
|
299
|
+
* Which of the row's blocks to write, by position. Absent means all of them.
|
|
300
|
+
*
|
|
301
|
+
* Positions rather than times or durations, so the server still owns every number: naming block
|
|
302
|
+
* two of a row it built is not the same kind of claim as sending "40 minutes at 20:52".
|
|
303
|
+
*/
|
|
304
|
+
blocks: Schema.optional(Schema.Array(Schema.Number.pipe(Schema.check(Schema.isInt())))),
|
|
305
|
+
note: Schema.optional(Note),
|
|
306
|
+
planId: Schema.String,
|
|
307
|
+
rowId: Schema.String,
|
|
308
|
+
/** Absent means the systems the week was read under. Neither is a usage error, not a write. */
|
|
309
|
+
targets: Schema.optional(WriteTargets),
|
|
310
|
+
/** Absent means "as proposed". Present must not exceed the row's `maxSeconds`. */
|
|
311
|
+
seconds: Schema.optional(WorkSeconds),
|
|
312
|
+
/** Absent means the Issue Key the evidence placed it on. */
|
|
313
|
+
ticketKey: Schema.optional(TicketKey)
|
|
314
|
+
});
|
|
315
|
+
/**
|
|
316
|
+
* Log time no session evidences — a meeting, a whiteboard, a review away from the keyboard.
|
|
317
|
+
*
|
|
318
|
+
* Deliberately an *addition* rather than a top-up: a person typing 30 minutes means add 30 minutes,
|
|
319
|
+
* which is what `jcf timer log` has always done. Nothing is subtracted, so running it twice logs
|
|
320
|
+
* twice, exactly as typing it twice would.
|
|
321
|
+
*/
|
|
322
|
+
export const ManualPayload = Schema.Struct({
|
|
323
|
+
day: Day,
|
|
324
|
+
note: Schema.optional(Note),
|
|
325
|
+
seconds: WorkSeconds,
|
|
326
|
+
targets: Schema.optional(WriteTargets),
|
|
327
|
+
/** Local `HH:MM` the work began. Absent lets the engine place it at local noon. */
|
|
328
|
+
startClock: Schema.optional(Schema.String.pipe(Schema.check(Schema.isPattern(/^(?:[01]\d|2[0-3]):[0-5]\d$/)))),
|
|
329
|
+
ticketKey: TicketKey
|
|
330
|
+
});
|
|
331
|
+
/** Treat one ticket as yours whatever Jira says its assignee is. Sticks, in `~/.jcf/config.json`. */
|
|
332
|
+
export const OwnershipPayload = Schema.Struct({
|
|
333
|
+
ticketKey: TicketKey
|
|
334
|
+
});
|
|
335
|
+
export const OwnershipResult = Schema.Struct({
|
|
336
|
+
ownershipOverrides: Schema.Array(Schema.String)
|
|
337
|
+
});
|
|
338
|
+
/** Map a directory prefix to an Issue Key, so recurring ticket-less work stops being unplaced. */
|
|
339
|
+
export const StandingPayload = Schema.Struct({
|
|
340
|
+
cwd: Schema.String.pipe(Schema.check(Schema.isPattern(/^(?:\/|~|[A-Za-z]:[\\/]|[\\/]{2}[^\\/]+[\\/][^\\/]+)/))),
|
|
341
|
+
ticketKey: TicketKey
|
|
342
|
+
});
|
|
343
|
+
export const StandingResult = Schema.Struct({
|
|
344
|
+
sessionTicketMap: Schema.Record(Schema.String, Schema.String)
|
|
345
|
+
});
|
|
346
|
+
/** Actual server stages. Counts describe completed attribution work, never estimated percentages. */
|
|
347
|
+
export const ReadProgress = Schema.Struct({
|
|
348
|
+
activity: Schema.optional(Schema.Struct({
|
|
349
|
+
batch: Schema.Number,
|
|
350
|
+
batches: Schema.Number,
|
|
351
|
+
kind: Schema.Literals(["status", "text", "request", "response"]),
|
|
352
|
+
text: Schema.String
|
|
353
|
+
})),
|
|
354
|
+
stage: Schema.Literals(["sessions", "attribution", "recorded", "issues", "calendar"]),
|
|
355
|
+
message: Schema.String,
|
|
356
|
+
completed: Schema.optional(Schema.Number),
|
|
357
|
+
total: Schema.optional(Schema.Number)
|
|
358
|
+
});
|
|
359
|
+
/** One authenticated read stream, ending in exactly one plan or failure. */
|
|
360
|
+
export const WeekReadEvent = Schema.Union([
|
|
361
|
+
Schema.TaggedStruct("Progress", { progress: ReadProgress }),
|
|
362
|
+
Schema.TaggedStruct("Complete", { plan: WeekPlan }),
|
|
363
|
+
Schema.TaggedStruct("Failed", { message: Schema.String })
|
|
364
|
+
]);
|
|
365
|
+
//# sourceMappingURL=contracts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src/shared/contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,qFAAqF;AACrF,MAAM,CAAC,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;AAE5F;;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;AAC5E,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC;IACxC,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;IAC3D,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IACnD,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;CAC1D,CAAC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CreditedBlock } from "@knpkv/jira-clockify/agent/sessions.js";
|
|
2
|
+
import type { ProposalBlockResponse } from "./contracts.js";
|
|
3
|
+
/** Use only the server-projected consumption for the same block objects given to the planner. */
|
|
4
|
+
export declare const consumedFromWeekBlocks: (blocks: ReadonlyArray<ProposalBlockResponse>) => (block: CreditedBlock, source: "clockify" | "jira") => number;
|
|
5
|
+
/** Compatibility exports; the engine owns confirmation planning for every caller. */
|
|
6
|
+
export { MINIMUM_WRITE_SECONDS, prepareProposal, type ProposedWrite, proposeWrite, selectedBlocks } from "@knpkv/jira-clockify/agent/writePlanning.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Data } from "effect";
|
|
2
|
+
class MissingProjectedConsumptionError extends Data.TaggedError("MissingProjectedConsumptionError") {
|
|
3
|
+
}
|
|
4
|
+
/** Use only the server-projected consumption for the same block objects given to the planner. */
|
|
5
|
+
export const consumedFromWeekBlocks = (blocks) => {
|
|
6
|
+
const byBlock = new Map(blocks.map((block) => [
|
|
7
|
+
block,
|
|
8
|
+
block.consumed
|
|
9
|
+
]));
|
|
10
|
+
return (block, source) => {
|
|
11
|
+
const consumed = byBlock.get(block);
|
|
12
|
+
if (consumed === undefined)
|
|
13
|
+
throw new MissingProjectedConsumptionError();
|
|
14
|
+
return consumed[source];
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
/** Compatibility exports; the engine owns confirmation planning for every caller. */
|
|
18
|
+
export { MINIMUM_WRITE_SECONDS, prepareProposal, proposeWrite, selectedBlocks } from "@knpkv/jira-clockify/agent/writePlanning.js";
|
|
19
|
+
//# sourceMappingURL=writePlanning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writePlanning.js","sourceRoot":"","sources":["../../src/shared/writePlanning.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAG7B,MAAM,gCAAiC,SAAQ,IAAI,CAAC,WAAW,CAAC,kCAAkC,CAAK;CAAG;AAE1G,iGAAiG;AACjG,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,MAA4C,EAAE,EAAE;IACrF,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAA+D,EAAE,CAAC;QACzG,KAAK;QACL,KAAK,CAAC,QAAQ;KACf,CAAC,CAAC,CAAA;IACH,OAAO,CAAC,KAAoB,EAAE,MAA2B,EAAU,EAAE;QACnE,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QACnC,IAAI,QAAQ,KAAK,SAAS;YAAE,MAAM,IAAI,gCAAgC,EAAE,CAAA;QACxE,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAA;IACzB,CAAC,CAAA;AACH,CAAC,CAAA;AAED,qFAAqF;AACrF,OAAO,EACL,qBAAqB,EACrB,eAAe,EAEf,YAAY,EACZ,cAAc,EACf,MAAM,6CAA6C,CAAA"}
|