@pxlabz/tasq-sdk 0.1.23 → 0.1.24
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/index.d.ts +520 -4
- package/dist/index.js +56 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -141,6 +141,16 @@ type TimeEntryItem = {
|
|
|
141
141
|
billable: TimeEntryBillable;
|
|
142
142
|
/** Whether the caller may edit or delete it: theirs, written by them, or an admin. */
|
|
143
143
|
canChange: boolean;
|
|
144
|
+
/** The closed client month that freezes it; null while it can change. */
|
|
145
|
+
locked: TimeEntryLock | null;
|
|
146
|
+
};
|
|
147
|
+
/** Why an entry can't change: a client's month is closed or invoiced. */
|
|
148
|
+
type TimeEntryLock = {
|
|
149
|
+
clientId: string;
|
|
150
|
+
clientName: string;
|
|
151
|
+
/** `YYYY-MM`. */
|
|
152
|
+
month: string;
|
|
153
|
+
state: "closed" | "invoiced";
|
|
144
154
|
};
|
|
145
155
|
/** `GET /workspaces/:slug/tasks/:taskId/time`. */
|
|
146
156
|
type TaskTimeResponse = {
|
|
@@ -190,6 +200,170 @@ type ProjectTimeResponse = {
|
|
|
190
200
|
}>;
|
|
191
201
|
truncated: boolean;
|
|
192
202
|
};
|
|
203
|
+
/** Minutes split by the billable flag. */
|
|
204
|
+
type BillableSplit = {
|
|
205
|
+
billable: number;
|
|
206
|
+
nonBillable: number;
|
|
207
|
+
notSet: number;
|
|
208
|
+
total: number;
|
|
209
|
+
};
|
|
210
|
+
type ClientHoursPerson = {
|
|
211
|
+
billable: number;
|
|
212
|
+
nonBillable: number;
|
|
213
|
+
notSet: number;
|
|
214
|
+
total: number;
|
|
215
|
+
/** Null for time logged by members who have since left. */
|
|
216
|
+
memberId: string | null;
|
|
217
|
+
name: string | null;
|
|
218
|
+
kind: "user" | "agent" | null;
|
|
219
|
+
};
|
|
220
|
+
/** `GET /workspaces/:slug/clients/:clientId/hours?month=&billable=`. */
|
|
221
|
+
type ClientHoursResponse = {
|
|
222
|
+
clientId: string;
|
|
223
|
+
name: string;
|
|
224
|
+
/** `YYYY-MM`, and the inclusive day range it covers. */
|
|
225
|
+
month: string;
|
|
226
|
+
from: string;
|
|
227
|
+
to: string;
|
|
228
|
+
billableOnly: boolean;
|
|
229
|
+
totals: BillableSplit;
|
|
230
|
+
/** Every linked project, most time first. */
|
|
231
|
+
projects: Array<{
|
|
232
|
+
billable: number;
|
|
233
|
+
nonBillable: number;
|
|
234
|
+
notSet: number;
|
|
235
|
+
total: number;
|
|
236
|
+
projectId: string;
|
|
237
|
+
name: string;
|
|
238
|
+
/** Linked to another client too, so these hours also count there. */
|
|
239
|
+
shared: boolean;
|
|
240
|
+
people: ClientHoursPerson[];
|
|
241
|
+
}>;
|
|
242
|
+
people: ClientHoursPerson[];
|
|
243
|
+
/** The month's billing state where Billing periods is on; null while open. */
|
|
244
|
+
period: ClientPeriodState | null;
|
|
245
|
+
/** Entries with no billable flag yet, oldest first, capped. */
|
|
246
|
+
notSetEntries: Array<{
|
|
247
|
+
id: string;
|
|
248
|
+
taskId: string;
|
|
249
|
+
identifier: string;
|
|
250
|
+
taskTitle: string;
|
|
251
|
+
memberName: string | null;
|
|
252
|
+
spentOn: string;
|
|
253
|
+
minutes: number;
|
|
254
|
+
}>;
|
|
255
|
+
};
|
|
256
|
+
/** A closed or invoiced client month. Times are ISO instants. */
|
|
257
|
+
type ClientPeriodState = {
|
|
258
|
+
state: "closed" | "invoiced";
|
|
259
|
+
/** A label for finding the invoice elsewhere; tasq bills nothing. */
|
|
260
|
+
invoiceRef: string | null;
|
|
261
|
+
closedAt: string;
|
|
262
|
+
closedBy: string | null;
|
|
263
|
+
invoicedAt: string | null;
|
|
264
|
+
invoicedBy: string | null;
|
|
265
|
+
};
|
|
266
|
+
/** One month on a client's Billing tab; `period` is null while it is open. */
|
|
267
|
+
type ClientBillingMonth = {
|
|
268
|
+
billable: number;
|
|
269
|
+
nonBillable: number;
|
|
270
|
+
notSet: number;
|
|
271
|
+
total: number;
|
|
272
|
+
/** `YYYY-MM`. */
|
|
273
|
+
month: string;
|
|
274
|
+
period: ClientPeriodState | null;
|
|
275
|
+
};
|
|
276
|
+
/** `GET /workspaces/:slug/clients/:clientId/billing`. */
|
|
277
|
+
type ClientBillingResponse = {
|
|
278
|
+
clientId: string;
|
|
279
|
+
name: string;
|
|
280
|
+
/** Newest first: this month, every month with hours, every closed month. */
|
|
281
|
+
months: ClientBillingMonth[];
|
|
282
|
+
};
|
|
283
|
+
/** One logged entry on My week's chosen day. */
|
|
284
|
+
type MyWeekEntry = {
|
|
285
|
+
id: string;
|
|
286
|
+
taskId: string;
|
|
287
|
+
identifier: string;
|
|
288
|
+
taskTitle: string;
|
|
289
|
+
projectName: string | null;
|
|
290
|
+
spentOn: string;
|
|
291
|
+
minutes: number;
|
|
292
|
+
note: string | null;
|
|
293
|
+
billable: TimeEntryBillable;
|
|
294
|
+
locked: TimeEntryLock | null;
|
|
295
|
+
};
|
|
296
|
+
/** A task the caller changed or commented on that day without logging time. */
|
|
297
|
+
type MyWeekUnlogged = {
|
|
298
|
+
taskId: string;
|
|
299
|
+
identifier: string;
|
|
300
|
+
title: string;
|
|
301
|
+
projectName: string | null;
|
|
302
|
+
reason: "commented" | "updated";
|
|
303
|
+
/** Their last change that day, an ISO instant. */
|
|
304
|
+
lastAt: string;
|
|
305
|
+
};
|
|
306
|
+
/** `GET /workspaces/:slug/me/week?day=&tz=`: the caller's week, Monday first. */
|
|
307
|
+
type MyWeekResponse = {
|
|
308
|
+
day: string;
|
|
309
|
+
from: string;
|
|
310
|
+
to: string;
|
|
311
|
+
totalMinutes: number;
|
|
312
|
+
days: Array<{
|
|
313
|
+
day: string;
|
|
314
|
+
minutes: number;
|
|
315
|
+
}>;
|
|
316
|
+
entries: MyWeekEntry[];
|
|
317
|
+
unlogged: MyWeekUnlogged[];
|
|
318
|
+
/** The agent's draft of this day, when its team shows drafts on My week. */
|
|
319
|
+
draft: TimeDraftView | null;
|
|
320
|
+
/** The agent that would draft this member's day, or null. */
|
|
321
|
+
drafter: TimeDraftAgent | null;
|
|
322
|
+
};
|
|
323
|
+
type TimeDraftAgent = {
|
|
324
|
+
memberId: string;
|
|
325
|
+
name: string;
|
|
326
|
+
};
|
|
327
|
+
/** One proposed entry on a timesheet draft. */
|
|
328
|
+
type TimeDraftLineView = {
|
|
329
|
+
id: string;
|
|
330
|
+
taskId: string;
|
|
331
|
+
identifier: string;
|
|
332
|
+
title: string;
|
|
333
|
+
projectName: string | null;
|
|
334
|
+
minutes: number;
|
|
335
|
+
billable: TimeEntryBillable;
|
|
336
|
+
/** The agent's one-line reason for the line. */
|
|
337
|
+
evidence: string | null;
|
|
338
|
+
included: boolean;
|
|
339
|
+
/** The entry this line became once logged. */
|
|
340
|
+
entryId: string | null;
|
|
341
|
+
};
|
|
342
|
+
/** One message in the conversation about a draft. */
|
|
343
|
+
type TimeDraftMessageView = {
|
|
344
|
+
id: string;
|
|
345
|
+
authorMemberId: string | null;
|
|
346
|
+
authorType: "user" | "agent" | "system";
|
|
347
|
+
authorName: string | null;
|
|
348
|
+
body: string;
|
|
349
|
+
createdAt: string;
|
|
350
|
+
};
|
|
351
|
+
/** An agent's timesheet draft for one member's day (TM-2). */
|
|
352
|
+
type TimeDraftView = {
|
|
353
|
+
id: string;
|
|
354
|
+
memberId: string;
|
|
355
|
+
teamId: string;
|
|
356
|
+
day: string;
|
|
357
|
+
state: "waiting" | "ready" | "logged" | "dismissed";
|
|
358
|
+
agent: TimeDraftAgent | null;
|
|
359
|
+
readyAt: string | null;
|
|
360
|
+
lines: TimeDraftLineView[];
|
|
361
|
+
messages: TimeDraftMessageView[];
|
|
362
|
+
};
|
|
363
|
+
/** `GET /workspaces/:slug/time-drafts/:draftId` */
|
|
364
|
+
type TimeDraftResponse = {
|
|
365
|
+
draft: TimeDraftView;
|
|
366
|
+
};
|
|
193
367
|
/** A project time report's range: inclusive `YYYY-MM-DD` days, at most 92. */
|
|
194
368
|
type TimeRange = {
|
|
195
369
|
from: string;
|
|
@@ -600,7 +774,7 @@ type MentionActorRef = {
|
|
|
600
774
|
*/
|
|
601
775
|
type AgentEvent = {
|
|
602
776
|
id: string;
|
|
603
|
-
kind: "mention" | "thread_message" | "cycle_closed";
|
|
777
|
+
kind: "mention" | "thread_message" | "cycle_closed" | "timesheet_due" | "timesheet_reply";
|
|
604
778
|
workspace: string;
|
|
605
779
|
/** Exactly one of `taskId` / `projectId` is set: the entity the thread is on. */
|
|
606
780
|
taskId: string | null;
|
|
@@ -611,6 +785,11 @@ type AgentEvent = {
|
|
|
611
785
|
commentId: string | null;
|
|
612
786
|
/** Set only on `cycle_closed`: the release to narrate (B-04d D-2). */
|
|
613
787
|
releaseId: string | null;
|
|
788
|
+
/**
|
|
789
|
+
* Set only on `timesheet_due` and `timesheet_reply`: the draft to write,
|
|
790
|
+
* read with `timeDrafts.get` (TM-2).
|
|
791
|
+
*/
|
|
792
|
+
timeDraftId: string | null;
|
|
614
793
|
mentionedBy: MentionActorRef | null;
|
|
615
794
|
deliveryCount: number;
|
|
616
795
|
createdAt: string;
|
|
@@ -628,7 +807,7 @@ type AgentEventsResponse = {
|
|
|
628
807
|
*/
|
|
629
808
|
type NotificationItem = {
|
|
630
809
|
id: string;
|
|
631
|
-
kind: "agent_reply" | "thread_reply" | "release_ready" | "approval_requested" | "approval_decided" | "assigned" | "mentioned" | "due_soon";
|
|
810
|
+
kind: "agent_reply" | "thread_reply" | "release_ready" | "approval_requested" | "approval_decided" | "assigned" | "mentioned" | "due_soon" | "timesheet_ready";
|
|
632
811
|
/** Exactly one of `taskId` / `projectId` is set: the entity the thread is on. */
|
|
633
812
|
taskId: string | null;
|
|
634
813
|
taskKey: string | null;
|
|
@@ -650,6 +829,9 @@ type NotificationItem = {
|
|
|
650
829
|
releaseId: string | null;
|
|
651
830
|
releaseNumber: number | null;
|
|
652
831
|
releaseTeamIdentifier: string | null;
|
|
832
|
+
/** Set only on `timesheet_ready`: the draft and the day it covers (TM-2). */
|
|
833
|
+
timeDraftId: string | null;
|
|
834
|
+
timeDraftDay: string | null;
|
|
653
835
|
actor: MentionActorRef | null;
|
|
654
836
|
readAt: string | null;
|
|
655
837
|
createdAt: string;
|
|
@@ -839,6 +1021,10 @@ type TeamAgentSettingsRecord = {
|
|
|
839
1021
|
isolation: AgentIsolation;
|
|
840
1022
|
/** The agent woken on a cycle close, if any (B-04d D-2). */
|
|
841
1023
|
releaseNarratorMemberId: string | null;
|
|
1024
|
+
/** The agent that drafts members' timesheets, if any (TM-2). */
|
|
1025
|
+
timesheetDrafterMemberId: string | null;
|
|
1026
|
+
timesheetDraftOnWeek: boolean;
|
|
1027
|
+
timesheetDraftInInbox: boolean;
|
|
842
1028
|
createdAt: string;
|
|
843
1029
|
updatedAt: string;
|
|
844
1030
|
};
|
|
@@ -986,7 +1172,7 @@ type DispatchResponse<TName extends ActionName> = {
|
|
|
986
1172
|
result: ActionWireOutputMap[TName];
|
|
987
1173
|
invalidates: Array<Array<string>>;
|
|
988
1174
|
};
|
|
989
|
-
type ActionName = "task.create" | "task.assign" | "task.bulkSetCycle" | "task.move" | "task.setPriority" | "task.setEstimate" | "task.setDates" | "task.update" | "task.setProject" | "task.setCycle" | "task.setMilestone" | "task.setParent" | "task.requestApproval" | "task.decide" | "task.addLabel" | "task.removeLabel" | "task.archive" | "task.unarchive" | "task.setField" | "time.log" | "time.update" | "time.delete" | "comment.add" | "notification.markRead" | "project.create" | "project.update" | "project.archive" | "project.unarchive" | "project.addTeam" | "project.removeTeam" | "project.addMember" | "project.removeMember" | "project.setLead" | "project.grantGuest" | "project.setGuestAccess" | "project.revokeGuest" | "project.star" | "project.unstar" | "project.setField" | "initiative.create" | "initiative.update" | "initiative.delete" | "initiative.linkProject" | "initiative.unlinkProject" | "projectUpdate.create" | "projectUpdate.update" | "projectUpdate.send" | "projectUpdate.delete" | "doc.create" | "doc.update" | "doc.link" | "doc.unlink" | "doc.archive" | "doc.unarchive" | "milestone.create" | "milestone.update" | "milestone.delete" | "milestone.reorder" | "milestone.promote" | "cycle.create" | "cycle.update" | "cycle.delete" | "status.create" | "status.update" | "status.reorder" | "status.delete" | "label.create" | "label.update" | "label.delete" | "field.create" | "field.update" | "field.archive" | "field.restore" | "field.addOption" | "field.updateOption" | "field.reorderOptions" | "team.cycleCadence.save" | "team.estimateSettings.save" | "team.agentSettings.save" | "team.cycleLifecycle.apply" | "team.applyTemplate" | "team.setModules" | "team.setWords" | "team.setFields" | "release.saveNarrative" | "agent.create" | "agent.setPolicy" | "agent.issueKey" | "agent.revokeKey" | "agent.pause" | "agent.resume" | "agent.remove";
|
|
1175
|
+
type ActionName = "task.create" | "task.assign" | "task.bulkSetCycle" | "task.move" | "task.setPriority" | "task.setEstimate" | "task.setDates" | "task.update" | "task.setProject" | "task.setCycle" | "task.setMilestone" | "task.setParent" | "task.requestApproval" | "task.decide" | "task.addLabel" | "task.removeLabel" | "task.archive" | "task.unarchive" | "task.setField" | "time.log" | "time.update" | "time.delete" | "billingPeriod.close" | "billingPeriod.markInvoiced" | "billingPeriod.reopen" | "timeDraft.request" | "timeDraft.save" | "timeDraft.confirm" | "timeDraft.dismiss" | "timeDraft.reply" | "comment.add" | "notification.markRead" | "project.create" | "project.update" | "project.archive" | "project.unarchive" | "project.addTeam" | "project.removeTeam" | "project.addMember" | "project.removeMember" | "project.setLead" | "project.grantGuest" | "project.setGuestAccess" | "project.revokeGuest" | "project.star" | "project.unstar" | "project.setField" | "initiative.create" | "initiative.update" | "initiative.delete" | "initiative.linkProject" | "initiative.unlinkProject" | "projectUpdate.create" | "projectUpdate.update" | "projectUpdate.send" | "projectUpdate.delete" | "doc.create" | "doc.update" | "doc.link" | "doc.unlink" | "doc.archive" | "doc.unarchive" | "milestone.create" | "milestone.update" | "milestone.delete" | "milestone.reorder" | "milestone.promote" | "cycle.create" | "cycle.update" | "cycle.delete" | "status.create" | "status.update" | "status.reorder" | "status.delete" | "label.create" | "label.update" | "label.delete" | "field.create" | "field.update" | "field.archive" | "field.restore" | "field.addOption" | "field.updateOption" | "field.reorderOptions" | "team.cycleCadence.save" | "team.estimateSettings.save" | "team.agentSettings.save" | "team.cycleLifecycle.apply" | "team.applyTemplate" | "team.setModules" | "team.setWords" | "team.setFields" | "release.saveNarrative" | "agent.create" | "agent.setPolicy" | "agent.issueKey" | "agent.revokeKey" | "agent.pause" | "agent.resume" | "agent.remove";
|
|
990
1176
|
type ActionInputMap = Omit<ActionParsedInputMap, "cycle.create" | "cycle.update"> & {
|
|
991
1177
|
"cycle.create": DatesAsInput<{
|
|
992
1178
|
teamIdentifier: string;
|
|
@@ -1115,6 +1301,48 @@ type ActionParsedInputMap = {
|
|
|
1115
1301
|
"time.delete": {
|
|
1116
1302
|
entryId: string;
|
|
1117
1303
|
};
|
|
1304
|
+
"billingPeriod.close": {
|
|
1305
|
+
clientId: string;
|
|
1306
|
+
month: string;
|
|
1307
|
+
};
|
|
1308
|
+
"billingPeriod.markInvoiced": {
|
|
1309
|
+
clientId: string;
|
|
1310
|
+
month: string;
|
|
1311
|
+
invoiceRef?: string | null | undefined;
|
|
1312
|
+
};
|
|
1313
|
+
"billingPeriod.reopen": {
|
|
1314
|
+
clientId: string;
|
|
1315
|
+
month: string;
|
|
1316
|
+
};
|
|
1317
|
+
"timeDraft.request": {
|
|
1318
|
+
day: string;
|
|
1319
|
+
};
|
|
1320
|
+
"timeDraft.save": {
|
|
1321
|
+
draftId: string;
|
|
1322
|
+
lines: {
|
|
1323
|
+
taskId: string;
|
|
1324
|
+
minutes: number;
|
|
1325
|
+
billable?: "billable" | "non_billable" | "not_set" | undefined;
|
|
1326
|
+
evidence?: string | null | undefined;
|
|
1327
|
+
}[];
|
|
1328
|
+
message?: string | null | undefined;
|
|
1329
|
+
};
|
|
1330
|
+
"timeDraft.confirm": {
|
|
1331
|
+
draftId: string;
|
|
1332
|
+
lines?: {
|
|
1333
|
+
lineId: string;
|
|
1334
|
+
included?: boolean | undefined;
|
|
1335
|
+
minutes?: number | undefined;
|
|
1336
|
+
billable?: "billable" | "non_billable" | "not_set" | undefined;
|
|
1337
|
+
}[] | undefined;
|
|
1338
|
+
};
|
|
1339
|
+
"timeDraft.dismiss": {
|
|
1340
|
+
draftId: string;
|
|
1341
|
+
};
|
|
1342
|
+
"timeDraft.reply": {
|
|
1343
|
+
draftId: string;
|
|
1344
|
+
body: string;
|
|
1345
|
+
};
|
|
1118
1346
|
"comment.add": {
|
|
1119
1347
|
body: string;
|
|
1120
1348
|
taskId?: string | undefined;
|
|
@@ -1403,6 +1631,9 @@ type ActionParsedInputMap = {
|
|
|
1403
1631
|
teamIdentifier: string;
|
|
1404
1632
|
isolation: "isolated" | "open";
|
|
1405
1633
|
releaseNarratorMemberId?: string | null | undefined;
|
|
1634
|
+
timesheetDrafterMemberId?: string | null | undefined;
|
|
1635
|
+
timesheetDraftOnWeek?: boolean | undefined;
|
|
1636
|
+
timesheetDraftInInbox?: boolean | undefined;
|
|
1406
1637
|
};
|
|
1407
1638
|
"team.cycleLifecycle.apply": {
|
|
1408
1639
|
teamIdentifier: string;
|
|
@@ -1425,6 +1656,10 @@ type ActionParsedInputMap = {
|
|
|
1425
1656
|
fields?: boolean | undefined;
|
|
1426
1657
|
recurring?: boolean | undefined;
|
|
1427
1658
|
time?: boolean | undefined;
|
|
1659
|
+
clientHours?: boolean | undefined;
|
|
1660
|
+
billingPeriods?: boolean | undefined;
|
|
1661
|
+
myWeek?: boolean | undefined;
|
|
1662
|
+
timeDrafts?: boolean | undefined;
|
|
1428
1663
|
};
|
|
1429
1664
|
};
|
|
1430
1665
|
"team.setWords": {
|
|
@@ -2703,6 +2938,165 @@ type ActionWireOutputMap = {
|
|
|
2703
2938
|
updatedAt: string;
|
|
2704
2939
|
};
|
|
2705
2940
|
};
|
|
2941
|
+
"billingPeriod.close": {
|
|
2942
|
+
period: {
|
|
2943
|
+
id: string;
|
|
2944
|
+
workspaceId: string;
|
|
2945
|
+
initiativeId: string;
|
|
2946
|
+
month: string;
|
|
2947
|
+
state: BillingPeriodStateValue;
|
|
2948
|
+
invoiceRef: string | null;
|
|
2949
|
+
closedAt: string;
|
|
2950
|
+
closedById: string | null;
|
|
2951
|
+
invoicedAt: string | null;
|
|
2952
|
+
invoicedById: string | null;
|
|
2953
|
+
createdAt: string;
|
|
2954
|
+
updatedAt: string;
|
|
2955
|
+
};
|
|
2956
|
+
closed: boolean;
|
|
2957
|
+
};
|
|
2958
|
+
"billingPeriod.markInvoiced": {
|
|
2959
|
+
period: {
|
|
2960
|
+
id: string;
|
|
2961
|
+
workspaceId: string;
|
|
2962
|
+
initiativeId: string;
|
|
2963
|
+
month: string;
|
|
2964
|
+
state: BillingPeriodStateValue;
|
|
2965
|
+
invoiceRef: string | null;
|
|
2966
|
+
closedAt: string;
|
|
2967
|
+
closedById: string | null;
|
|
2968
|
+
invoicedAt: string | null;
|
|
2969
|
+
invoicedById: string | null;
|
|
2970
|
+
createdAt: string;
|
|
2971
|
+
updatedAt: string;
|
|
2972
|
+
};
|
|
2973
|
+
};
|
|
2974
|
+
"billingPeriod.reopen": {
|
|
2975
|
+
clientId: string;
|
|
2976
|
+
month: string;
|
|
2977
|
+
previous: {
|
|
2978
|
+
id: string;
|
|
2979
|
+
workspaceId: string;
|
|
2980
|
+
initiativeId: string;
|
|
2981
|
+
month: string;
|
|
2982
|
+
state: BillingPeriodStateValue;
|
|
2983
|
+
invoiceRef: string | null;
|
|
2984
|
+
closedAt: string;
|
|
2985
|
+
closedById: string | null;
|
|
2986
|
+
invoicedAt: string | null;
|
|
2987
|
+
invoicedById: string | null;
|
|
2988
|
+
createdAt: string;
|
|
2989
|
+
updatedAt: string;
|
|
2990
|
+
} | null;
|
|
2991
|
+
};
|
|
2992
|
+
"timeDraft.request": {
|
|
2993
|
+
draft: {
|
|
2994
|
+
id: string;
|
|
2995
|
+
workspaceId: string;
|
|
2996
|
+
memberId: string;
|
|
2997
|
+
teamId: string;
|
|
2998
|
+
agentMemberId: string | null;
|
|
2999
|
+
day: string;
|
|
3000
|
+
state: TimeDraftStateValue;
|
|
3001
|
+
readyAt: string | null;
|
|
3002
|
+
settledAt: string | null;
|
|
3003
|
+
createdAt: string;
|
|
3004
|
+
updatedAt: string;
|
|
3005
|
+
};
|
|
3006
|
+
requested: boolean;
|
|
3007
|
+
};
|
|
3008
|
+
"timeDraft.save": {
|
|
3009
|
+
draft: {
|
|
3010
|
+
id: string;
|
|
3011
|
+
workspaceId: string;
|
|
3012
|
+
memberId: string;
|
|
3013
|
+
teamId: string;
|
|
3014
|
+
agentMemberId: string | null;
|
|
3015
|
+
day: string;
|
|
3016
|
+
state: TimeDraftStateValue;
|
|
3017
|
+
readyAt: string | null;
|
|
3018
|
+
settledAt: string | null;
|
|
3019
|
+
createdAt: string;
|
|
3020
|
+
updatedAt: string;
|
|
3021
|
+
};
|
|
3022
|
+
lines: {
|
|
3023
|
+
id: string;
|
|
3024
|
+
draftId: string;
|
|
3025
|
+
taskId: string;
|
|
3026
|
+
position: number;
|
|
3027
|
+
minutes: number;
|
|
3028
|
+
billable: TimeEntryBillableValue;
|
|
3029
|
+
evidence: string | null;
|
|
3030
|
+
included: boolean;
|
|
3031
|
+
entryId: string | null;
|
|
3032
|
+
}[];
|
|
3033
|
+
};
|
|
3034
|
+
"timeDraft.confirm": {
|
|
3035
|
+
draft: {
|
|
3036
|
+
id: string;
|
|
3037
|
+
workspaceId: string;
|
|
3038
|
+
memberId: string;
|
|
3039
|
+
teamId: string;
|
|
3040
|
+
agentMemberId: string | null;
|
|
3041
|
+
day: string;
|
|
3042
|
+
state: TimeDraftStateValue;
|
|
3043
|
+
readyAt: string | null;
|
|
3044
|
+
settledAt: string | null;
|
|
3045
|
+
createdAt: string;
|
|
3046
|
+
updatedAt: string;
|
|
3047
|
+
};
|
|
3048
|
+
entries: {
|
|
3049
|
+
id: string;
|
|
3050
|
+
taskId: string;
|
|
3051
|
+
memberId: string | null;
|
|
3052
|
+
createdById: string | null;
|
|
3053
|
+
createdByType: "user" | "agent" | "system";
|
|
3054
|
+
spentOn: string;
|
|
3055
|
+
minutes: number;
|
|
3056
|
+
note: string | null;
|
|
3057
|
+
billable: TimeEntryBillableValue;
|
|
3058
|
+
createdAt: string;
|
|
3059
|
+
updatedAt: string;
|
|
3060
|
+
}[];
|
|
3061
|
+
};
|
|
3062
|
+
"timeDraft.dismiss": {
|
|
3063
|
+
draft: {
|
|
3064
|
+
id: string;
|
|
3065
|
+
workspaceId: string;
|
|
3066
|
+
memberId: string;
|
|
3067
|
+
teamId: string;
|
|
3068
|
+
agentMemberId: string | null;
|
|
3069
|
+
day: string;
|
|
3070
|
+
state: TimeDraftStateValue;
|
|
3071
|
+
readyAt: string | null;
|
|
3072
|
+
settledAt: string | null;
|
|
3073
|
+
createdAt: string;
|
|
3074
|
+
updatedAt: string;
|
|
3075
|
+
};
|
|
3076
|
+
};
|
|
3077
|
+
"timeDraft.reply": {
|
|
3078
|
+
draft: {
|
|
3079
|
+
id: string;
|
|
3080
|
+
workspaceId: string;
|
|
3081
|
+
memberId: string;
|
|
3082
|
+
teamId: string;
|
|
3083
|
+
agentMemberId: string | null;
|
|
3084
|
+
day: string;
|
|
3085
|
+
state: TimeDraftStateValue;
|
|
3086
|
+
readyAt: string | null;
|
|
3087
|
+
settledAt: string | null;
|
|
3088
|
+
createdAt: string;
|
|
3089
|
+
updatedAt: string;
|
|
3090
|
+
};
|
|
3091
|
+
message: {
|
|
3092
|
+
id: string;
|
|
3093
|
+
draftId: string;
|
|
3094
|
+
authorMemberId: string | null;
|
|
3095
|
+
authorType: "user" | "agent" | "system";
|
|
3096
|
+
body: string;
|
|
3097
|
+
createdAt: string;
|
|
3098
|
+
};
|
|
3099
|
+
};
|
|
2706
3100
|
"comment.add": {
|
|
2707
3101
|
comment: {
|
|
2708
3102
|
id: string;
|
|
@@ -2819,6 +3213,10 @@ type ActionWireOutputMap = {
|
|
|
2819
3213
|
fields: boolean;
|
|
2820
3214
|
recurring: boolean;
|
|
2821
3215
|
time: boolean;
|
|
3216
|
+
clientHours: boolean;
|
|
3217
|
+
billingPeriods: boolean;
|
|
3218
|
+
myWeek: boolean;
|
|
3219
|
+
timeDrafts: boolean;
|
|
2822
3220
|
};
|
|
2823
3221
|
words: {
|
|
2824
3222
|
initiative: "client" | "initiative";
|
|
@@ -3796,6 +4194,9 @@ type ActionWireOutputMap = {
|
|
|
3796
4194
|
revision: number;
|
|
3797
4195
|
isolation: "isolated" | "open";
|
|
3798
4196
|
releaseNarratorMemberId: string | null;
|
|
4197
|
+
timesheetDrafterMemberId: string | null;
|
|
4198
|
+
timesheetDraftOnWeek: boolean;
|
|
4199
|
+
timesheetDraftInInbox: boolean;
|
|
3799
4200
|
createdAt: string;
|
|
3800
4201
|
updatedAt: string;
|
|
3801
4202
|
};
|
|
@@ -3930,6 +4331,10 @@ type ActionWireOutputMap = {
|
|
|
3930
4331
|
fields: boolean;
|
|
3931
4332
|
recurring: boolean;
|
|
3932
4333
|
time: boolean;
|
|
4334
|
+
clientHours: boolean;
|
|
4335
|
+
billingPeriods: boolean;
|
|
4336
|
+
myWeek: boolean;
|
|
4337
|
+
timeDrafts: boolean;
|
|
3933
4338
|
};
|
|
3934
4339
|
words: {
|
|
3935
4340
|
initiative: "client" | "initiative";
|
|
@@ -3957,6 +4362,10 @@ type ActionWireOutputMap = {
|
|
|
3957
4362
|
fields: boolean;
|
|
3958
4363
|
recurring: boolean;
|
|
3959
4364
|
time: boolean;
|
|
4365
|
+
clientHours: boolean;
|
|
4366
|
+
billingPeriods: boolean;
|
|
4367
|
+
myWeek: boolean;
|
|
4368
|
+
timeDrafts: boolean;
|
|
3960
4369
|
};
|
|
3961
4370
|
words: {
|
|
3962
4371
|
initiative: "client" | "initiative";
|
|
@@ -3984,6 +4393,10 @@ type ActionWireOutputMap = {
|
|
|
3984
4393
|
fields: boolean;
|
|
3985
4394
|
recurring: boolean;
|
|
3986
4395
|
time: boolean;
|
|
4396
|
+
clientHours: boolean;
|
|
4397
|
+
billingPeriods: boolean;
|
|
4398
|
+
myWeek: boolean;
|
|
4399
|
+
timeDrafts: boolean;
|
|
3987
4400
|
};
|
|
3988
4401
|
words: {
|
|
3989
4402
|
initiative: "client" | "initiative";
|
|
@@ -4011,6 +4424,10 @@ type ActionWireOutputMap = {
|
|
|
4011
4424
|
fields: boolean;
|
|
4012
4425
|
recurring: boolean;
|
|
4013
4426
|
time: boolean;
|
|
4427
|
+
clientHours: boolean;
|
|
4428
|
+
billingPeriods: boolean;
|
|
4429
|
+
myWeek: boolean;
|
|
4430
|
+
timeDrafts: boolean;
|
|
4014
4431
|
};
|
|
4015
4432
|
words: {
|
|
4016
4433
|
initiative: "client" | "initiative";
|
|
@@ -4280,6 +4697,10 @@ type TeamModules = {
|
|
|
4280
4697
|
fields: boolean;
|
|
4281
4698
|
recurring: boolean;
|
|
4282
4699
|
time: boolean;
|
|
4700
|
+
clientHours: boolean;
|
|
4701
|
+
billingPeriods: boolean;
|
|
4702
|
+
myWeek: boolean;
|
|
4703
|
+
timeDrafts: boolean;
|
|
4283
4704
|
};
|
|
4284
4705
|
type TeamLabels = {
|
|
4285
4706
|
initiative: LabelPair;
|
|
@@ -4345,6 +4766,54 @@ type TimeEntryRecord = {
|
|
|
4345
4766
|
updatedAt: Date;
|
|
4346
4767
|
};
|
|
4347
4768
|
type TimeEntryBillableValue = "billable" | "non_billable" | "not_set";
|
|
4769
|
+
type BillingPeriodRecord = {
|
|
4770
|
+
id: string;
|
|
4771
|
+
workspaceId: string;
|
|
4772
|
+
initiativeId: string;
|
|
4773
|
+
month: string;
|
|
4774
|
+
state: BillingPeriodStateValue;
|
|
4775
|
+
invoiceRef: string | null;
|
|
4776
|
+
closedAt: Date;
|
|
4777
|
+
closedById: string | null;
|
|
4778
|
+
invoicedAt: Date | null;
|
|
4779
|
+
invoicedById: string | null;
|
|
4780
|
+
createdAt: Date;
|
|
4781
|
+
updatedAt: Date;
|
|
4782
|
+
};
|
|
4783
|
+
type BillingPeriodStateValue = "closed" | "invoiced";
|
|
4784
|
+
type TimeDraftLineRecord = {
|
|
4785
|
+
id: string;
|
|
4786
|
+
draftId: string;
|
|
4787
|
+
taskId: string;
|
|
4788
|
+
position: number;
|
|
4789
|
+
minutes: number;
|
|
4790
|
+
billable: TimeEntryBillableValue;
|
|
4791
|
+
evidence: string | null;
|
|
4792
|
+
included: boolean;
|
|
4793
|
+
entryId: string | null;
|
|
4794
|
+
};
|
|
4795
|
+
type TimeDraftMessageRecord = {
|
|
4796
|
+
id: string;
|
|
4797
|
+
draftId: string;
|
|
4798
|
+
authorMemberId: string | null;
|
|
4799
|
+
authorType: "user" | "agent" | "system";
|
|
4800
|
+
body: string;
|
|
4801
|
+
createdAt: Date;
|
|
4802
|
+
};
|
|
4803
|
+
type TimeDraftRecord = {
|
|
4804
|
+
id: string;
|
|
4805
|
+
workspaceId: string;
|
|
4806
|
+
memberId: string;
|
|
4807
|
+
teamId: string;
|
|
4808
|
+
agentMemberId: string | null;
|
|
4809
|
+
day: string;
|
|
4810
|
+
state: TimeDraftStateValue;
|
|
4811
|
+
readyAt: Date | null;
|
|
4812
|
+
settledAt: Date | null;
|
|
4813
|
+
createdAt: Date;
|
|
4814
|
+
updatedAt: Date;
|
|
4815
|
+
};
|
|
4816
|
+
type TimeDraftStateValue = "waiting" | "ready" | "logged" | "dismissed";
|
|
4348
4817
|
type FieldTypeValue = "number" | "date" | "text" | "checkbox" | "single_select" | "multi_select" | "people";
|
|
4349
4818
|
type FieldAppliesToValue = "project" | "task";
|
|
4350
4819
|
type NumberFormatValue = "plain" | "currency" | "percent";
|
|
@@ -4477,6 +4946,53 @@ declare class TasqClient {
|
|
|
4477
4946
|
update: (slug: string, input: ActionInputMap["time.update"]) => Promise<DispatchResponse<"time.update">>;
|
|
4478
4947
|
delete: (slug: string, input: ActionInputMap["time.delete"]) => Promise<DispatchResponse<"time.delete">>;
|
|
4479
4948
|
};
|
|
4949
|
+
/**
|
|
4950
|
+
* Clients (initiatives) and their hours. Member-only; refused unless a team
|
|
4951
|
+
* with a project for the client has Client hours on.
|
|
4952
|
+
*/
|
|
4953
|
+
readonly clients: {
|
|
4954
|
+
/**
|
|
4955
|
+
* One month of a client's hours by billable flag, project and person.
|
|
4956
|
+
* `month` is `YYYY-MM`; `billableOnly` counts billable entries only.
|
|
4957
|
+
*/
|
|
4958
|
+
hours: (slug: string, clientId: string, month: string, options?: {
|
|
4959
|
+
billableOnly?: boolean;
|
|
4960
|
+
}) => Promise<ClientHoursResponse>;
|
|
4961
|
+
/** A client's billing months, newest first, with each one's hours and state. */
|
|
4962
|
+
billing: (slug: string, clientId: string) => Promise<ClientBillingResponse>;
|
|
4963
|
+
};
|
|
4964
|
+
/** The caller's own time (TM-2, My week). */
|
|
4965
|
+
readonly me: {
|
|
4966
|
+
/**
|
|
4967
|
+
* The caller's Monday-to-Sunday week around `day` (`YYYY-MM-DD`), that
|
|
4968
|
+
* day's entries, and tasks they worked on that day with no time logged.
|
|
4969
|
+
* `tz` is the IANA zone that decides which edits fall on the day.
|
|
4970
|
+
*/
|
|
4971
|
+
week: (slug: string, day: string, options?: {
|
|
4972
|
+
tz?: string;
|
|
4973
|
+
}) => Promise<MyWeekResponse>;
|
|
4974
|
+
};
|
|
4975
|
+
/**
|
|
4976
|
+
* Agent timesheet drafts (TM-2). The drafting agent reads a draft and the
|
|
4977
|
+
* member's day and saves lines; the member requests, logs, dismisses or
|
|
4978
|
+
* replies. Agent keys are refused the member's side by policy.
|
|
4979
|
+
*/
|
|
4980
|
+
readonly timeDrafts: {
|
|
4981
|
+
get: (slug: string, draftId: string) => Promise<TimeDraftView>;
|
|
4982
|
+
/** The member's week around `day`, read by the agent that drafts it. */
|
|
4983
|
+
memberWeek: (slug: string, memberId: string, day: string) => Promise<MyWeekResponse>;
|
|
4984
|
+
request: (slug: string, input: ActionInputMap["timeDraft.request"]) => Promise<DispatchResponse<"timeDraft.request">>;
|
|
4985
|
+
save: (slug: string, input: ActionInputMap["timeDraft.save"]) => Promise<DispatchResponse<"timeDraft.save">>;
|
|
4986
|
+
confirm: (slug: string, input: ActionInputMap["timeDraft.confirm"]) => Promise<DispatchResponse<"timeDraft.confirm">>;
|
|
4987
|
+
dismiss: (slug: string, input: ActionInputMap["timeDraft.dismiss"]) => Promise<DispatchResponse<"timeDraft.dismiss">>;
|
|
4988
|
+
reply: (slug: string, input: ActionInputMap["timeDraft.reply"]) => Promise<DispatchResponse<"timeDraft.reply">>;
|
|
4989
|
+
};
|
|
4990
|
+
/** Close, invoice and reopen a client's month (admins only). */
|
|
4991
|
+
readonly billingPeriods: {
|
|
4992
|
+
close: (slug: string, input: ActionInputMap["billingPeriod.close"]) => Promise<DispatchResponse<"billingPeriod.close">>;
|
|
4993
|
+
markInvoiced: (slug: string, input: ActionInputMap["billingPeriod.markInvoiced"]) => Promise<DispatchResponse<"billingPeriod.markInvoiced">>;
|
|
4994
|
+
reopen: (slug: string, input: ActionInputMap["billingPeriod.reopen"]) => Promise<DispatchResponse<"billingPeriod.reopen">>;
|
|
4995
|
+
};
|
|
4480
4996
|
readonly projects: {
|
|
4481
4997
|
list: (slug: string) => Promise<ProjectListItem[]>;
|
|
4482
4998
|
get: (slug: string, projectId: string) => Promise<ProjectDetail>;
|
|
@@ -4712,4 +5228,4 @@ declare class TasqPolicyDeniedError extends TasqApiError {
|
|
|
4712
5228
|
constructor(status: number, body: ErrorBody);
|
|
4713
5229
|
}
|
|
4714
5230
|
|
|
4715
|
-
export { AGENT_ISOLATION_VALUES, AGENT_KEY_PREFIX, type ActionInputMap, type ActionName, type ActionWireOutputMap, type ActivityFeedActor, type ActivityFeedItem, type ActivityFeedResponse, type ActivityFeedSubject, type AgentEvent, type AgentEventsQuery, type AgentEventsResponse, type AgentIsolation, type AgentPolicyDetail, type AgentPolicyRecord, type AgentRecord, type CliTokenIssued, type CommentRecord, type CurrentUser, type CycleListFilters, type CycleListItem, type CycleRecord, DURATION_FORMS, type DispatchResponse, type FieldAppliesToValue, type FieldDefinitionItem, type FieldDefinitionRecord, type FieldOptionItem, type FieldOptionRecord, type FieldTypeValue, type FieldValue, type FieldValueItem, type InitiativeListItem, type InitiativeRecord, type InitiativeRef, type InitiativeStatus, type InitiativeStatusValue, type LabelListItem, type LabelRecord, MAX_AGENT_WAKES_PER_MESSAGE, MAX_CONSECUTIVE_AGENT_MESSAGES, type MentionActorRef, type NotificationItem, type NotificationsResponse, type NumberFormatValue, PROJECT_HEALTH_VALUES, type PriorityValue, type ProjectDetail, type ProjectHealth, type ProjectListItem, type ProjectRecord, type ProjectTimePerson, type ProjectTimeResponse, type ProjectUpdateAuthor, type ProjectUpdateListItem, type ProjectUpdatesResponse, RELEASE_CONTEXT_TASK_LIMIT, RELEASE_DISPOSITIONS, RELEASE_NARRATIVE_EXCERPT_MAX, RELEASE_NARRATIVE_MAX, type Release, type ReleaseContext, type ReleaseCounts, type ReleaseDiff, type ReleaseDisposition, type ReleaseNarrativeAuthor, type ReleasePreviousSummary, type ReleaseSummary, type ReleaseTask, SUPPRESSED_REASONS, type StatusCategory, type StatusCategoryValue, type SuppressedReason, THREAD_CONTEXT_ACTIVITY_LIMIT, THREAD_CONTEXT_DESCRIPTION_MAX, THREAD_CONTEXT_MESSAGE_LIMIT, type TaskApproval, type TaskApprovalDecision, type TaskComment, type TaskCreator, type TaskDetail, type TaskListFilters, type TaskListItem, type TaskRecord, type TaskTimeResponse, TasqApiError, type TasqAuth, TasqClient, type TasqClientOptions, TasqPolicyDeniedError, TasqRateLimitError, type TasqRequestOptions, TasqValidationError, type TasqValidationIssue, type TeamAgentSettingsRecord, type TeamAgentSettingsResponse, type TeamDetail, type TeamListItem, type TeamRecord, type TeamStatus, type ThreadContext, type ThreadContextActivity, type ThreadContextEntity, type ThreadContextMessage, type ThreadContextParticipant, type TimeEntryBillable, type TimeEntryBillableValue, type TimeEntryItem, type TimeEntryRecord, type TimeRange, USER_TOKEN_PREFIX, type WaitingApproval, type WaitingDraft, type WaitingResponse, type WakeOutcome, type WorkspaceDetail, type WorkspaceMemberListItem, type WorkspaceSummary, formatMinutes, parseDuration };
|
|
5231
|
+
export { AGENT_ISOLATION_VALUES, AGENT_KEY_PREFIX, type ActionInputMap, type ActionName, type ActionWireOutputMap, type ActivityFeedActor, type ActivityFeedItem, type ActivityFeedResponse, type ActivityFeedSubject, type AgentEvent, type AgentEventsQuery, type AgentEventsResponse, type AgentIsolation, type AgentPolicyDetail, type AgentPolicyRecord, type AgentRecord, type BillableSplit, type BillingPeriodRecord, type BillingPeriodStateValue, type CliTokenIssued, type ClientBillingMonth, type ClientBillingResponse, type ClientHoursPerson, type ClientHoursResponse, type ClientPeriodState, type CommentRecord, type CurrentUser, type CycleListFilters, type CycleListItem, type CycleRecord, DURATION_FORMS, type DispatchResponse, type FieldAppliesToValue, type FieldDefinitionItem, type FieldDefinitionRecord, type FieldOptionItem, type FieldOptionRecord, type FieldTypeValue, type FieldValue, type FieldValueItem, type InitiativeListItem, type InitiativeRecord, type InitiativeRef, type InitiativeStatus, type InitiativeStatusValue, type LabelListItem, type LabelRecord, MAX_AGENT_WAKES_PER_MESSAGE, MAX_CONSECUTIVE_AGENT_MESSAGES, type MentionActorRef, type MyWeekEntry, type MyWeekResponse, type MyWeekUnlogged, type NotificationItem, type NotificationsResponse, type NumberFormatValue, PROJECT_HEALTH_VALUES, type PriorityValue, type ProjectDetail, type ProjectHealth, type ProjectListItem, type ProjectRecord, type ProjectTimePerson, type ProjectTimeResponse, type ProjectUpdateAuthor, type ProjectUpdateListItem, type ProjectUpdatesResponse, RELEASE_CONTEXT_TASK_LIMIT, RELEASE_DISPOSITIONS, RELEASE_NARRATIVE_EXCERPT_MAX, RELEASE_NARRATIVE_MAX, type Release, type ReleaseContext, type ReleaseCounts, type ReleaseDiff, type ReleaseDisposition, type ReleaseNarrativeAuthor, type ReleasePreviousSummary, type ReleaseSummary, type ReleaseTask, SUPPRESSED_REASONS, type StatusCategory, type StatusCategoryValue, type SuppressedReason, THREAD_CONTEXT_ACTIVITY_LIMIT, THREAD_CONTEXT_DESCRIPTION_MAX, THREAD_CONTEXT_MESSAGE_LIMIT, type TaskApproval, type TaskApprovalDecision, type TaskComment, type TaskCreator, type TaskDetail, type TaskListFilters, type TaskListItem, type TaskRecord, type TaskTimeResponse, TasqApiError, type TasqAuth, TasqClient, type TasqClientOptions, TasqPolicyDeniedError, TasqRateLimitError, type TasqRequestOptions, TasqValidationError, type TasqValidationIssue, type TeamAgentSettingsRecord, type TeamAgentSettingsResponse, type TeamDetail, type TeamListItem, type TeamRecord, type TeamStatus, type ThreadContext, type ThreadContextActivity, type ThreadContextEntity, type ThreadContextMessage, type ThreadContextParticipant, type TimeDraftAgent, type TimeDraftLineRecord, type TimeDraftLineView, type TimeDraftMessageRecord, type TimeDraftMessageView, type TimeDraftRecord, type TimeDraftResponse, type TimeDraftStateValue, type TimeDraftView, type TimeEntryBillable, type TimeEntryBillableValue, type TimeEntryItem, type TimeEntryLock, type TimeEntryRecord, type TimeRange, USER_TOKEN_PREFIX, type WaitingApproval, type WaitingDraft, type WaitingResponse, type WakeOutcome, type WorkspaceDetail, type WorkspaceMemberListItem, type WorkspaceSummary, formatMinutes, parseDuration };
|
package/dist/index.js
CHANGED
|
@@ -255,6 +255,62 @@ var TasqClient = class _TasqClient {
|
|
|
255
255
|
update: (slug, input) => this.dispatch("time.update", slug, input),
|
|
256
256
|
delete: (slug, input) => this.dispatch("time.delete", slug, input)
|
|
257
257
|
};
|
|
258
|
+
/**
|
|
259
|
+
* Clients (initiatives) and their hours. Member-only; refused unless a team
|
|
260
|
+
* with a project for the client has Client hours on.
|
|
261
|
+
*/
|
|
262
|
+
clients = {
|
|
263
|
+
/**
|
|
264
|
+
* One month of a client's hours by billable flag, project and person.
|
|
265
|
+
* `month` is `YYYY-MM`; `billableOnly` counts billable entries only.
|
|
266
|
+
*/
|
|
267
|
+
hours: (slug, clientId, month, options = {}) => this.#get(
|
|
268
|
+
`/workspaces/${encodeURIComponent(slug)}/clients/${encodeURIComponent(clientId)}/hours`,
|
|
269
|
+
{ month, billable: options.billableOnly ? "billable" : "all" }
|
|
270
|
+
),
|
|
271
|
+
/** A client's billing months, newest first, with each one's hours and state. */
|
|
272
|
+
billing: (slug, clientId) => this.#get(
|
|
273
|
+
`/workspaces/${encodeURIComponent(slug)}/clients/${encodeURIComponent(clientId)}/billing`
|
|
274
|
+
)
|
|
275
|
+
};
|
|
276
|
+
/** The caller's own time (TM-2, My week). */
|
|
277
|
+
me = {
|
|
278
|
+
/**
|
|
279
|
+
* The caller's Monday-to-Sunday week around `day` (`YYYY-MM-DD`), that
|
|
280
|
+
* day's entries, and tasks they worked on that day with no time logged.
|
|
281
|
+
* `tz` is the IANA zone that decides which edits fall on the day.
|
|
282
|
+
*/
|
|
283
|
+
week: (slug, day, options = {}) => this.#get(
|
|
284
|
+
`/workspaces/${encodeURIComponent(slug)}/me/week`,
|
|
285
|
+
options.tz ? { day, tz: options.tz } : { day }
|
|
286
|
+
)
|
|
287
|
+
};
|
|
288
|
+
/**
|
|
289
|
+
* Agent timesheet drafts (TM-2). The drafting agent reads a draft and the
|
|
290
|
+
* member's day and saves lines; the member requests, logs, dismisses or
|
|
291
|
+
* replies. Agent keys are refused the member's side by policy.
|
|
292
|
+
*/
|
|
293
|
+
timeDrafts = {
|
|
294
|
+
get: async (slug, draftId) => (await this.#get(
|
|
295
|
+
`/workspaces/${encodeURIComponent(slug)}/time-drafts/${encodeURIComponent(draftId)}`
|
|
296
|
+
)).draft,
|
|
297
|
+
/** The member's week around `day`, read by the agent that drafts it. */
|
|
298
|
+
memberWeek: (slug, memberId, day) => this.#get(
|
|
299
|
+
`/workspaces/${encodeURIComponent(slug)}/members/${encodeURIComponent(memberId)}/week`,
|
|
300
|
+
{ day }
|
|
301
|
+
),
|
|
302
|
+
request: (slug, input) => this.dispatch("timeDraft.request", slug, input),
|
|
303
|
+
save: (slug, input) => this.dispatch("timeDraft.save", slug, input),
|
|
304
|
+
confirm: (slug, input) => this.dispatch("timeDraft.confirm", slug, input),
|
|
305
|
+
dismiss: (slug, input) => this.dispatch("timeDraft.dismiss", slug, input),
|
|
306
|
+
reply: (slug, input) => this.dispatch("timeDraft.reply", slug, input)
|
|
307
|
+
};
|
|
308
|
+
/** Close, invoice and reopen a client's month (admins only). */
|
|
309
|
+
billingPeriods = {
|
|
310
|
+
close: (slug, input) => this.dispatch("billingPeriod.close", slug, input),
|
|
311
|
+
markInvoiced: (slug, input) => this.dispatch("billingPeriod.markInvoiced", slug, input),
|
|
312
|
+
reopen: (slug, input) => this.dispatch("billingPeriod.reopen", slug, input)
|
|
313
|
+
};
|
|
258
314
|
projects = {
|
|
259
315
|
list: async (slug) => (await this.#get(
|
|
260
316
|
`/workspaces/${encodeURIComponent(slug)}/projects`
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/prefixes.ts","../src/errors.ts","../src/client.ts","../src/time.ts","../src/types.ts"],"sourcesContent":["/**\n * Token prefixes, duplicated from `@tasq/contracts/agents`.\n *\n * They are re-declared here rather than re-exported because contracts is\n * private: tsup's dts bundler leaves a `@tasq/contracts/agents` import in the\n * emitted `.d.ts`, which a published consumer cannot resolve.\n * `src/prefixes.equality.ts` asserts these stay in step with contracts.\n */\n\n/** Plaintext prefix of an agent API key. */\nexport const AGENT_KEY_PREFIX = \"tq_ag_\";\n\n/** Plaintext prefix of a user (CLI) token. */\nexport const USER_TOKEN_PREFIX = \"tq_us_\";\n","/** Shape of the API's error envelope: `{ error: { code, message, details? } }`. */\ntype ErrorBody = {\n\tcode: string;\n\tmessage: string;\n\tdetails?: unknown;\n};\n\n/** Every failure the client raises for a non-2xx response. */\nexport class TasqApiError extends Error {\n\treadonly code: string;\n\treadonly status: number;\n\treadonly details: unknown;\n\n\tconstructor(status: number, body: ErrorBody) {\n\t\tsuper(body.message);\n\t\tthis.name = \"TasqApiError\";\n\t\tthis.code = body.code;\n\t\tthis.status = status;\n\t\tthis.details = body.details;\n\t}\n}\n\ntype RateLimitDetails = {\n\tlimit?: number;\n\tremaining?: number;\n\tresetAt?: string;\n};\n\n/** A `429 RATE_LIMITED`. `retryAfterSeconds` is never negative. */\nexport class TasqRateLimitError extends TasqApiError {\n\treadonly retryAfterSeconds: number;\n\treadonly resetAt: Date | undefined;\n\treadonly limit: number | undefined;\n\treadonly remaining: number | undefined;\n\n\tconstructor(status: number, body: ErrorBody, retryAfterHeader: string | null) {\n\t\tsuper(status, body);\n\t\tthis.name = \"TasqRateLimitError\";\n\n\t\tconst details = (body.details ?? {}) as RateLimitDetails;\n\n\t\tthis.limit = details.limit;\n\t\tthis.remaining = details.remaining;\n\t\tthis.resetAt =\n\t\t\tdetails.resetAt === undefined ? undefined : new Date(details.resetAt);\n\n\t\tconst fromHeader = Number(retryAfterHeader);\n\n\t\tif (retryAfterHeader !== null && Number.isFinite(fromHeader)) {\n\t\t\tthis.retryAfterSeconds = Math.max(0, fromHeader);\n\t\t} else if (this.resetAt !== undefined) {\n\t\t\tconst ms = this.resetAt.getTime() - Date.now();\n\n\t\t\tthis.retryAfterSeconds = Math.max(0, Math.ceil(ms / 1000));\n\t\t} else {\n\t\t\tthis.retryAfterSeconds = 0;\n\t\t}\n\t}\n}\n\nexport type TasqValidationIssue = {\n\tpath: (string | number)[];\n\tmessage: string;\n};\n\n/** A `400 VALIDATION_ERROR`. `issues` mirrors the API's Zod issue list. */\nexport class TasqValidationError extends TasqApiError {\n\treadonly issues: TasqValidationIssue[];\n\n\tconstructor(status: number, body: ErrorBody) {\n\t\tsuper(status, body);\n\t\tthis.name = \"TasqValidationError\";\n\t\tthis.issues = Array.isArray(body.details)\n\t\t\t? (body.details as TasqValidationIssue[])\n\t\t\t: [];\n\t}\n}\n\n/** A `403 AGENT_ACTION_DENIED`: the agent's policy does not allow the action. */\nexport class TasqPolicyDeniedError extends TasqApiError {\n\t/** The rejected action name, when the API reported one. */\n\treadonly action: string | undefined;\n\t/** The policy version quoted in the message, when the API quoted one. */\n\treadonly policyVersion: number | undefined;\n\n\tconstructor(status: number, body: ErrorBody) {\n\t\tsuper(status, body);\n\t\tthis.name = \"TasqPolicyDeniedError\";\n\t\tthis.action = actionFromDetails(body.details);\n\t\tthis.policyVersion = policyVersionFromMessage(body.message);\n\t}\n}\n\nfunction actionFromDetails(details: ErrorBody[\"details\"]): string | undefined {\n\tif (!Array.isArray(details)) return undefined;\n\n\tconst issues = details as TasqValidationIssue[];\n\n\tfor (const issue of issues) {\n\t\tif (issue.path[0] === \"action\") return issue.message;\n\t}\n\n\treturn undefined;\n}\n\nfunction policyVersionFromMessage(message: string): number | undefined {\n\tconst match = /policy v(?:ersion )?(\\d+)/i.exec(message);\n\n\tif (!match?.[1]) return undefined;\n\n\treturn Number(match[1]);\n}\n\n/**\n * Raised before any request when the client has no credential but the called\n * method needs one. Shaped like an API error so callers map it uniformly.\n */\nexport function noCredentialError(): TasqApiError {\n\treturn new TasqApiError(0, {\n\t\tcode: \"NO_CREDENTIAL\",\n\t\tmessage:\n\t\t\t\"No credential configured. Run `tasq auth login`, or set TASQ_API_KEY.\",\n\t});\n}\n\n/** Build the right error subclass for a failed response. */\nexport function toTasqError(\n\tstatus: number,\n\tbody: ErrorBody,\n\tretryAfterHeader: string | null,\n): TasqApiError {\n\tif (status === 429 || body.code === \"RATE_LIMITED\") {\n\t\treturn new TasqRateLimitError(status, body, retryAfterHeader);\n\t}\n\n\tif (body.code === \"VALIDATION_ERROR\") {\n\t\treturn new TasqValidationError(status, body);\n\t}\n\n\tif (body.code === \"AGENT_ACTION_DENIED\") {\n\t\treturn new TasqPolicyDeniedError(status, body);\n\t}\n\n\treturn new TasqApiError(status, body);\n}\n","import type {\n\tActionInputMap,\n\tActionName,\n\tDispatchResponse,\n} from \"./contracts\";\nimport { AGENT_KEY_PREFIX, USER_TOKEN_PREFIX } from \"./prefixes\";\nimport { noCredentialError, type TasqApiError, toTasqError } from \"./errors\";\nimport type {\n\tActivityFeedResponse,\n\tAgentPolicyDetail,\n\tCliTokenIssued,\n\tCurrentUser,\n\tCycleListFilters,\n\tCycleListItem,\n\tInitiativeListItem,\n\tFieldDefinitionItem,\n\tFieldValue,\n\tLabelListItem,\n\tProjectDetail,\n\tProjectListItem,\n\tProjectTimeResponse,\n\tProjectUpdateListItem,\n\tProjectUpdatesResponse,\n\tRelease,\n\tReleaseContext,\n\tReleaseDiff,\n\tReleaseSummary,\n\tTaskApprovalDecision,\n\tTaskDetail,\n\tTaskListFilters,\n\tTaskListItem,\n\tTaskTimeResponse,\n\tThreadContext,\n\tAgentEventsResponse,\n\tNotificationsResponse,\n\tTeamAgentSettingsResponse,\n\tTeamDetail,\n\tTeamListItem,\n\tTimeRange,\n\tWaitingResponse,\n\tWorkspaceDetail,\n\tWorkspaceMemberListItem,\n\tWorkspaceSummary,\n} from \"./types\";\n\n/** The API's largest page of project updates. */\nconst PROJECT_UPDATES_PAGE_MAX = 100;\n\n/** Either an agent key (`tq_ag_…`) or a user token (`tq_us_…`). */\nexport type TasqAuth = { agentKey: string } | { userToken: string };\n\nexport type TasqClientOptions = {\n\t/** Origin of the API, with or without a trailing slash. `/api` is appended. */\n\tbaseUrl: string;\n\t/**\n\t * Omit to build an anonymous client. Only `auth.requestMagicLink` and\n\t * `auth.verifyCliCode` work without one; everything else throws\n\t * `NO_CREDENTIAL` before reaching the network.\n\t */\n\tauth?: TasqAuth;\n\t/** Injectable for tests and for runtimes with a non-global `fetch`. */\n\tfetch?: typeof fetch;\n};\n\ntype QueryValue = string | number | boolean | undefined;\n\n/** Cancellation and a ceiling, for the calls that can block. */\nexport type TasqRequestOptions = {\n\tsignal?: AbortSignal;\n\ttimeoutMs?: number;\n};\n\nexport type AgentEventsQuery = {\n\t/** Seconds to hold the connection open, 0-25. The server clamps. */\n\twait?: number;\n\t/** Event ids to acknowledge before this poll selects. */\n\tack?: ReadonlyArray<string>;\n\tlimit?: number;\n};\n\nfunction assertPrefix(token: string, prefix: string, label: string): void {\n\tif (!token.startsWith(prefix)) {\n\t\tthrow new Error(\n\t\t\t`Invalid ${label}: expected a token starting with \"${prefix}\".`,\n\t\t);\n\t}\n}\n\nfunction credential(auth: TasqAuth | undefined): string | undefined {\n\tif (auth === undefined) return undefined;\n\n\tif (\"agentKey\" in auth) {\n\t\tassertPrefix(auth.agentKey, AGENT_KEY_PREFIX, \"agent key\");\n\n\t\treturn auth.agentKey;\n\t}\n\n\tassertPrefix(auth.userToken, USER_TOKEN_PREFIX, \"user token\");\n\n\treturn auth.userToken;\n}\n\nfunction normaliseBaseUrl(baseUrl: string): string {\n\treturn `${baseUrl.replace(/\\/+$/, \"\")}/api`;\n}\n\nfunction queryString(params: Record<string, QueryValue> | undefined): string {\n\tif (!params) return \"\";\n\n\tconst search = new URLSearchParams();\n\n\tfor (const [key, value] of Object.entries(params)) {\n\t\tif (value === undefined) continue;\n\n\t\tsearch.set(key, String(value));\n\t}\n\n\tconst encoded = search.toString();\n\n\treturn encoded === \"\" ? \"\" : `?${encoded}`;\n}\n\n/**\n * `releases.context` reads as JSON or as the rendered Markdown prompt; the\n * return type follows `format` rather than widening to a union at every call\n * site.\n */\ntype ReleaseContextRead = {\n\t(\n\t\tslug: string,\n\t\treleaseId: string,\n\t\toptions?: { format?: \"json\" } & TasqRequestOptions,\n\t): Promise<ReleaseContext>;\n\t(\n\t\tslug: string,\n\t\treleaseId: string,\n\t\toptions: { format: \"markdown\" } & TasqRequestOptions,\n\t): Promise<string>;\n};\n\nexport class TasqClient {\n\treadonly #baseUrl: string;\n\treadonly #token: string | undefined;\n\treadonly #fetch: typeof fetch;\n\n\t/** A client with no credential, for the two anonymous auth calls. */\n\tstatic anonymous(baseUrl: string, fetchImpl?: typeof fetch): TasqClient {\n\t\treturn new TasqClient({ baseUrl, fetch: fetchImpl });\n\t}\n\n\tconstructor(options: TasqClientOptions) {\n\t\tthis.#baseUrl = normaliseBaseUrl(options.baseUrl);\n\t\tthis.#token = credential(options.auth);\n\t\tthis.#fetch = options.fetch ?? globalThis.fetch;\n\t}\n\n\tasync #request<T>(\n\t\tpath: string,\n\t\tinit: RequestInit & { anonymous?: boolean; timeoutMs?: number } = {},\n\t): Promise<T> {\n\t\tconst { anonymous = false, timeoutMs, ...requestInit } = init;\n\t\tconst headers = new Headers(requestInit.headers);\n\n\t\tif (!anonymous) {\n\t\t\tif (this.#token === undefined) throw noCredentialError();\n\n\t\t\theaders.set(\"authorization\", `Bearer ${this.#token}`);\n\t\t}\n\n\t\tif (requestInit.body !== undefined && !headers.has(\"content-type\")) {\n\t\t\theaders.set(\"content-type\", \"application/json\");\n\t\t}\n\n\t\theaders.set(\"accept\", \"application/json\");\n\n\t\t// A long poll needs both a caller's cancel (Ctrl-C in the CLI) and a\n\t\t// ceiling of its own. `AbortSignal.any` folds the two into one so the\n\t\t// caller's signal is still what fetch sees when no timeout is asked for.\n\t\tconst timeout =\n\t\t\ttimeoutMs === undefined ? undefined : AbortSignal.timeout(timeoutMs);\n\n\t\tconst signals = [requestInit.signal, timeout].filter(\n\t\t\t(candidate): candidate is AbortSignal => candidate != null,\n\t\t);\n\n\t\tconst signal =\n\t\t\tsignals.length === 0\n\t\t\t\t? undefined\n\t\t\t\t: signals.length === 1\n\t\t\t\t\t? signals[0]\n\t\t\t\t\t: AbortSignal.any(signals);\n\n\t\tconst response = await this.#fetch(`${this.#baseUrl}${path}`, {\n\t\t\t...requestInit,\n\t\t\theaders,\n\t\t\tsignal,\n\t\t});\n\n\t\tif (!response.ok) {\n\t\t\tthrow await this.#toError(response);\n\t\t}\n\n\t\treturn (await response.json()) as T;\n\t}\n\n\t/**\n\t * A read whose body is Markdown rather than JSON.\n\t *\n\t * The export and the `format=markdown` context are documents, not\n\t * envelopes, so they are read as text. Errors still arrive as the JSON\n\t * envelope every other route uses, so the failure path is `#toError`'s,\n\t * unchanged.\n\t */\n\tasync #text(\n\t\tpath: string,\n\t\tparams?: Record<string, QueryValue>,\n\t\toptions?: TasqRequestOptions,\n\t): Promise<string> {\n\t\tconst headers = new Headers({ accept: \"text/markdown\" });\n\n\t\tif (this.#token === undefined) throw noCredentialError();\n\n\t\theaders.set(\"authorization\", `Bearer ${this.#token}`);\n\n\t\tconst timeout =\n\t\t\toptions?.timeoutMs === undefined\n\t\t\t\t? undefined\n\t\t\t\t: AbortSignal.timeout(options.timeoutMs);\n\n\t\tconst signals = [options?.signal, timeout].filter(\n\t\t\t(candidate): candidate is AbortSignal => candidate != null,\n\t\t);\n\n\t\tconst signal =\n\t\t\tsignals.length === 0\n\t\t\t\t? undefined\n\t\t\t\t: signals.length === 1\n\t\t\t\t\t? signals[0]\n\t\t\t\t\t: AbortSignal.any(signals);\n\n\t\tconst response = await this.#fetch(\n\t\t\t`${this.#baseUrl}${path}${queryString(params)}`,\n\t\t\t{ headers, signal },\n\t\t);\n\n\t\tif (!response.ok) throw await this.#toError(response);\n\n\t\treturn await response.text();\n\t}\n\n\tasync #toError(response: Response): Promise<TasqApiError> {\n\t\tconst retryAfter = response.headers.get(\"retry-after\");\n\n\t\tconst fallback = {\n\t\t\tcode: `HTTP_${response.status}`,\n\t\t\tmessage: `Request failed with status ${response.status}`,\n\t\t};\n\n\t\tconst envelope = (await response.json().catch(() => null)) as {\n\t\t\terror?: { code?: string; message?: string; details?: unknown };\n\t\t} | null;\n\n\t\tconst error = envelope?.error;\n\n\t\tconst body =\n\t\t\terror?.code === undefined\n\t\t\t\t? fallback\n\t\t\t\t: {\n\t\t\t\t\t\tcode: error.code,\n\t\t\t\t\t\tmessage: error.message ?? fallback.message,\n\t\t\t\t\t\tdetails: error.details,\n\t\t\t\t\t};\n\n\t\treturn toTasqError(response.status, body, retryAfter);\n\t}\n\n\t#get<T>(\n\t\tpath: string,\n\t\tparams?: Record<string, QueryValue>,\n\t\toptions?: TasqRequestOptions,\n\t): Promise<T> {\n\t\treturn this.#request<T>(`${path}${queryString(params)}`, options);\n\t}\n\n\treadonly workspaces = {\n\t\tlist: async (): Promise<WorkspaceSummary[]> =>\n\t\t\t(await this.#get<{ workspaces: WorkspaceSummary[] }>(\"/workspaces\"))\n\t\t\t\t.workspaces,\n\n\t\tget: async (slug: string): Promise<WorkspaceDetail> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ workspace: WorkspaceDetail }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}`,\n\t\t\t\t)\n\t\t\t).workspace,\n\t};\n\n\treadonly tasks = {\n\t\tlist: async (\n\t\t\tslug: string,\n\t\t\tfilters?: TaskListFilters,\n\t\t): Promise<TaskListItem[]> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ tasks: TaskListItem[] }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/tasks`,\n\t\t\t\t\tfilters,\n\t\t\t\t)\n\t\t\t).tasks,\n\n\t\tget: async (slug: string, taskId: string): Promise<TaskDetail> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ task: TaskDetail }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/tasks/${encodeURIComponent(taskId)}`,\n\t\t\t\t)\n\t\t\t).task,\n\n\t\t/**\n\t\t * Ask a person to sign off on a task (6.3). Asking again while a\n\t\t * request stands replaces the approver. The approver cannot be an agent.\n\t\t */\n\t\trequestApproval: (\n\t\t\tslug: string,\n\t\t\ttaskId: string,\n\t\t\tapproverId: string,\n\t\t): Promise<DispatchResponse<\"task.requestApproval\">> =>\n\t\t\tthis.dispatch(\"task.requestApproval\", slug, { taskId, approverId }),\n\n\t\t/**\n\t\t * The approver's answer (6.3). `approve` also moves the task to the next\n\t\t * status in its team's category order. Person credentials only: no\n\t\t * agent policy can include it.\n\t\t */\n\t\tdecide: (\n\t\t\tslug: string,\n\t\t\ttaskId: string,\n\t\t\tdecision: TaskApprovalDecision,\n\t\t): Promise<DispatchResponse<\"task.decide\">> =>\n\t\t\tthis.dispatch(\"task.decide\", slug, { taskId, decision }),\n\t};\n\n\t/**\n\t * Time tracking: whole minutes on a task for a day, no running timer.\n\t * Everything here is member-level; a guest credential is refused. Turn a\n\t * typed duration into minutes with `parseDuration`.\n\t */\n\treadonly time = {\n\t\t/** A task's entries, newest day first, and its total with direct subtasks. */\n\t\tforTask: (slug: string, taskId: string): Promise<TaskTimeResponse> =>\n\t\t\tthis.#get<TaskTimeResponse>(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/tasks/${encodeURIComponent(taskId)}/time`,\n\t\t\t),\n\n\t\t/**\n\t\t * Time on a project's tasks between two inclusive `YYYY-MM-DD` days, by\n\t\t * person and day. The API reads at most 92 days at a time.\n\t\t */\n\t\tforProject: (\n\t\t\tslug: string,\n\t\t\tprojectId: string,\n\t\t\trange: TimeRange,\n\t\t): Promise<ProjectTimeResponse> =>\n\t\t\tthis.#get<ProjectTimeResponse>(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/projects/${encodeURIComponent(projectId)}/time`,\n\t\t\t\t{ from: range.from, to: range.to },\n\t\t\t),\n\n\t\t/**\n\t\t * Log minutes on a task for a day. `memberId` defaults to the caller;\n\t\t * logging for someone else is an admin's job.\n\t\t */\n\t\tlog: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"time.log\"],\n\t\t): Promise<DispatchResponse<\"time.log\">> =>\n\t\t\tthis.dispatch(\"time.log\", slug, input),\n\n\t\t/** Change an entry; omitted fields are left alone, `note: null` clears it. */\n\t\tupdate: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"time.update\"],\n\t\t): Promise<DispatchResponse<\"time.update\">> =>\n\t\t\tthis.dispatch(\"time.update\", slug, input),\n\n\t\tdelete: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"time.delete\"],\n\t\t): Promise<DispatchResponse<\"time.delete\">> =>\n\t\t\tthis.dispatch(\"time.delete\", slug, input),\n\t};\n\n\treadonly projects = {\n\t\tlist: async (slug: string): Promise<ProjectListItem[]> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ projects: ProjectListItem[] }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/projects`,\n\t\t\t\t)\n\t\t\t).projects,\n\n\t\tget: async (slug: string, projectId: string): Promise<ProjectDetail> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ project: ProjectDetail }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/projects/${encodeURIComponent(projectId)}`,\n\t\t\t\t)\n\t\t\t).project,\n\n\t\t/**\n\t\t * Pin a project to the caller's own sidebar. People only: an agent\n\t\t * key is refused by policy whatever its preset.\n\t\t */\n\t\tstar: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"project.star\"],\n\t\t): Promise<DispatchResponse<\"project.star\">> =>\n\t\t\tthis.dispatch(\"project.star\", slug, input),\n\n\t\tunstar: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"project.unstar\"],\n\t\t): Promise<DispatchResponse<\"project.unstar\">> =>\n\t\t\tthis.dispatch(\"project.unstar\", slug, input),\n\n\t\t/**\n\t\t * Share a project with a guest already in the workspace (6.2). Admins\n\t\t * and the project lead only; an agent key is always refused.\n\t\t */\n\t\tgrantGuest: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"project.grantGuest\"],\n\t\t): Promise<DispatchResponse<\"project.grantGuest\">> =>\n\t\t\tthis.dispatch(\"project.grantGuest\", slug, input),\n\n\t\tsetGuestAccess: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"project.setGuestAccess\"],\n\t\t): Promise<DispatchResponse<\"project.setGuestAccess\">> =>\n\t\t\tthis.dispatch(\"project.setGuestAccess\", slug, input),\n\n\t\trevokeGuest: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"project.revokeGuest\"],\n\t\t): Promise<DispatchResponse<\"project.revokeGuest\">> =>\n\t\t\tthis.dispatch(\"project.revokeGuest\", slug, input),\n\t};\n\n\t/**\n\t * Initiatives group projects across teams. Any member reads them; every\n\t * write is admin-level, so an agent key (always a member) cannot make one.\n\t */\n\treadonly initiatives = {\n\t\tlist: async (slug: string): Promise<InitiativeListItem[]> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ initiatives: InitiativeListItem[] }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/initiatives`,\n\t\t\t\t)\n\t\t\t).initiatives,\n\n\t\tcreate: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"initiative.create\"],\n\t\t): Promise<DispatchResponse<\"initiative.create\">> =>\n\t\t\tthis.dispatch(\"initiative.create\", slug, input),\n\n\t\tupdate: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"initiative.update\"],\n\t\t): Promise<DispatchResponse<\"initiative.update\">> =>\n\t\t\tthis.dispatch(\"initiative.update\", slug, input),\n\n\t\tdelete: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"initiative.delete\"],\n\t\t): Promise<DispatchResponse<\"initiative.delete\">> =>\n\t\t\tthis.dispatch(\"initiative.delete\", slug, input),\n\n\t\tlinkProject: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"initiative.linkProject\"],\n\t\t): Promise<DispatchResponse<\"initiative.linkProject\">> =>\n\t\t\tthis.dispatch(\"initiative.linkProject\", slug, input),\n\n\t\tunlinkProject: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"initiative.unlinkProject\"],\n\t\t): Promise<DispatchResponse<\"initiative.unlinkProject\">> =>\n\t\t\tthis.dispatch(\"initiative.unlinkProject\", slug, input),\n\t};\n\n\t/**\n\t * Project updates: a health call and a body for the project's client (7.5).\n\t *\n\t * `draft` is what an agent calls; an agent's update is always a draft\n\t * whatever it passes. `send` is people only: no agent policy can grant it,\n\t * because nothing an agent drafts goes to a client without a person\n\t * approving it.\n\t */\n\treadonly projectUpdates = {\n\t\t/**\n\t\t * Every update on the project, drafts included, newest first. Follows\n\t\t * `nextCursor` until the last page; use `listPage` for one page.\n\t\t */\n\t\tlist: async (\n\t\t\tslug: string,\n\t\t\tprojectId: string,\n\t\t): Promise<ProjectUpdateListItem[]> => {\n\t\t\tconst updates: ProjectUpdateListItem[] = [];\n\t\t\tlet before: string | undefined;\n\n\t\t\tdo {\n\t\t\t\tconst page = await this.projectUpdates.listPage(slug, projectId, {\n\t\t\t\t\tlimit: PROJECT_UPDATES_PAGE_MAX,\n\t\t\t\t\tbefore,\n\t\t\t\t});\n\n\t\t\t\tupdates.push(...page.updates);\n\t\t\t\tbefore = page.nextCursor ?? undefined;\n\t\t\t} while (before !== undefined);\n\n\t\t\treturn updates;\n\t\t},\n\n\t\t/**\n\t\t * One page of the project's updates, drafts included, newest first; pass\n\t\t * `nextCursor` as `before` for the next. The API returns 20 by default,\n\t\t * at most 100.\n\t\t */\n\t\tlistPage: (\n\t\t\tslug: string,\n\t\t\tprojectId: string,\n\t\t\tquery: { limit?: number; before?: string } = {},\n\t\t): Promise<ProjectUpdatesResponse> =>\n\t\t\tthis.#get<ProjectUpdatesResponse>(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/projects/${encodeURIComponent(projectId)}/updates`,\n\t\t\t\t{ limit: query.limit, before: query.before },\n\t\t\t),\n\n\t\tdraft: (\n\t\t\tslug: string,\n\t\t\tinput: Omit<ActionInputMap[\"projectUpdate.create\"], \"send\">,\n\t\t): Promise<DispatchResponse<\"projectUpdate.create\">> =>\n\t\t\tthis.dispatch(\"projectUpdate.create\", slug, input),\n\n\t\tcreate: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"projectUpdate.create\"],\n\t\t): Promise<DispatchResponse<\"projectUpdate.create\">> =>\n\t\t\tthis.dispatch(\"projectUpdate.create\", slug, input),\n\n\t\tupdate: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"projectUpdate.update\"],\n\t\t): Promise<DispatchResponse<\"projectUpdate.update\">> =>\n\t\t\tthis.dispatch(\"projectUpdate.update\", slug, input),\n\n\t\tsend: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"projectUpdate.send\"],\n\t\t): Promise<DispatchResponse<\"projectUpdate.send\">> =>\n\t\t\tthis.dispatch(\"projectUpdate.send\", slug, input),\n\n\t\tdelete: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"projectUpdate.delete\"],\n\t\t): Promise<DispatchResponse<\"projectUpdate.delete\">> =>\n\t\t\tthis.dispatch(\"projectUpdate.delete\", slug, input),\n\t};\n\n\treadonly threads = {\n\t\t/**\n\t\t * The context bundle for one thread: the entity it hangs off, the\n\t\t * transcript, recent activity, and the participants (D-6).\n\t\t *\n\t\t * Authorized by the entity's own read rule, so a read-only agent may\n\t\t * pull it. Lists are capped per D-8 with `truncated` flags.\n\t\t */\n\t\tcontext: (\n\t\t\tslug: string,\n\t\t\tthreadId: string,\n\t\t\toptions?: TasqRequestOptions,\n\t\t): Promise<ThreadContext> =>\n\t\t\tthis.#get<ThreadContext>(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/threads/${encodeURIComponent(threadId)}/context`,\n\t\t\t\tundefined,\n\t\t\t\toptions,\n\t\t\t),\n\t};\n\n\treadonly cycles = {\n\t\tlist: async (\n\t\t\tslug: string,\n\t\t\tfilters?: CycleListFilters,\n\t\t): Promise<CycleListItem[]> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ cycles: CycleListItem[] }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/cycles`,\n\t\t\t\t\tfilters,\n\t\t\t\t)\n\t\t\t).cycles,\n\n\t};\n\n\treadonly teams = {\n\t\tlist: async (slug: string): Promise<TeamListItem[]> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ teams: TeamListItem[] }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/teams`,\n\t\t\t\t)\n\t\t\t).teams,\n\n\t\t/** The only read that carries a team's statuses. */\n\t\tget: async (slug: string, identifier: string): Promise<TeamDetail> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ team: TeamDetail }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/teams/${encodeURIComponent(identifier)}`,\n\t\t\t\t)\n\t\t\t).team,\n\n\t\t/**\n\t\t * Whether agents on this team may wake each other, plus the loop and\n\t\t * fan-out limits that stand behind the open setting (B-04c D-1).\n\t\t *\n\t\t * Read-only here on purpose: saving the setting is admin-only and web-only\n\t\t * (D-8), so no agent key can reach it.\n\t\t */\n\t\tagentSettings: (\n\t\t\tslug: string,\n\t\t\tidentifier: string,\n\t\t): Promise<TeamAgentSettingsResponse> =>\n\t\t\tthis.#get<TeamAgentSettingsResponse>(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/teams/${encodeURIComponent(identifier)}/agent-settings`,\n\t\t\t),\n\t};\n\n\treadonly labels = {\n\t\tlist: async (slug: string): Promise<LabelListItem[]> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ labels: LabelListItem[] }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/labels`,\n\t\t\t\t)\n\t\t\t).labels,\n\t};\n\n\t/**\n\t * Custom fields (6.4): the workspace library, archived fields included.\n\t * Values are set with `task.setField` and `project.setField`, by field key.\n\t */\n\treadonly fields = {\n\t\tlist: async (slug: string): Promise<FieldDefinitionItem[]> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ fields: FieldDefinitionItem[] }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/fields`,\n\t\t\t\t)\n\t\t\t).fields,\n\n\t\t/** Set a task's value; null, `[]` or `false` clears it. */\n\t\tsetTaskValue: (\n\t\t\tslug: string,\n\t\t\ttaskId: string,\n\t\t\tfieldKey: string,\n\t\t\tvalue: FieldValue,\n\t\t): Promise<DispatchResponse<\"task.setField\">> =>\n\t\t\tthis.dispatch(\"task.setField\", slug, { taskId, fieldKey, value }),\n\n\t\t/** Set a project field's value; null clears it. */\n\t\tsetProjectValue: (\n\t\t\tslug: string,\n\t\t\tprojectId: string,\n\t\t\tfieldKey: string,\n\t\t\tvalue: FieldValue,\n\t\t): Promise<DispatchResponse<\"project.setField\">> =>\n\t\t\tthis.dispatch(\"project.setField\", slug, { projectId, fieldKey, value }),\n\t};\n\n\treadonly agents = {\n\t\tpolicy: (slug: string, agentId: string): Promise<AgentPolicyDetail> =>\n\t\t\tthis.#get<AgentPolicyDetail>(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/agents/${encodeURIComponent(agentId)}/policy`,\n\t\t\t),\n\n\t\t/**\n\t\t * Long-poll for mentions addressed to the agent behind this key.\n\t\t *\n\t\t * The same call acks: ids passed as `ack` are marked before the select\n\t\t * runs, so a runner's next poll is also its acknowledgement of the last\n\t\t * batch (D-5). Agent keys only.\n\t\t */\n\t\tevents: (\n\t\t\tslug: string,\n\t\t\tquery: AgentEventsQuery = {},\n\t\t\toptions?: TasqRequestOptions,\n\t\t): Promise<AgentEventsResponse> =>\n\t\t\tthis.#get<AgentEventsResponse>(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/agents/me/events`,\n\t\t\t\t{\n\t\t\t\t\twait: query.wait,\n\t\t\t\t\tlimit: query.limit,\n\t\t\t\t\tack:\n\t\t\t\t\t\tquery.ack === undefined || query.ack.length === 0\n\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t: query.ack.join(\",\"),\n\t\t\t\t},\n\t\t\t\toptions,\n\t\t\t),\n\t};\n\n\t/**\n\t * Releases: the structural record of a cycle close, and the narrative an\n\t * agent or a person attaches to it (B-04d).\n\t *\n\t * Reads are authorized by the workspace role guard rather than a policy\n\t * action, so a read-only agent may pull the context it needs; the write\n\t * goes through `release.saveNarrative` like every other action.\n\t */\n\treadonly releases = {\n\t\tlist: async (\n\t\t\tslug: string,\n\t\t\tteamIdentifier?: string,\n\t\t): Promise<ReleaseSummary[]> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ releases: ReleaseSummary[] }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/releases`,\n\t\t\t\t\t{ team: teamIdentifier },\n\t\t\t\t)\n\t\t\t).releases,\n\n\t\tget: async (slug: string, releaseId: string): Promise<Release> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ release: Release }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/releases/${encodeURIComponent(releaseId)}`,\n\t\t\t\t)\n\t\t\t).release,\n\n\t\t/**\n\t\t * The context bundle a narrator writes from.\n\t\t *\n\t\t * `format: \"markdown\"` returns the server-rendered prompt as a string,\n\t\t * which is what a harness pastes into a model; the default returns the\n\t\t * bundle, for a runner that branches on the fields itself.\n\t\t */\n\t\tcontext: ((\n\t\t\tslug: string,\n\t\t\treleaseId: string,\n\t\t\toptions: { format?: \"json\" | \"markdown\" } & TasqRequestOptions = {},\n\t\t): Promise<ReleaseContext | string> => {\n\t\t\tconst path = `/workspaces/${encodeURIComponent(slug)}/releases/${encodeURIComponent(releaseId)}/context`;\n\n\t\t\treturn options.format === \"markdown\"\n\t\t\t\t? this.#text(path, { format: \"markdown\" }, options)\n\t\t\t\t: this.#get<ReleaseContext>(path, undefined, options);\n\t\t}) as ReleaseContextRead,\n\n\t\tdiff: async (slug: string, releaseId: string): Promise<ReleaseDiff> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ releaseId: string; diff: ReleaseDiff }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/releases/${encodeURIComponent(releaseId)}/diff`,\n\t\t\t\t)\n\t\t\t).diff,\n\n\t\t/** The release as a Markdown document, the same body the web export serves. */\n\t\texport: (slug: string, releaseId: string): Promise<string> =>\n\t\t\tthis.#text(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/releases/${encodeURIComponent(releaseId)}/export`,\n\t\t\t),\n\n\t\t/** Last write wins; the author and timestamp move with the body (D-3). */\n\t\tsaveNarrative: (\n\t\t\tslug: string,\n\t\t\tinput: { releaseId: string; narrative: string },\n\t\t): Promise<DispatchResponse<\"release.saveNarrative\">> =>\n\t\t\tthis.dispatch(\"release.saveNarrative\", slug, input),\n\t};\n\n\treadonly members = {\n\t\tlist: async (slug: string): Promise<WorkspaceMemberListItem[]> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ members: WorkspaceMemberListItem[] }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/members`,\n\t\t\t\t)\n\t\t\t).members,\n\t};\n\n\treadonly notifications = {\n\t\tlist: (\n\t\t\tslug: string,\n\t\t\tquery: { unread?: boolean } = {},\n\t\t): Promise<NotificationsResponse> =>\n\t\t\tthis.#get<NotificationsResponse>(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/notifications`,\n\t\t\t\t{ unread: query.unread === true ? 1 : undefined },\n\t\t\t),\n\t};\n\n\treadonly activity = {\n\t\t/** The workspace activity feed, newest first; page with `nextCursor`. */\n\t\tlist: (\n\t\t\tslug: string,\n\t\t\tquery: { limit?: number; before?: string } = {},\n\t\t): Promise<ActivityFeedResponse> =>\n\t\t\tthis.#get<ActivityFeedResponse>(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/activity`,\n\t\t\t\t{ limit: query.limit, before: query.before },\n\t\t\t),\n\t};\n\n\treadonly waiting = {\n\t\t/** Approvals and agent drafts waiting on the caller. People only. */\n\t\tget: (slug: string): Promise<WaitingResponse> =>\n\t\t\tthis.#get<WaitingResponse>(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/waiting`,\n\t\t\t),\n\t};\n\n\treadonly auth = {\n\t\t/** The principal behind the current credential. */\n\t\tme: async (): Promise<CurrentUser> =>\n\t\t\t(await this.#get<{ user: CurrentUser }>(\"/auth/me\")).user,\n\n\t\t/** Step one of CLI login: mail a sign-in code. Needs no credential. */\n\t\trequestMagicLink: async (input: { email: string }): Promise<void> => {\n\t\t\tawait this.#request<unknown>(\"/auth/magic-link\", {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tbody: JSON.stringify({ email: input.email }),\n\t\t\t\tanonymous: true,\n\t\t\t});\n\t\t},\n\n\t\t/** Step two: exchange the code for a `tq_us_…` token. Needs no credential. */\n\t\tverifyCliCode: (input: {\n\t\t\temail: string;\n\t\t\tcode: string;\n\t\t\tlabel: string;\n\t\t}): Promise<CliTokenIssued> =>\n\t\t\tthis.#request<CliTokenIssued>(\"/auth/cli/verify-code\", {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tbody: JSON.stringify(input),\n\t\t\t\tanonymous: true,\n\t\t\t}),\n\n\t\t/** Revoke the user token this client authenticates with. */\n\t\trevokeUserToken: async (): Promise<void> => {\n\t\t\tawait this.#request<unknown>(\"/auth/cli/token\", { method: \"DELETE\" });\n\t\t},\n\t};\n\n\t/** Run a write action. The API validates `input`; the SDK does not. */\n\tdispatch<TName extends ActionName>(\n\t\taction: TName,\n\t\tslug: string,\n\t\tinput: ActionInputMap[TName],\n\t): Promise<DispatchResponse<TName>> {\n\t\treturn this.#request<DispatchResponse<TName>>(\n\t\t\t`/workspaces/${encodeURIComponent(slug)}/actions`,\n\t\t\t{ method: \"POST\", body: JSON.stringify({ action, input }) },\n\t\t);\n\t}\n}\n","/**\n * Duration helpers for time tracking, duplicated from `@tasq/contracts/time`.\n *\n * Re-declared rather than re-exported because contracts is private and cannot\n * be published (see `prefixes.ts`). The CLI and the MCP server read durations\n * through these, so `1h 30m` means the same thing there as in the web form.\n * `time.test.ts` runs both copies over the same inputs to keep them in step.\n */\n\n/** The forms `parseDuration` reads, for error messages. */\nexport const DURATION_FORMS = \"1h 30m, 1h30m, 90m, 1.5h, 1:30 or a bare number of hours\";\n\n/**\n * Parse a typed duration into whole minutes, or null when it is not one.\n *\n * Accepts `1h 30m`, `1h30m`, `90m`, `90min`, `1.5h`, `1:30` and a bare number\n * of hours (`2`). Range limits are the action's job; this only reads.\n */\nexport function parseDuration(raw: string): number | null {\n\tconst value = raw.trim().toLowerCase().replace(/\\s+/g, \"\");\n\n\tif (!value) return null;\n\n\tlet match = value.match(/^(\\d{1,2}):([0-5]\\d)$/);\n\n\tif (match) return Number(match[1]) * 60 + Number(match[2]);\n\n\tmatch = value.match(/^(\\d+(?:\\.\\d+)?)h$/);\n\n\tif (match) return Math.round(Number(match[1]) * 60);\n\n\tmatch = value.match(/^(\\d+)m(?:in|ins)?$/);\n\n\tif (match) return Number(match[1]);\n\n\tmatch = value.match(/^(\\d+)h(\\d+)m?(?:in|ins)?$/);\n\n\tif (match) return Number(match[1]) * 60 + Number(match[2]);\n\n\tmatch = value.match(/^(\\d+(?:\\.\\d+)?)$/);\n\n\tif (match) return Math.round(Number(match[1]) * 60);\n\n\treturn null;\n}\n\n/** `90` → `1h 30m`, `60` → `1h`, `45` → `45m`, `0` → `0m`. */\nexport function formatMinutes(minutes: number): string {\n\tconst hours = Math.floor(minutes / 60);\n\tconst rest = minutes % 60;\n\n\tif (hours === 0) return `${rest}m`;\n\n\treturn rest === 0 ? `${hours}h` : `${hours}h ${rest}m`;\n}\n","/**\n * Response shapes for the read routes the client wraps.\n *\n * These are hand-declared rather than re-exported from `AppType`. Deriving\n * them with `InferResponseType` typechecks, but neither tsup's `dts.resolve`\n * nor `tsc --declaration` expands a type alias on emit: the published\n * `.d.ts` kept a live `hono/client` import and a dangling `AppType`\n * reference that no consumer can resolve, and some inferred members (the\n * cycle `status` field) print as an absolute path into `apps/api`.\n *\n * So the shapes live here, and `types.equality.ts` asserts each one is\n * structurally identical to what the route actually returns. A handler\n * change breaks `bun run typecheck`, which is the drift guard the derived\n * version was there to provide.\n *\n * All timestamps are ISO-8601 strings: this is the JSON-serialised form.\n */\n\nimport type {\n\tFieldAppliesToValue,\n\tFieldTypeValue,\n\tNumberFormatValue,\n\tTeamLabels,\n\tTeamModules,\n\tTeamTemplateId,\n\tTeamWords,\n\tTimeEntryBillableValue,\n} from \"./contracts\";\n\nexport type WorkspaceRole = \"owner\" | \"admin\" | \"member\" | \"guest\";\n\nexport type WorkspaceSummary = {\n\tid: string;\n\tname: string;\n\tslug: string;\n\trole: WorkspaceRole;\n\tjoinedAt: string;\n\tcreatedAt: string;\n\tupdatedAt: string;\n};\n\nexport type WorkspaceDetail = {\n\tid: string;\n\tname: string;\n\tslug: string;\n\trole: WorkspaceRole;\n\tcreatedAt: string;\n\tupdatedAt: string;\n};\n\nexport type MemberRef = {\n\tmemberId: string;\n\tname: string | null;\n\temail: string | null;\n};\n\nexport type PersonRef = {\n\tid: string;\n\tname: string | null;\n\temail: string | null;\n};\n\nexport type TaskStatusRef = {\n\tid: string;\n\tname: string;\n\tcolor: string;\n\tcategory: string;\n\tposition: number;\n};\n\nexport type TaskLabelRef = {\n\tid: string;\n\tname: string;\n\tcolor: string;\n};\n\nexport type TaskListItem = {\n\tid: string;\n\tidentifier: string;\n\tnumber: number;\n\ttitle: string;\n\tpriority: string;\n\testimateValue: number | null;\n\testimateSettingsRevisionId: string | null;\n\tsortOrder: number;\n\tarchivedAt: string | null;\n\tcreatedAt: string;\n\tupdatedAt: string;\n\tteamId: string;\n\tteamIdentifier: string;\n\tteamModules: TeamModules;\n\tprojectId: string | null;\n\tmilestoneId: string | null;\n\t/** 5.5: the task this is a subtask of, one level only (D-2). */\n\tparentTaskId: string | null;\n\t/** The parent's key, so a subtask shown away from its parent can name it. */\n\tparentIdentifier: string | null;\n\t/**\n\t * 5.5: how many subtasks this task has and how many are done, the `n/m` a\n\t * client shows. Cancelled and archived subtasks are in neither number.\n\t */\n\tsubtaskProgress: SubtaskProgress;\n\tcycleId: string | null;\n\t/** All-day `YYYY-MM-DD` dates, never instants (D-5). */\n\tdueDate: string | null;\n\tstartDate: string | null;\n\tstatus: TaskStatusRef;\n\tassignee: MemberRef | null;\n\t/** 6.3: where a sign-off stands; null until someone asks for one. */\n\tapproval: TaskApproval | null;\n\t/** Who created the task; null when that member has since been removed. */\n\tcreator: TaskCreator | null;\n\tlabels: TaskLabelRef[];\n\t/** Minutes logged on this task and its direct subtasks; zero when none. */\n\tloggedMinutes: number;\n\t/** 6.4: custom field values the task holds; an empty field is absent. */\n\tfieldValues: FieldValueItem[];\n};\n\nexport type TaskCreator = {\n\tmemberId: string;\n\tname: string | null;\n\tkind: \"user\" | \"agent\";\n};\n\n/**\n * A task's approval (6.3). `approver` is null when the person asked has since\n * left the workspace; the request still stands.\n */\nexport type TaskApproval = {\n\tstate: \"requested\" | \"approved\" | \"changes_requested\" | \"rejected\";\n\tapprover: { memberId: string; name: string | null } | null;\n\trequestedAt: string | null;\n\tdecidedAt: string | null;\n};\n\n/** What `task.decide` takes: approve, ask for changes, or reject. */\nexport type TaskApprovalDecision = \"approve\" | \"changes\" | \"reject\";\n\n/**\n * Time tracking. An entry is a person, a task, a day and whole minutes; there\n * is no running timer. Logging, editing and deleting are member-level actions\n * (`time.log`, `time.update`, `time.delete`); guests can neither log nor read.\n */\nexport type TimeEntryBillable = TimeEntryBillableValue;\n\n/** One entry as `GET /tasks/:taskId/time` lists it. */\nexport type TimeEntryItem = {\n\tid: string;\n\ttaskId: string;\n\t/** Who did the work; null once that member has left the workspace. */\n\tmember: { memberId: string; name: string | null; kind: \"user\" | \"agent\" } | null;\n\t/** All-day `YYYY-MM-DD`, never an instant (D-5). */\n\tspentOn: string;\n\tminutes: number;\n\tnote: string | null;\n\tbillable: TimeEntryBillable;\n\t/** Whether the caller may edit or delete it: theirs, written by them, or an admin. */\n\tcanChange: boolean;\n};\n\n/** `GET /workspaces/:slug/tasks/:taskId/time`. */\nexport type TaskTimeResponse = {\n\ttaskId: string;\n\t/** Own entries plus every direct subtask's: the task row's `loggedMinutes`. */\n\ttotalMinutes: number;\n\townMinutes: number;\n\t/** Newest day first. */\n\tentries: TimeEntryItem[];\n\t/** Direct subtasks with time logged on them, by number. */\n\tsubtasks: Array<{\n\t\ttaskId: string;\n\t\tidentifier: string;\n\t\ttitle: string;\n\t\tminutes: number;\n\t}>;\n};\n\nexport type ProjectTimePerson = {\n\t/** Null for time logged by members who have since left. */\n\tmemberId: string | null;\n\tname: string | null;\n\tkind: \"user\" | \"agent\" | null;\n\ttotalMinutes: number;\n\t/** Minutes per `YYYY-MM-DD`; days with nothing logged are absent. */\n\tbyDay: Record<string, number>;\n};\n\n/** `GET /workspaces/:slug/projects/:projectId/time?from=&to=`. */\nexport type ProjectTimeResponse = {\n\tprojectId: string;\n\tfrom: string;\n\tto: string;\n\ttotalMinutes: number;\n\t/** Most time first. */\n\tpeople: ProjectTimePerson[];\n\t/** Oldest day first, capped; `truncated` says when the range held more. */\n\tentries: Array<{\n\t\tid: string;\n\t\ttaskId: string;\n\t\tidentifier: string;\n\t\ttaskTitle: string;\n\t\tmemberId: string | null;\n\t\tmemberName: string | null;\n\t\tspentOn: string;\n\t\tminutes: number;\n\t\tnote: string | null;\n\t\tbillable: TimeEntryBillable;\n\t}>;\n\ttruncated: boolean;\n};\n\n/** A project time report's range: inclusive `YYYY-MM-DD` days, at most 92. */\nexport type TimeRange = { from: string; to: string };\n\nexport type SubtaskProgress = { total: number; completed: number };\n\nexport type NamedRef = { id: string; name: string };\n\nexport type TaskComment = {\n\tid: string;\n\tbody: string;\n\t/** The comment this one replies to. One level of threading only (D-3). */\n\tparentId: string | null;\n\tcreatedAt: string;\n\tupdatedAt: string;\n\t/** Null when the author's membership is gone. */\n\tauthorType: \"user\" | \"agent\" | null;\n\tmentions: Array<{ agentId: string; name: string | null }>;\n\tauthor: MemberRef | null;\n};\n\nexport type TaskActivityEntry = {\n\tid: string;\n\taction: string;\n\tfieldChanged: string | null;\n\toldValue: string | null;\n\tnewValue: string | null;\n\tcreatedAt: string;\n\tactorType: \"user\" | \"agent\" | \"system\";\n\tactor: MemberRef | null;\n};\n\nexport type EstimateScale = \"fibonacci\" | \"linear\";\n\nexport type TaskEstimateEditing =\n\t| {\n\t\t\tenabled: true;\n\t\t\tscale: EstimateScale;\n\t\t\tvalues: number[];\n\t\t\trevisionId: string;\n\t\t\tepoch: string;\n\t\t}\n\t| { enabled: false };\n\n/** A TipTap JSON document. Kept opaque so no editor types reach consumers. */\n/** A JSON value carried by a description node attribute. */\nexport type DescriptionAttrValue =\n\t| string\n\t| number\n\t| boolean\n\t| null\n\t| DescriptionAttrValue[]\n\t| { [key: string]: DescriptionAttrValue };\n\nexport type DescriptionAttrs = { [key: string]: DescriptionAttrValue };\n\nexport type DescriptionMark = { type: string; attrs?: DescriptionAttrs };\n\nexport type DescriptionNode = {\n\ttype?: string;\n\ttext?: string;\n\tattrs?: DescriptionAttrs;\n\tmarks?: DescriptionMark[];\n\tcontent?: DescriptionNode[];\n};\n\nexport type DescriptionDocumentJson = {\n\tversion: 1;\n\tcontent: DescriptionNode;\n};\n\nexport type TaskDetail = TaskListItem & {\n\tdescription: string | null;\n\tdescriptionDocument: DescriptionDocumentJson | null;\n\tdescriptionMarkdown: string | null;\n\testimateEditing: TaskEstimateEditing;\n\tproject: NamedRef | null;\n\tmilestone: NamedRef | null;\n\tcycle: NamedRef | null;\n\t/** 5.5: this task's subtasks, unarchived, oldest first. */\n\tsubtasks: TaskListItem[];\n\t/** 5.5: set when this task is itself a subtask. */\n\tparent: { id: string; identifier: string; title: string } | null;\n\tcomments: TaskComment[];\n\tactivityLog: TaskActivityEntry[];\n\t/** 6.2: the reader's access to the task's project; null for members. */\n\tviewerAccess: ProjectAccess | null;\n};\n\nexport type TaskCounts = {\n\tbacklog: number;\n\tunstarted: number;\n\tstarted: number;\n\tcompleted: number;\n\tcancelled: number;\n\ttotal: number;\n};\n\nexport type EffortByTeam = {\n\tteamId: string;\n\tteamIdentifier: string;\n\tmode: \"count\" | \"effort\";\n\tscale: EstimateScale | null;\n\tpoints: number;\n\tunestimatedTasks: number;\n};\n\nexport type TeamRef = { id: string; name: string; identifier: string };\n\nexport type ProjectStatus =\n\t| \"backlog\"\n\t| \"planned\"\n\t| \"in_progress\"\n\t| \"completed\"\n\t| \"cancelled\";\n\n/** A project's health, as called by its latest sent update (7.5). */\nexport const PROJECT_HEALTH_VALUES = [\n\t\"on_track\",\n\t\"at_risk\",\n\t\"off_track\",\n] as const;\n\nexport type ProjectHealth = (typeof PROJECT_HEALTH_VALUES)[number];\n\nexport type ProjectListItem = {\n\tid: string;\n\tworkspaceId: string;\n\tname: string;\n\tdescription: string | null;\n\tstatus: ProjectStatus;\n\tstartDate: string | null;\n\ttargetDate: string | null;\n\tleadId: string | null;\n\tarchivedAt: string | null;\n\tcreatedAt: string;\n\tupdatedAt: string;\n\ttaskCounts: TaskCounts;\n\tcompletionPercentage: number;\n\teffortByTeam: EffortByTeam[];\n\tteams: TeamRef[];\n\tlead: PersonRef | null;\n\tmembers: PersonRef[];\n\t/** Null until a project update has been sent. Drafts never move it. */\n\thealth: ProjectHealth | null;\n\t/** When the latest sent update went out. */\n\tlatestUpdateAt: string | null;\n\t/** Whether the calling member starred it. Always false for an agent key. */\n\tstarred: boolean;\n\t/** Active initiatives the project belongs to, by name. */\n\tinitiatives: InitiativeRef[];\n\t/** 6.2: how many guests the project is shared with. */\n\tguestCount: number;\n\t/** 6.2: the reader's access when they are a guest; null for members. */\n\tviewerAccess: ProjectAccess | null;\n\t/** 6.4: project field values; an empty field is absent. */\n\tfieldValues: FieldValueItem[];\n};\n\n/** What a guest may do on a project they are shared on (6.2 GU-1). */\nexport type ProjectAccess = \"view\" | \"comment\";\n\nexport type InitiativeRef = { id: string; name: string };\n\nexport type InitiativeStatus = \"active\" | \"archived\";\n\n/** One row of `GET /workspaces/:slug/initiatives`, archived ones included. */\nexport type InitiativeListItem = {\n\tid: string;\n\tname: string;\n\tstatus: InitiativeStatus;\n\townerMemberId: string | null;\n\tprojectIds: string[];\n\tcreatedAt: string;\n};\n\nexport type ProjectMilestone = {\n\tid: string;\n\tname: string;\n\tdescription: string | null;\n\ttargetDate: string | null;\n\tposition: number;\n\ttaskCounts: TaskCounts;\n\tcompletionPercentage: number;\n\tisCurrent: boolean;\n\teffortByTeam: EffortByTeam[];\n};\n\nexport type ProjectDetail = ProjectListItem & {\n\tmilestones: ProjectMilestone[];\n\ttasks: TaskListItem[];\n\t/** Project threads, same shape as task detail comments (D-2). */\n\tcomments: TaskComment[];\n};\n\n/** Who wrote a project update. Null once the author has left. */\nexport type ProjectUpdateAuthor = {\n\tmemberId: string;\n\tname: string;\n\tkind: \"user\" | \"agent\";\n};\n\n/** One row of `GET /workspaces/:slug/projects/:projectId/updates`, newest first. */\nexport type ProjectUpdateListItem = {\n\tid: string;\n\tprojectId: string;\n\thealth: ProjectHealth;\n\tbody: string;\n\tauthor: ProjectUpdateAuthor | null;\n\tactorType: \"user\" | \"agent\";\n\t/** Null while the update is a draft. */\n\tsentAt: string | null;\n\tcreatedAt: string;\n\tupdatedAt: string;\n};\n\n/** `GET /workspaces/:slug/projects/:projectId/updates`, newest first. */\nexport type ProjectUpdatesResponse = {\n\tupdates: ProjectUpdateListItem[];\n\t/** Pass as `before` for the next page; null on the last page. */\n\tnextCursor: string | null;\n};\n\nexport type CycleState = \"upcoming\" | \"active\" | \"completed\";\n\nexport type CycleListItem = {\n\tid: string;\n\tteamId: string;\n\tteamIdentifier: string;\n\tteamName: string;\n\tname: string;\n\tdescription: string | null;\n\tstartDate: string;\n\tendDate: string;\n\tdateConvention: \"legacy\" | \"exclusive\";\n\tsource: \"legacy\" | \"generated\" | \"override\";\n\tcadenceRevisionId: string | null;\n\tcadenceSequence: number | null;\n\tcadenceTimezone: string | null;\n\tstatus: CycleState;\n\tstate: CycleState;\n\tlegacyStatus: \"upcoming\" | \"active\" | \"completed\";\n\tstateSource: \"transition_markers\" | \"planned_dates\";\n\tstartedAt: string | null;\n\tcontractFrozenAt: string | null;\n\tclosedAt: string | null;\n\treportMode: \"count\" | \"effort\";\n\treportEffectiveStartedAt: string;\n\treportingContractState: \"frozen\" | \"derived\" | \"provisional\";\n\testimateSettingsRevisionId: string | null;\n\testimateScale: EstimateScale | null;\n\testimateEpoch: string | null;\n\thistoryObservedSince: string;\n\thistoryComplete: boolean;\n\thistoryCoverage: { level: \"partial\" | \"complete\"; observedSince: string };\n\ttaskCounts: TaskCounts;\n\tcompletionPercentage: number;\n\teffort?: { readonly points: number; readonly unestimatedTasks: number };\n\tcreatedAt: string;\n\tupdatedAt: string;\n};\n\nexport type TeamListItem = {\n\tid: string;\n\tworkspaceId: string;\n\tname: string;\n\tidentifier: string;\n\tmodules: TeamModules;\n\twords: TeamWords;\n\tstartedFrom: TeamTemplateId | null;\n\tlabels: TeamLabels;\n\tmemberCount: number;\n\tcreatedAt: string;\n\tupdatedAt: string;\n};\n\nexport type StatusCategory =\n\t| \"backlog\"\n\t| \"unstarted\"\n\t| \"started\"\n\t| \"completed\"\n\t| \"cancelled\";\n\nexport type TeamStatus = {\n\tid: string;\n\tname: string;\n\tcolor: string;\n\tposition: number;\n\tcategory: StatusCategory;\n};\n\n/** `GET /workspaces/:slug/teams/:identifier` — the only read with statuses. */\nexport type TeamDetail = {\n\tid: string;\n\tworkspaceId: string;\n\tname: string;\n\tidentifier: string;\n\tmodules: TeamModules;\n\twords: TeamWords;\n\tstartedFrom: TeamTemplateId | null;\n\tlabels: TeamLabels;\n\tcreatedAt: string;\n\tupdatedAt: string;\n\tstatuses: TeamStatus[];\n};\n\n/**\n * Custom fields (6.4). A value as the API carries it: text and `YYYY-MM-DD`\n * dates are strings, numbers are numbers, a checkbox is `true`, a\n * single-select is one option id, a multi-select or people field is a list\n * of option or member ids. Null is no value.\n */\nexport type FieldValue = string | number | boolean | string[] | null;\n\nexport type FieldValueItem = { fieldId: string; value: FieldValue };\n\nexport type FieldOptionItem = {\n\tid: string;\n\tname: string;\n\tcolor: string;\n\tposition: number;\n\tarchivedAt: string | null;\n};\n\n/** One field in the workspace library, from `GET /workspaces/:slug/fields`. */\nexport type FieldDefinitionItem = {\n\tid: string;\n\t/** Stable once created: the CLI, agents and `?fields=` filters use it. */\n\tkey: string;\n\tname: string;\n\tdescription: string | null;\n\ttype: FieldTypeValue;\n\tappliesTo: FieldAppliesToValue;\n\tnumberFormat: NumberFormatValue | null;\n\tprecision: number | null;\n\tcurrencyCode: string | null;\n\tvisibleToGuests: boolean;\n\tarchivedAt: string | null;\n\toptions: FieldOptionItem[];\n\t/** Teams that switched this task field on, in their order. */\n\tteams: Array<{ teamId: string; position: number }>;\n\t/** How many tasks or projects hold a value. Absent for a guest. */\n\tvalueCount?: number;\n};\n\nexport type LabelListItem = {\n\tid: string;\n\tworkspaceId: string;\n\tname: string;\n\tcolor: string;\n\tcreatedAt: string;\n\tupdatedAt: string;\n};\n\nexport type AgentPolicyPresetName = \"read_only\" | \"triage\" | \"full\" | \"custom\";\n\nexport type AgentPolicyDetail = {\n\tpolicy: {\n\t\tid: string;\n\t\tversion: number;\n\t\tpreset: AgentPolicyPresetName;\n\t\tallowedActions: string[];\n\t};\n\tallowable: string[];\n\thistory: {\n\t\tversion: number;\n\t\tpreset: AgentPolicyPresetName;\n\t\tcreatedAt: string;\n\t\tcreatedByName: string | null;\n\t}[];\n};\n\nexport type CurrentUser = {\n\tid: string;\n\temail: string;\n\tname: string | null;\n\tavatarUrl: string | null;\n\tcreatedAt: string;\n};\n\n/** Filters accepted by `GET /workspaces/:slug/tasks`. */\nexport type TaskListFilters = {\n\tteam?: string;\n\tstatus?: string;\n\tassignee?: string;\n\tpriority?: string;\n\tproject?: string;\n\tcycle?: string;\n\t/** `overdue`, `today`, `week`, or `none` for tasks with no due date. */\n\tdue?: string;\n\t/**\n\t * `due` orders by due date, dated tasks first; `field:<key>` or\n\t * `field:<key>:desc` orders by a number, date or text field (6.4).\n\t */\n\tsort?: string;\n\t/**\n\t * Custom field filters (6.4): `key:op:value` joined by `;`, where op is\n\t * `is`, `gt`, `lt`, `set` or `empty`, e.g. `budget:gt:1000;channel:is:Email`.\n\t */\n\tfields?: string;\n\tq?: string;\n\tincludeArchived?: boolean;\n};\n\n/** Filters accepted by `GET /workspaces/:slug/cycles`. */\nexport type CycleListFilters = {\n\tteam?: string;\n};\n\n/** `POST /auth/cli/verify-code` response. */\nexport type CliTokenIssued = {\n\ttoken: string;\n\texpiresAt: string;\n\tuser: { id: string; email: string; name: string | null };\n};\n\n/** Who wrote the comment behind an event or a notification. */\nexport type MentionActorRef = {\n\tmemberId: string;\n\ttype: \"user\" | \"agent\";\n\tname: string | null;\n};\n\n/**\n * One row of `GET /workspaces/:slug/agents/me/events`.\n *\n * `mention` is a request addressed to the agent; `thread_message` is a later\n * human message in a thread the agent already joined (D-4). Ids only (D-6):\n * every read from these ids passes the policy layer.\n */\nexport type AgentEvent = {\n\tid: string;\n\tkind: \"mention\" | \"thread_message\" | \"cycle_closed\";\n\tworkspace: string;\n\t/** Exactly one of `taskId` / `projectId` is set: the entity the thread is on. */\n\ttaskId: string | null;\n\ttaskKey: string | null;\n\tprojectId: string | null;\n\t/** The thread the comment belongs to: the root comment's id (D-1). */\n\tthreadId: string | null;\n\tcommentId: string | null;\n\t/** Set only on `cycle_closed`: the release to narrate (B-04d D-2). */\n\treleaseId: string | null;\n\tmentionedBy: MentionActorRef | null;\n\tdeliveryCount: number;\n\tcreatedAt: string;\n};\n\n/** `GET /workspaces/:slug/agents/me/events` */\nexport type AgentEventsResponse = {\n\tevents: AgentEvent[];\n\tacked: string[];\n};\n\n/**\n * One row of `GET /workspaces/:slug/notifications`.\n *\n * `agent_reply` is a direct reply to the human's own message; `thread_reply`\n * is an agent message in a thread the human participates in (D-9).\n */\nexport type NotificationItem = {\n\tid: string;\n\tkind:\n\t\t| \"agent_reply\"\n\t\t| \"thread_reply\"\n\t\t| \"release_ready\"\n\t\t| \"approval_requested\"\n\t\t| \"approval_decided\"\n\t\t| \"assigned\"\n\t\t| \"mentioned\"\n\t\t| \"due_soon\";\n\t/** Exactly one of `taskId` / `projectId` is set: the entity the thread is on. */\n\ttaskId: string | null;\n\ttaskKey: string | null;\n\t/** The task's title when `taskId` is set. */\n\ttaskTitle: string | null;\n\tprojectId: string | null;\n\t/** Name of the project a project thread is on; null for a task thread. */\n\tprojectName: string | null;\n\t/** The thread the comment belongs to: the root comment's id (D-1). */\n\tthreadId: string | null;\n\tcommentId: string | null;\n\t/** The linked comment as plain text, ~200 characters cut on a word. */\n\texcerpt: string | null;\n\t/** Set only on `approval_decided`: the decision that row announced. */\n\tdecision: \"approved\" | \"changes_requested\" | \"rejected\" | null;\n\t/** Set only on `due_soon`: the due date (`YYYY-MM-DD`) the row was written for. */\n\tdueDate: string | null;\n\t/** Set only on `release_ready`: the release and how to name it (B-04d D-1). */\n\treleaseId: string | null;\n\treleaseNumber: number | null;\n\treleaseTeamIdentifier: string | null;\n\tactor: MentionActorRef | null;\n\treadAt: string | null;\n\tcreatedAt: string;\n};\n\n/** `GET /workspaces/:slug/notifications` */\nexport type NotificationsResponse = {\n\tnotifications: NotificationItem[];\n\tunreadCount: number;\n};\n\n/** Who did something in the workspace activity feed. */\nexport type ActivityFeedActor = {\n\tmemberId: string | null;\n\tname: string;\n\tkind: \"user\" | \"agent\" | \"system\";\n};\n\n/** What an activity feed row is about. `key` is the task key on a task. */\nexport type ActivityFeedSubject = {\n\ttype: \"task\" | \"project\" | \"initiative\" | \"project_update\" | \"team\" | \"other\";\n\tid: string;\n\tkey: string | null;\n\ttitle: string;\n\tprojectId: string | null;\n};\n\n/**\n * One row of `GET /workspaces/:slug/activity`. `summary` is a verb phrase\n * with neither actor nor subject, so a row reads \"{actor} {summary} {subject}\".\n */\nexport type ActivityFeedItem = {\n\t/** `a:<activity id>` or `e:<event id>`. */\n\tid: string;\n\toccurredAt: string;\n\tactor: ActivityFeedActor;\n\tsummary: string;\n\tsubject: ActivityFeedSubject;\n};\n\n/** `GET /workspaces/:slug/activity`, newest first. */\nexport type ActivityFeedResponse = {\n\titems: ActivityFeedItem[];\n\tnextCursor: string | null;\n};\n\n/** An approval asked of the caller. */\nexport type WaitingApproval = {\n\ttaskId: string;\n\ttaskKey: string;\n\ttitle: string;\n\tprojectId: string | null;\n\tprojectName: string | null;\n\trequestedAt: string | null;\n\trequestedBy: {\n\t\tmemberId: string;\n\t\tname: string;\n\t\tkind: \"user\" | \"agent\";\n\t} | null;\n};\n\n/** An unsent agent draft on a project the caller leads. */\nexport type WaitingDraft = {\n\tupdateId: string;\n\tprojectId: string;\n\tprojectName: string;\n\thealth: ProjectHealth;\n\tbodyExcerpt: string;\n\tauthor: { memberId: string; name: string; kind: \"agent\" };\n\tcreatedAt: string;\n};\n\n/** `GET /workspaces/:slug/waiting` — people only. */\nexport type WaitingResponse = {\n\tapprovals: WaitingApproval[];\n\tdrafts: WaitingDraft[];\n\t/** Unsent agent-authored updates across the workspace, by agent member id. */\n\tdraftsByAgent: Record<string, number>;\n};\n\n/**\n * One row of `GET /workspaces/:slug/members`, narrowed to what the CLI needs\n * to turn an `--mention <name>` into an agent id. The route returns more per\n * agent (policy, keys); those members are left off deliberately so the SDK\n * does not promise a shape the CLI never reads.\n */\nexport type WorkspaceMemberListItem = {\n\tid: string;\n\tagentId: string | null;\n\ttype: \"user\" | \"agent\";\n\tname: string | null;\n\temail: string | null;\n\trole: \"owner\" | \"admin\" | \"member\" | \"guest\";\n};\n\n// ---------------------------------------------------------------------------\n// Thread context (B-04 slice 2, D-6/D-8).\n// ---------------------------------------------------------------------------\n\n/** Last N messages returned in a thread transcript (D-8). */\nexport const THREAD_CONTEXT_MESSAGE_LIMIT = 50;\n\n/** Last N activity rows returned for the entity (D-8). */\nexport const THREAD_CONTEXT_ACTIVITY_LIMIT = 20;\n\n/** Entity description is cut at this many characters (D-8). */\nexport const THREAD_CONTEXT_DESCRIPTION_MAX = 8000;\n\nexport type ThreadContextEntity =\n\t| {\n\t\t\ttype: \"task\";\n\t\t\tid: string;\n\t\t\t/** The human task key, e.g. `ENG-248`. */\n\t\t\tkey: string | null;\n\t\t\ttitle: string;\n\t\t\tstatus: string | null;\n\t\t\tdescription: string | null;\n\t\t\tdescriptionTruncated: boolean;\n\t\t\tproject: { id: string; name: string } | null;\n\t\t}\n\t| {\n\t\t\ttype: \"project\";\n\t\t\tid: string;\n\t\t\tkey: null;\n\t\t\ttitle: string;\n\t\t\tstatus: string | null;\n\t\t\tdescription: string | null;\n\t\t\tdescriptionTruncated: boolean;\n\t\t\tteams: Array<{ id: string; identifier: string; name: string }>;\n\t\t};\n\nexport type ThreadContextMessage = {\n\tid: string;\n\tauthorType: \"user\" | \"agent\" | null;\n\tauthorName: string | null;\n\tbody: string;\n\tcreatedAt: string;\n};\n\nexport type ThreadContextActivity = {\n\tid: string;\n\tkind: string;\n\tactorName: string | null;\n\tsummary: string;\n\tcreatedAt: string;\n};\n\nexport type ThreadContextParticipant = {\n\tmemberId: string;\n\ttype: \"user\" | \"agent\";\n\tname: string | null;\n\tjoinedVia: \"author\" | \"mention\";\n};\n\n/** `GET /workspaces/:slug/threads/:threadId/context` */\nexport type ThreadContext = {\n\tthreadId: string;\n\tentity: ThreadContextEntity;\n\tthread: {\n\t\t/** Oldest first, capped at `THREAD_CONTEXT_MESSAGE_LIMIT`. */\n\t\tmessages: Array<ThreadContextMessage>;\n\t\t/** Messages in the thread, including any the cap dropped. */\n\t\ttotal: number;\n\t\ttruncated: boolean;\n\t};\n\trecentActivity: Array<ThreadContextActivity>;\n\tparticipants: Array<ThreadContextParticipant>;\n};\n\n// ---------------------------------------------------------------------------\n// Agent isolation and loop safety (B-04c, D-1/D-4/D-5/D-6).\n// ---------------------------------------------------------------------------\n\n/** Whether agents on a team may wake each other. No setting means `isolated`. */\nexport const AGENT_ISOLATION_VALUES = [\"isolated\", \"open\"] as const;\n\nexport type AgentIsolation = (typeof AGENT_ISOLATION_VALUES)[number];\n\n/**\n * Why a wake was recorded `suppressed` instead of delivered. Precedence when\n * several apply: `isolation` > `loop_cap` > `fanout_cap`.\n */\nexport const SUPPRESSED_REASONS = [\n\t\"isolation\",\n\t\"fanout_cap\",\n\t\"loop_cap\",\n\t\"guest_actor\",\n] as const;\n\nexport type SuppressedReason = (typeof SUPPRESSED_REASONS)[number];\n\n/** One message wakes at most this many agents (D-4). */\nexport const MAX_AGENT_WAKES_PER_MESSAGE = 10;\n\n/**\n * A thread stops waking agents after this many agent messages in a row\n * without a person posting (D-5).\n */\nexport const MAX_CONSECUTIVE_AGENT_MESSAGES = 5;\n\n/**\n * One agent's outcome for a message, as `comment.add` reports it. `reason` is\n * null exactly when the wake is `pending`.\n */\nexport type WakeOutcome = {\n\tagentId: string;\n\tstate: \"pending\" | \"suppressed\";\n\treason: SuppressedReason | null;\n};\n\n/** The stored current setting for a team; absent until somebody saves one. */\nexport type TeamAgentSettingsRecord = {\n\tteamId: string;\n\tcurrentRevisionId: string;\n\trevision: number;\n\tisolation: AgentIsolation;\n\t/** The agent woken on a cycle close, if any (B-04d D-2). */\n\treleaseNarratorMemberId: string | null;\n\tcreatedAt: string;\n\tupdatedAt: string;\n};\n\n/** `GET /workspaces/:slug/teams/:identifier/agent-settings` */\nexport type TeamAgentSettingsResponse = {\n\tsettings: TeamAgentSettingsRecord | null;\n\t/** The effective setting: `isolated` when there is no row. */\n\tisolation: AgentIsolation;\n\tlimits: {\n\t\tmaxWakesPerMessage: number;\n\t\tmaxConsecutiveAgentMessages: number;\n\t};\n};\n\n// ---------------------------------------------------------------------------\n// Releases (B-04d, D-1/D-3/D-4).\n// ---------------------------------------------------------------------------\n\n/** How a task ended the cycle. Orthogonal to `addedMidCycle`. */\nexport const RELEASE_DISPOSITIONS = [\n\t\"shipped\",\n\t\"carried_over\",\n\t\"dropped\",\n] as const;\n\nexport type ReleaseDisposition = (typeof RELEASE_DISPOSITIONS)[number];\n\n/** A narrative is capped here on the way in (D-3). */\nexport const RELEASE_NARRATIVE_MAX = 50_000;\n\n/** Narrative excerpt length in a list row and in the previous-release summary. */\nexport const RELEASE_NARRATIVE_EXCERPT_MAX = 500;\n\n/** Each context list is cut at this many tasks. */\nexport const RELEASE_CONTEXT_TASK_LIMIT = 100;\n\nexport type ReleaseTask = {\n\tsourceTaskId: string;\n\ttaskIdentifier: string;\n\ttitle: string;\n\tstatusName: string;\n\tstatusCategory: string;\n\tdisposition: ReleaseDisposition;\n\taddedMidCycle: boolean;\n};\n\n/** Who wrote the narrative currently on a release. */\nexport type ReleaseNarrativeAuthor = {\n\tmemberId: string | null;\n\ttype: \"user\" | \"agent\" | \"system\" | null;\n\tname: string | null;\n\tupdatedAt: string;\n};\n\nexport type ReleaseCounts = {\n\tshipped: number;\n\tcarriedOver: number;\n\tdropped: number;\n\taddedMidCycle: number;\n\ttotal: number;\n};\n\n/** One row of `GET /workspaces/:slug/releases`. */\nexport type ReleaseSummary = {\n\tid: string;\n\tnumber: number;\n\tteamId: string;\n\tteamIdentifier: string;\n\tcycleId: string;\n\tcycleName: string | null;\n\tclosedAt: string;\n\tcounts: ReleaseCounts;\n\t/** First `RELEASE_NARRATIVE_EXCERPT_MAX` characters, or null when unwritten. */\n\tnarrativeExcerpt: string | null;\n\tnarrativeTruncated: boolean;\n\tnarrativeAuthor: ReleaseNarrativeAuthor | null;\n\tcreatedAt: string;\n};\n\n/** `GET /workspaces/:slug/releases/:releaseId` */\nexport type Release = ReleaseSummary & {\n\tcycleStartDate: string | null;\n\tcycleEndDate: string | null;\n\tnarrative: string | null;\n\ttasks: ReleaseTask[];\n};\n\n/**\n * The change between a release and the previous release of the same team\n * (D-4). Keyed by `sourceTaskId`, so a task that moved between cycles is\n * followed across them.\n */\nexport type ReleaseDiff = {\n\tpreviousReleaseId: string | null;\n\tpreviousReleaseNumber: number | null;\n\t/** In this release, not in the previous one. */\n\tadded: ReleaseTask[];\n\t/** Shipped in this release, whatever it was in the previous one. */\n\tcompleted: ReleaseTask[];\n\t/** Carried over in both: still unfinished after two cycles. */\n\tcarried: ReleaseTask[];\n\t/** Present in the previous release, absent from this one. */\n\tdropped: ReleaseTask[];\n};\n\n/** The previous release, as the context bundle summarizes it. */\nexport type ReleasePreviousSummary = {\n\tid: string;\n\tnumber: number;\n\tclosedAt: string;\n\tcounts: ReleaseCounts;\n\tnarrativeExcerpt: string | null;\n\tnarrativeTruncated: boolean;\n};\n\n/**\n * `GET /workspaces/:slug/releases/:releaseId/context`\n *\n * One read that hands a narrator everything it needs to write the narrative.\n * Every list is capped at `RELEASE_CONTEXT_TASK_LIMIT`; `counts` carries the\n * full totals, so a renderer can say \"showing N of M\".\n */\nexport type ReleaseContext = {\n\treleaseId: string;\n\tnumber: number;\n\tteam: { id: string; identifier: string; name: string };\n\tcycle: {\n\t\tid: string;\n\t\tname: string | null;\n\t\tstartDate: string | null;\n\t\tendDate: string | null;\n\t};\n\tclosedAt: string;\n\tcounts: ReleaseCounts;\n\tshipped: ReleaseTask[];\n\tcarriedOver: ReleaseTask[];\n\tdropped: ReleaseTask[];\n\taddedMidCycle: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,UAAQ,MAAM,MAAM,qBAAqB;AAEzC,MAAI,MAAO,QAAO,OAAO,MAAM,CAAC,CAAC;AAEjC,UAAQ,MAAM,MAAM,4BAA4B;AAEhD,MAAI,MAAO,QAAO,OAAO,MAAM,CAAC,CAAC,IAAI,KAAK,OAAO,MAAM,CAAC,CAAC;AAEzD,UAAQ,MAAM,MAAM,mBAAmB;AAEvC,MAAI,MAAO,QAAO,KAAK,MAAM,OAAO,MAAM,CAAC,CAAC,IAAI,EAAE;AAElD,SAAO;AACR;AAGO,SAAS,cAAc,SAAyB;AACtD,QAAM,QAAQ,KAAK,MAAM,UAAU,EAAE;AACrC,QAAM,OAAO,UAAU;AAEvB,MAAI,UAAU,EAAG,QAAO,GAAG,IAAI;AAE/B,SAAO,SAAS,IAAI,GAAG,KAAK,MAAM,GAAG,KAAK,KAAK,IAAI;AACpD;;;ACkRO,IAAM,wBAAwB;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AACD;AAudO,IAAM,+BAA+B;AAGrC,IAAM,gCAAgC;AAGtC,IAAM,iCAAiC;AAoEvC,IAAM,yBAAyB,CAAC,YAAY,MAAM;AAQlD,IAAM,qBAAqB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAKO,IAAM,8BAA8B;AAMpC,IAAM,iCAAiC;AAwCvC,IAAM,uBAAuB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AACD;AAKO,IAAM,wBAAwB;AAG9B,IAAM,gCAAgC;AAGtC,IAAM,6BAA6B;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/prefixes.ts","../src/errors.ts","../src/client.ts","../src/time.ts","../src/types.ts"],"sourcesContent":["/**\n * Token prefixes, duplicated from `@tasq/contracts/agents`.\n *\n * They are re-declared here rather than re-exported because contracts is\n * private: tsup's dts bundler leaves a `@tasq/contracts/agents` import in the\n * emitted `.d.ts`, which a published consumer cannot resolve.\n * `src/prefixes.equality.ts` asserts these stay in step with contracts.\n */\n\n/** Plaintext prefix of an agent API key. */\nexport const AGENT_KEY_PREFIX = \"tq_ag_\";\n\n/** Plaintext prefix of a user (CLI) token. */\nexport const USER_TOKEN_PREFIX = \"tq_us_\";\n","/** Shape of the API's error envelope: `{ error: { code, message, details? } }`. */\ntype ErrorBody = {\n\tcode: string;\n\tmessage: string;\n\tdetails?: unknown;\n};\n\n/** Every failure the client raises for a non-2xx response. */\nexport class TasqApiError extends Error {\n\treadonly code: string;\n\treadonly status: number;\n\treadonly details: unknown;\n\n\tconstructor(status: number, body: ErrorBody) {\n\t\tsuper(body.message);\n\t\tthis.name = \"TasqApiError\";\n\t\tthis.code = body.code;\n\t\tthis.status = status;\n\t\tthis.details = body.details;\n\t}\n}\n\ntype RateLimitDetails = {\n\tlimit?: number;\n\tremaining?: number;\n\tresetAt?: string;\n};\n\n/** A `429 RATE_LIMITED`. `retryAfterSeconds` is never negative. */\nexport class TasqRateLimitError extends TasqApiError {\n\treadonly retryAfterSeconds: number;\n\treadonly resetAt: Date | undefined;\n\treadonly limit: number | undefined;\n\treadonly remaining: number | undefined;\n\n\tconstructor(status: number, body: ErrorBody, retryAfterHeader: string | null) {\n\t\tsuper(status, body);\n\t\tthis.name = \"TasqRateLimitError\";\n\n\t\tconst details = (body.details ?? {}) as RateLimitDetails;\n\n\t\tthis.limit = details.limit;\n\t\tthis.remaining = details.remaining;\n\t\tthis.resetAt =\n\t\t\tdetails.resetAt === undefined ? undefined : new Date(details.resetAt);\n\n\t\tconst fromHeader = Number(retryAfterHeader);\n\n\t\tif (retryAfterHeader !== null && Number.isFinite(fromHeader)) {\n\t\t\tthis.retryAfterSeconds = Math.max(0, fromHeader);\n\t\t} else if (this.resetAt !== undefined) {\n\t\t\tconst ms = this.resetAt.getTime() - Date.now();\n\n\t\t\tthis.retryAfterSeconds = Math.max(0, Math.ceil(ms / 1000));\n\t\t} else {\n\t\t\tthis.retryAfterSeconds = 0;\n\t\t}\n\t}\n}\n\nexport type TasqValidationIssue = {\n\tpath: (string | number)[];\n\tmessage: string;\n};\n\n/** A `400 VALIDATION_ERROR`. `issues` mirrors the API's Zod issue list. */\nexport class TasqValidationError extends TasqApiError {\n\treadonly issues: TasqValidationIssue[];\n\n\tconstructor(status: number, body: ErrorBody) {\n\t\tsuper(status, body);\n\t\tthis.name = \"TasqValidationError\";\n\t\tthis.issues = Array.isArray(body.details)\n\t\t\t? (body.details as TasqValidationIssue[])\n\t\t\t: [];\n\t}\n}\n\n/** A `403 AGENT_ACTION_DENIED`: the agent's policy does not allow the action. */\nexport class TasqPolicyDeniedError extends TasqApiError {\n\t/** The rejected action name, when the API reported one. */\n\treadonly action: string | undefined;\n\t/** The policy version quoted in the message, when the API quoted one. */\n\treadonly policyVersion: number | undefined;\n\n\tconstructor(status: number, body: ErrorBody) {\n\t\tsuper(status, body);\n\t\tthis.name = \"TasqPolicyDeniedError\";\n\t\tthis.action = actionFromDetails(body.details);\n\t\tthis.policyVersion = policyVersionFromMessage(body.message);\n\t}\n}\n\nfunction actionFromDetails(details: ErrorBody[\"details\"]): string | undefined {\n\tif (!Array.isArray(details)) return undefined;\n\n\tconst issues = details as TasqValidationIssue[];\n\n\tfor (const issue of issues) {\n\t\tif (issue.path[0] === \"action\") return issue.message;\n\t}\n\n\treturn undefined;\n}\n\nfunction policyVersionFromMessage(message: string): number | undefined {\n\tconst match = /policy v(?:ersion )?(\\d+)/i.exec(message);\n\n\tif (!match?.[1]) return undefined;\n\n\treturn Number(match[1]);\n}\n\n/**\n * Raised before any request when the client has no credential but the called\n * method needs one. Shaped like an API error so callers map it uniformly.\n */\nexport function noCredentialError(): TasqApiError {\n\treturn new TasqApiError(0, {\n\t\tcode: \"NO_CREDENTIAL\",\n\t\tmessage:\n\t\t\t\"No credential configured. Run `tasq auth login`, or set TASQ_API_KEY.\",\n\t});\n}\n\n/** Build the right error subclass for a failed response. */\nexport function toTasqError(\n\tstatus: number,\n\tbody: ErrorBody,\n\tretryAfterHeader: string | null,\n): TasqApiError {\n\tif (status === 429 || body.code === \"RATE_LIMITED\") {\n\t\treturn new TasqRateLimitError(status, body, retryAfterHeader);\n\t}\n\n\tif (body.code === \"VALIDATION_ERROR\") {\n\t\treturn new TasqValidationError(status, body);\n\t}\n\n\tif (body.code === \"AGENT_ACTION_DENIED\") {\n\t\treturn new TasqPolicyDeniedError(status, body);\n\t}\n\n\treturn new TasqApiError(status, body);\n}\n","import type {\n\tActionInputMap,\n\tActionName,\n\tDispatchResponse,\n} from \"./contracts\";\nimport { AGENT_KEY_PREFIX, USER_TOKEN_PREFIX } from \"./prefixes\";\nimport { noCredentialError, type TasqApiError, toTasqError } from \"./errors\";\nimport type {\n\tActivityFeedResponse,\n\tAgentPolicyDetail,\n\tCliTokenIssued,\n\tCurrentUser,\n\tCycleListFilters,\n\tCycleListItem,\n\tInitiativeListItem,\n\tFieldDefinitionItem,\n\tFieldValue,\n\tLabelListItem,\n\tProjectDetail,\n\tProjectListItem,\n\tClientHoursResponse,\n\tClientBillingResponse,\n\tMyWeekResponse,\n\tTimeDraftResponse,\n\tTimeDraftView,\n\tProjectTimeResponse,\n\tProjectUpdateListItem,\n\tProjectUpdatesResponse,\n\tRelease,\n\tReleaseContext,\n\tReleaseDiff,\n\tReleaseSummary,\n\tTaskApprovalDecision,\n\tTaskDetail,\n\tTaskListFilters,\n\tTaskListItem,\n\tTaskTimeResponse,\n\tThreadContext,\n\tAgentEventsResponse,\n\tNotificationsResponse,\n\tTeamAgentSettingsResponse,\n\tTeamDetail,\n\tTeamListItem,\n\tTimeRange,\n\tWaitingResponse,\n\tWorkspaceDetail,\n\tWorkspaceMemberListItem,\n\tWorkspaceSummary,\n} from \"./types\";\n\n/** The API's largest page of project updates. */\nconst PROJECT_UPDATES_PAGE_MAX = 100;\n\n/** Either an agent key (`tq_ag_…`) or a user token (`tq_us_…`). */\nexport type TasqAuth = { agentKey: string } | { userToken: string };\n\nexport type TasqClientOptions = {\n\t/** Origin of the API, with or without a trailing slash. `/api` is appended. */\n\tbaseUrl: string;\n\t/**\n\t * Omit to build an anonymous client. Only `auth.requestMagicLink` and\n\t * `auth.verifyCliCode` work without one; everything else throws\n\t * `NO_CREDENTIAL` before reaching the network.\n\t */\n\tauth?: TasqAuth;\n\t/** Injectable for tests and for runtimes with a non-global `fetch`. */\n\tfetch?: typeof fetch;\n};\n\ntype QueryValue = string | number | boolean | undefined;\n\n/** Cancellation and a ceiling, for the calls that can block. */\nexport type TasqRequestOptions = {\n\tsignal?: AbortSignal;\n\ttimeoutMs?: number;\n};\n\nexport type AgentEventsQuery = {\n\t/** Seconds to hold the connection open, 0-25. The server clamps. */\n\twait?: number;\n\t/** Event ids to acknowledge before this poll selects. */\n\tack?: ReadonlyArray<string>;\n\tlimit?: number;\n};\n\nfunction assertPrefix(token: string, prefix: string, label: string): void {\n\tif (!token.startsWith(prefix)) {\n\t\tthrow new Error(\n\t\t\t`Invalid ${label}: expected a token starting with \"${prefix}\".`,\n\t\t);\n\t}\n}\n\nfunction credential(auth: TasqAuth | undefined): string | undefined {\n\tif (auth === undefined) return undefined;\n\n\tif (\"agentKey\" in auth) {\n\t\tassertPrefix(auth.agentKey, AGENT_KEY_PREFIX, \"agent key\");\n\n\t\treturn auth.agentKey;\n\t}\n\n\tassertPrefix(auth.userToken, USER_TOKEN_PREFIX, \"user token\");\n\n\treturn auth.userToken;\n}\n\nfunction normaliseBaseUrl(baseUrl: string): string {\n\treturn `${baseUrl.replace(/\\/+$/, \"\")}/api`;\n}\n\nfunction queryString(params: Record<string, QueryValue> | undefined): string {\n\tif (!params) return \"\";\n\n\tconst search = new URLSearchParams();\n\n\tfor (const [key, value] of Object.entries(params)) {\n\t\tif (value === undefined) continue;\n\n\t\tsearch.set(key, String(value));\n\t}\n\n\tconst encoded = search.toString();\n\n\treturn encoded === \"\" ? \"\" : `?${encoded}`;\n}\n\n/**\n * `releases.context` reads as JSON or as the rendered Markdown prompt; the\n * return type follows `format` rather than widening to a union at every call\n * site.\n */\ntype ReleaseContextRead = {\n\t(\n\t\tslug: string,\n\t\treleaseId: string,\n\t\toptions?: { format?: \"json\" } & TasqRequestOptions,\n\t): Promise<ReleaseContext>;\n\t(\n\t\tslug: string,\n\t\treleaseId: string,\n\t\toptions: { format: \"markdown\" } & TasqRequestOptions,\n\t): Promise<string>;\n};\n\nexport class TasqClient {\n\treadonly #baseUrl: string;\n\treadonly #token: string | undefined;\n\treadonly #fetch: typeof fetch;\n\n\t/** A client with no credential, for the two anonymous auth calls. */\n\tstatic anonymous(baseUrl: string, fetchImpl?: typeof fetch): TasqClient {\n\t\treturn new TasqClient({ baseUrl, fetch: fetchImpl });\n\t}\n\n\tconstructor(options: TasqClientOptions) {\n\t\tthis.#baseUrl = normaliseBaseUrl(options.baseUrl);\n\t\tthis.#token = credential(options.auth);\n\t\tthis.#fetch = options.fetch ?? globalThis.fetch;\n\t}\n\n\tasync #request<T>(\n\t\tpath: string,\n\t\tinit: RequestInit & { anonymous?: boolean; timeoutMs?: number } = {},\n\t): Promise<T> {\n\t\tconst { anonymous = false, timeoutMs, ...requestInit } = init;\n\t\tconst headers = new Headers(requestInit.headers);\n\n\t\tif (!anonymous) {\n\t\t\tif (this.#token === undefined) throw noCredentialError();\n\n\t\t\theaders.set(\"authorization\", `Bearer ${this.#token}`);\n\t\t}\n\n\t\tif (requestInit.body !== undefined && !headers.has(\"content-type\")) {\n\t\t\theaders.set(\"content-type\", \"application/json\");\n\t\t}\n\n\t\theaders.set(\"accept\", \"application/json\");\n\n\t\t// A long poll needs both a caller's cancel (Ctrl-C in the CLI) and a\n\t\t// ceiling of its own. `AbortSignal.any` folds the two into one so the\n\t\t// caller's signal is still what fetch sees when no timeout is asked for.\n\t\tconst timeout =\n\t\t\ttimeoutMs === undefined ? undefined : AbortSignal.timeout(timeoutMs);\n\n\t\tconst signals = [requestInit.signal, timeout].filter(\n\t\t\t(candidate): candidate is AbortSignal => candidate != null,\n\t\t);\n\n\t\tconst signal =\n\t\t\tsignals.length === 0\n\t\t\t\t? undefined\n\t\t\t\t: signals.length === 1\n\t\t\t\t\t? signals[0]\n\t\t\t\t\t: AbortSignal.any(signals);\n\n\t\tconst response = await this.#fetch(`${this.#baseUrl}${path}`, {\n\t\t\t...requestInit,\n\t\t\theaders,\n\t\t\tsignal,\n\t\t});\n\n\t\tif (!response.ok) {\n\t\t\tthrow await this.#toError(response);\n\t\t}\n\n\t\treturn (await response.json()) as T;\n\t}\n\n\t/**\n\t * A read whose body is Markdown rather than JSON.\n\t *\n\t * The export and the `format=markdown` context are documents, not\n\t * envelopes, so they are read as text. Errors still arrive as the JSON\n\t * envelope every other route uses, so the failure path is `#toError`'s,\n\t * unchanged.\n\t */\n\tasync #text(\n\t\tpath: string,\n\t\tparams?: Record<string, QueryValue>,\n\t\toptions?: TasqRequestOptions,\n\t): Promise<string> {\n\t\tconst headers = new Headers({ accept: \"text/markdown\" });\n\n\t\tif (this.#token === undefined) throw noCredentialError();\n\n\t\theaders.set(\"authorization\", `Bearer ${this.#token}`);\n\n\t\tconst timeout =\n\t\t\toptions?.timeoutMs === undefined\n\t\t\t\t? undefined\n\t\t\t\t: AbortSignal.timeout(options.timeoutMs);\n\n\t\tconst signals = [options?.signal, timeout].filter(\n\t\t\t(candidate): candidate is AbortSignal => candidate != null,\n\t\t);\n\n\t\tconst signal =\n\t\t\tsignals.length === 0\n\t\t\t\t? undefined\n\t\t\t\t: signals.length === 1\n\t\t\t\t\t? signals[0]\n\t\t\t\t\t: AbortSignal.any(signals);\n\n\t\tconst response = await this.#fetch(\n\t\t\t`${this.#baseUrl}${path}${queryString(params)}`,\n\t\t\t{ headers, signal },\n\t\t);\n\n\t\tif (!response.ok) throw await this.#toError(response);\n\n\t\treturn await response.text();\n\t}\n\n\tasync #toError(response: Response): Promise<TasqApiError> {\n\t\tconst retryAfter = response.headers.get(\"retry-after\");\n\n\t\tconst fallback = {\n\t\t\tcode: `HTTP_${response.status}`,\n\t\t\tmessage: `Request failed with status ${response.status}`,\n\t\t};\n\n\t\tconst envelope = (await response.json().catch(() => null)) as {\n\t\t\terror?: { code?: string; message?: string; details?: unknown };\n\t\t} | null;\n\n\t\tconst error = envelope?.error;\n\n\t\tconst body =\n\t\t\terror?.code === undefined\n\t\t\t\t? fallback\n\t\t\t\t: {\n\t\t\t\t\t\tcode: error.code,\n\t\t\t\t\t\tmessage: error.message ?? fallback.message,\n\t\t\t\t\t\tdetails: error.details,\n\t\t\t\t\t};\n\n\t\treturn toTasqError(response.status, body, retryAfter);\n\t}\n\n\t#get<T>(\n\t\tpath: string,\n\t\tparams?: Record<string, QueryValue>,\n\t\toptions?: TasqRequestOptions,\n\t): Promise<T> {\n\t\treturn this.#request<T>(`${path}${queryString(params)}`, options);\n\t}\n\n\treadonly workspaces = {\n\t\tlist: async (): Promise<WorkspaceSummary[]> =>\n\t\t\t(await this.#get<{ workspaces: WorkspaceSummary[] }>(\"/workspaces\"))\n\t\t\t\t.workspaces,\n\n\t\tget: async (slug: string): Promise<WorkspaceDetail> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ workspace: WorkspaceDetail }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}`,\n\t\t\t\t)\n\t\t\t).workspace,\n\t};\n\n\treadonly tasks = {\n\t\tlist: async (\n\t\t\tslug: string,\n\t\t\tfilters?: TaskListFilters,\n\t\t): Promise<TaskListItem[]> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ tasks: TaskListItem[] }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/tasks`,\n\t\t\t\t\tfilters,\n\t\t\t\t)\n\t\t\t).tasks,\n\n\t\tget: async (slug: string, taskId: string): Promise<TaskDetail> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ task: TaskDetail }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/tasks/${encodeURIComponent(taskId)}`,\n\t\t\t\t)\n\t\t\t).task,\n\n\t\t/**\n\t\t * Ask a person to sign off on a task (6.3). Asking again while a\n\t\t * request stands replaces the approver. The approver cannot be an agent.\n\t\t */\n\t\trequestApproval: (\n\t\t\tslug: string,\n\t\t\ttaskId: string,\n\t\t\tapproverId: string,\n\t\t): Promise<DispatchResponse<\"task.requestApproval\">> =>\n\t\t\tthis.dispatch(\"task.requestApproval\", slug, { taskId, approverId }),\n\n\t\t/**\n\t\t * The approver's answer (6.3). `approve` also moves the task to the next\n\t\t * status in its team's category order. Person credentials only: no\n\t\t * agent policy can include it.\n\t\t */\n\t\tdecide: (\n\t\t\tslug: string,\n\t\t\ttaskId: string,\n\t\t\tdecision: TaskApprovalDecision,\n\t\t): Promise<DispatchResponse<\"task.decide\">> =>\n\t\t\tthis.dispatch(\"task.decide\", slug, { taskId, decision }),\n\t};\n\n\t/**\n\t * Time tracking: whole minutes on a task for a day, no running timer.\n\t * Everything here is member-level; a guest credential is refused. Turn a\n\t * typed duration into minutes with `parseDuration`.\n\t */\n\treadonly time = {\n\t\t/** A task's entries, newest day first, and its total with direct subtasks. */\n\t\tforTask: (slug: string, taskId: string): Promise<TaskTimeResponse> =>\n\t\t\tthis.#get<TaskTimeResponse>(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/tasks/${encodeURIComponent(taskId)}/time`,\n\t\t\t),\n\n\t\t/**\n\t\t * Time on a project's tasks between two inclusive `YYYY-MM-DD` days, by\n\t\t * person and day. The API reads at most 92 days at a time.\n\t\t */\n\t\tforProject: (\n\t\t\tslug: string,\n\t\t\tprojectId: string,\n\t\t\trange: TimeRange,\n\t\t): Promise<ProjectTimeResponse> =>\n\t\t\tthis.#get<ProjectTimeResponse>(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/projects/${encodeURIComponent(projectId)}/time`,\n\t\t\t\t{ from: range.from, to: range.to },\n\t\t\t),\n\n\t\t/**\n\t\t * Log minutes on a task for a day. `memberId` defaults to the caller;\n\t\t * logging for someone else is an admin's job.\n\t\t */\n\t\tlog: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"time.log\"],\n\t\t): Promise<DispatchResponse<\"time.log\">> =>\n\t\t\tthis.dispatch(\"time.log\", slug, input),\n\n\t\t/** Change an entry; omitted fields are left alone, `note: null` clears it. */\n\t\tupdate: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"time.update\"],\n\t\t): Promise<DispatchResponse<\"time.update\">> =>\n\t\t\tthis.dispatch(\"time.update\", slug, input),\n\n\t\tdelete: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"time.delete\"],\n\t\t): Promise<DispatchResponse<\"time.delete\">> =>\n\t\t\tthis.dispatch(\"time.delete\", slug, input),\n\t};\n\n\t/**\n\t * Clients (initiatives) and their hours. Member-only; refused unless a team\n\t * with a project for the client has Client hours on.\n\t */\n\treadonly clients = {\n\t\t/**\n\t\t * One month of a client's hours by billable flag, project and person.\n\t\t * `month` is `YYYY-MM`; `billableOnly` counts billable entries only.\n\t\t */\n\t\thours: (\n\t\t\tslug: string,\n\t\t\tclientId: string,\n\t\t\tmonth: string,\n\t\t\toptions: { billableOnly?: boolean } = {},\n\t\t): Promise<ClientHoursResponse> =>\n\t\t\tthis.#get<ClientHoursResponse>(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/clients/${encodeURIComponent(clientId)}/hours`,\n\t\t\t\t{ month, billable: options.billableOnly ? \"billable\" : \"all\" },\n\t\t\t),\n\n\t\t/** A client's billing months, newest first, with each one's hours and state. */\n\t\tbilling: (slug: string, clientId: string): Promise<ClientBillingResponse> =>\n\t\t\tthis.#get<ClientBillingResponse>(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/clients/${encodeURIComponent(clientId)}/billing`,\n\t\t\t),\n\t};\n\n\t/** The caller's own time (TM-2, My week). */\n\treadonly me = {\n\t\t/**\n\t\t * The caller's Monday-to-Sunday week around `day` (`YYYY-MM-DD`), that\n\t\t * day's entries, and tasks they worked on that day with no time logged.\n\t\t * `tz` is the IANA zone that decides which edits fall on the day.\n\t\t */\n\t\tweek: (\n\t\t\tslug: string,\n\t\t\tday: string,\n\t\t\toptions: { tz?: string } = {},\n\t\t): Promise<MyWeekResponse> =>\n\t\t\tthis.#get<MyWeekResponse>(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/me/week`,\n\t\t\t\toptions.tz ? { day, tz: options.tz } : { day },\n\t\t\t),\n\t};\n\n\t/**\n\t * Agent timesheet drafts (TM-2). The drafting agent reads a draft and the\n\t * member's day and saves lines; the member requests, logs, dismisses or\n\t * replies. Agent keys are refused the member's side by policy.\n\t */\n\treadonly timeDrafts = {\n\t\tget: async (slug: string, draftId: string): Promise<TimeDraftView> =>\n\t\t\t(\n\t\t\t\tawait this.#get<TimeDraftResponse>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/time-drafts/${encodeURIComponent(draftId)}`,\n\t\t\t\t)\n\t\t\t).draft,\n\n\t\t/** The member's week around `day`, read by the agent that drafts it. */\n\t\tmemberWeek: (slug: string, memberId: string, day: string): Promise<MyWeekResponse> =>\n\t\t\tthis.#get<MyWeekResponse>(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/members/${encodeURIComponent(memberId)}/week`,\n\t\t\t\t{ day },\n\t\t\t),\n\n\t\trequest: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"timeDraft.request\"],\n\t\t): Promise<DispatchResponse<\"timeDraft.request\">> =>\n\t\t\tthis.dispatch(\"timeDraft.request\", slug, input),\n\n\t\tsave: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"timeDraft.save\"],\n\t\t): Promise<DispatchResponse<\"timeDraft.save\">> =>\n\t\t\tthis.dispatch(\"timeDraft.save\", slug, input),\n\n\t\tconfirm: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"timeDraft.confirm\"],\n\t\t): Promise<DispatchResponse<\"timeDraft.confirm\">> =>\n\t\t\tthis.dispatch(\"timeDraft.confirm\", slug, input),\n\n\t\tdismiss: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"timeDraft.dismiss\"],\n\t\t): Promise<DispatchResponse<\"timeDraft.dismiss\">> =>\n\t\t\tthis.dispatch(\"timeDraft.dismiss\", slug, input),\n\n\t\treply: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"timeDraft.reply\"],\n\t\t): Promise<DispatchResponse<\"timeDraft.reply\">> =>\n\t\t\tthis.dispatch(\"timeDraft.reply\", slug, input),\n\t};\n\n\t/** Close, invoice and reopen a client's month (admins only). */\n\treadonly billingPeriods = {\n\t\tclose: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"billingPeriod.close\"],\n\t\t): Promise<DispatchResponse<\"billingPeriod.close\">> =>\n\t\t\tthis.dispatch(\"billingPeriod.close\", slug, input),\n\n\t\tmarkInvoiced: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"billingPeriod.markInvoiced\"],\n\t\t): Promise<DispatchResponse<\"billingPeriod.markInvoiced\">> =>\n\t\t\tthis.dispatch(\"billingPeriod.markInvoiced\", slug, input),\n\n\t\treopen: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"billingPeriod.reopen\"],\n\t\t): Promise<DispatchResponse<\"billingPeriod.reopen\">> =>\n\t\t\tthis.dispatch(\"billingPeriod.reopen\", slug, input),\n\t};\n\n\treadonly projects = {\n\t\tlist: async (slug: string): Promise<ProjectListItem[]> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ projects: ProjectListItem[] }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/projects`,\n\t\t\t\t)\n\t\t\t).projects,\n\n\t\tget: async (slug: string, projectId: string): Promise<ProjectDetail> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ project: ProjectDetail }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/projects/${encodeURIComponent(projectId)}`,\n\t\t\t\t)\n\t\t\t).project,\n\n\t\t/**\n\t\t * Pin a project to the caller's own sidebar. People only: an agent\n\t\t * key is refused by policy whatever its preset.\n\t\t */\n\t\tstar: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"project.star\"],\n\t\t): Promise<DispatchResponse<\"project.star\">> =>\n\t\t\tthis.dispatch(\"project.star\", slug, input),\n\n\t\tunstar: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"project.unstar\"],\n\t\t): Promise<DispatchResponse<\"project.unstar\">> =>\n\t\t\tthis.dispatch(\"project.unstar\", slug, input),\n\n\t\t/**\n\t\t * Share a project with a guest already in the workspace (6.2). Admins\n\t\t * and the project lead only; an agent key is always refused.\n\t\t */\n\t\tgrantGuest: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"project.grantGuest\"],\n\t\t): Promise<DispatchResponse<\"project.grantGuest\">> =>\n\t\t\tthis.dispatch(\"project.grantGuest\", slug, input),\n\n\t\tsetGuestAccess: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"project.setGuestAccess\"],\n\t\t): Promise<DispatchResponse<\"project.setGuestAccess\">> =>\n\t\t\tthis.dispatch(\"project.setGuestAccess\", slug, input),\n\n\t\trevokeGuest: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"project.revokeGuest\"],\n\t\t): Promise<DispatchResponse<\"project.revokeGuest\">> =>\n\t\t\tthis.dispatch(\"project.revokeGuest\", slug, input),\n\t};\n\n\t/**\n\t * Initiatives group projects across teams. Any member reads them; every\n\t * write is admin-level, so an agent key (always a member) cannot make one.\n\t */\n\treadonly initiatives = {\n\t\tlist: async (slug: string): Promise<InitiativeListItem[]> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ initiatives: InitiativeListItem[] }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/initiatives`,\n\t\t\t\t)\n\t\t\t).initiatives,\n\n\t\tcreate: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"initiative.create\"],\n\t\t): Promise<DispatchResponse<\"initiative.create\">> =>\n\t\t\tthis.dispatch(\"initiative.create\", slug, input),\n\n\t\tupdate: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"initiative.update\"],\n\t\t): Promise<DispatchResponse<\"initiative.update\">> =>\n\t\t\tthis.dispatch(\"initiative.update\", slug, input),\n\n\t\tdelete: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"initiative.delete\"],\n\t\t): Promise<DispatchResponse<\"initiative.delete\">> =>\n\t\t\tthis.dispatch(\"initiative.delete\", slug, input),\n\n\t\tlinkProject: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"initiative.linkProject\"],\n\t\t): Promise<DispatchResponse<\"initiative.linkProject\">> =>\n\t\t\tthis.dispatch(\"initiative.linkProject\", slug, input),\n\n\t\tunlinkProject: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"initiative.unlinkProject\"],\n\t\t): Promise<DispatchResponse<\"initiative.unlinkProject\">> =>\n\t\t\tthis.dispatch(\"initiative.unlinkProject\", slug, input),\n\t};\n\n\t/**\n\t * Project updates: a health call and a body for the project's client (7.5).\n\t *\n\t * `draft` is what an agent calls; an agent's update is always a draft\n\t * whatever it passes. `send` is people only: no agent policy can grant it,\n\t * because nothing an agent drafts goes to a client without a person\n\t * approving it.\n\t */\n\treadonly projectUpdates = {\n\t\t/**\n\t\t * Every update on the project, drafts included, newest first. Follows\n\t\t * `nextCursor` until the last page; use `listPage` for one page.\n\t\t */\n\t\tlist: async (\n\t\t\tslug: string,\n\t\t\tprojectId: string,\n\t\t): Promise<ProjectUpdateListItem[]> => {\n\t\t\tconst updates: ProjectUpdateListItem[] = [];\n\t\t\tlet before: string | undefined;\n\n\t\t\tdo {\n\t\t\t\tconst page = await this.projectUpdates.listPage(slug, projectId, {\n\t\t\t\t\tlimit: PROJECT_UPDATES_PAGE_MAX,\n\t\t\t\t\tbefore,\n\t\t\t\t});\n\n\t\t\t\tupdates.push(...page.updates);\n\t\t\t\tbefore = page.nextCursor ?? undefined;\n\t\t\t} while (before !== undefined);\n\n\t\t\treturn updates;\n\t\t},\n\n\t\t/**\n\t\t * One page of the project's updates, drafts included, newest first; pass\n\t\t * `nextCursor` as `before` for the next. The API returns 20 by default,\n\t\t * at most 100.\n\t\t */\n\t\tlistPage: (\n\t\t\tslug: string,\n\t\t\tprojectId: string,\n\t\t\tquery: { limit?: number; before?: string } = {},\n\t\t): Promise<ProjectUpdatesResponse> =>\n\t\t\tthis.#get<ProjectUpdatesResponse>(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/projects/${encodeURIComponent(projectId)}/updates`,\n\t\t\t\t{ limit: query.limit, before: query.before },\n\t\t\t),\n\n\t\tdraft: (\n\t\t\tslug: string,\n\t\t\tinput: Omit<ActionInputMap[\"projectUpdate.create\"], \"send\">,\n\t\t): Promise<DispatchResponse<\"projectUpdate.create\">> =>\n\t\t\tthis.dispatch(\"projectUpdate.create\", slug, input),\n\n\t\tcreate: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"projectUpdate.create\"],\n\t\t): Promise<DispatchResponse<\"projectUpdate.create\">> =>\n\t\t\tthis.dispatch(\"projectUpdate.create\", slug, input),\n\n\t\tupdate: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"projectUpdate.update\"],\n\t\t): Promise<DispatchResponse<\"projectUpdate.update\">> =>\n\t\t\tthis.dispatch(\"projectUpdate.update\", slug, input),\n\n\t\tsend: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"projectUpdate.send\"],\n\t\t): Promise<DispatchResponse<\"projectUpdate.send\">> =>\n\t\t\tthis.dispatch(\"projectUpdate.send\", slug, input),\n\n\t\tdelete: (\n\t\t\tslug: string,\n\t\t\tinput: ActionInputMap[\"projectUpdate.delete\"],\n\t\t): Promise<DispatchResponse<\"projectUpdate.delete\">> =>\n\t\t\tthis.dispatch(\"projectUpdate.delete\", slug, input),\n\t};\n\n\treadonly threads = {\n\t\t/**\n\t\t * The context bundle for one thread: the entity it hangs off, the\n\t\t * transcript, recent activity, and the participants (D-6).\n\t\t *\n\t\t * Authorized by the entity's own read rule, so a read-only agent may\n\t\t * pull it. Lists are capped per D-8 with `truncated` flags.\n\t\t */\n\t\tcontext: (\n\t\t\tslug: string,\n\t\t\tthreadId: string,\n\t\t\toptions?: TasqRequestOptions,\n\t\t): Promise<ThreadContext> =>\n\t\t\tthis.#get<ThreadContext>(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/threads/${encodeURIComponent(threadId)}/context`,\n\t\t\t\tundefined,\n\t\t\t\toptions,\n\t\t\t),\n\t};\n\n\treadonly cycles = {\n\t\tlist: async (\n\t\t\tslug: string,\n\t\t\tfilters?: CycleListFilters,\n\t\t): Promise<CycleListItem[]> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ cycles: CycleListItem[] }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/cycles`,\n\t\t\t\t\tfilters,\n\t\t\t\t)\n\t\t\t).cycles,\n\n\t};\n\n\treadonly teams = {\n\t\tlist: async (slug: string): Promise<TeamListItem[]> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ teams: TeamListItem[] }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/teams`,\n\t\t\t\t)\n\t\t\t).teams,\n\n\t\t/** The only read that carries a team's statuses. */\n\t\tget: async (slug: string, identifier: string): Promise<TeamDetail> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ team: TeamDetail }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/teams/${encodeURIComponent(identifier)}`,\n\t\t\t\t)\n\t\t\t).team,\n\n\t\t/**\n\t\t * Whether agents on this team may wake each other, plus the loop and\n\t\t * fan-out limits that stand behind the open setting (B-04c D-1).\n\t\t *\n\t\t * Read-only here on purpose: saving the setting is admin-only and web-only\n\t\t * (D-8), so no agent key can reach it.\n\t\t */\n\t\tagentSettings: (\n\t\t\tslug: string,\n\t\t\tidentifier: string,\n\t\t): Promise<TeamAgentSettingsResponse> =>\n\t\t\tthis.#get<TeamAgentSettingsResponse>(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/teams/${encodeURIComponent(identifier)}/agent-settings`,\n\t\t\t),\n\t};\n\n\treadonly labels = {\n\t\tlist: async (slug: string): Promise<LabelListItem[]> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ labels: LabelListItem[] }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/labels`,\n\t\t\t\t)\n\t\t\t).labels,\n\t};\n\n\t/**\n\t * Custom fields (6.4): the workspace library, archived fields included.\n\t * Values are set with `task.setField` and `project.setField`, by field key.\n\t */\n\treadonly fields = {\n\t\tlist: async (slug: string): Promise<FieldDefinitionItem[]> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ fields: FieldDefinitionItem[] }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/fields`,\n\t\t\t\t)\n\t\t\t).fields,\n\n\t\t/** Set a task's value; null, `[]` or `false` clears it. */\n\t\tsetTaskValue: (\n\t\t\tslug: string,\n\t\t\ttaskId: string,\n\t\t\tfieldKey: string,\n\t\t\tvalue: FieldValue,\n\t\t): Promise<DispatchResponse<\"task.setField\">> =>\n\t\t\tthis.dispatch(\"task.setField\", slug, { taskId, fieldKey, value }),\n\n\t\t/** Set a project field's value; null clears it. */\n\t\tsetProjectValue: (\n\t\t\tslug: string,\n\t\t\tprojectId: string,\n\t\t\tfieldKey: string,\n\t\t\tvalue: FieldValue,\n\t\t): Promise<DispatchResponse<\"project.setField\">> =>\n\t\t\tthis.dispatch(\"project.setField\", slug, { projectId, fieldKey, value }),\n\t};\n\n\treadonly agents = {\n\t\tpolicy: (slug: string, agentId: string): Promise<AgentPolicyDetail> =>\n\t\t\tthis.#get<AgentPolicyDetail>(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/agents/${encodeURIComponent(agentId)}/policy`,\n\t\t\t),\n\n\t\t/**\n\t\t * Long-poll for mentions addressed to the agent behind this key.\n\t\t *\n\t\t * The same call acks: ids passed as `ack` are marked before the select\n\t\t * runs, so a runner's next poll is also its acknowledgement of the last\n\t\t * batch (D-5). Agent keys only.\n\t\t */\n\t\tevents: (\n\t\t\tslug: string,\n\t\t\tquery: AgentEventsQuery = {},\n\t\t\toptions?: TasqRequestOptions,\n\t\t): Promise<AgentEventsResponse> =>\n\t\t\tthis.#get<AgentEventsResponse>(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/agents/me/events`,\n\t\t\t\t{\n\t\t\t\t\twait: query.wait,\n\t\t\t\t\tlimit: query.limit,\n\t\t\t\t\tack:\n\t\t\t\t\t\tquery.ack === undefined || query.ack.length === 0\n\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t: query.ack.join(\",\"),\n\t\t\t\t},\n\t\t\t\toptions,\n\t\t\t),\n\t};\n\n\t/**\n\t * Releases: the structural record of a cycle close, and the narrative an\n\t * agent or a person attaches to it (B-04d).\n\t *\n\t * Reads are authorized by the workspace role guard rather than a policy\n\t * action, so a read-only agent may pull the context it needs; the write\n\t * goes through `release.saveNarrative` like every other action.\n\t */\n\treadonly releases = {\n\t\tlist: async (\n\t\t\tslug: string,\n\t\t\tteamIdentifier?: string,\n\t\t): Promise<ReleaseSummary[]> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ releases: ReleaseSummary[] }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/releases`,\n\t\t\t\t\t{ team: teamIdentifier },\n\t\t\t\t)\n\t\t\t).releases,\n\n\t\tget: async (slug: string, releaseId: string): Promise<Release> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ release: Release }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/releases/${encodeURIComponent(releaseId)}`,\n\t\t\t\t)\n\t\t\t).release,\n\n\t\t/**\n\t\t * The context bundle a narrator writes from.\n\t\t *\n\t\t * `format: \"markdown\"` returns the server-rendered prompt as a string,\n\t\t * which is what a harness pastes into a model; the default returns the\n\t\t * bundle, for a runner that branches on the fields itself.\n\t\t */\n\t\tcontext: ((\n\t\t\tslug: string,\n\t\t\treleaseId: string,\n\t\t\toptions: { format?: \"json\" | \"markdown\" } & TasqRequestOptions = {},\n\t\t): Promise<ReleaseContext | string> => {\n\t\t\tconst path = `/workspaces/${encodeURIComponent(slug)}/releases/${encodeURIComponent(releaseId)}/context`;\n\n\t\t\treturn options.format === \"markdown\"\n\t\t\t\t? this.#text(path, { format: \"markdown\" }, options)\n\t\t\t\t: this.#get<ReleaseContext>(path, undefined, options);\n\t\t}) as ReleaseContextRead,\n\n\t\tdiff: async (slug: string, releaseId: string): Promise<ReleaseDiff> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ releaseId: string; diff: ReleaseDiff }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/releases/${encodeURIComponent(releaseId)}/diff`,\n\t\t\t\t)\n\t\t\t).diff,\n\n\t\t/** The release as a Markdown document, the same body the web export serves. */\n\t\texport: (slug: string, releaseId: string): Promise<string> =>\n\t\t\tthis.#text(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/releases/${encodeURIComponent(releaseId)}/export`,\n\t\t\t),\n\n\t\t/** Last write wins; the author and timestamp move with the body (D-3). */\n\t\tsaveNarrative: (\n\t\t\tslug: string,\n\t\t\tinput: { releaseId: string; narrative: string },\n\t\t): Promise<DispatchResponse<\"release.saveNarrative\">> =>\n\t\t\tthis.dispatch(\"release.saveNarrative\", slug, input),\n\t};\n\n\treadonly members = {\n\t\tlist: async (slug: string): Promise<WorkspaceMemberListItem[]> =>\n\t\t\t(\n\t\t\t\tawait this.#get<{ members: WorkspaceMemberListItem[] }>(\n\t\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/members`,\n\t\t\t\t)\n\t\t\t).members,\n\t};\n\n\treadonly notifications = {\n\t\tlist: (\n\t\t\tslug: string,\n\t\t\tquery: { unread?: boolean } = {},\n\t\t): Promise<NotificationsResponse> =>\n\t\t\tthis.#get<NotificationsResponse>(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/notifications`,\n\t\t\t\t{ unread: query.unread === true ? 1 : undefined },\n\t\t\t),\n\t};\n\n\treadonly activity = {\n\t\t/** The workspace activity feed, newest first; page with `nextCursor`. */\n\t\tlist: (\n\t\t\tslug: string,\n\t\t\tquery: { limit?: number; before?: string } = {},\n\t\t): Promise<ActivityFeedResponse> =>\n\t\t\tthis.#get<ActivityFeedResponse>(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/activity`,\n\t\t\t\t{ limit: query.limit, before: query.before },\n\t\t\t),\n\t};\n\n\treadonly waiting = {\n\t\t/** Approvals and agent drafts waiting on the caller. People only. */\n\t\tget: (slug: string): Promise<WaitingResponse> =>\n\t\t\tthis.#get<WaitingResponse>(\n\t\t\t\t`/workspaces/${encodeURIComponent(slug)}/waiting`,\n\t\t\t),\n\t};\n\n\treadonly auth = {\n\t\t/** The principal behind the current credential. */\n\t\tme: async (): Promise<CurrentUser> =>\n\t\t\t(await this.#get<{ user: CurrentUser }>(\"/auth/me\")).user,\n\n\t\t/** Step one of CLI login: mail a sign-in code. Needs no credential. */\n\t\trequestMagicLink: async (input: { email: string }): Promise<void> => {\n\t\t\tawait this.#request<unknown>(\"/auth/magic-link\", {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tbody: JSON.stringify({ email: input.email }),\n\t\t\t\tanonymous: true,\n\t\t\t});\n\t\t},\n\n\t\t/** Step two: exchange the code for a `tq_us_…` token. Needs no credential. */\n\t\tverifyCliCode: (input: {\n\t\t\temail: string;\n\t\t\tcode: string;\n\t\t\tlabel: string;\n\t\t}): Promise<CliTokenIssued> =>\n\t\t\tthis.#request<CliTokenIssued>(\"/auth/cli/verify-code\", {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tbody: JSON.stringify(input),\n\t\t\t\tanonymous: true,\n\t\t\t}),\n\n\t\t/** Revoke the user token this client authenticates with. */\n\t\trevokeUserToken: async (): Promise<void> => {\n\t\t\tawait this.#request<unknown>(\"/auth/cli/token\", { method: \"DELETE\" });\n\t\t},\n\t};\n\n\t/** Run a write action. The API validates `input`; the SDK does not. */\n\tdispatch<TName extends ActionName>(\n\t\taction: TName,\n\t\tslug: string,\n\t\tinput: ActionInputMap[TName],\n\t): Promise<DispatchResponse<TName>> {\n\t\treturn this.#request<DispatchResponse<TName>>(\n\t\t\t`/workspaces/${encodeURIComponent(slug)}/actions`,\n\t\t\t{ method: \"POST\", body: JSON.stringify({ action, input }) },\n\t\t);\n\t}\n}\n","/**\n * Duration helpers for time tracking, duplicated from `@tasq/contracts/time`.\n *\n * Re-declared rather than re-exported because contracts is private and cannot\n * be published (see `prefixes.ts`). The CLI and the MCP server read durations\n * through these, so `1h 30m` means the same thing there as in the web form.\n * `time.test.ts` runs both copies over the same inputs to keep them in step.\n */\n\n/** The forms `parseDuration` reads, for error messages. */\nexport const DURATION_FORMS = \"1h 30m, 1h30m, 90m, 1.5h, 1:30 or a bare number of hours\";\n\n/**\n * Parse a typed duration into whole minutes, or null when it is not one.\n *\n * Accepts `1h 30m`, `1h30m`, `90m`, `90min`, `1.5h`, `1:30` and a bare number\n * of hours (`2`). Range limits are the action's job; this only reads.\n */\nexport function parseDuration(raw: string): number | null {\n\tconst value = raw.trim().toLowerCase().replace(/\\s+/g, \"\");\n\n\tif (!value) return null;\n\n\tlet match = value.match(/^(\\d{1,2}):([0-5]\\d)$/);\n\n\tif (match) return Number(match[1]) * 60 + Number(match[2]);\n\n\tmatch = value.match(/^(\\d+(?:\\.\\d+)?)h$/);\n\n\tif (match) return Math.round(Number(match[1]) * 60);\n\n\tmatch = value.match(/^(\\d+)m(?:in|ins)?$/);\n\n\tif (match) return Number(match[1]);\n\n\tmatch = value.match(/^(\\d+)h(\\d+)m?(?:in|ins)?$/);\n\n\tif (match) return Number(match[1]) * 60 + Number(match[2]);\n\n\tmatch = value.match(/^(\\d+(?:\\.\\d+)?)$/);\n\n\tif (match) return Math.round(Number(match[1]) * 60);\n\n\treturn null;\n}\n\n/** `90` → `1h 30m`, `60` → `1h`, `45` → `45m`, `0` → `0m`. */\nexport function formatMinutes(minutes: number): string {\n\tconst hours = Math.floor(minutes / 60);\n\tconst rest = minutes % 60;\n\n\tif (hours === 0) return `${rest}m`;\n\n\treturn rest === 0 ? `${hours}h` : `${hours}h ${rest}m`;\n}\n","/**\n * Response shapes for the read routes the client wraps.\n *\n * These are hand-declared rather than re-exported from `AppType`. Deriving\n * them with `InferResponseType` typechecks, but neither tsup's `dts.resolve`\n * nor `tsc --declaration` expands a type alias on emit: the published\n * `.d.ts` kept a live `hono/client` import and a dangling `AppType`\n * reference that no consumer can resolve, and some inferred members (the\n * cycle `status` field) print as an absolute path into `apps/api`.\n *\n * So the shapes live here, and `types.equality.ts` asserts each one is\n * structurally identical to what the route actually returns. A handler\n * change breaks `bun run typecheck`, which is the drift guard the derived\n * version was there to provide.\n *\n * All timestamps are ISO-8601 strings: this is the JSON-serialised form.\n */\n\nimport type {\n\tFieldAppliesToValue,\n\tFieldTypeValue,\n\tNumberFormatValue,\n\tTeamLabels,\n\tTeamModules,\n\tTeamTemplateId,\n\tTeamWords,\n\tTimeEntryBillableValue,\n} from \"./contracts\";\n\nexport type WorkspaceRole = \"owner\" | \"admin\" | \"member\" | \"guest\";\n\nexport type WorkspaceSummary = {\n\tid: string;\n\tname: string;\n\tslug: string;\n\trole: WorkspaceRole;\n\tjoinedAt: string;\n\tcreatedAt: string;\n\tupdatedAt: string;\n};\n\nexport type WorkspaceDetail = {\n\tid: string;\n\tname: string;\n\tslug: string;\n\trole: WorkspaceRole;\n\tcreatedAt: string;\n\tupdatedAt: string;\n};\n\nexport type MemberRef = {\n\tmemberId: string;\n\tname: string | null;\n\temail: string | null;\n};\n\nexport type PersonRef = {\n\tid: string;\n\tname: string | null;\n\temail: string | null;\n};\n\nexport type TaskStatusRef = {\n\tid: string;\n\tname: string;\n\tcolor: string;\n\tcategory: string;\n\tposition: number;\n};\n\nexport type TaskLabelRef = {\n\tid: string;\n\tname: string;\n\tcolor: string;\n};\n\nexport type TaskListItem = {\n\tid: string;\n\tidentifier: string;\n\tnumber: number;\n\ttitle: string;\n\tpriority: string;\n\testimateValue: number | null;\n\testimateSettingsRevisionId: string | null;\n\tsortOrder: number;\n\tarchivedAt: string | null;\n\tcreatedAt: string;\n\tupdatedAt: string;\n\tteamId: string;\n\tteamIdentifier: string;\n\tteamModules: TeamModules;\n\tprojectId: string | null;\n\tmilestoneId: string | null;\n\t/** 5.5: the task this is a subtask of, one level only (D-2). */\n\tparentTaskId: string | null;\n\t/** The parent's key, so a subtask shown away from its parent can name it. */\n\tparentIdentifier: string | null;\n\t/**\n\t * 5.5: how many subtasks this task has and how many are done, the `n/m` a\n\t * client shows. Cancelled and archived subtasks are in neither number.\n\t */\n\tsubtaskProgress: SubtaskProgress;\n\tcycleId: string | null;\n\t/** All-day `YYYY-MM-DD` dates, never instants (D-5). */\n\tdueDate: string | null;\n\tstartDate: string | null;\n\tstatus: TaskStatusRef;\n\tassignee: MemberRef | null;\n\t/** 6.3: where a sign-off stands; null until someone asks for one. */\n\tapproval: TaskApproval | null;\n\t/** Who created the task; null when that member has since been removed. */\n\tcreator: TaskCreator | null;\n\tlabels: TaskLabelRef[];\n\t/** Minutes logged on this task and its direct subtasks; zero when none. */\n\tloggedMinutes: number;\n\t/** 6.4: custom field values the task holds; an empty field is absent. */\n\tfieldValues: FieldValueItem[];\n};\n\nexport type TaskCreator = {\n\tmemberId: string;\n\tname: string | null;\n\tkind: \"user\" | \"agent\";\n};\n\n/**\n * A task's approval (6.3). `approver` is null when the person asked has since\n * left the workspace; the request still stands.\n */\nexport type TaskApproval = {\n\tstate: \"requested\" | \"approved\" | \"changes_requested\" | \"rejected\";\n\tapprover: { memberId: string; name: string | null } | null;\n\trequestedAt: string | null;\n\tdecidedAt: string | null;\n};\n\n/** What `task.decide` takes: approve, ask for changes, or reject. */\nexport type TaskApprovalDecision = \"approve\" | \"changes\" | \"reject\";\n\n/**\n * Time tracking. An entry is a person, a task, a day and whole minutes; there\n * is no running timer. Logging, editing and deleting are member-level actions\n * (`time.log`, `time.update`, `time.delete`); guests can neither log nor read.\n */\nexport type TimeEntryBillable = TimeEntryBillableValue;\n\n/** One entry as `GET /tasks/:taskId/time` lists it. */\nexport type TimeEntryItem = {\n\tid: string;\n\ttaskId: string;\n\t/** Who did the work; null once that member has left the workspace. */\n\tmember: { memberId: string; name: string | null; kind: \"user\" | \"agent\" } | null;\n\t/** All-day `YYYY-MM-DD`, never an instant (D-5). */\n\tspentOn: string;\n\tminutes: number;\n\tnote: string | null;\n\tbillable: TimeEntryBillable;\n\t/** Whether the caller may edit or delete it: theirs, written by them, or an admin. */\n\tcanChange: boolean;\n\t/** The closed client month that freezes it; null while it can change. */\n\tlocked: TimeEntryLock | null;\n};\n\n/** Why an entry can't change: a client's month is closed or invoiced. */\nexport type TimeEntryLock = {\n\tclientId: string;\n\tclientName: string;\n\t/** `YYYY-MM`. */\n\tmonth: string;\n\tstate: \"closed\" | \"invoiced\";\n};\n\n/** `GET /workspaces/:slug/tasks/:taskId/time`. */\nexport type TaskTimeResponse = {\n\ttaskId: string;\n\t/** Own entries plus every direct subtask's: the task row's `loggedMinutes`. */\n\ttotalMinutes: number;\n\townMinutes: number;\n\t/** Newest day first. */\n\tentries: TimeEntryItem[];\n\t/** Direct subtasks with time logged on them, by number. */\n\tsubtasks: Array<{\n\t\ttaskId: string;\n\t\tidentifier: string;\n\t\ttitle: string;\n\t\tminutes: number;\n\t}>;\n};\n\nexport type ProjectTimePerson = {\n\t/** Null for time logged by members who have since left. */\n\tmemberId: string | null;\n\tname: string | null;\n\tkind: \"user\" | \"agent\" | null;\n\ttotalMinutes: number;\n\t/** Minutes per `YYYY-MM-DD`; days with nothing logged are absent. */\n\tbyDay: Record<string, number>;\n};\n\n/** `GET /workspaces/:slug/projects/:projectId/time?from=&to=`. */\nexport type ProjectTimeResponse = {\n\tprojectId: string;\n\tfrom: string;\n\tto: string;\n\ttotalMinutes: number;\n\t/** Most time first. */\n\tpeople: ProjectTimePerson[];\n\t/** Oldest day first, capped; `truncated` says when the range held more. */\n\tentries: Array<{\n\t\tid: string;\n\t\ttaskId: string;\n\t\tidentifier: string;\n\t\ttaskTitle: string;\n\t\tmemberId: string | null;\n\t\tmemberName: string | null;\n\t\tspentOn: string;\n\t\tminutes: number;\n\t\tnote: string | null;\n\t\tbillable: TimeEntryBillable;\n\t}>;\n\ttruncated: boolean;\n};\n\n/** Minutes split by the billable flag. */\nexport type BillableSplit = {\n\tbillable: number;\n\tnonBillable: number;\n\tnotSet: number;\n\ttotal: number;\n};\n\nexport type ClientHoursPerson = {\n\tbillable: number;\n\tnonBillable: number;\n\tnotSet: number;\n\ttotal: number;\n\t/** Null for time logged by members who have since left. */\n\tmemberId: string | null;\n\tname: string | null;\n\tkind: \"user\" | \"agent\" | null;\n};\n\n/** `GET /workspaces/:slug/clients/:clientId/hours?month=&billable=`. */\nexport type ClientHoursResponse = {\n\tclientId: string;\n\tname: string;\n\t/** `YYYY-MM`, and the inclusive day range it covers. */\n\tmonth: string;\n\tfrom: string;\n\tto: string;\n\tbillableOnly: boolean;\n\ttotals: BillableSplit;\n\t/** Every linked project, most time first. */\n\tprojects: Array<{\n\t\tbillable: number;\n\t\tnonBillable: number;\n\t\tnotSet: number;\n\t\ttotal: number;\n\t\tprojectId: string;\n\t\tname: string;\n\t\t/** Linked to another client too, so these hours also count there. */\n\t\tshared: boolean;\n\t\tpeople: ClientHoursPerson[];\n\t}>;\n\tpeople: ClientHoursPerson[];\n\t/** The month's billing state where Billing periods is on; null while open. */\n\tperiod: ClientPeriodState | null;\n\t/** Entries with no billable flag yet, oldest first, capped. */\n\tnotSetEntries: Array<{\n\t\tid: string;\n\t\ttaskId: string;\n\t\tidentifier: string;\n\t\ttaskTitle: string;\n\t\tmemberName: string | null;\n\t\tspentOn: string;\n\t\tminutes: number;\n\t}>;\n};\n\n/** A closed or invoiced client month. Times are ISO instants. */\nexport type ClientPeriodState = {\n\tstate: \"closed\" | \"invoiced\";\n\t/** A label for finding the invoice elsewhere; tasq bills nothing. */\n\tinvoiceRef: string | null;\n\tclosedAt: string;\n\tclosedBy: string | null;\n\tinvoicedAt: string | null;\n\tinvoicedBy: string | null;\n};\n\n/** One month on a client's Billing tab; `period` is null while it is open. */\nexport type ClientBillingMonth = {\n\tbillable: number;\n\tnonBillable: number;\n\tnotSet: number;\n\ttotal: number;\n\t/** `YYYY-MM`. */\n\tmonth: string;\n\tperiod: ClientPeriodState | null;\n};\n\n/** `GET /workspaces/:slug/clients/:clientId/billing`. */\nexport type ClientBillingResponse = {\n\tclientId: string;\n\tname: string;\n\t/** Newest first: this month, every month with hours, every closed month. */\n\tmonths: ClientBillingMonth[];\n};\n\n/** One logged entry on My week's chosen day. */\nexport type MyWeekEntry = {\n\tid: string;\n\ttaskId: string;\n\tidentifier: string;\n\ttaskTitle: string;\n\tprojectName: string | null;\n\tspentOn: string;\n\tminutes: number;\n\tnote: string | null;\n\tbillable: TimeEntryBillable;\n\tlocked: TimeEntryLock | null;\n};\n\n/** A task the caller changed or commented on that day without logging time. */\nexport type MyWeekUnlogged = {\n\ttaskId: string;\n\tidentifier: string;\n\ttitle: string;\n\tprojectName: string | null;\n\treason: \"commented\" | \"updated\";\n\t/** Their last change that day, an ISO instant. */\n\tlastAt: string;\n};\n\n/** `GET /workspaces/:slug/me/week?day=&tz=`: the caller's week, Monday first. */\nexport type MyWeekResponse = {\n\tday: string;\n\tfrom: string;\n\tto: string;\n\ttotalMinutes: number;\n\tdays: Array<{ day: string; minutes: number }>;\n\tentries: MyWeekEntry[];\n\tunlogged: MyWeekUnlogged[];\n\t/** The agent's draft of this day, when its team shows drafts on My week. */\n\tdraft: TimeDraftView | null;\n\t/** The agent that would draft this member's day, or null. */\n\tdrafter: TimeDraftAgent | null;\n};\n\nexport type TimeDraftAgent = { memberId: string; name: string };\n\n/** One proposed entry on a timesheet draft. */\nexport type TimeDraftLineView = {\n\tid: string;\n\ttaskId: string;\n\tidentifier: string;\n\ttitle: string;\n\tprojectName: string | null;\n\tminutes: number;\n\tbillable: TimeEntryBillable;\n\t/** The agent's one-line reason for the line. */\n\tevidence: string | null;\n\tincluded: boolean;\n\t/** The entry this line became once logged. */\n\tentryId: string | null;\n};\n\n/** One message in the conversation about a draft. */\nexport type TimeDraftMessageView = {\n\tid: string;\n\tauthorMemberId: string | null;\n\tauthorType: \"user\" | \"agent\" | \"system\";\n\tauthorName: string | null;\n\tbody: string;\n\tcreatedAt: string;\n};\n\n/** An agent's timesheet draft for one member's day (TM-2). */\nexport type TimeDraftView = {\n\tid: string;\n\tmemberId: string;\n\tteamId: string;\n\tday: string;\n\tstate: \"waiting\" | \"ready\" | \"logged\" | \"dismissed\";\n\tagent: TimeDraftAgent | null;\n\treadyAt: string | null;\n\tlines: TimeDraftLineView[];\n\tmessages: TimeDraftMessageView[];\n};\n\n/** `GET /workspaces/:slug/time-drafts/:draftId` */\nexport type TimeDraftResponse = { draft: TimeDraftView };\n\n/** A project time report's range: inclusive `YYYY-MM-DD` days, at most 92. */\nexport type TimeRange = { from: string; to: string };\n\nexport type SubtaskProgress = { total: number; completed: number };\n\nexport type NamedRef = { id: string; name: string };\n\nexport type TaskComment = {\n\tid: string;\n\tbody: string;\n\t/** The comment this one replies to. One level of threading only (D-3). */\n\tparentId: string | null;\n\tcreatedAt: string;\n\tupdatedAt: string;\n\t/** Null when the author's membership is gone. */\n\tauthorType: \"user\" | \"agent\" | null;\n\tmentions: Array<{ agentId: string; name: string | null }>;\n\tauthor: MemberRef | null;\n};\n\nexport type TaskActivityEntry = {\n\tid: string;\n\taction: string;\n\tfieldChanged: string | null;\n\toldValue: string | null;\n\tnewValue: string | null;\n\tcreatedAt: string;\n\tactorType: \"user\" | \"agent\" | \"system\";\n\tactor: MemberRef | null;\n};\n\nexport type EstimateScale = \"fibonacci\" | \"linear\";\n\nexport type TaskEstimateEditing =\n\t| {\n\t\t\tenabled: true;\n\t\t\tscale: EstimateScale;\n\t\t\tvalues: number[];\n\t\t\trevisionId: string;\n\t\t\tepoch: string;\n\t\t}\n\t| { enabled: false };\n\n/** A TipTap JSON document. Kept opaque so no editor types reach consumers. */\n/** A JSON value carried by a description node attribute. */\nexport type DescriptionAttrValue =\n\t| string\n\t| number\n\t| boolean\n\t| null\n\t| DescriptionAttrValue[]\n\t| { [key: string]: DescriptionAttrValue };\n\nexport type DescriptionAttrs = { [key: string]: DescriptionAttrValue };\n\nexport type DescriptionMark = { type: string; attrs?: DescriptionAttrs };\n\nexport type DescriptionNode = {\n\ttype?: string;\n\ttext?: string;\n\tattrs?: DescriptionAttrs;\n\tmarks?: DescriptionMark[];\n\tcontent?: DescriptionNode[];\n};\n\nexport type DescriptionDocumentJson = {\n\tversion: 1;\n\tcontent: DescriptionNode;\n};\n\nexport type TaskDetail = TaskListItem & {\n\tdescription: string | null;\n\tdescriptionDocument: DescriptionDocumentJson | null;\n\tdescriptionMarkdown: string | null;\n\testimateEditing: TaskEstimateEditing;\n\tproject: NamedRef | null;\n\tmilestone: NamedRef | null;\n\tcycle: NamedRef | null;\n\t/** 5.5: this task's subtasks, unarchived, oldest first. */\n\tsubtasks: TaskListItem[];\n\t/** 5.5: set when this task is itself a subtask. */\n\tparent: { id: string; identifier: string; title: string } | null;\n\tcomments: TaskComment[];\n\tactivityLog: TaskActivityEntry[];\n\t/** 6.2: the reader's access to the task's project; null for members. */\n\tviewerAccess: ProjectAccess | null;\n};\n\nexport type TaskCounts = {\n\tbacklog: number;\n\tunstarted: number;\n\tstarted: number;\n\tcompleted: number;\n\tcancelled: number;\n\ttotal: number;\n};\n\nexport type EffortByTeam = {\n\tteamId: string;\n\tteamIdentifier: string;\n\tmode: \"count\" | \"effort\";\n\tscale: EstimateScale | null;\n\tpoints: number;\n\tunestimatedTasks: number;\n};\n\nexport type TeamRef = { id: string; name: string; identifier: string };\n\nexport type ProjectStatus =\n\t| \"backlog\"\n\t| \"planned\"\n\t| \"in_progress\"\n\t| \"completed\"\n\t| \"cancelled\";\n\n/** A project's health, as called by its latest sent update (7.5). */\nexport const PROJECT_HEALTH_VALUES = [\n\t\"on_track\",\n\t\"at_risk\",\n\t\"off_track\",\n] as const;\n\nexport type ProjectHealth = (typeof PROJECT_HEALTH_VALUES)[number];\n\nexport type ProjectListItem = {\n\tid: string;\n\tworkspaceId: string;\n\tname: string;\n\tdescription: string | null;\n\tstatus: ProjectStatus;\n\tstartDate: string | null;\n\ttargetDate: string | null;\n\tleadId: string | null;\n\tarchivedAt: string | null;\n\tcreatedAt: string;\n\tupdatedAt: string;\n\ttaskCounts: TaskCounts;\n\tcompletionPercentage: number;\n\teffortByTeam: EffortByTeam[];\n\tteams: TeamRef[];\n\tlead: PersonRef | null;\n\tmembers: PersonRef[];\n\t/** Null until a project update has been sent. Drafts never move it. */\n\thealth: ProjectHealth | null;\n\t/** When the latest sent update went out. */\n\tlatestUpdateAt: string | null;\n\t/** Whether the calling member starred it. Always false for an agent key. */\n\tstarred: boolean;\n\t/** Active initiatives the project belongs to, by name. */\n\tinitiatives: InitiativeRef[];\n\t/** 6.2: how many guests the project is shared with. */\n\tguestCount: number;\n\t/** 6.2: the reader's access when they are a guest; null for members. */\n\tviewerAccess: ProjectAccess | null;\n\t/** 6.4: project field values; an empty field is absent. */\n\tfieldValues: FieldValueItem[];\n};\n\n/** What a guest may do on a project they are shared on (6.2 GU-1). */\nexport type ProjectAccess = \"view\" | \"comment\";\n\nexport type InitiativeRef = { id: string; name: string };\n\nexport type InitiativeStatus = \"active\" | \"archived\";\n\n/** One row of `GET /workspaces/:slug/initiatives`, archived ones included. */\nexport type InitiativeListItem = {\n\tid: string;\n\tname: string;\n\tstatus: InitiativeStatus;\n\townerMemberId: string | null;\n\tprojectIds: string[];\n\tcreatedAt: string;\n};\n\nexport type ProjectMilestone = {\n\tid: string;\n\tname: string;\n\tdescription: string | null;\n\ttargetDate: string | null;\n\tposition: number;\n\ttaskCounts: TaskCounts;\n\tcompletionPercentage: number;\n\tisCurrent: boolean;\n\teffortByTeam: EffortByTeam[];\n};\n\nexport type ProjectDetail = ProjectListItem & {\n\tmilestones: ProjectMilestone[];\n\ttasks: TaskListItem[];\n\t/** Project threads, same shape as task detail comments (D-2). */\n\tcomments: TaskComment[];\n};\n\n/** Who wrote a project update. Null once the author has left. */\nexport type ProjectUpdateAuthor = {\n\tmemberId: string;\n\tname: string;\n\tkind: \"user\" | \"agent\";\n};\n\n/** One row of `GET /workspaces/:slug/projects/:projectId/updates`, newest first. */\nexport type ProjectUpdateListItem = {\n\tid: string;\n\tprojectId: string;\n\thealth: ProjectHealth;\n\tbody: string;\n\tauthor: ProjectUpdateAuthor | null;\n\tactorType: \"user\" | \"agent\";\n\t/** Null while the update is a draft. */\n\tsentAt: string | null;\n\tcreatedAt: string;\n\tupdatedAt: string;\n};\n\n/** `GET /workspaces/:slug/projects/:projectId/updates`, newest first. */\nexport type ProjectUpdatesResponse = {\n\tupdates: ProjectUpdateListItem[];\n\t/** Pass as `before` for the next page; null on the last page. */\n\tnextCursor: string | null;\n};\n\nexport type CycleState = \"upcoming\" | \"active\" | \"completed\";\n\nexport type CycleListItem = {\n\tid: string;\n\tteamId: string;\n\tteamIdentifier: string;\n\tteamName: string;\n\tname: string;\n\tdescription: string | null;\n\tstartDate: string;\n\tendDate: string;\n\tdateConvention: \"legacy\" | \"exclusive\";\n\tsource: \"legacy\" | \"generated\" | \"override\";\n\tcadenceRevisionId: string | null;\n\tcadenceSequence: number | null;\n\tcadenceTimezone: string | null;\n\tstatus: CycleState;\n\tstate: CycleState;\n\tlegacyStatus: \"upcoming\" | \"active\" | \"completed\";\n\tstateSource: \"transition_markers\" | \"planned_dates\";\n\tstartedAt: string | null;\n\tcontractFrozenAt: string | null;\n\tclosedAt: string | null;\n\treportMode: \"count\" | \"effort\";\n\treportEffectiveStartedAt: string;\n\treportingContractState: \"frozen\" | \"derived\" | \"provisional\";\n\testimateSettingsRevisionId: string | null;\n\testimateScale: EstimateScale | null;\n\testimateEpoch: string | null;\n\thistoryObservedSince: string;\n\thistoryComplete: boolean;\n\thistoryCoverage: { level: \"partial\" | \"complete\"; observedSince: string };\n\ttaskCounts: TaskCounts;\n\tcompletionPercentage: number;\n\teffort?: { readonly points: number; readonly unestimatedTasks: number };\n\tcreatedAt: string;\n\tupdatedAt: string;\n};\n\nexport type TeamListItem = {\n\tid: string;\n\tworkspaceId: string;\n\tname: string;\n\tidentifier: string;\n\tmodules: TeamModules;\n\twords: TeamWords;\n\tstartedFrom: TeamTemplateId | null;\n\tlabels: TeamLabels;\n\tmemberCount: number;\n\tcreatedAt: string;\n\tupdatedAt: string;\n};\n\nexport type StatusCategory =\n\t| \"backlog\"\n\t| \"unstarted\"\n\t| \"started\"\n\t| \"completed\"\n\t| \"cancelled\";\n\nexport type TeamStatus = {\n\tid: string;\n\tname: string;\n\tcolor: string;\n\tposition: number;\n\tcategory: StatusCategory;\n};\n\n/** `GET /workspaces/:slug/teams/:identifier` — the only read with statuses. */\nexport type TeamDetail = {\n\tid: string;\n\tworkspaceId: string;\n\tname: string;\n\tidentifier: string;\n\tmodules: TeamModules;\n\twords: TeamWords;\n\tstartedFrom: TeamTemplateId | null;\n\tlabels: TeamLabels;\n\tcreatedAt: string;\n\tupdatedAt: string;\n\tstatuses: TeamStatus[];\n};\n\n/**\n * Custom fields (6.4). A value as the API carries it: text and `YYYY-MM-DD`\n * dates are strings, numbers are numbers, a checkbox is `true`, a\n * single-select is one option id, a multi-select or people field is a list\n * of option or member ids. Null is no value.\n */\nexport type FieldValue = string | number | boolean | string[] | null;\n\nexport type FieldValueItem = { fieldId: string; value: FieldValue };\n\nexport type FieldOptionItem = {\n\tid: string;\n\tname: string;\n\tcolor: string;\n\tposition: number;\n\tarchivedAt: string | null;\n};\n\n/** One field in the workspace library, from `GET /workspaces/:slug/fields`. */\nexport type FieldDefinitionItem = {\n\tid: string;\n\t/** Stable once created: the CLI, agents and `?fields=` filters use it. */\n\tkey: string;\n\tname: string;\n\tdescription: string | null;\n\ttype: FieldTypeValue;\n\tappliesTo: FieldAppliesToValue;\n\tnumberFormat: NumberFormatValue | null;\n\tprecision: number | null;\n\tcurrencyCode: string | null;\n\tvisibleToGuests: boolean;\n\tarchivedAt: string | null;\n\toptions: FieldOptionItem[];\n\t/** Teams that switched this task field on, in their order. */\n\tteams: Array<{ teamId: string; position: number }>;\n\t/** How many tasks or projects hold a value. Absent for a guest. */\n\tvalueCount?: number;\n};\n\nexport type LabelListItem = {\n\tid: string;\n\tworkspaceId: string;\n\tname: string;\n\tcolor: string;\n\tcreatedAt: string;\n\tupdatedAt: string;\n};\n\nexport type AgentPolicyPresetName = \"read_only\" | \"triage\" | \"full\" | \"custom\";\n\nexport type AgentPolicyDetail = {\n\tpolicy: {\n\t\tid: string;\n\t\tversion: number;\n\t\tpreset: AgentPolicyPresetName;\n\t\tallowedActions: string[];\n\t};\n\tallowable: string[];\n\thistory: {\n\t\tversion: number;\n\t\tpreset: AgentPolicyPresetName;\n\t\tcreatedAt: string;\n\t\tcreatedByName: string | null;\n\t}[];\n};\n\nexport type CurrentUser = {\n\tid: string;\n\temail: string;\n\tname: string | null;\n\tavatarUrl: string | null;\n\tcreatedAt: string;\n};\n\n/** Filters accepted by `GET /workspaces/:slug/tasks`. */\nexport type TaskListFilters = {\n\tteam?: string;\n\tstatus?: string;\n\tassignee?: string;\n\tpriority?: string;\n\tproject?: string;\n\tcycle?: string;\n\t/** `overdue`, `today`, `week`, or `none` for tasks with no due date. */\n\tdue?: string;\n\t/**\n\t * `due` orders by due date, dated tasks first; `field:<key>` or\n\t * `field:<key>:desc` orders by a number, date or text field (6.4).\n\t */\n\tsort?: string;\n\t/**\n\t * Custom field filters (6.4): `key:op:value` joined by `;`, where op is\n\t * `is`, `gt`, `lt`, `set` or `empty`, e.g. `budget:gt:1000;channel:is:Email`.\n\t */\n\tfields?: string;\n\tq?: string;\n\tincludeArchived?: boolean;\n};\n\n/** Filters accepted by `GET /workspaces/:slug/cycles`. */\nexport type CycleListFilters = {\n\tteam?: string;\n};\n\n/** `POST /auth/cli/verify-code` response. */\nexport type CliTokenIssued = {\n\ttoken: string;\n\texpiresAt: string;\n\tuser: { id: string; email: string; name: string | null };\n};\n\n/** Who wrote the comment behind an event or a notification. */\nexport type MentionActorRef = {\n\tmemberId: string;\n\ttype: \"user\" | \"agent\";\n\tname: string | null;\n};\n\n/**\n * One row of `GET /workspaces/:slug/agents/me/events`.\n *\n * `mention` is a request addressed to the agent; `thread_message` is a later\n * human message in a thread the agent already joined (D-4). Ids only (D-6):\n * every read from these ids passes the policy layer.\n */\nexport type AgentEvent = {\n\tid: string;\n\tkind:\n\t\t| \"mention\"\n\t\t| \"thread_message\"\n\t\t| \"cycle_closed\"\n\t\t| \"timesheet_due\"\n\t\t| \"timesheet_reply\";\n\tworkspace: string;\n\t/** Exactly one of `taskId` / `projectId` is set: the entity the thread is on. */\n\ttaskId: string | null;\n\ttaskKey: string | null;\n\tprojectId: string | null;\n\t/** The thread the comment belongs to: the root comment's id (D-1). */\n\tthreadId: string | null;\n\tcommentId: string | null;\n\t/** Set only on `cycle_closed`: the release to narrate (B-04d D-2). */\n\treleaseId: string | null;\n\t/**\n\t * Set only on `timesheet_due` and `timesheet_reply`: the draft to write,\n\t * read with `timeDrafts.get` (TM-2).\n\t */\n\ttimeDraftId: string | null;\n\tmentionedBy: MentionActorRef | null;\n\tdeliveryCount: number;\n\tcreatedAt: string;\n};\n\n/** `GET /workspaces/:slug/agents/me/events` */\nexport type AgentEventsResponse = {\n\tevents: AgentEvent[];\n\tacked: string[];\n};\n\n/**\n * One row of `GET /workspaces/:slug/notifications`.\n *\n * `agent_reply` is a direct reply to the human's own message; `thread_reply`\n * is an agent message in a thread the human participates in (D-9).\n */\nexport type NotificationItem = {\n\tid: string;\n\tkind:\n\t\t| \"agent_reply\"\n\t\t| \"thread_reply\"\n\t\t| \"release_ready\"\n\t\t| \"approval_requested\"\n\t\t| \"approval_decided\"\n\t\t| \"assigned\"\n\t\t| \"mentioned\"\n\t\t| \"due_soon\"\n\t\t| \"timesheet_ready\";\n\t/** Exactly one of `taskId` / `projectId` is set: the entity the thread is on. */\n\ttaskId: string | null;\n\ttaskKey: string | null;\n\t/** The task's title when `taskId` is set. */\n\ttaskTitle: string | null;\n\tprojectId: string | null;\n\t/** Name of the project a project thread is on; null for a task thread. */\n\tprojectName: string | null;\n\t/** The thread the comment belongs to: the root comment's id (D-1). */\n\tthreadId: string | null;\n\tcommentId: string | null;\n\t/** The linked comment as plain text, ~200 characters cut on a word. */\n\texcerpt: string | null;\n\t/** Set only on `approval_decided`: the decision that row announced. */\n\tdecision: \"approved\" | \"changes_requested\" | \"rejected\" | null;\n\t/** Set only on `due_soon`: the due date (`YYYY-MM-DD`) the row was written for. */\n\tdueDate: string | null;\n\t/** Set only on `release_ready`: the release and how to name it (B-04d D-1). */\n\treleaseId: string | null;\n\treleaseNumber: number | null;\n\treleaseTeamIdentifier: string | null;\n\t/** Set only on `timesheet_ready`: the draft and the day it covers (TM-2). */\n\ttimeDraftId: string | null;\n\ttimeDraftDay: string | null;\n\tactor: MentionActorRef | null;\n\treadAt: string | null;\n\tcreatedAt: string;\n};\n\n/** `GET /workspaces/:slug/notifications` */\nexport type NotificationsResponse = {\n\tnotifications: NotificationItem[];\n\tunreadCount: number;\n};\n\n/** Who did something in the workspace activity feed. */\nexport type ActivityFeedActor = {\n\tmemberId: string | null;\n\tname: string;\n\tkind: \"user\" | \"agent\" | \"system\";\n};\n\n/** What an activity feed row is about. `key` is the task key on a task. */\nexport type ActivityFeedSubject = {\n\ttype: \"task\" | \"project\" | \"initiative\" | \"project_update\" | \"team\" | \"other\";\n\tid: string;\n\tkey: string | null;\n\ttitle: string;\n\tprojectId: string | null;\n};\n\n/**\n * One row of `GET /workspaces/:slug/activity`. `summary` is a verb phrase\n * with neither actor nor subject, so a row reads \"{actor} {summary} {subject}\".\n */\nexport type ActivityFeedItem = {\n\t/** `a:<activity id>` or `e:<event id>`. */\n\tid: string;\n\toccurredAt: string;\n\tactor: ActivityFeedActor;\n\tsummary: string;\n\tsubject: ActivityFeedSubject;\n};\n\n/** `GET /workspaces/:slug/activity`, newest first. */\nexport type ActivityFeedResponse = {\n\titems: ActivityFeedItem[];\n\tnextCursor: string | null;\n};\n\n/** An approval asked of the caller. */\nexport type WaitingApproval = {\n\ttaskId: string;\n\ttaskKey: string;\n\ttitle: string;\n\tprojectId: string | null;\n\tprojectName: string | null;\n\trequestedAt: string | null;\n\trequestedBy: {\n\t\tmemberId: string;\n\t\tname: string;\n\t\tkind: \"user\" | \"agent\";\n\t} | null;\n};\n\n/** An unsent agent draft on a project the caller leads. */\nexport type WaitingDraft = {\n\tupdateId: string;\n\tprojectId: string;\n\tprojectName: string;\n\thealth: ProjectHealth;\n\tbodyExcerpt: string;\n\tauthor: { memberId: string; name: string; kind: \"agent\" };\n\tcreatedAt: string;\n};\n\n/** `GET /workspaces/:slug/waiting` — people only. */\nexport type WaitingResponse = {\n\tapprovals: WaitingApproval[];\n\tdrafts: WaitingDraft[];\n\t/** Unsent agent-authored updates across the workspace, by agent member id. */\n\tdraftsByAgent: Record<string, number>;\n};\n\n/**\n * One row of `GET /workspaces/:slug/members`, narrowed to what the CLI needs\n * to turn an `--mention <name>` into an agent id. The route returns more per\n * agent (policy, keys); those members are left off deliberately so the SDK\n * does not promise a shape the CLI never reads.\n */\nexport type WorkspaceMemberListItem = {\n\tid: string;\n\tagentId: string | null;\n\ttype: \"user\" | \"agent\";\n\tname: string | null;\n\temail: string | null;\n\trole: \"owner\" | \"admin\" | \"member\" | \"guest\";\n};\n\n// ---------------------------------------------------------------------------\n// Thread context (B-04 slice 2, D-6/D-8).\n// ---------------------------------------------------------------------------\n\n/** Last N messages returned in a thread transcript (D-8). */\nexport const THREAD_CONTEXT_MESSAGE_LIMIT = 50;\n\n/** Last N activity rows returned for the entity (D-8). */\nexport const THREAD_CONTEXT_ACTIVITY_LIMIT = 20;\n\n/** Entity description is cut at this many characters (D-8). */\nexport const THREAD_CONTEXT_DESCRIPTION_MAX = 8000;\n\nexport type ThreadContextEntity =\n\t| {\n\t\t\ttype: \"task\";\n\t\t\tid: string;\n\t\t\t/** The human task key, e.g. `ENG-248`. */\n\t\t\tkey: string | null;\n\t\t\ttitle: string;\n\t\t\tstatus: string | null;\n\t\t\tdescription: string | null;\n\t\t\tdescriptionTruncated: boolean;\n\t\t\tproject: { id: string; name: string } | null;\n\t\t}\n\t| {\n\t\t\ttype: \"project\";\n\t\t\tid: string;\n\t\t\tkey: null;\n\t\t\ttitle: string;\n\t\t\tstatus: string | null;\n\t\t\tdescription: string | null;\n\t\t\tdescriptionTruncated: boolean;\n\t\t\tteams: Array<{ id: string; identifier: string; name: string }>;\n\t\t};\n\nexport type ThreadContextMessage = {\n\tid: string;\n\tauthorType: \"user\" | \"agent\" | null;\n\tauthorName: string | null;\n\tbody: string;\n\tcreatedAt: string;\n};\n\nexport type ThreadContextActivity = {\n\tid: string;\n\tkind: string;\n\tactorName: string | null;\n\tsummary: string;\n\tcreatedAt: string;\n};\n\nexport type ThreadContextParticipant = {\n\tmemberId: string;\n\ttype: \"user\" | \"agent\";\n\tname: string | null;\n\tjoinedVia: \"author\" | \"mention\";\n};\n\n/** `GET /workspaces/:slug/threads/:threadId/context` */\nexport type ThreadContext = {\n\tthreadId: string;\n\tentity: ThreadContextEntity;\n\tthread: {\n\t\t/** Oldest first, capped at `THREAD_CONTEXT_MESSAGE_LIMIT`. */\n\t\tmessages: Array<ThreadContextMessage>;\n\t\t/** Messages in the thread, including any the cap dropped. */\n\t\ttotal: number;\n\t\ttruncated: boolean;\n\t};\n\trecentActivity: Array<ThreadContextActivity>;\n\tparticipants: Array<ThreadContextParticipant>;\n};\n\n// ---------------------------------------------------------------------------\n// Agent isolation and loop safety (B-04c, D-1/D-4/D-5/D-6).\n// ---------------------------------------------------------------------------\n\n/** Whether agents on a team may wake each other. No setting means `isolated`. */\nexport const AGENT_ISOLATION_VALUES = [\"isolated\", \"open\"] as const;\n\nexport type AgentIsolation = (typeof AGENT_ISOLATION_VALUES)[number];\n\n/**\n * Why a wake was recorded `suppressed` instead of delivered. Precedence when\n * several apply: `isolation` > `loop_cap` > `fanout_cap`.\n */\nexport const SUPPRESSED_REASONS = [\n\t\"isolation\",\n\t\"fanout_cap\",\n\t\"loop_cap\",\n\t\"guest_actor\",\n] as const;\n\nexport type SuppressedReason = (typeof SUPPRESSED_REASONS)[number];\n\n/** One message wakes at most this many agents (D-4). */\nexport const MAX_AGENT_WAKES_PER_MESSAGE = 10;\n\n/**\n * A thread stops waking agents after this many agent messages in a row\n * without a person posting (D-5).\n */\nexport const MAX_CONSECUTIVE_AGENT_MESSAGES = 5;\n\n/**\n * One agent's outcome for a message, as `comment.add` reports it. `reason` is\n * null exactly when the wake is `pending`.\n */\nexport type WakeOutcome = {\n\tagentId: string;\n\tstate: \"pending\" | \"suppressed\";\n\treason: SuppressedReason | null;\n};\n\n/** The stored current setting for a team; absent until somebody saves one. */\nexport type TeamAgentSettingsRecord = {\n\tteamId: string;\n\tcurrentRevisionId: string;\n\trevision: number;\n\tisolation: AgentIsolation;\n\t/** The agent woken on a cycle close, if any (B-04d D-2). */\n\treleaseNarratorMemberId: string | null;\n\t/** The agent that drafts members' timesheets, if any (TM-2). */\n\ttimesheetDrafterMemberId: string | null;\n\ttimesheetDraftOnWeek: boolean;\n\ttimesheetDraftInInbox: boolean;\n\tcreatedAt: string;\n\tupdatedAt: string;\n};\n\n/** `GET /workspaces/:slug/teams/:identifier/agent-settings` */\nexport type TeamAgentSettingsResponse = {\n\tsettings: TeamAgentSettingsRecord | null;\n\t/** The effective setting: `isolated` when there is no row. */\n\tisolation: AgentIsolation;\n\tlimits: {\n\t\tmaxWakesPerMessage: number;\n\t\tmaxConsecutiveAgentMessages: number;\n\t};\n};\n\n// ---------------------------------------------------------------------------\n// Releases (B-04d, D-1/D-3/D-4).\n// ---------------------------------------------------------------------------\n\n/** How a task ended the cycle. Orthogonal to `addedMidCycle`. */\nexport const RELEASE_DISPOSITIONS = [\n\t\"shipped\",\n\t\"carried_over\",\n\t\"dropped\",\n] as const;\n\nexport type ReleaseDisposition = (typeof RELEASE_DISPOSITIONS)[number];\n\n/** A narrative is capped here on the way in (D-3). */\nexport const RELEASE_NARRATIVE_MAX = 50_000;\n\n/** Narrative excerpt length in a list row and in the previous-release summary. */\nexport const RELEASE_NARRATIVE_EXCERPT_MAX = 500;\n\n/** Each context list is cut at this many tasks. */\nexport const RELEASE_CONTEXT_TASK_LIMIT = 100;\n\nexport type ReleaseTask = {\n\tsourceTaskId: string;\n\ttaskIdentifier: string;\n\ttitle: string;\n\tstatusName: string;\n\tstatusCategory: string;\n\tdisposition: ReleaseDisposition;\n\taddedMidCycle: boolean;\n};\n\n/** Who wrote the narrative currently on a release. */\nexport type ReleaseNarrativeAuthor = {\n\tmemberId: string | null;\n\ttype: \"user\" | \"agent\" | \"system\" | null;\n\tname: string | null;\n\tupdatedAt: string;\n};\n\nexport type ReleaseCounts = {\n\tshipped: number;\n\tcarriedOver: number;\n\tdropped: number;\n\taddedMidCycle: number;\n\ttotal: number;\n};\n\n/** One row of `GET /workspaces/:slug/releases`. */\nexport type ReleaseSummary = {\n\tid: string;\n\tnumber: number;\n\tteamId: string;\n\tteamIdentifier: string;\n\tcycleId: string;\n\tcycleName: string | null;\n\tclosedAt: string;\n\tcounts: ReleaseCounts;\n\t/** First `RELEASE_NARRATIVE_EXCERPT_MAX` characters, or null when unwritten. */\n\tnarrativeExcerpt: string | null;\n\tnarrativeTruncated: boolean;\n\tnarrativeAuthor: ReleaseNarrativeAuthor | null;\n\tcreatedAt: string;\n};\n\n/** `GET /workspaces/:slug/releases/:releaseId` */\nexport type Release = ReleaseSummary & {\n\tcycleStartDate: string | null;\n\tcycleEndDate: string | null;\n\tnarrative: string | null;\n\ttasks: ReleaseTask[];\n};\n\n/**\n * The change between a release and the previous release of the same team\n * (D-4). Keyed by `sourceTaskId`, so a task that moved between cycles is\n * followed across them.\n */\nexport type ReleaseDiff = {\n\tpreviousReleaseId: string | null;\n\tpreviousReleaseNumber: number | null;\n\t/** In this release, not in the previous one. */\n\tadded: ReleaseTask[];\n\t/** Shipped in this release, whatever it was in the previous one. */\n\tcompleted: ReleaseTask[];\n\t/** Carried over in both: still unfinished after two cycles. */\n\tcarried: ReleaseTask[];\n\t/** Present in the previous release, absent from this one. */\n\tdropped: ReleaseTask[];\n};\n\n/** The previous release, as the context bundle summarizes it. */\nexport type ReleasePreviousSummary = {\n\tid: string;\n\tnumber: number;\n\tclosedAt: string;\n\tcounts: ReleaseCounts;\n\tnarrativeExcerpt: string | null;\n\tnarrativeTruncated: boolean;\n};\n\n/**\n * `GET /workspaces/:slug/releases/:releaseId/context`\n *\n * One read that hands a narrator everything it needs to write the narrative.\n * Every list is capped at `RELEASE_CONTEXT_TASK_LIMIT`; `counts` carries the\n * full totals, so a renderer can say \"showing N of M\".\n */\nexport type ReleaseContext = {\n\treleaseId: string;\n\tnumber: number;\n\tteam: { id: string; identifier: string; name: string };\n\tcycle: {\n\t\tid: string;\n\t\tname: string | null;\n\t\tstartDate: string | null;\n\t\tendDate: string | null;\n\t};\n\tclosedAt: string;\n\tcounts: ReleaseCounts;\n\tshipped: ReleaseTask[];\n\tcarriedOver: ReleaseTask[];\n\tdropped: ReleaseTask[];\n\taddedMidCycle: ReleaseTask[];\n\ttruncated: boolean;\n\tprevious: ReleasePreviousSummary | null;\n\tdiff: ReleaseDiff;\n};\n"],"mappings":";AAUO,IAAM,mBAAmB;AAGzB,IAAM,oBAAoB;;;ACL1B,IAAM,eAAN,cAA2B,MAAM;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,QAAgB,MAAiB;AAC5C,UAAM,KAAK,OAAO;AAClB,SAAK,OAAO;AACZ,SAAK,OAAO,KAAK;AACjB,SAAK,SAAS;AACd,SAAK,UAAU,KAAK;AAAA,EACrB;AACD;AASO,IAAM,qBAAN,cAAiC,aAAa;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,QAAgB,MAAiB,kBAAiC;AAC7E,UAAM,QAAQ,IAAI;AAClB,SAAK,OAAO;AAEZ,UAAM,UAAW,KAAK,WAAW,CAAC;AAElC,SAAK,QAA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