@imagile-dev/toil-ui 0.1.0-beta.2 → 0.1.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +144 -79
- package/dist/app/assets/{Graph-CS6dQALI.js → Graph-CFuW4gKS.js} +1 -1
- package/dist/app/assets/{PowershellMan-rG0kojOi.js → PowershellMan-BMVCrjjz.js} +1 -1
- package/dist/app/assets/index-BcEh-0qQ.css +1 -0
- package/dist/app/assets/index-D9EQ864e.js +74 -0
- package/dist/app/assets/theme-BJbhJDgp.css +1 -0
- package/dist/app/assets/theme-CC5mVuDH.css +1 -0
- package/dist/app/assets/theme-O_2f4jli.css +1 -0
- package/dist/app/assets/theme-gYmLCU0M.css +1 -0
- package/dist/app/assets/theme-mWrwQOT7.css +1 -0
- package/dist/app/assets/theme-paULUSRX.css +1 -0
- package/dist/app/index.html +2 -2
- package/dist/server/toil-ui.js +1572 -802
- package/package.json +2 -2
- package/dist/app/assets/index-B1I248Ba.js +0 -66
- package/dist/app/assets/index-DNYTmC1J.css +0 -1
- package/dist/app/assets/theme-63MlXwuO.css +0 -1
- package/dist/app/assets/theme-BJDDePbd.css +0 -1
- package/dist/app/assets/theme-BVugNGOi.css +0 -1
- package/dist/app/assets/theme-C_ukluUB.css +0 -1
- package/dist/app/assets/theme-D3_AOEgB.css +0 -1
- package/dist/app/assets/theme-DMjUjC0D.css +0 -1
package/dist/server/toil-ui.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// toil-ui-build {"version":"0.1.0-beta.
|
|
2
|
+
// toil-ui-build {"version":"0.1.0-beta.3","commit":"a8ca2c90f7942fbcd4cf98e643a97c83742330c4"}
|
|
3
3
|
import { contractVersion, execute, mapOwi, registry, version } from "@imagile-dev/toil/api";
|
|
4
4
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
5
|
import { chmodSync, closeSync, cpSync, existsSync, linkSync, lstatSync, mkdirSync, openSync, readFileSync, readSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
@@ -35,6 +35,7 @@ var CONFIG_CHANGES = [
|
|
|
35
35
|
"dossiers field",
|
|
36
36
|
"dossiers person",
|
|
37
37
|
"dossiers wip-limit",
|
|
38
|
+
"dossiers analyze set",
|
|
38
39
|
"dossiers onboard",
|
|
39
40
|
"dossiers describe",
|
|
40
41
|
"theme set"
|
|
@@ -45,300 +46,7 @@ var CONFIG_COMMANDS = /* @__PURE__ */ new Set([...CONFIG_READS, ...CONFIG_CHANGE
|
|
|
45
46
|
var DEFAULT_TIMEOUT_MS = 12e4;
|
|
46
47
|
//#endregion
|
|
47
48
|
//#region src/fixtures/config-areas.json
|
|
48
|
-
var config_areas_default = [
|
|
49
|
-
{
|
|
50
|
-
"name": "ado",
|
|
51
|
-
"description": "Azure DevOps Server: work items, repositories, pull requests and pipelines",
|
|
52
|
-
"connection": [
|
|
53
|
-
{
|
|
54
|
-
"name": "baseUrl",
|
|
55
|
-
"description": "Azure DevOps Server root, e.g. https://ado.imagile.dev (keep any /tfs prefix)",
|
|
56
|
-
"secret": false,
|
|
57
|
-
"password": false,
|
|
58
|
-
"default": null,
|
|
59
|
-
"required": true
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"name": "collection",
|
|
63
|
-
"description": "Default collection, when --collection isn't given",
|
|
64
|
-
"secret": false,
|
|
65
|
-
"password": false,
|
|
66
|
-
"default": null,
|
|
67
|
-
"required": false
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
"name": "project",
|
|
71
|
-
"description": "Default team project, when --project isn't given",
|
|
72
|
-
"secret": false,
|
|
73
|
-
"password": false,
|
|
74
|
-
"default": null,
|
|
75
|
-
"required": false
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
"name": "repo",
|
|
79
|
-
"description": "Default git repository, when --repo isn't given",
|
|
80
|
-
"secret": false,
|
|
81
|
-
"password": false,
|
|
82
|
-
"default": null,
|
|
83
|
-
"required": false
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
"name": "fieldAliases",
|
|
87
|
-
"description": "Work item field aliases, friendly name to reference name (e.g. {\"storypoints\": \"Microsoft.VSTS.Scheduling.StoryPoints\"})",
|
|
88
|
-
"secret": false,
|
|
89
|
-
"password": false,
|
|
90
|
-
"default": null,
|
|
91
|
-
"required": false
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
"name": "discoveredFields",
|
|
95
|
-
"description": "Work item fields recorded by an earlier discovery; kept, not read",
|
|
96
|
-
"secret": false,
|
|
97
|
-
"password": false,
|
|
98
|
-
"default": null,
|
|
99
|
-
"required": false
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
"name": "discoveredTypes",
|
|
103
|
-
"description": "Work item types recorded by an earlier discovery; kept, not read",
|
|
104
|
-
"secret": false,
|
|
105
|
-
"password": false,
|
|
106
|
-
"default": null,
|
|
107
|
-
"required": false
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
"name": "pat",
|
|
111
|
-
"description": "Personal access token",
|
|
112
|
-
"secret": true,
|
|
113
|
-
"password": false,
|
|
114
|
-
"default": null,
|
|
115
|
-
"required": true
|
|
116
|
-
}
|
|
117
|
-
]
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
"name": "bitbucket",
|
|
121
|
-
"description": "Bitbucket Data Center: repositories, pull requests, comments, reviewers and build statuses",
|
|
122
|
-
"connection": [
|
|
123
|
-
{
|
|
124
|
-
"name": "baseUrl",
|
|
125
|
-
"description": "Bitbucket server root, e.g. https://bitbucket.imagile.dev",
|
|
126
|
-
"secret": false,
|
|
127
|
-
"password": false,
|
|
128
|
-
"default": null,
|
|
129
|
-
"required": true
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
"name": "project",
|
|
133
|
-
"description": "Default project key",
|
|
134
|
-
"secret": false,
|
|
135
|
-
"password": false,
|
|
136
|
-
"default": null,
|
|
137
|
-
"required": false
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
"name": "repo",
|
|
141
|
-
"description": "Default repository slug",
|
|
142
|
-
"secret": false,
|
|
143
|
-
"password": false,
|
|
144
|
-
"default": null,
|
|
145
|
-
"required": false
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
"name": "targetBranch",
|
|
149
|
-
"description": "Default target branch for pr create (main when unset)",
|
|
150
|
-
"secret": false,
|
|
151
|
-
"password": false,
|
|
152
|
-
"default": null,
|
|
153
|
-
"required": false
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
"name": "pat",
|
|
157
|
-
"description": "HTTP access token",
|
|
158
|
-
"secret": true,
|
|
159
|
-
"password": false,
|
|
160
|
-
"default": null,
|
|
161
|
-
"required": true
|
|
162
|
-
}
|
|
163
|
-
]
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
"name": "github",
|
|
167
|
-
"description": "GitHub and GitHub Enterprise Server: pull requests, reviews, comments, checks, labels, assignees, issues and projects",
|
|
168
|
-
"connection": [
|
|
169
|
-
{
|
|
170
|
-
"name": "baseUrl",
|
|
171
|
-
"description": "REST API root: https://api.github.com, or https://ghe.imagile.dev/api/v3 for Enterprise Server",
|
|
172
|
-
"secret": false,
|
|
173
|
-
"password": false,
|
|
174
|
-
"default": null,
|
|
175
|
-
"required": true
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
"name": "owner",
|
|
179
|
-
"description": "Default owner (user or org)",
|
|
180
|
-
"secret": false,
|
|
181
|
-
"password": false,
|
|
182
|
-
"default": null,
|
|
183
|
-
"required": false
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
"name": "repo",
|
|
187
|
-
"description": "Default repository name",
|
|
188
|
-
"secret": false,
|
|
189
|
-
"password": false,
|
|
190
|
-
"default": null,
|
|
191
|
-
"required": false
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
"name": "targetBranch",
|
|
195
|
-
"description": "Default base branch for pr create (main when unset)",
|
|
196
|
-
"secret": false,
|
|
197
|
-
"password": false,
|
|
198
|
-
"default": null,
|
|
199
|
-
"required": false
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
"name": "token",
|
|
203
|
-
"description": "Fine-grained personal access token",
|
|
204
|
-
"secret": true,
|
|
205
|
-
"password": false,
|
|
206
|
-
"default": null,
|
|
207
|
-
"required": true
|
|
208
|
-
}
|
|
209
|
-
]
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
"name": "jenkins",
|
|
213
|
-
"description": "Jenkins: jobs, builds, console logs and the build queue",
|
|
214
|
-
"connection": [
|
|
215
|
-
{
|
|
216
|
-
"name": "baseUrl",
|
|
217
|
-
"description": "Jenkins server root, e.g. https://jenkins.imagile.dev",
|
|
218
|
-
"secret": false,
|
|
219
|
-
"password": false,
|
|
220
|
-
"default": null,
|
|
221
|
-
"required": true
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
"name": "username",
|
|
225
|
-
"description": "Jenkins user name the API token belongs to",
|
|
226
|
-
"secret": false,
|
|
227
|
-
"password": false,
|
|
228
|
-
"default": null,
|
|
229
|
-
"required": true
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
"name": "instance",
|
|
233
|
-
"description": "The name --instance selects this connection by, when it isn't the connection's own name",
|
|
234
|
-
"secret": false,
|
|
235
|
-
"password": false,
|
|
236
|
-
"default": null,
|
|
237
|
-
"required": false
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
"name": "apiToken",
|
|
241
|
-
"description": "Jenkins API token",
|
|
242
|
-
"secret": true,
|
|
243
|
-
"password": false,
|
|
244
|
-
"default": null,
|
|
245
|
-
"required": true
|
|
246
|
-
}
|
|
247
|
-
]
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
"name": "jira",
|
|
251
|
-
"description": "Jira Data Center: issues, search, transitions, comments, worklogs, attachments, custom fields, boards and sprints",
|
|
252
|
-
"connection": [
|
|
253
|
-
{
|
|
254
|
-
"name": "baseUrl",
|
|
255
|
-
"description": "Jira server root, e.g. https://jira.imagile.dev",
|
|
256
|
-
"secret": false,
|
|
257
|
-
"password": false,
|
|
258
|
-
"default": null,
|
|
259
|
-
"required": true
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
"name": "customFields",
|
|
263
|
-
"description": "Custom fields addressable by friendly name",
|
|
264
|
-
"secret": false,
|
|
265
|
-
"password": false,
|
|
266
|
-
"default": null,
|
|
267
|
-
"required": false
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
"name": "project",
|
|
271
|
-
"description": "Default project key for issue create",
|
|
272
|
-
"secret": false,
|
|
273
|
-
"password": false,
|
|
274
|
-
"default": null,
|
|
275
|
-
"required": false
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
"name": "issueType",
|
|
279
|
-
"description": "Default issue type for issue create (Task when unset)",
|
|
280
|
-
"secret": false,
|
|
281
|
-
"password": false,
|
|
282
|
-
"default": null,
|
|
283
|
-
"required": false
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
"name": "priority",
|
|
287
|
-
"description": "Default priority for issue create",
|
|
288
|
-
"secret": false,
|
|
289
|
-
"password": false,
|
|
290
|
-
"default": null,
|
|
291
|
-
"required": false
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
"name": "apiToken",
|
|
295
|
-
"description": "Personal access token",
|
|
296
|
-
"secret": true,
|
|
297
|
-
"password": false,
|
|
298
|
-
"default": null,
|
|
299
|
-
"required": true
|
|
300
|
-
}
|
|
301
|
-
]
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
"name": "openshift",
|
|
305
|
-
"description": "OpenShift and Kubernetes: pods, deployments, events, logs and resource usage",
|
|
306
|
-
"connection": [
|
|
307
|
-
{
|
|
308
|
-
"name": "baseUrl",
|
|
309
|
-
"description": "API server URL, e.g. https://openshift.imagile.dev",
|
|
310
|
-
"secret": false,
|
|
311
|
-
"password": false,
|
|
312
|
-
"default": null,
|
|
313
|
-
"required": false
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
"name": "env",
|
|
317
|
-
"description": "Environment name that --env selects this cluster by, e.g. prod",
|
|
318
|
-
"secret": false,
|
|
319
|
-
"password": false,
|
|
320
|
-
"default": null,
|
|
321
|
-
"required": false
|
|
322
|
-
},
|
|
323
|
-
{
|
|
324
|
-
"name": "instance",
|
|
325
|
-
"description": "Cluster instance name within the environment that --instance selects this cluster by, e.g. east",
|
|
326
|
-
"secret": false,
|
|
327
|
-
"password": false,
|
|
328
|
-
"default": null,
|
|
329
|
-
"required": false
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
"name": "token",
|
|
333
|
-
"description": "Bearer token, typically a service account token",
|
|
334
|
-
"secret": true,
|
|
335
|
-
"password": false,
|
|
336
|
-
"default": null,
|
|
337
|
-
"required": false
|
|
338
|
-
}
|
|
339
|
-
]
|
|
340
|
-
}
|
|
341
|
-
];
|
|
49
|
+
var config_areas_default = /*#__PURE__*/ JSON.parse("[{\"name\":\"ado\",\"description\":\"Azure DevOps Server and Azure DevOps Services: work items, boards, sprints, repositories, pull requests and pipelines\",\"connection\":[{\"name\":\"baseUrl\",\"description\":\"Server: the root, e.g. https://ado.imagile.dev (keep any /tfs prefix). Services: the organization URL, https://dev.azure.com/<organization> (or https://<organization>.visualstudio.com)\",\"secret\":false,\"password\":false,\"default\":null,\"required\":true},{\"name\":\"deployment\",\"description\":\"Which Azure DevOps this is: \\\"server\\\" for Azure DevOps Server (the default), or \\\"cloud\\\" for Azure DevOps Services\",\"secret\":false,\"password\":false,\"default\":\"server\",\"required\":false},{\"name\":\"collection\",\"description\":\"Server only: default collection, when --collection isn't given\",\"secret\":false,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"project\",\"description\":\"Default team project, when --project isn't given\",\"secret\":false,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"repo\",\"description\":\"Default git repository, when --repo isn't given\",\"secret\":false,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"team\",\"description\":\"Services only: default team for the board, backlog and sprint commands, when --team isn't given (else the project's default team)\",\"secret\":false,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"fieldAliases\",\"description\":\"Work item field aliases, friendly name to reference name (e.g. {\\\"storypoints\\\": \\\"Microsoft.VSTS.Scheduling.StoryPoints\\\"})\",\"secret\":false,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"discoveredFields\",\"description\":\"Server only: work item fields recorded by an earlier discovery; kept, not read\",\"secret\":false,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"discoveredTypes\",\"description\":\"Server only: work item types recorded by an earlier discovery; kept, not read\",\"secret\":false,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"pat\",\"description\":\"Personal access token. Services: an organization-scoped one\",\"secret\":true,\"password\":false,\"default\":null,\"required\":true}]},{\"name\":\"bitbucket\",\"description\":\"Bitbucket Data Center and Bitbucket Cloud: repositories, branches, tags, commits, files, pull requests, comments, reviewers, build statuses and Pipelines\",\"connection\":[{\"name\":\"baseUrl\",\"description\":\"Bitbucket root: the Data Center server (https://bitbucket.imagile.dev), or the Cloud REST API root (https://api.bitbucket.org/2.0)\",\"secret\":false,\"password\":false,\"default\":null,\"required\":true},{\"name\":\"deployment\",\"description\":\"Which Bitbucket this is: \\\"server\\\" for Data Center (the default), or \\\"cloud\\\" for Bitbucket Cloud\",\"secret\":false,\"password\":false,\"default\":\"server\",\"required\":false},{\"name\":\"email\",\"description\":\"Bitbucket Cloud only: the email address of the Atlassian account an API token belongs to (with apiToken)\",\"secret\":false,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"project\",\"description\":\"Data Center: default project key\",\"secret\":false,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"workspace\",\"description\":\"Bitbucket Cloud: default workspace slug\",\"secret\":false,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"repo\",\"description\":\"Default repository slug\",\"secret\":false,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"targetBranch\",\"description\":\"Data Center: default target branch for pr create (main when unset)\",\"secret\":false,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"pat\",\"description\":\"Data Center: an HTTP access token\",\"secret\":true,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"apiToken\",\"description\":\"Bitbucket Cloud only: an Atlassian API token with Bitbucket scopes, sent as Basic auth with email\",\"secret\":true,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"accessToken\",\"description\":\"Bitbucket Cloud only: a workspace, project or repository access token, sent as Bearer\",\"secret\":true,\"password\":false,\"default\":null,\"required\":false}]},{\"name\":\"github\",\"description\":\"GitHub and GitHub Enterprise Server: pull requests, reviews, comments, checks, labels, assignees, issues and projects\",\"connection\":[{\"name\":\"baseUrl\",\"description\":\"REST API root: https://api.github.com, or https://ghe.imagile.dev/api/v3 for Enterprise Server\",\"secret\":false,\"password\":false,\"default\":null,\"required\":true},{\"name\":\"owner\",\"description\":\"Default owner (user or org)\",\"secret\":false,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"repo\",\"description\":\"Default repository name\",\"secret\":false,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"targetBranch\",\"description\":\"Default base branch for pr create (main when unset)\",\"secret\":false,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"token\",\"description\":\"Fine-grained personal access token\",\"secret\":true,\"password\":false,\"default\":null,\"required\":true}]},{\"name\":\"jenkins\",\"description\":\"Jenkins: jobs, builds, console logs and the build queue\",\"connection\":[{\"name\":\"baseUrl\",\"description\":\"Jenkins server root, e.g. https://jenkins.imagile.dev\",\"secret\":false,\"password\":false,\"default\":null,\"required\":true},{\"name\":\"username\",\"description\":\"Jenkins user name the API token belongs to\",\"secret\":false,\"password\":false,\"default\":null,\"required\":true},{\"name\":\"instance\",\"description\":\"The name --instance selects this connection by, when it isn't the connection's own name\",\"secret\":false,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"apiToken\",\"description\":\"Jenkins API token\",\"secret\":true,\"password\":false,\"default\":null,\"required\":true}]},{\"name\":\"jira\",\"description\":\"Jira Data Center and Jira Cloud: issues, JQL search, transitions, comments, worklogs, attachments, custom fields, projects, users, boards and sprints\",\"connection\":[{\"name\":\"baseUrl\",\"description\":\"Jira root: the Data Center server (https://jira.imagile.dev), or the Cloud site (https://<your-site>.atlassian.net)\",\"secret\":false,\"password\":false,\"default\":null,\"required\":true},{\"name\":\"deployment\",\"description\":\"Which Jira this is: \\\"server\\\" for Data Center (the default), or \\\"cloud\\\" for Jira Cloud\",\"secret\":false,\"password\":false,\"default\":\"server\",\"required\":false},{\"name\":\"email\",\"description\":\"Jira Cloud only: the email address of the Atlassian account the API token belongs to\",\"secret\":false,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"customFields\",\"description\":\"Custom fields addressable by friendly name\",\"secret\":false,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"project\",\"description\":\"Default project key for issue create\",\"secret\":false,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"issueType\",\"description\":\"Default issue type for issue create (Task when unset)\",\"secret\":false,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"priority\",\"description\":\"Default priority for issue create\",\"secret\":false,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"apiToken\",\"description\":\"Data Center: a personal access token. Cloud: an Atlassian account API token\",\"secret\":true,\"password\":false,\"default\":null,\"required\":true}]},{\"name\":\"openshift\",\"description\":\"OpenShift and Kubernetes: pods, deployments, events, logs and resource usage\",\"connection\":[{\"name\":\"baseUrl\",\"description\":\"API server URL, e.g. https://openshift.imagile.dev\",\"secret\":false,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"env\",\"description\":\"Environment name that --env selects this cluster by, e.g. prod\",\"secret\":false,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"instance\",\"description\":\"Cluster instance name within the environment that --instance selects this cluster by, e.g. east\",\"secret\":false,\"password\":false,\"default\":null,\"required\":false},{\"name\":\"token\",\"description\":\"Bearer token, typically a service account token\",\"secret\":true,\"password\":false,\"default\":null,\"required\":false}]}]");
|
|
342
50
|
//#endregion
|
|
343
51
|
//#region src/fixtures/dossiers.ts
|
|
344
52
|
var DOSSIERS$1 = [
|
|
@@ -436,7 +144,7 @@ var DOSSIERS$1 = [
|
|
|
436
144
|
].join("\n")]
|
|
437
145
|
}
|
|
438
146
|
},
|
|
439
|
-
|
|
147
|
+
bitbucket: {
|
|
440
148
|
connection: "bitbucket-cloud",
|
|
441
149
|
workspace: "imagile",
|
|
442
150
|
repo: "checkout-sdk"
|
|
@@ -456,7 +164,7 @@ var DOSSIERS$1 = [
|
|
|
456
164
|
name: "Ada D.",
|
|
457
165
|
ids: {
|
|
458
166
|
github: "ada-dev",
|
|
459
|
-
|
|
167
|
+
bitbucket: "557058:abc12345-0000-0000-0000-000000000020"
|
|
460
168
|
}
|
|
461
169
|
},
|
|
462
170
|
{
|
|
@@ -477,9 +185,11 @@ var fileOf = (name) => `${USER_DIR}/${name}.json`;
|
|
|
477
185
|
/** Each area's context inputs, as `dossiers show` resolves them: the ones the registry declares, nothing else. */
|
|
478
186
|
var CONTEXT = {
|
|
479
187
|
jira: ["project"],
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
188
|
+
bitbucket: [
|
|
189
|
+
"project",
|
|
190
|
+
"workspace",
|
|
191
|
+
"repo"
|
|
192
|
+
],
|
|
483
193
|
jenkins: ["instance"],
|
|
484
194
|
ado: [
|
|
485
195
|
"collection",
|
|
@@ -552,9 +262,95 @@ function listData() {
|
|
|
552
262
|
};
|
|
553
263
|
}
|
|
554
264
|
//#endregion
|
|
265
|
+
//#region src/ado-revisions.ts
|
|
266
|
+
var isRec$6 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
267
|
+
var DAY$7 = 864e5;
|
|
268
|
+
/** The fields of a revision that `mapOwi` reads (adoHistory): the revision's `rev` is the feed's own, the rest are asked for by name. */
|
|
269
|
+
var ADO_FEED_FIELDS = "System.Rev,System.ChangedDate,System.ChangedBy,System.State,System.IterationPath";
|
|
270
|
+
/** `Name <email>`: the text form of an identity in the feed. */
|
|
271
|
+
var NAMED = /^.+<[^<>]+>$/;
|
|
272
|
+
/**
|
|
273
|
+
* The instant the feed is asked to start at: a day before the window opens, so
|
|
274
|
+
* it covers WIQL's `@Today - n`, which counts from the start of today.
|
|
275
|
+
*/
|
|
276
|
+
var feedStart = (now, windowDays) => (/* @__PURE__ */ new Date(now.getTime() - (windowDays + 1) * DAY$7)).toISOString();
|
|
277
|
+
/** The revisions of one item as `work-item history` lists them, if the feed has exactly revisions 1 to `rev`. */
|
|
278
|
+
function wholeRevisions(revisions, rev) {
|
|
279
|
+
if (!revisions?.length || typeof rev !== "number" || !Number.isInteger(rev) || rev < 1 || revisions.length !== rev) return null;
|
|
280
|
+
const sorted = [...revisions].sort((a, b) => Number(a.rev) - Number(b.rev));
|
|
281
|
+
for (const [n, r] of sorted.entries()) {
|
|
282
|
+
if (r.rev !== n + 1 || !isRec$6(r.fields)) return null;
|
|
283
|
+
if (typeof r.fields["System.ChangedDate"] !== "string") return null;
|
|
284
|
+
const by = r.fields["System.ChangedBy"];
|
|
285
|
+
if (typeof by === "string" && !NAMED.test(by)) return null;
|
|
286
|
+
}
|
|
287
|
+
return sorted;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* The feed split into what `mapOwi` has always been given. `items` are the
|
|
291
|
+
* work items `get-many` returned (each with its `id` and `rev`), `historyCommand`
|
|
292
|
+
* names the command the envelopes stand in for, and `iterationOverride` is the
|
|
293
|
+
* dossier's own iteration field, when it sets one: any such field sends every
|
|
294
|
+
* item to `work-item history`.
|
|
295
|
+
*/
|
|
296
|
+
function splitRevisionFeed(feed, items, historyCommand, iterationOverride) {
|
|
297
|
+
const ids = items.map((i) => Number(i.id)).filter(Number.isFinite);
|
|
298
|
+
if (!feed || !feed.ok || !Array.isArray(feed.data) || iterationOverride !== void 0) return {
|
|
299
|
+
histories: [],
|
|
300
|
+
incomplete: ids
|
|
301
|
+
};
|
|
302
|
+
const byItem = /* @__PURE__ */ new Map();
|
|
303
|
+
for (const r of feed.data) {
|
|
304
|
+
if (!isRec$6(r) || typeof r.id !== "number") continue;
|
|
305
|
+
const list = byItem.get(r.id);
|
|
306
|
+
if (list) list.push(r);
|
|
307
|
+
else byItem.set(r.id, [r]);
|
|
308
|
+
}
|
|
309
|
+
const meta = {
|
|
310
|
+
...feed.meta,
|
|
311
|
+
command: historyCommand
|
|
312
|
+
};
|
|
313
|
+
delete meta.page;
|
|
314
|
+
delete meta.warnings;
|
|
315
|
+
const histories = [];
|
|
316
|
+
const incomplete = [];
|
|
317
|
+
for (const item of items) {
|
|
318
|
+
const id = Number(item.id);
|
|
319
|
+
const whole = wholeRevisions(byItem.get(id), item.rev);
|
|
320
|
+
if (whole === null) incomplete.push(id);
|
|
321
|
+
else histories.push({
|
|
322
|
+
ok: true,
|
|
323
|
+
data: whole,
|
|
324
|
+
error: null,
|
|
325
|
+
meta
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
return {
|
|
329
|
+
histories,
|
|
330
|
+
incomplete
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
/** The key a revision is known by: an item's revision numbers never repeat. */
|
|
334
|
+
var revisionKey = (r) => `${r.id}@${r.rev}`;
|
|
335
|
+
/**
|
|
336
|
+
* The cached feed with a delta read from a watermark laid over it, by item and
|
|
337
|
+
* revision number (a revision read twice, as the watermark's margin makes
|
|
338
|
+
* likely, is kept once, the newer copy). `keep`, when given, drops the items
|
|
339
|
+
* the sync no longer lists, so the cached feed stays the size of the window.
|
|
340
|
+
* The merged feed is whole where `splitRevisionFeed` can tell: it sees the same
|
|
341
|
+
* run of 1 to `rev` or it reads the item with `work-item history`.
|
|
342
|
+
*/
|
|
343
|
+
function mergeFeed(cached, fresh, keep) {
|
|
344
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
345
|
+
for (const r of cached) byKey.set(revisionKey(r), r);
|
|
346
|
+
for (const r of fresh) byKey.set(revisionKey(r), r);
|
|
347
|
+
const all = [...byKey.values()];
|
|
348
|
+
return keep ? all.filter((r) => keep.has(Number(r.id))) : all;
|
|
349
|
+
}
|
|
350
|
+
//#endregion
|
|
555
351
|
//#region src/model/delivery.ts
|
|
556
|
-
var isRec$
|
|
557
|
-
var recs$2 = (v) => Array.isArray(v) ? v.filter(isRec$
|
|
352
|
+
var isRec$5 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
353
|
+
var recs$2 = (v) => Array.isArray(v) ? v.filter(isRec$5) : [];
|
|
558
354
|
var str$2 = (v) => typeof v === "string" && v !== "" ? v : null;
|
|
559
355
|
/** An instant as ISO 8601, or '' (shown as unknown) when it's missing or unparsable: one bad date stays on its own row. */
|
|
560
356
|
var iso = (v) => {
|
|
@@ -562,8 +358,8 @@ var iso = (v) => {
|
|
|
562
358
|
const t = new Date(v).getTime();
|
|
563
359
|
return Number.isNaN(t) ? "" : new Date(t).toISOString();
|
|
564
360
|
};
|
|
565
|
-
/** A source's family, as the panels name it:
|
|
566
|
-
var family
|
|
361
|
+
/** A source's family, as the panels name it: an area's first word (`github`, `ado`). */
|
|
362
|
+
var family = (area) => area.split("-")[0];
|
|
567
363
|
/**
|
|
568
364
|
* A pull request's `ChangeRef`, made from its OWI change: the work items it
|
|
569
365
|
* names that the dossier's own queries returned, its state, and the time the
|
|
@@ -575,7 +371,7 @@ function changeRef(c, byId) {
|
|
|
575
371
|
return {
|
|
576
372
|
id: c.id,
|
|
577
373
|
kind: "pull-request",
|
|
578
|
-
source: family
|
|
374
|
+
source: family(c.source.area),
|
|
579
375
|
command: c.source.command,
|
|
580
376
|
items: c.workItems.filter((id) => byId.has(id)),
|
|
581
377
|
title: c.title,
|
|
@@ -617,12 +413,12 @@ function jenkinsBuilds(data, connection, job, pr) {
|
|
|
617
413
|
/** Azure Pipelines CI runs, each joined to its pull request by `triggerInfo["pr.number"]` or a `refs/pull/<id>/merge` branch. */
|
|
618
414
|
function adoBuilds(data, connection, prs) {
|
|
619
415
|
return recs$2(data).flatMap((run) => {
|
|
620
|
-
const number = (isRec$
|
|
416
|
+
const number = (isRec$5(run.triggerInfo) ? str$2(run.triggerInfo["pr.number"]) : null) ?? /^refs\/pull\/(\d+)\/merge$/.exec(str$2(run.sourceBranch) ?? "")?.[1];
|
|
621
417
|
const pr = number ? prs.find((p) => p.id.endsWith(`#${number}`)) : void 0;
|
|
622
418
|
if (!pr) return [];
|
|
623
419
|
const status = str$2(run.status);
|
|
624
420
|
const result = str$2(run.result);
|
|
625
|
-
const definition = isRec$
|
|
421
|
+
const definition = isRec$5(run.definition) ? str$2(run.definition.name) : null;
|
|
626
422
|
return [{
|
|
627
423
|
id: `${connection}:build#${run.id}`,
|
|
628
424
|
kind: "build",
|
|
@@ -630,7 +426,7 @@ function adoBuilds(data, connection, prs) {
|
|
|
630
426
|
command: "ado run list",
|
|
631
427
|
items: pr.items,
|
|
632
428
|
title: `${definition ?? "build"} ${run.buildNumber}`,
|
|
633
|
-
url: isRec$
|
|
429
|
+
url: isRec$5(run._links) && isRec$5(run._links.web) ? str$2(run._links.web.href) : null,
|
|
634
430
|
state: status === "completed" ? result ?? "completed" : status ?? "unknown",
|
|
635
431
|
outcome: status !== "completed" ? "running" : result === "succeeded" ? "passed" : "failed",
|
|
636
432
|
builds: pr.id,
|
|
@@ -688,7 +484,7 @@ function included$1(commit, prs) {
|
|
|
688
484
|
var IMAGE_TAG = /:(?:(.+)-)?([0-9a-f]{7,40})$/;
|
|
689
485
|
/** An OpenShift namespace's Deployments for the dossier's repositories, by the commit in each image tag. */
|
|
690
486
|
function openshiftDeployments(data, environment, repos, prs) {
|
|
691
|
-
const body = isRec$
|
|
487
|
+
const body = isRec$5(data) ? data : {};
|
|
692
488
|
return recs$2(body.deployments).filter((d) => repos.includes(String(d.name))).map((d) => {
|
|
693
489
|
const image = str$2(recs$2(d.images)[0]?.image) ?? "";
|
|
694
490
|
const [, version, commit] = IMAGE_TAG.exec(image) ?? [];
|
|
@@ -711,7 +507,7 @@ function openshiftDeployments(data, environment, repos, prs) {
|
|
|
711
507
|
}
|
|
712
508
|
/** Azure Pipelines deploy runs: the newest successful run per `templateParameters.environment`. */
|
|
713
509
|
function adoDeployments(data, connection, prs) {
|
|
714
|
-
const runs = recs$2(data).filter((r) => r.status === "completed" && r.result === "succeeded" && isRec$
|
|
510
|
+
const runs = recs$2(data).filter((r) => r.status === "completed" && r.result === "succeeded" && isRec$5(r.templateParameters) && str$2(r.templateParameters.environment)).sort((a, b) => iso(a.finishTime) < iso(b.finishTime) ? 1 : -1);
|
|
715
511
|
const seen = /* @__PURE__ */ new Set();
|
|
716
512
|
const out = [];
|
|
717
513
|
for (const run of runs) {
|
|
@@ -724,12 +520,12 @@ function adoDeployments(data, connection, prs) {
|
|
|
724
520
|
environment,
|
|
725
521
|
source: "ado",
|
|
726
522
|
command: "ado run list",
|
|
727
|
-
name: `${isRec$
|
|
523
|
+
name: `${isRec$5(run.definition) ? str$2(run.definition.name) : "deploy"} ${run.buildNumber}`,
|
|
728
524
|
commit: commit.slice(0, 7),
|
|
729
525
|
version: null,
|
|
730
526
|
state: String(run.result),
|
|
731
527
|
outcome: "passed",
|
|
732
|
-
url: isRec$
|
|
528
|
+
url: isRec$5(run._links) && isRec$5(run._links.web) ? str$2(run._links.web.href) : null,
|
|
733
529
|
...included$1(commit, prs)
|
|
734
530
|
});
|
|
735
531
|
}
|
|
@@ -746,8 +542,76 @@ var byEnvironment = (a, b) => {
|
|
|
746
542
|
return rank(a.environment) - rank(b.environment) || a.environment.localeCompare(b.environment);
|
|
747
543
|
};
|
|
748
544
|
//#endregion
|
|
545
|
+
//#region src/jira-changelog.ts
|
|
546
|
+
var isRec$4 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
547
|
+
/** The entries of one issue's inline changelog, if Jira sent all of them. */
|
|
548
|
+
function wholeHistories(changelog) {
|
|
549
|
+
if (!isRec$4(changelog) || !Array.isArray(changelog.histories)) return null;
|
|
550
|
+
const histories = changelog.histories.filter(isRec$4);
|
|
551
|
+
if (typeof changelog.total !== "number" || changelog.total !== histories.length) return null;
|
|
552
|
+
if (typeof changelog.maxResults !== "number" || histories.length >= changelog.maxResults) return null;
|
|
553
|
+
return histories;
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* `issue history` lists entries oldest first, on both deployments. Cloud's
|
|
557
|
+
* search sends them newest first (Data Center's order is undocumented,
|
|
558
|
+
* docs/decisions/493-jira-changelog.md), so a list that runs newest first is
|
|
559
|
+
* turned round, which gives `mapOwi` the entries in the order
|
|
560
|
+
* `issue history` would have. A list already oldest first is left alone.
|
|
561
|
+
*/
|
|
562
|
+
function oldestFirst(histories) {
|
|
563
|
+
const at = (h) => Date.parse(String(h?.created ?? "").replace(/([+-]\d{2})(\d{2})$/, "$1:$2"));
|
|
564
|
+
const first = at(histories[0]);
|
|
565
|
+
const last = at(histories[histories.length - 1]);
|
|
566
|
+
return Number.isFinite(first) && Number.isFinite(last) && first > last ? [...histories].reverse() : histories;
|
|
567
|
+
}
|
|
568
|
+
function splitChangelogs(search, historyCommand) {
|
|
569
|
+
const data = search.data;
|
|
570
|
+
if (!search.ok || !isRec$4(data) || !Array.isArray(data.issues)) return {
|
|
571
|
+
search,
|
|
572
|
+
histories: [],
|
|
573
|
+
incomplete: []
|
|
574
|
+
};
|
|
575
|
+
const histories = [];
|
|
576
|
+
const incomplete = [];
|
|
577
|
+
const meta = {
|
|
578
|
+
...search.meta,
|
|
579
|
+
command: historyCommand
|
|
580
|
+
};
|
|
581
|
+
delete meta.page;
|
|
582
|
+
delete meta.warnings;
|
|
583
|
+
const issues = data.issues.map((issue) => {
|
|
584
|
+
if (!isRec$4(issue)) return issue;
|
|
585
|
+
const { changelog, ...rest } = issue;
|
|
586
|
+
const key = String(issue.key);
|
|
587
|
+
const whole = wholeHistories(changelog);
|
|
588
|
+
if (whole === null) incomplete.push(key);
|
|
589
|
+
else histories.push({
|
|
590
|
+
key,
|
|
591
|
+
history: {
|
|
592
|
+
ok: true,
|
|
593
|
+
data: oldestFirst(whole),
|
|
594
|
+
error: null,
|
|
595
|
+
meta
|
|
596
|
+
}
|
|
597
|
+
});
|
|
598
|
+
return rest;
|
|
599
|
+
});
|
|
600
|
+
return {
|
|
601
|
+
search: {
|
|
602
|
+
...search,
|
|
603
|
+
data: {
|
|
604
|
+
...data,
|
|
605
|
+
issues
|
|
606
|
+
}
|
|
607
|
+
},
|
|
608
|
+
histories,
|
|
609
|
+
incomplete
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
//#endregion
|
|
749
613
|
//#region src/model/flow.ts
|
|
750
|
-
var DAY$
|
|
614
|
+
var DAY$6 = 864e5;
|
|
751
615
|
/**
|
|
752
616
|
* Work that flows: not an epic, feature or other container. An item with no
|
|
753
617
|
* type at all (a GitHub issue in a repository without issue types) is work,
|
|
@@ -764,7 +628,7 @@ function percentile(values, p) {
|
|
|
764
628
|
function weekStart(iso) {
|
|
765
629
|
const t = Date.parse(iso);
|
|
766
630
|
const day = new Date(t).getUTCDay();
|
|
767
|
-
const monday = Math.floor(t / DAY$
|
|
631
|
+
const monday = Math.floor(t / DAY$6) * DAY$6 - (day + 6) % 7 * DAY$6;
|
|
768
632
|
return new Date(monday).toISOString();
|
|
769
633
|
}
|
|
770
634
|
new Intl.DateTimeFormat("en-GB", {
|
|
@@ -783,9 +647,15 @@ new Intl.DateTimeFormat("en-GB", {
|
|
|
783
647
|
timeZone: "UTC"
|
|
784
648
|
});
|
|
785
649
|
//#endregion
|
|
786
|
-
//#region src/
|
|
787
|
-
|
|
788
|
-
|
|
650
|
+
//#region ../src/core/brief/time.ts
|
|
651
|
+
/**
|
|
652
|
+
* The clock arithmetic the briefing and Toil UI share. Time waiting on a
|
|
653
|
+
* review is counted in working days, Monday to Friday UTC, since nobody
|
|
654
|
+
* reviews at the weekend except the people who say they don't. Moved here
|
|
655
|
+
* from Toil UI (#494) so toil's briefing and Toil UI's pull request page
|
|
656
|
+
* count the same days.
|
|
657
|
+
*/
|
|
658
|
+
var DAY$5 = 864e5;
|
|
789
659
|
/** Working days between two instants, Monday to Friday UTC, to the fraction of a day. */
|
|
790
660
|
function workingDays(from, to) {
|
|
791
661
|
let a = Date.parse(from);
|
|
@@ -793,13 +663,92 @@ function workingDays(from, to) {
|
|
|
793
663
|
if (!(b > a)) return 0;
|
|
794
664
|
let n = 0;
|
|
795
665
|
while (a < b) {
|
|
796
|
-
const end = Math.min(b, (Math.floor(a / DAY$
|
|
666
|
+
const end = Math.min(b, (Math.floor(a / DAY$5) + 1) * DAY$5);
|
|
797
667
|
const d = new Date(a).getUTCDay();
|
|
798
|
-
if (d !== 0 && d !== 6) n += (end - a) / DAY$
|
|
668
|
+
if (d !== 0 && d !== 6) n += (end - a) / DAY$5;
|
|
799
669
|
a = end;
|
|
800
670
|
}
|
|
801
671
|
return n;
|
|
802
672
|
}
|
|
673
|
+
var LENS = new Map([
|
|
674
|
+
{
|
|
675
|
+
id: "failing",
|
|
676
|
+
label: "Failing checks",
|
|
677
|
+
severity: "danger",
|
|
678
|
+
unit: "hours",
|
|
679
|
+
threshold: 24,
|
|
680
|
+
on: true,
|
|
681
|
+
test: (t) => `checks on an open pull request for an open item have failed for more than ${t} hours`
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
id: "blocked",
|
|
685
|
+
label: "Blocked",
|
|
686
|
+
severity: "danger",
|
|
687
|
+
unit: null,
|
|
688
|
+
threshold: null,
|
|
689
|
+
on: true,
|
|
690
|
+
test: () => "an open item waits on another open item"
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
id: "waiting",
|
|
694
|
+
label: "Waiting on review",
|
|
695
|
+
severity: "warn",
|
|
696
|
+
unit: "working days",
|
|
697
|
+
threshold: 2,
|
|
698
|
+
on: true,
|
|
699
|
+
test: (t) => `an open pull request has had no first review for more than ${t} working days`
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
id: "sprint",
|
|
703
|
+
label: "Sprint at risk",
|
|
704
|
+
severity: "warn",
|
|
705
|
+
unit: null,
|
|
706
|
+
threshold: null,
|
|
707
|
+
on: true,
|
|
708
|
+
test: () => "at the pace so far, the current sprint won't finish the points in it"
|
|
709
|
+
},
|
|
710
|
+
{
|
|
711
|
+
id: "stale",
|
|
712
|
+
label: "Stale",
|
|
713
|
+
severity: "warn",
|
|
714
|
+
unit: "days",
|
|
715
|
+
threshold: 5,
|
|
716
|
+
on: true,
|
|
717
|
+
test: (t) => `an item in progress has had no update for more than ${t} days`
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
id: "load",
|
|
721
|
+
label: "Over the WIP limit",
|
|
722
|
+
severity: "warn",
|
|
723
|
+
unit: null,
|
|
724
|
+
threshold: null,
|
|
725
|
+
on: true,
|
|
726
|
+
test: (_t, wip) => `someone has more than ${wip ?? "the dossier's WIP limit of"} items in progress (describe load, never rank people)`
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
id: "drift",
|
|
730
|
+
label: "Ticket and pull request disagree",
|
|
731
|
+
severity: "warn",
|
|
732
|
+
unit: null,
|
|
733
|
+
threshold: null,
|
|
734
|
+
on: true,
|
|
735
|
+
test: () => "an item is done while its pull request is open, or its pull request merged while the item is still open"
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
id: "ready",
|
|
739
|
+
label: "Not ready",
|
|
740
|
+
severity: "warn",
|
|
741
|
+
unit: null,
|
|
742
|
+
threshold: null,
|
|
743
|
+
on: false,
|
|
744
|
+
test: () => "the next item in line fails the readiness checks"
|
|
745
|
+
}
|
|
746
|
+
].map((l) => [l.id, l]));
|
|
747
|
+
var lensDef = (id) => LENS.get(id);
|
|
748
|
+
//#endregion
|
|
749
|
+
//#region src/model/prs.ts
|
|
750
|
+
var DAY$4 = 864e5;
|
|
751
|
+
var WEEK = 7 * DAY$4;
|
|
803
752
|
var isOpen$1 = (c) => c.state === "OPEN" || c.state === "DRAFT";
|
|
804
753
|
var round1$2 = (n) => Math.round(n * 10) / 10;
|
|
805
754
|
var daysText = (n) => `${round1$2(n)} working ${round1$2(n) === 1 ? "day" : "days"}`;
|
|
@@ -851,8 +800,12 @@ function sizeOf(c) {
|
|
|
851
800
|
files: c.size?.files ?? null
|
|
852
801
|
};
|
|
853
802
|
}
|
|
803
|
+
/** Working days a pull request may wait for its first review before it is flagged. */
|
|
804
|
+
var PICKUP_DAYS = lensDef("waiting").threshold;
|
|
805
|
+
/** Hours checks may fail before it is flagged. */
|
|
806
|
+
var FAILING_HOURS = lensDef("failing").threshold;
|
|
854
807
|
var PR_FLAG_LABEL = {
|
|
855
|
-
"slow-pickup": `No first review in
|
|
808
|
+
"slow-pickup": `No first review in ${PICKUP_DAYS} working days`,
|
|
856
809
|
"failing-checks": "Checks failing for over a day",
|
|
857
810
|
conflict: "Merge conflict",
|
|
858
811
|
"no-work-item": "No linked work item",
|
|
@@ -866,13 +819,13 @@ function flagsOf(c, byId, now) {
|
|
|
866
819
|
const items = linked(c, byId).map((id) => byId.get(id));
|
|
867
820
|
if (c.state === "OPEN") {
|
|
868
821
|
const waited = c.created ? workingDays(c.created, c.firstReviewAt ?? now) : null;
|
|
869
|
-
if (!c.firstReviewAt && waited !== null && waited >
|
|
822
|
+
if (!c.firstReviewAt && waited !== null && waited > PICKUP_DAYS) out.push({
|
|
870
823
|
flag: "slow-pickup",
|
|
871
824
|
text: `Open ${daysText(waited)} with no review yet.`
|
|
872
825
|
});
|
|
873
826
|
}
|
|
874
827
|
if (isOpen$1(c)) {
|
|
875
|
-
if (c.checks === "FAILING" && c.checksAt && Date.parse(now) - Date.parse(c.checksAt) >
|
|
828
|
+
if (c.checks === "FAILING" && c.checksAt && Date.parse(now) - Date.parse(c.checksAt) > FAILING_HOURS * 36e5) out.push({
|
|
876
829
|
flag: "failing-checks",
|
|
877
830
|
text: `Failing since ${c.checksAt.slice(0, 16).replace("T", " ")} UTC, ${round1$2((Date.parse(now) - Date.parse(c.checksAt)) / DAY$4)} days.`
|
|
878
831
|
});
|
|
@@ -1158,11 +1111,9 @@ function readPeople(dossier) {
|
|
|
1158
1111
|
}
|
|
1159
1112
|
var identityKey = (area, id) => `${area}\u0000${lower$1(id)}`;
|
|
1160
1113
|
var keyOf$2 = (i) => identityKey(i.area, i.id);
|
|
1161
|
-
/**
|
|
1162
|
-
var family = (area) => area.replace(/-cloud$/, "");
|
|
1163
|
-
/** The identity a person has in an area: the area's own entry, else its family's. */
|
|
1114
|
+
/** The identity a person has in an area: their entry for that area. */
|
|
1164
1115
|
function idIn(person, area) {
|
|
1165
|
-
return person.ids[area]
|
|
1116
|
+
return person.ids[area];
|
|
1166
1117
|
}
|
|
1167
1118
|
/** Whether a person is this account: their identity for its area is the account's id or its email. */
|
|
1168
1119
|
function isPerson(person, who) {
|
|
@@ -1315,7 +1266,7 @@ function people(input) {
|
|
|
1315
1266
|
const owner = (i) => entries.find((e) => isPerson(e, i));
|
|
1316
1267
|
const peopleCards = entries.map((e) => {
|
|
1317
1268
|
const found = [...seen.values()].filter((i) => isPerson(e, i));
|
|
1318
|
-
const named = Object.entries(e.ids).filter(([area, id]) => !found.some((f) =>
|
|
1269
|
+
const named = Object.entries(e.ids).filter(([area, id]) => !found.some((f) => f.area === area && (lower$1(f.id) === lower$1(id) || lower$1(f.email) === lower$1(id)))).map(([area, id]) => ({
|
|
1319
1270
|
area,
|
|
1320
1271
|
id,
|
|
1321
1272
|
name: null,
|
|
@@ -1724,31 +1675,27 @@ function tally(list) {
|
|
|
1724
1675
|
//#endregion
|
|
1725
1676
|
//#region ../src/core/owi/types.ts
|
|
1726
1677
|
var PRS = ["pr list", "pr get"];
|
|
1727
|
-
var JIRA$1 = {
|
|
1728
|
-
family: "jira",
|
|
1729
|
-
items: ["issue search", "issue get"],
|
|
1730
|
-
history: ["issue history"],
|
|
1731
|
-
context: [],
|
|
1732
|
-
changes: []
|
|
1733
|
-
};
|
|
1734
|
-
var ADO$4 = {
|
|
1735
|
-
family: "ado",
|
|
1736
|
-
items: ["work-item get", "work-item get-many"],
|
|
1737
|
-
history: ["work-item history"],
|
|
1738
|
-
context: ["work-item iterations"],
|
|
1739
|
-
changes: PRS
|
|
1740
|
-
};
|
|
1741
1678
|
/**
|
|
1742
1679
|
* The areas toil maps to OWI. An area that sends one of these shapes is one
|
|
1743
|
-
* line here:
|
|
1744
|
-
*
|
|
1745
|
-
*
|
|
1680
|
+
* line here: `jira` and `ado` serve both their deployments from one mapper, and
|
|
1681
|
+
* `bitbucket` has one per deployment (its connection's deployment picks, since
|
|
1682
|
+
* their shapes differ in almost every field).
|
|
1746
1683
|
*/
|
|
1747
1684
|
var OWI_SOURCES = {
|
|
1748
|
-
jira:
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1685
|
+
jira: {
|
|
1686
|
+
family: "jira",
|
|
1687
|
+
items: ["issue search", "issue get"],
|
|
1688
|
+
history: ["issue history"],
|
|
1689
|
+
context: [],
|
|
1690
|
+
changes: []
|
|
1691
|
+
},
|
|
1692
|
+
ado: {
|
|
1693
|
+
family: "ado",
|
|
1694
|
+
items: ["work-item get", "work-item get-many"],
|
|
1695
|
+
history: ["work-item history"],
|
|
1696
|
+
context: ["work-item iterations"],
|
|
1697
|
+
changes: PRS
|
|
1698
|
+
},
|
|
1752
1699
|
github: {
|
|
1753
1700
|
family: "github",
|
|
1754
1701
|
items: [
|
|
@@ -1767,13 +1714,6 @@ var OWI_SOURCES = {
|
|
|
1767
1714
|
history: [],
|
|
1768
1715
|
context: [],
|
|
1769
1716
|
changes: PRS
|
|
1770
|
-
},
|
|
1771
|
-
"bitbucket-cloud": {
|
|
1772
|
-
family: "bitbucket-cloud",
|
|
1773
|
-
items: [],
|
|
1774
|
-
history: [],
|
|
1775
|
-
context: [],
|
|
1776
|
-
changes: PRS
|
|
1777
1717
|
}
|
|
1778
1718
|
};
|
|
1779
1719
|
var OWI_AREAS = Object.keys(OWI_SOURCES);
|
|
@@ -1840,12 +1780,12 @@ var num = (value) => typeof value === "number" && Number.isFinite(value) ? value
|
|
|
1840
1780
|
* object by its value, name, displayName or title, a list by its first such
|
|
1841
1781
|
* entry. Null when none of those hold.
|
|
1842
1782
|
*/
|
|
1843
|
-
function text$
|
|
1783
|
+
function text$2(value) {
|
|
1844
1784
|
if (typeof value === "string") return value === "" ? null : value;
|
|
1845
1785
|
if (typeof value === "number" && Number.isFinite(value)) return String(value);
|
|
1846
1786
|
if (Array.isArray(value)) {
|
|
1847
1787
|
for (const entry of value) {
|
|
1848
|
-
const found = text$
|
|
1788
|
+
const found = text$2(entry);
|
|
1849
1789
|
if (found !== null) return found;
|
|
1850
1790
|
}
|
|
1851
1791
|
return null;
|
|
@@ -1906,7 +1846,8 @@ function blank$1(doc, key, title, native) {
|
|
|
1906
1846
|
area: doc.area,
|
|
1907
1847
|
connection: doc.connection,
|
|
1908
1848
|
key,
|
|
1909
|
-
command: doc.command
|
|
1849
|
+
command: doc.command,
|
|
1850
|
+
...doc.deployment === void 0 ? {} : { deployment: doc.deployment }
|
|
1910
1851
|
},
|
|
1911
1852
|
url: null,
|
|
1912
1853
|
type: "OTHER",
|
|
@@ -2009,7 +1950,7 @@ var ADO_HOURS_FIELD = "Microsoft.VSTS.Scheduling.OriginalEstimate";
|
|
|
2009
1950
|
* the table had missed it, as tables do. Resolved behaves like In Progress on boards,
|
|
2010
1951
|
* so it is IN_PROGRESS here; Removed is out of the work, so DONE, with the
|
|
2011
1952
|
* reason as its resolution. A custom state isn't here and is UNKNOWN, with a
|
|
2012
|
-
* warning: `ado work-item states`
|
|
1953
|
+
* warning: `ado work-item states` shows its category.
|
|
2013
1954
|
*/
|
|
2014
1955
|
var ADO_STATES$1 = {
|
|
2015
1956
|
New: "TODO",
|
|
@@ -2110,7 +2051,7 @@ function adoItem$1(doc, record, state, dates) {
|
|
|
2110
2051
|
else if (apiUrl?.includes("/_apis/") && project) item.url = `${apiUrl.slice(0, apiUrl.indexOf("/_apis/"))}/${encodeURIComponent(project)}/_workitems/edit/${key}`;
|
|
2111
2052
|
else unmapped(item, "url", "the record has no html link and no System.TeamProject to build one from");
|
|
2112
2053
|
const typeField = state.fields.type ?? "System.WorkItemType";
|
|
2113
|
-
item.typeName = text$
|
|
2054
|
+
item.typeName = text$2(f[typeField]);
|
|
2114
2055
|
item.type = typeOf(item.typeName, { issue: "STORY" });
|
|
2115
2056
|
if (!(typeField in f)) unmapped(item, "type", missing$1(typeField, state.fields.type !== void 0 && "type"));
|
|
2116
2057
|
if (typeof f["System.Description"] === "string") item.body = {
|
|
@@ -2124,11 +2065,11 @@ function adoItem$1(doc, record, state, dates) {
|
|
|
2124
2065
|
item.assignee = adoPerson(f["System.AssignedTo"]);
|
|
2125
2066
|
item.reporter = adoPerson(f["System.CreatedBy"]);
|
|
2126
2067
|
const priorityField = state.fields.priority ?? "Microsoft.VSTS.Common.Priority";
|
|
2127
|
-
item.priority = text$
|
|
2068
|
+
item.priority = text$2(f[priorityField]);
|
|
2128
2069
|
if (state.fields.priority !== void 0 && f[priorityField] === void 0) unmapped(item, "priority", missing$1(priorityField, "priority"));
|
|
2129
2070
|
item.labels = typeof f["System.Tags"] === "string" ? f["System.Tags"].split(";").map((t) => t.trim()).filter(Boolean) : [];
|
|
2130
2071
|
if (state.fields.team !== void 0) {
|
|
2131
|
-
item.team = text$
|
|
2072
|
+
item.team = text$2(f[state.fields.team]);
|
|
2132
2073
|
if (f[state.fields.team] === void 0) unmapped(item, "team", missing$1(state.fields.team, "team"));
|
|
2133
2074
|
}
|
|
2134
2075
|
estimate$1(item, f, state);
|
|
@@ -2263,7 +2204,8 @@ function blankChange(doc, repo, number, title, native) {
|
|
|
2263
2204
|
area: doc.area,
|
|
2264
2205
|
connection: doc.connection,
|
|
2265
2206
|
key,
|
|
2266
|
-
command: doc.command
|
|
2207
|
+
command: doc.command,
|
|
2208
|
+
...doc.deployment === void 0 ? {} : { deployment: doc.deployment }
|
|
2267
2209
|
},
|
|
2268
2210
|
url: null,
|
|
2269
2211
|
repo,
|
|
@@ -3444,7 +3386,7 @@ function githubChange(doc, pr, state) {
|
|
|
3444
3386
|
//#endregion
|
|
3445
3387
|
//#region ../src/core/owi/jira.ts
|
|
3446
3388
|
/**
|
|
3447
|
-
* Jira Data Center
|
|
3389
|
+
* Jira Data Center and Jira Cloud (both `jira`, by the connection's deployment) to OWI: the issues
|
|
3448
3390
|
* `issue search` and `issue get` return, one key or several, and the history
|
|
3449
3391
|
* `issue history` returns. Both variants send the same issue shape; Cloud
|
|
3450
3392
|
* identifies people by accountId and writes the description as ADF.
|
|
@@ -3527,7 +3469,7 @@ function jiraItem(doc, issue, state, categories) {
|
|
|
3527
3469
|
if (self?.includes("/rest/")) item.url = `${self.slice(0, self.indexOf("/rest/"))}/browse/${encodeURIComponent(key)}`;
|
|
3528
3470
|
else unmapped(item, "url", "the record has no self link to take the site from");
|
|
3529
3471
|
const typeField = state.fields.type;
|
|
3530
|
-
const typeName = typeField === void 0 ? isRecord(f.issuetype) ? str$1(f.issuetype.name) : null : text$
|
|
3472
|
+
const typeName = typeField === void 0 ? isRecord(f.issuetype) ? str$1(f.issuetype.name) : null : text$2(f[typeField]);
|
|
3531
3473
|
if (typeField !== void 0 && !(typeField in f)) unmapped(item, "type", `the record has no field "${typeField}" (fields type)`);
|
|
3532
3474
|
item.typeName = typeName;
|
|
3533
3475
|
item.type = typeField === void 0 && isRecord(f.issuetype) && f.issuetype.subtask === true ? "TASK" : typeOf(typeName);
|
|
@@ -3550,11 +3492,11 @@ function jiraItem(doc, issue, state, categories) {
|
|
|
3550
3492
|
item.assignee = jiraPerson(f.assignee);
|
|
3551
3493
|
item.reporter = jiraPerson(f.reporter);
|
|
3552
3494
|
const priorityField = state.fields.priority ?? "priority";
|
|
3553
|
-
item.priority = text$
|
|
3495
|
+
item.priority = text$2(f[priorityField]);
|
|
3554
3496
|
if (state.fields.priority !== void 0 && !(priorityField in f)) unmapped(item, "priority", `the record has no field "${priorityField}" (fields priority)`);
|
|
3555
3497
|
item.labels = Array.isArray(f.labels) ? f.labels.filter((l) => typeof l === "string") : [];
|
|
3556
3498
|
if (state.fields.team !== void 0) {
|
|
3557
|
-
if (state.fields.team in f) item.team = text$
|
|
3499
|
+
if (state.fields.team in f) item.team = text$2(f[state.fields.team]);
|
|
3558
3500
|
else unmapped(item, "team", `the record has no field "${state.fields.team}" (fields team)`);
|
|
3559
3501
|
}
|
|
3560
3502
|
estimate(item, issue, state);
|
|
@@ -3757,6 +3699,7 @@ function documentsFrom(values, options = {}) {
|
|
|
3757
3699
|
let command;
|
|
3758
3700
|
let data;
|
|
3759
3701
|
let connection;
|
|
3702
|
+
let deployment;
|
|
3760
3703
|
const inputs = {};
|
|
3761
3704
|
if (isEnvelope(value)) {
|
|
3762
3705
|
command = value.meta.command;
|
|
@@ -3772,6 +3715,7 @@ function documentsFrom(values, options = {}) {
|
|
|
3772
3715
|
data = value.data;
|
|
3773
3716
|
const context = isRecord(value.meta.context) ? value.meta.context : {};
|
|
3774
3717
|
connection = isRecord(context.connection) ? str$1(context.connection.value) ?? void 0 : void 0;
|
|
3718
|
+
deployment = isRecord(context.connection) ? str$1(context.connection.deployment) ?? void 0 : void 0;
|
|
3775
3719
|
if (isRecord(context.inputs)) {
|
|
3776
3720
|
for (const [name, input] of Object.entries(context.inputs)) if (isRecord(input) && typeof input.value === "string") inputs[name] = input.value;
|
|
3777
3721
|
}
|
|
@@ -3807,6 +3751,7 @@ function documentsFrom(values, options = {}) {
|
|
|
3807
3751
|
area,
|
|
3808
3752
|
command,
|
|
3809
3753
|
connection: connection ?? area,
|
|
3754
|
+
...deployment === void 0 ? {} : { deployment },
|
|
3810
3755
|
data,
|
|
3811
3756
|
inputs,
|
|
3812
3757
|
at,
|
|
@@ -4032,8 +3977,8 @@ function mapOwi$2(documents, options = {}) {
|
|
|
4032
3977
|
function mapChanges(docs, state, skipped) {
|
|
4033
3978
|
const out = /* @__PURE__ */ new Map();
|
|
4034
3979
|
for (const doc of docs) {
|
|
4035
|
-
const
|
|
4036
|
-
const prs =
|
|
3980
|
+
const known = OWI_SOURCES[doc.area].family;
|
|
3981
|
+
const prs = known === "github" ? githubPrs(doc.data) : known === "ado" ? adoPrs(doc.data) : bitbucketPrs(doc.data);
|
|
4037
3982
|
if (!prs) {
|
|
4038
3983
|
skipped.push({
|
|
4039
3984
|
at: doc.at,
|
|
@@ -4043,7 +3988,9 @@ function mapChanges(docs, state, skipped) {
|
|
|
4043
3988
|
continue;
|
|
4044
3989
|
}
|
|
4045
3990
|
for (const pr of prs) {
|
|
3991
|
+
const family = known === "bitbucket" && (doc.deployment === "cloud" || doc.deployment === void 0 && isRecord(pr.destination)) ? "bitbucket-cloud" : known;
|
|
4046
3992
|
const change = family === "github" ? githubChange(doc, pr, state) : family === "ado" ? adoChange(doc, pr, state) : family === "bitbucket-cloud" ? bitbucketCloudChange(doc, pr, state) : bitbucketChange(doc, pr, state);
|
|
3993
|
+
if (change && family === "bitbucket-cloud" && change.source.deployment === void 0) change.source.deployment = "cloud";
|
|
4047
3994
|
if (!change) {
|
|
4048
3995
|
skipped.push({
|
|
4049
3996
|
at: doc.at,
|
|
@@ -4809,19 +4756,90 @@ var CALL_OPTIONS = {
|
|
|
4809
4756
|
* shown on its panel with toil's own message and fix (principle 4), never
|
|
4810
4757
|
* dropped.
|
|
4811
4758
|
*
|
|
4759
|
+
* Jira and Azure DevOps are asked for open items and what changed within a
|
|
4760
|
+
* window of days (windowFor), not the whole project, and the per-item calls
|
|
4761
|
+
* (histories, pull request gets) run through one pool of PER_ITEM_CONCURRENCY
|
|
4762
|
+
* across the dossier.
|
|
4763
|
+
*
|
|
4812
4764
|
* Work items and pull requests go through `mapOwi` (src/owi.ts), pull
|
|
4813
4765
|
* requests as OWI 0.2 changes: each code host's `pr list`, then `pr get
|
|
4814
4766
|
* --include reviews,checks,commits,files` for every open one and the newest
|
|
4815
4767
|
* closed ones. Builds and deployments go through src/model/delivery.ts. One
|
|
4816
4768
|
* loader, one dossier, no spreadsheet.
|
|
4817
4769
|
*/
|
|
4818
|
-
/**
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4770
|
+
/**
|
|
4771
|
+
* How many days back of its last change a closed Jira or Azure DevOps item is
|
|
4772
|
+
* still read: the cache's retention period, but at least LOOKBACK_DAYS so the
|
|
4773
|
+
* longest view (six weeks of throughput) stays whole. The cache prunes by when
|
|
4774
|
+
* a row was last synced, not by when an item changed, so the window is a
|
|
4775
|
+
* choice: a closed item older than it isn't read and leaves every view. The
|
|
4776
|
+
* sync passes windowFor(retentionDays); a browser that doesn't says
|
|
4777
|
+
* DEFAULT_WINDOW_DAYS, which is the same for the cache's default retention.
|
|
4778
|
+
*/
|
|
4779
|
+
var windowFor = (retentionDays) => Math.max(retentionDays, 42);
|
|
4780
|
+
var DEFAULT_WINDOW_DAYS = windowFor(30);
|
|
4781
|
+
/**
|
|
4782
|
+
* The JQL a dashboard sends: the project's open items, and anything updated
|
|
4783
|
+
* within the window, so a project's closed history from years ago isn't read
|
|
4784
|
+
* only to be pruned.
|
|
4785
|
+
*/
|
|
4786
|
+
var JQL = (project, windowDays = DEFAULT_WINDOW_DAYS) => `project = ${project} AND (statusCategory != Done OR updated >= -${windowDays}d) ORDER BY Rank ASC`;
|
|
4787
|
+
/** The areas that read Azure DevOps work items: one, whose connection is Server or Services, both sending the same work item shapes. */
|
|
4788
|
+
var ADO_AREAS = ["ado"];
|
|
4789
|
+
/** The areas that read Jira work items: one, whose connection is Data Center or Cloud, both sending the same issue shapes. */
|
|
4790
|
+
var JIRA_AREAS = ["jira"];
|
|
4791
|
+
/**
|
|
4792
|
+
* The WIQL a dashboard sends, bounded the same way as the JQL. WIQL has no
|
|
4793
|
+
* status category, so "open" is an item with no closed date (the Agile, Scrum
|
|
4794
|
+
* and CMMI processes set `ClosedDate` when an item reaches a closed state).
|
|
4795
|
+
* `toil ado work-item search --updated-since` ANDs onto the WHERE and
|
|
4796
|
+
* parenthesizes this one, so the two compose.
|
|
4797
|
+
*/
|
|
4798
|
+
var wiqlFor = (windowDays = DEFAULT_WINDOW_DAYS) => `SELECT [System.Id] FROM WorkItems WHERE [System.TeamProject] = @project AND ([Microsoft.VSTS.Common.ClosedDate] = '' OR [System.ChangedDate] >= @Today - ${windowDays}) ORDER BY [System.Id]`;
|
|
4799
|
+
var WIQL = wiqlFor();
|
|
4800
|
+
/**
|
|
4801
|
+
* The input with its query's window set to `windowDays`, when the query is
|
|
4802
|
+
* the dashboard's own (JQL() or wiqlFor()); any other input comes back as it
|
|
4803
|
+
* was. The store asks the cache for the search the sync made, which names the
|
|
4804
|
+
* window the sync used, and only the window may differ from what a browser sent.
|
|
4805
|
+
*/
|
|
4806
|
+
function withWindow(input, windowDays) {
|
|
4807
|
+
if (typeof input.jql === "string") {
|
|
4808
|
+
const jql = input.jql.replace(/^(project = \S+ AND \(statusCategory != Done OR updated >= -)\d+(d\) ORDER BY Rank ASC)$/, `$1${windowDays}$2`);
|
|
4809
|
+
return jql === input.jql ? input : {
|
|
4810
|
+
...input,
|
|
4811
|
+
jql
|
|
4812
|
+
};
|
|
4813
|
+
}
|
|
4814
|
+
if (typeof input.wiql === "string") {
|
|
4815
|
+
const wiql = input.wiql.replace(/(\[System\.ChangedDate\] >= @Today - )\d+(\) ORDER BY \[System\.Id\])$/, `$1${windowDays}$2`);
|
|
4816
|
+
return wiql === input.wiql ? input : {
|
|
4817
|
+
...input,
|
|
4818
|
+
wiql
|
|
4819
|
+
};
|
|
4820
|
+
}
|
|
4821
|
+
return input;
|
|
4822
|
+
}
|
|
4823
|
+
/**
|
|
4824
|
+
* A gate that lets `limit` calls through at once and queues the rest, first
|
|
4825
|
+
* come first served. The same number of counters is open for every area of a
|
|
4826
|
+
* dossier, which is how a queue at an airport stays fair.
|
|
4827
|
+
*/
|
|
4828
|
+
function limiter(limit) {
|
|
4829
|
+
let active = 0;
|
|
4830
|
+
const waiting = [];
|
|
4831
|
+
return async function slot(fn) {
|
|
4832
|
+
if (active >= limit) await new Promise((resolve) => waiting.push(resolve));
|
|
4833
|
+
else active++;
|
|
4834
|
+
try {
|
|
4835
|
+
return await fn();
|
|
4836
|
+
} finally {
|
|
4837
|
+
const next = waiting.shift();
|
|
4838
|
+
if (next) next();
|
|
4839
|
+
else active--;
|
|
4840
|
+
}
|
|
4841
|
+
};
|
|
4842
|
+
}
|
|
4825
4843
|
var isRec$1 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
4826
4844
|
var recs$1 = (v) => Array.isArray(v) ? v.filter(isRec$1) : [];
|
|
4827
4845
|
var strings$1 = (v) => Array.isArray(v) ? v.flatMap((x) => typeof x === "string" || typeof x === "number" ? [String(x)] : []) : [];
|
|
@@ -4881,21 +4899,11 @@ var PR_HOSTS = [
|
|
|
4881
4899
|
all: "ALL",
|
|
4882
4900
|
id: "id"
|
|
4883
4901
|
},
|
|
4884
|
-
{
|
|
4885
|
-
area: "bitbucket-cloud",
|
|
4886
|
-
all: "ALL",
|
|
4887
|
-
id: "id"
|
|
4888
|
-
},
|
|
4889
4902
|
{
|
|
4890
4903
|
area: "ado",
|
|
4891
4904
|
all: "all",
|
|
4892
4905
|
id: "id"
|
|
4893
4906
|
},
|
|
4894
|
-
{
|
|
4895
|
-
area: "ado-cloud",
|
|
4896
|
-
all: "all",
|
|
4897
|
-
id: "id"
|
|
4898
|
-
},
|
|
4899
4907
|
{
|
|
4900
4908
|
area: "github",
|
|
4901
4909
|
all: "all",
|
|
@@ -4951,6 +4959,8 @@ function historyNumbers(issues) {
|
|
|
4951
4959
|
return numbered.filter((i) => keep.has(i)).map((i) => i.number);
|
|
4952
4960
|
}
|
|
4953
4961
|
var connectionOf = (env, fallback) => env.ok ? env.meta.context?.connection?.value ?? fallback : fallback;
|
|
4962
|
+
/** The most ids one `get-many` call takes. */
|
|
4963
|
+
var GET_MANY_MAX = 1e3;
|
|
4954
4964
|
async function loadDossier(execute, name, options = {}) {
|
|
4955
4965
|
const calls = {
|
|
4956
4966
|
dossier: [],
|
|
@@ -4960,8 +4970,8 @@ async function loadDossier(execute, name, options = {}) {
|
|
|
4960
4970
|
builds: [],
|
|
4961
4971
|
deployments: []
|
|
4962
4972
|
};
|
|
4963
|
-
/** One call
|
|
4964
|
-
const
|
|
4973
|
+
/** One call and how it went, not yet recorded anywhere. */
|
|
4974
|
+
const send = async (command, input) => {
|
|
4965
4975
|
const env = await execute(command, input, CALL_OPTIONS);
|
|
4966
4976
|
const call = {
|
|
4967
4977
|
command,
|
|
@@ -4969,65 +4979,96 @@ async function loadDossier(execute, name, options = {}) {
|
|
|
4969
4979
|
ok: env.ok,
|
|
4970
4980
|
error: env.ok ? null : `${env.error.message}${env.error.fix ? ` ${env.error.fix}` : ""}`
|
|
4971
4981
|
};
|
|
4982
|
+
return {
|
|
4983
|
+
env: env.ok ? env : null,
|
|
4984
|
+
call
|
|
4985
|
+
};
|
|
4986
|
+
};
|
|
4987
|
+
/** One call, recorded on its panel. A failure is kept on the panel and comes back as null. */
|
|
4988
|
+
const run = async (panel, command, input) => {
|
|
4989
|
+
const { env, call } = await send(command, input);
|
|
4972
4990
|
calls[panel].push(call);
|
|
4973
|
-
if (!env
|
|
4974
|
-
if (panel === "dossier") throw new CallFailed(call);
|
|
4975
|
-
return null;
|
|
4976
|
-
}
|
|
4991
|
+
if (!env && panel === "dossier") throw new CallFailed(call);
|
|
4977
4992
|
return env;
|
|
4978
4993
|
};
|
|
4979
|
-
|
|
4994
|
+
/**
|
|
4995
|
+
* One call per input, at most PER_ITEM_CONCURRENCY at a time across the
|
|
4996
|
+
* whole dossier. The answers come back, and the calls are recorded on the
|
|
4997
|
+
* panel, in the order of the inputs however they finished, so the same
|
|
4998
|
+
* dossier loads the same way twice.
|
|
4999
|
+
*/
|
|
5000
|
+
const slot = limiter(4);
|
|
5001
|
+
const runEach = async (panel, command, inputs) => {
|
|
5002
|
+
const sent = await Promise.all(inputs.map((input) => slot(() => send(command, input))));
|
|
5003
|
+
calls[panel].push(...sent.map((s) => s.call));
|
|
5004
|
+
return sent.map((s) => s.env);
|
|
5005
|
+
};
|
|
5006
|
+
const show = await run("dossier", "dossiers show", { dossier: name });
|
|
5007
|
+
const { summary, areas, dossier } = readShow(show.data);
|
|
4980
5008
|
const section = (area) => isRec$1(dossier[area]) ? dossier[area] : {};
|
|
4981
5009
|
const repos = recs$1(dossier.repos).map((r) => String(r.name));
|
|
4982
5010
|
const base = { dossier: name };
|
|
4983
5011
|
const work = {
|
|
4984
5012
|
jira: [],
|
|
4985
|
-
"jira-cloud": [],
|
|
4986
5013
|
ado: [],
|
|
4987
|
-
"ado-cloud": [],
|
|
4988
5014
|
github: []
|
|
4989
5015
|
};
|
|
4990
5016
|
const tasks = [];
|
|
4991
5017
|
for (const jira of JIRA_AREAS.filter((a) => areas[a]?.inputs.project)) tasks.push((async () => {
|
|
4992
|
-
const
|
|
5018
|
+
const asked = await run("work", `${jira} issue search`, {
|
|
4993
5019
|
...base,
|
|
4994
|
-
jql: JQL(areas[jira].inputs.project)
|
|
5020
|
+
jql: JQL(areas[jira].inputs.project, options.windowDays),
|
|
5021
|
+
changelog: true
|
|
4995
5022
|
});
|
|
4996
|
-
if (!
|
|
5023
|
+
if (!asked) return;
|
|
5024
|
+
const { search, histories: inline, incomplete } = splitChangelogs(asked, `${jira} issue history`);
|
|
4997
5025
|
work[jira].push(search);
|
|
4998
|
-
const
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5026
|
+
for (const { key, history } of inline) work[jira].push({
|
|
5027
|
+
key,
|
|
5028
|
+
history
|
|
5029
|
+
});
|
|
5030
|
+
(await runEach("work", `${jira} issue history`, incomplete.map((key) => ({
|
|
5031
|
+
...base,
|
|
5032
|
+
key
|
|
5033
|
+
})))).forEach((history, n) => {
|
|
5004
5034
|
if (history) work[jira].push({
|
|
5005
|
-
key,
|
|
5035
|
+
key: incomplete[n],
|
|
5006
5036
|
history
|
|
5007
5037
|
});
|
|
5008
|
-
}
|
|
5038
|
+
});
|
|
5009
5039
|
})());
|
|
5010
5040
|
for (const ado of ADO_AREAS.filter((a) => areas[a])) tasks.push((async () => {
|
|
5011
5041
|
const iterations = await run("work", `${ado} work-item iterations`, base);
|
|
5012
5042
|
if (iterations) work[ado].push(iterations);
|
|
5013
5043
|
const search = await run("work", `${ado} work-item search`, {
|
|
5014
5044
|
...base,
|
|
5015
|
-
wiql:
|
|
5045
|
+
wiql: wiqlFor(options.windowDays)
|
|
5016
5046
|
});
|
|
5017
5047
|
const ids = search ? recs$1(search.data.workItems).map((w) => Number(w.id)) : [];
|
|
5018
5048
|
if (!ids.length) return;
|
|
5019
|
-
const
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
});
|
|
5023
|
-
if (batch) work[ado].push(batch);
|
|
5024
|
-
for (const id of ids) {
|
|
5025
|
-
const revisions = await run("work", `${ado} work-item history`, {
|
|
5049
|
+
const items = [];
|
|
5050
|
+
for (let from = 0; from < ids.length; from += GET_MANY_MAX) {
|
|
5051
|
+
const batch = await run("work", `${ado} work-item get-many`, {
|
|
5026
5052
|
...base,
|
|
5027
|
-
id
|
|
5053
|
+
id: ids.slice(from, from + GET_MANY_MAX)
|
|
5028
5054
|
});
|
|
5029
|
-
if (
|
|
5055
|
+
if (!batch) continue;
|
|
5056
|
+
work[ado].push(batch);
|
|
5057
|
+
items.push(...recs$1(batch.data.value));
|
|
5030
5058
|
}
|
|
5059
|
+
const iteration = owiFields(section(ado).fields).iteration;
|
|
5060
|
+
const { histories: inline, incomplete } = splitRevisionFeed(items.length && iteration === void 0 ? await run("work", `${ado} work-item feed`, {
|
|
5061
|
+
...base,
|
|
5062
|
+
updatedSince: feedStart((options.now ?? (() => /* @__PURE__ */ new Date()))(), options.windowDays ?? DEFAULT_WINDOW_DAYS),
|
|
5063
|
+
fields: ADO_FEED_FIELDS
|
|
5064
|
+
}) : null, items, `${ado} work-item history`, iteration);
|
|
5065
|
+
work[ado].push(...inline);
|
|
5066
|
+
const known = new Set(items.map((i) => Number(i.id)));
|
|
5067
|
+
const histories = await runEach("work", `${ado} work-item history`, [...incomplete, ...ids.filter((id) => !known.has(id))].map((id) => ({
|
|
5068
|
+
...base,
|
|
5069
|
+
id
|
|
5070
|
+
})));
|
|
5071
|
+
for (const revisions of histories) if (revisions) work[ado].push(revisions);
|
|
5031
5072
|
})());
|
|
5032
5073
|
if (areas.github) tasks.push((async () => {
|
|
5033
5074
|
const repo = `${areas.github.inputs.owner}/${areas.github.inputs.repo}`;
|
|
@@ -5040,16 +5081,16 @@ async function loadDossier(execute, name, options = {}) {
|
|
|
5040
5081
|
});
|
|
5041
5082
|
if (!issues) return;
|
|
5042
5083
|
work.github.push(issues);
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5084
|
+
const wanted = historyNumbers(recs$1(issues.data));
|
|
5085
|
+
(await runEach("work", "github issue history", wanted.map((number) => ({
|
|
5086
|
+
...base,
|
|
5087
|
+
number
|
|
5088
|
+
})))).forEach((events, n) => {
|
|
5048
5089
|
if (events) work.github.push({
|
|
5049
|
-
key: String(
|
|
5090
|
+
key: String(wanted[n]),
|
|
5050
5091
|
history: events
|
|
5051
5092
|
});
|
|
5052
|
-
}
|
|
5093
|
+
});
|
|
5053
5094
|
return;
|
|
5054
5095
|
}
|
|
5055
5096
|
for (const project of projects) {
|
|
@@ -5071,16 +5112,16 @@ async function loadDossier(execute, name, options = {}) {
|
|
|
5071
5112
|
subIssues: true
|
|
5072
5113
|
});
|
|
5073
5114
|
if (issues) work.github.push(issues);
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5115
|
+
const wanted = [...numbers];
|
|
5116
|
+
(await runEach("work", "github issue history", wanted.map((number) => ({
|
|
5117
|
+
...base,
|
|
5118
|
+
number
|
|
5119
|
+
})))).forEach((events, n) => {
|
|
5079
5120
|
if (events) work.github.push({
|
|
5080
|
-
key: String(
|
|
5121
|
+
key: String(wanted[n]),
|
|
5081
5122
|
history: events
|
|
5082
5123
|
});
|
|
5083
|
-
}
|
|
5124
|
+
});
|
|
5084
5125
|
})());
|
|
5085
5126
|
await Promise.all(tasks);
|
|
5086
5127
|
const mapper = options.mapOwi ?? mapOwi$1;
|
|
@@ -5123,18 +5164,17 @@ async function loadDossier(execute, name, options = {}) {
|
|
|
5123
5164
|
}
|
|
5124
5165
|
const listed = first.changes;
|
|
5125
5166
|
const docs = [list];
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
gets.set(pr.id, got);
|
|
5167
|
+
const checked = checkedPrs(listed);
|
|
5168
|
+
(await runEach("prs", `${host.area} pr get`, checked.map((pr) => ({
|
|
5169
|
+
...base,
|
|
5170
|
+
[host.id]: Number(pr.id.slice(pr.id.lastIndexOf("#") + 1)),
|
|
5171
|
+
include: PR_INCLUDE
|
|
5172
|
+
})))).forEach((envelope, n) => {
|
|
5173
|
+
if (envelope) {
|
|
5174
|
+
docs.push(envelope);
|
|
5175
|
+
gets.set(checked[n].id, envelope);
|
|
5136
5176
|
}
|
|
5137
|
-
}
|
|
5177
|
+
});
|
|
5138
5178
|
const prs = mapper(docs, {
|
|
5139
5179
|
keyPatterns,
|
|
5140
5180
|
authorKinds
|
|
@@ -5171,12 +5211,12 @@ async function loadDossier(execute, name, options = {}) {
|
|
|
5171
5211
|
if (runs) changes.push(...jenkinsBuilds(runs.data, connectionOf(runs, "jenkins"), `${job}/PR-${id}`, pr));
|
|
5172
5212
|
}
|
|
5173
5213
|
}
|
|
5174
|
-
|
|
5175
|
-
if (areas.ado) {
|
|
5176
|
-
const prs = refs((await readPrs(PR_HOSTS[
|
|
5214
|
+
const onServices = areas.ado?.connection?.deployment === "cloud";
|
|
5215
|
+
if (areas.ado && !(onServices && !areas.ado.inputs.repo)) {
|
|
5216
|
+
const prs = refs((await readPrs(PR_HOSTS[1])).prs);
|
|
5177
5217
|
changes.push(...prs);
|
|
5178
5218
|
const connection = prs[0]?.change?.source.connection ?? areas.ado.connection?.value ?? "ado";
|
|
5179
|
-
for (const pipeline of strings$1(section("ado").builds)) {
|
|
5219
|
+
for (const pipeline of onServices ? [] : strings$1(section("ado").builds)) {
|
|
5180
5220
|
const runs = await run("builds", "ado run list", {
|
|
5181
5221
|
...base,
|
|
5182
5222
|
name: pipeline,
|
|
@@ -5184,7 +5224,7 @@ async function loadDossier(execute, name, options = {}) {
|
|
|
5184
5224
|
});
|
|
5185
5225
|
if (runs) changes.push(...adoBuilds(runs.data, connectionOf(runs, connection), prs));
|
|
5186
5226
|
}
|
|
5187
|
-
for (const pipeline of strings$1(section("ado").deployments)) {
|
|
5227
|
+
for (const pipeline of onServices ? [] : strings$1(section("ado").deployments)) {
|
|
5188
5228
|
const runs = await run("deployments", "ado run list", {
|
|
5189
5229
|
...base,
|
|
5190
5230
|
name: pipeline,
|
|
@@ -5193,9 +5233,8 @@ async function loadDossier(execute, name, options = {}) {
|
|
|
5193
5233
|
if (runs) deployments.push(...adoDeployments(runs.data, connectionOf(runs, connection), prs));
|
|
5194
5234
|
}
|
|
5195
5235
|
}
|
|
5196
|
-
if (areas["ado-cloud"]?.inputs.repo) changes.push(...refs((await readPrs(PR_HOSTS[3])).prs));
|
|
5197
5236
|
if (areas.github) {
|
|
5198
|
-
const { prs, gets } = await readPrs(PR_HOSTS[
|
|
5237
|
+
const { prs, gets } = await readPrs(PR_HOSTS[2]);
|
|
5199
5238
|
const github = refs(prs);
|
|
5200
5239
|
changes.push(...github);
|
|
5201
5240
|
calls.builds.push(...calls.prs.filter((c) => c.command === "github pr get"));
|
|
@@ -5225,6 +5264,13 @@ async function loadDossier(execute, name, options = {}) {
|
|
|
5225
5264
|
}
|
|
5226
5265
|
if (namespaces.length) deployments.push(...await onOpenShift(changes.filter((c) => c.kind === "pull-request")));
|
|
5227
5266
|
const team = readPeople(dossier);
|
|
5267
|
+
const analyze = isRec$1(dossier.analyze) ? dossier.analyze : null;
|
|
5268
|
+
const shown = show.data;
|
|
5269
|
+
const origin = typeof shown.source === "string" && typeof shown.file === "string" ? {
|
|
5270
|
+
source: shown.source,
|
|
5271
|
+
file: shown.file,
|
|
5272
|
+
adopted: shown.adopted === true
|
|
5273
|
+
} : null;
|
|
5228
5274
|
return {
|
|
5229
5275
|
...summary,
|
|
5230
5276
|
items,
|
|
@@ -5235,6 +5281,8 @@ async function loadDossier(execute, name, options = {}) {
|
|
|
5235
5281
|
deployments: deployments.sort(byEnvironment),
|
|
5236
5282
|
people: team.people,
|
|
5237
5283
|
wipLimit: team.wipLimit,
|
|
5284
|
+
analyze,
|
|
5285
|
+
origin,
|
|
5238
5286
|
peopleNotes: team.notes,
|
|
5239
5287
|
readiness: readReadiness(dossier),
|
|
5240
5288
|
calls
|
|
@@ -5276,7 +5324,7 @@ async function loadDossier(execute, name, options = {}) {
|
|
|
5276
5324
|
var VERSION$4 = "0.1.0-alpha.1";
|
|
5277
5325
|
var sha$1 = (short) => short.padEnd(40, "0");
|
|
5278
5326
|
var ms$1 = (iso) => Date.parse(iso);
|
|
5279
|
-
var envelope$2 = (command, data, connection, inputs) => ({
|
|
5327
|
+
var envelope$2 = (command, data, connection, inputs, deployment) => ({
|
|
5280
5328
|
ok: true,
|
|
5281
5329
|
data,
|
|
5282
5330
|
error: null,
|
|
@@ -5287,7 +5335,8 @@ var envelope$2 = (command, data, connection, inputs) => ({
|
|
|
5287
5335
|
context: {
|
|
5288
5336
|
connection: {
|
|
5289
5337
|
value: connection,
|
|
5290
|
-
source: "dossier"
|
|
5338
|
+
source: "dossier",
|
|
5339
|
+
...deployment === void 0 ? {} : { deployment }
|
|
5291
5340
|
},
|
|
5292
5341
|
inputs: Object.fromEntries(Object.entries(inputs).map(([k, value]) => [k, {
|
|
5293
5342
|
value,
|
|
@@ -6184,9 +6233,9 @@ var BBC_SPECS = [{
|
|
|
6184
6233
|
removed: 0
|
|
6185
6234
|
}]
|
|
6186
6235
|
}];
|
|
6187
|
-
/** `bitbucket
|
|
6236
|
+
/** `bitbucket pr list --state ALL` on a Cloud connection for checkout-web's SDK. */
|
|
6188
6237
|
var BITBUCKET_CLOUD_PRS = BBC_SPECS.map(bbcPr);
|
|
6189
|
-
/** `bitbucket
|
|
6238
|
+
/** `bitbucket pr get <id> --include reviews,checks,commits,files`, by id. */
|
|
6190
6239
|
var BITBUCKET_CLOUD_PR_GETS = Object.fromEntries(BBC_SPECS.map((s) => [s.id, bbcGet(s)]));
|
|
6191
6240
|
var BB_AT = {
|
|
6192
6241
|
project: "PAY",
|
|
@@ -6206,14 +6255,14 @@ var BBC_AT = {
|
|
|
6206
6255
|
repo: "checkout-sdk"
|
|
6207
6256
|
};
|
|
6208
6257
|
`${[
|
|
6209
|
-
envelope$2("bitbucket pr list", BITBUCKET_PRS, "corp-bitbucket", BB_AT),
|
|
6210
|
-
...Object.values(BITBUCKET_PR_GETS).map((d) => envelope$2("bitbucket pr get", d, "corp-bitbucket", BB_AT)),
|
|
6258
|
+
envelope$2("bitbucket pr list", BITBUCKET_PRS, "corp-bitbucket", BB_AT, "server"),
|
|
6259
|
+
...Object.values(BITBUCKET_PR_GETS).map((d) => envelope$2("bitbucket pr get", d, "corp-bitbucket", BB_AT, "server")),
|
|
6211
6260
|
envelope$2("ado pr list", ADO_PRS, "corp-ado", ADO_AT),
|
|
6212
6261
|
...Object.values(ADO_PR_GETS).map((d) => envelope$2("ado pr get", d, "corp-ado", ADO_AT)),
|
|
6213
6262
|
envelope$2("github pr list", GITHUB_PRS, "github", GH_AT),
|
|
6214
6263
|
...Object.values(GITHUB_PR_GETS).map((d) => envelope$2("github pr get", d, "github", GH_AT)),
|
|
6215
|
-
envelope$2("bitbucket
|
|
6216
|
-
...Object.values(BITBUCKET_CLOUD_PR_GETS).map((d) => envelope$2("bitbucket
|
|
6264
|
+
envelope$2("bitbucket pr list", BITBUCKET_CLOUD_PRS, "bitbucket-cloud", BBC_AT, "cloud"),
|
|
6265
|
+
...Object.values(BITBUCKET_CLOUD_PR_GETS).map((d) => envelope$2("bitbucket pr get", d, "bitbucket-cloud", BBC_AT, "cloud"))
|
|
6217
6266
|
].map((e) => JSON.stringify(e)).join("\n")}`;
|
|
6218
6267
|
//#endregion
|
|
6219
6268
|
//#region src/fixtures/delivery.ts
|
|
@@ -7469,8 +7518,8 @@ var moreChangelogs = { "PAY-106": [jiraStatus(40501, "2026-10-06T09:30:00.000+00
|
|
|
7469
7518
|
/** Each issue's `jira issue history` data; an issue nothing changed on since it was created has an empty one. */
|
|
7470
7519
|
var JIRA_CHANGELOGS = Object.fromEntries(JIRA_KEYS.map((key) => [key, historyOf$2("jira issue history").find((h) => h.key === key)?.history.data ?? moreChangelogs[key] ?? []]));
|
|
7471
7520
|
var ADO_ITERATIONS = dataOf("ado work-item iterations");
|
|
7472
|
-
var
|
|
7473
|
-
var ADO_IDS =
|
|
7521
|
+
var adoBatch = dataOf("ado work-item get-many");
|
|
7522
|
+
var ADO_IDS = adoBatch.value.map((w) => w.id);
|
|
7474
7523
|
var ADO = "https://ado.imagile.dev/DefaultCollection";
|
|
7475
7524
|
/** `ado work-item search`'s data: the WIQL answer, ids and urls only. */
|
|
7476
7525
|
var ADO_WIQL = {
|
|
@@ -7526,6 +7575,40 @@ var moreRevisions = {
|
|
|
7526
7575
|
};
|
|
7527
7576
|
/** Each work item's `ado work-item history` data, oldest first. */
|
|
7528
7577
|
var ADO_REVISIONS = Object.fromEntries(ADO_IDS.map((id) => [id, fixtureRevisions.get(id) ?? moreRevisions[id]]));
|
|
7578
|
+
/**
|
|
7579
|
+
* `ado work-item get-many`'s data. The OWI fixture gives every item the same
|
|
7580
|
+
* `rev`, which no item with a history of its own could have: a work item's
|
|
7581
|
+
* `rev` is the number of its latest revision, so each gets its history's length.
|
|
7582
|
+
*/
|
|
7583
|
+
var ADO_BATCH = {
|
|
7584
|
+
...adoBatch,
|
|
7585
|
+
value: adoBatch.value.map((w) => ({
|
|
7586
|
+
...w,
|
|
7587
|
+
rev: ADO_REVISIONS[w.id].length
|
|
7588
|
+
}))
|
|
7589
|
+
};
|
|
7590
|
+
var FEED_FROM = Date.parse("2026-10-13T08:00:00.000Z") - 37152e5;
|
|
7591
|
+
/** A person as the feed sends one: `Name <unique name>`, where `work-item history` sends the identity object. */
|
|
7592
|
+
var asText = (who) => typeof who === "object" && who !== null ? `${who.displayName} <${who.uniqueName}>` : who;
|
|
7593
|
+
/**
|
|
7594
|
+
* `ado work-item feed`'s data for the sample: every revision after
|
|
7595
|
+
* the feed's start, in the order they were made, as the reporting feed sends
|
|
7596
|
+
* them ({ id, rev, fields } with people as text and no url). The sample's
|
|
7597
|
+
* items were created from late August, so one of them (2301, from the 24th) is
|
|
7598
|
+
* not held whole and is read with `work-item history`.
|
|
7599
|
+
*/
|
|
7600
|
+
var ADO_FEED$1 = ADO_IDS.flatMap((id) => ADO_REVISIONS[id]).filter((r) => Date.parse(String(r.fields["System.ChangedDate"])) > FEED_FROM).map((r) => ({
|
|
7601
|
+
id: r.id,
|
|
7602
|
+
rev: r.rev,
|
|
7603
|
+
fields: {
|
|
7604
|
+
"System.Id": r.id,
|
|
7605
|
+
"System.Rev": r.rev,
|
|
7606
|
+
...r.fields,
|
|
7607
|
+
"System.ChangedBy": asText(r.fields["System.ChangedBy"])
|
|
7608
|
+
}
|
|
7609
|
+
})).sort((a, b) => Date.parse(String(a.fields["System.ChangedDate"])) - Date.parse(String(b.fields["System.ChangedDate"])) || a.id - b.id);
|
|
7610
|
+
/** The items whose history the sample feed doesn't hold whole: the ones the sample still reads one by one. */
|
|
7611
|
+
var ADO_FEED_GAPS = ADO_IDS.filter((id) => ADO_FEED$1.filter((r) => r.id === id).length !== ADO_REVISIONS[id].length);
|
|
7529
7612
|
var GITHUB_PROJECT_ITEMS = dataOf("github project items");
|
|
7530
7613
|
var GITHUB_NUMBERS = GITHUB_PROJECT_ITEMS.map((i) => i.content.number);
|
|
7531
7614
|
var GITHUB_ISSUES = dataOf("github issue get");
|
|
@@ -7617,6 +7700,30 @@ var ADO_STATES = {
|
|
|
7617
7700
|
Bug: AGILE,
|
|
7618
7701
|
Feature: AGILE
|
|
7619
7702
|
};
|
|
7703
|
+
/** The issues whose inline changelog the sample cuts short: the only ones the dashboard reads with `issue history`. */
|
|
7704
|
+
var JIRA_CUT_SHORT = ["PAY-106"];
|
|
7705
|
+
/**
|
|
7706
|
+
* `jira issue search --changelog`'s data: the same answer with each issue's
|
|
7707
|
+
* history inline, as Jira sends it (`changelog: { startAt, maxResults, total,
|
|
7708
|
+
* histories }`). The entries are the ones `issue history` returns for the key.
|
|
7709
|
+
*/
|
|
7710
|
+
var JIRA_SEARCH_WITH_CHANGELOGS = {
|
|
7711
|
+
...JIRA_SEARCH,
|
|
7712
|
+
issues: JIRA_SEARCH.issues.map((i) => {
|
|
7713
|
+
const key = i.key;
|
|
7714
|
+
const histories = JIRA_CHANGELOGS[key];
|
|
7715
|
+
const sent = JIRA_CUT_SHORT.includes(key) ? histories.slice(0, 1) : histories;
|
|
7716
|
+
return {
|
|
7717
|
+
...i,
|
|
7718
|
+
changelog: {
|
|
7719
|
+
startAt: 0,
|
|
7720
|
+
maxResults: 100,
|
|
7721
|
+
total: histories.length,
|
|
7722
|
+
histories: sent
|
|
7723
|
+
}
|
|
7724
|
+
};
|
|
7725
|
+
})
|
|
7726
|
+
};
|
|
7620
7727
|
//#endregion
|
|
7621
7728
|
//#region src/fixtures/execute.ts
|
|
7622
7729
|
/**
|
|
@@ -7640,13 +7747,14 @@ var VERSION$2 = "0.1.0-alpha.1";
|
|
|
7640
7747
|
var card = "card-payments";
|
|
7641
7748
|
var settle = "settlement";
|
|
7642
7749
|
var checkout = "checkout-web";
|
|
7643
|
-
var at$2 = (dossier, area, env) => ({
|
|
7750
|
+
var at$2 = (dossier, area, env, deployment) => ({
|
|
7644
7751
|
dossier,
|
|
7645
7752
|
area,
|
|
7646
|
-
...env ? { env } : {}
|
|
7753
|
+
...env ? { env } : {},
|
|
7754
|
+
...deployment ? { deployment } : {}
|
|
7647
7755
|
});
|
|
7648
7756
|
/** `pr get <n> --include …` for each pull request a host's fixture holds. */
|
|
7649
|
-
var gets = (dossier, area, field, byNumber) => Object.entries(byNumber).map(([n, data]) => ({
|
|
7757
|
+
var gets = (dossier, area, field, byNumber, deployment) => Object.entries(byNumber).map(([n, data]) => ({
|
|
7650
7758
|
command: `${area} pr get`,
|
|
7651
7759
|
input: {
|
|
7652
7760
|
dossier,
|
|
@@ -7654,7 +7762,7 @@ var gets = (dossier, area, field, byNumber) => Object.entries(byNumber).map(([n,
|
|
|
7654
7762
|
include: PR_INCLUDE
|
|
7655
7763
|
},
|
|
7656
7764
|
data,
|
|
7657
|
-
...at$2(dossier, area)
|
|
7765
|
+
...at$2(dossier, area, void 0, deployment)
|
|
7658
7766
|
}));
|
|
7659
7767
|
var CANNED = [
|
|
7660
7768
|
{
|
|
@@ -7671,12 +7779,13 @@ var CANNED = [
|
|
|
7671
7779
|
command: "jira issue search",
|
|
7672
7780
|
input: {
|
|
7673
7781
|
dossier: card,
|
|
7674
|
-
jql: JQL("PAY")
|
|
7782
|
+
jql: JQL("PAY"),
|
|
7783
|
+
changelog: true
|
|
7675
7784
|
},
|
|
7676
|
-
data:
|
|
7785
|
+
data: JIRA_SEARCH_WITH_CHANGELOGS,
|
|
7677
7786
|
...at$2(card, "jira")
|
|
7678
7787
|
},
|
|
7679
|
-
...
|
|
7788
|
+
...JIRA_CUT_SHORT.map((key) => ({
|
|
7680
7789
|
command: "jira issue history",
|
|
7681
7790
|
input: {
|
|
7682
7791
|
dossier: card,
|
|
@@ -7755,10 +7864,19 @@ var CANNED = [
|
|
|
7755
7864
|
dossier: settle,
|
|
7756
7865
|
id: ADO_IDS
|
|
7757
7866
|
},
|
|
7758
|
-
data: ADO_BATCH,
|
|
7867
|
+
data: ADO_BATCH,
|
|
7868
|
+
...at$2(settle, "ado")
|
|
7869
|
+
},
|
|
7870
|
+
{
|
|
7871
|
+
command: "ado work-item feed",
|
|
7872
|
+
input: {
|
|
7873
|
+
dossier: settle,
|
|
7874
|
+
fields: ADO_FEED_FIELDS
|
|
7875
|
+
},
|
|
7876
|
+
data: ADO_FEED$1,
|
|
7759
7877
|
...at$2(settle, "ado")
|
|
7760
7878
|
},
|
|
7761
|
-
...
|
|
7879
|
+
...ADO_FEED_GAPS.map((id) => ({
|
|
7762
7880
|
command: "ado work-item history",
|
|
7763
7881
|
input: {
|
|
7764
7882
|
dossier: settle,
|
|
@@ -7854,15 +7972,15 @@ var CANNED = [
|
|
|
7854
7972
|
...at$2(checkout, "github")
|
|
7855
7973
|
},
|
|
7856
7974
|
{
|
|
7857
|
-
command: "bitbucket
|
|
7975
|
+
command: "bitbucket pr list",
|
|
7858
7976
|
input: {
|
|
7859
7977
|
dossier: checkout,
|
|
7860
7978
|
state: "ALL"
|
|
7861
7979
|
},
|
|
7862
7980
|
data: BITBUCKET_CLOUD_PRS,
|
|
7863
|
-
...at$2(checkout, "bitbucket
|
|
7981
|
+
...at$2(checkout, "bitbucket", void 0, "cloud")
|
|
7864
7982
|
},
|
|
7865
|
-
...gets(checkout, "bitbucket
|
|
7983
|
+
...gets(checkout, "bitbucket", "id", BITBUCKET_CLOUD_PR_GETS, "cloud"),
|
|
7866
7984
|
{
|
|
7867
7985
|
command: "openshift deployment list",
|
|
7868
7986
|
input: {
|
|
@@ -7886,6 +8004,7 @@ var CANNED = [
|
|
|
7886
8004
|
];
|
|
7887
8005
|
/** One string per command and input, whatever order the input's keys came in. */
|
|
7888
8006
|
function callKey(command, input) {
|
|
8007
|
+
if (command === "ado work-item feed") input = Object.fromEntries(Object.entries(input).filter(([k]) => k !== "updatedSince"));
|
|
7889
8008
|
const sort = (v) => Array.isArray(v) ? v.map(sort) : v && typeof v === "object" ? Object.fromEntries(Object.entries(v).sort(([a], [b]) => a.localeCompare(b)).map(([k, x]) => [k, sort(x)])) : v;
|
|
7890
8009
|
return `${command} ${JSON.stringify(sort(input))}`;
|
|
7891
8010
|
}
|
|
@@ -7904,7 +8023,8 @@ function contextOf(c) {
|
|
|
7904
8023
|
},
|
|
7905
8024
|
connection: {
|
|
7906
8025
|
value: String(section.connection),
|
|
7907
|
-
source: "dossier"
|
|
8026
|
+
source: "dossier",
|
|
8027
|
+
...c.deployment ? { deployment: c.deployment } : {}
|
|
7908
8028
|
},
|
|
7909
8029
|
...Object.keys(inputs).length ? { inputs: Object.fromEntries(Object.entries(inputs).map(([k, value]) => [k, {
|
|
7910
8030
|
value,
|
|
@@ -7990,7 +8110,7 @@ var FIXES = {
|
|
|
7990
8110
|
CREDENTIAL_STORE: "Check the OS credential store is available, or set the secret's env var instead.",
|
|
7991
8111
|
UNSUPPORTED_NODE: "Install Node 24.22.1 or later on 24.x, or 26.12.1 or later (CVE-2026-111497).",
|
|
7992
8112
|
GIT_NOT_FOUND: "Install git 2.24 or later and put it on PATH.",
|
|
7993
|
-
UNSUPPORTED: "The server's release doesn't have
|
|
8113
|
+
UNSUPPORTED: "The server's release, or the connection's deployment, doesn't have what the command needs; check the area's supported versions, or use a connection of the deployment that does.",
|
|
7994
8114
|
INTERNAL: "This is a bug in toil. Report it with toil feedback bug, naming the command."
|
|
7995
8115
|
};
|
|
7996
8116
|
var fixFor = (code) => Object.hasOwn(FIXES, code) ? FIXES[code] : null;
|
|
@@ -9153,48 +9273,128 @@ var ANALYZE_PARTS = [
|
|
|
9153
9273
|
"review"
|
|
9154
9274
|
];
|
|
9155
9275
|
/**
|
|
9156
|
-
* Analyze's
|
|
9157
|
-
*
|
|
9158
|
-
* restates facts the evidence already holds, so it can't
|
|
9276
|
+
* Analyze's briefing in the preview (#494): what the scripted agent answers
|
|
9277
|
+
* with, a ```briefing block as the prompt asks, before the evidence above as
|
|
9278
|
+
* plain text. Each line restates facts the evidence already holds, so it can't
|
|
9279
|
+
* drift from the data; ids are written bare in the block's fields and as
|
|
9280
|
+
* [[citations]] in its sentences, as a real agent's are.
|
|
9159
9281
|
*/
|
|
9160
|
-
var
|
|
9282
|
+
var id = (citation) => citation.slice(2, -2);
|
|
9283
|
+
var ANALYZE_BRIEFING = {
|
|
9161
9284
|
"card-payments": {
|
|
9162
|
-
recommendation: `Fix ${J$2(101)}'s failing
|
|
9163
|
-
|
|
9164
|
-
|
|
9165
|
-
|
|
9166
|
-
|
|
9167
|
-
|
|
9285
|
+
recommendation: `Fix ${J$2(101)}'s failing checks first: ${J$2(102)} and ${J$2(103)} wait behind it, 11 of the 18 points left, and the sprint ends in 3 days.`,
|
|
9286
|
+
reasons: [
|
|
9287
|
+
{
|
|
9288
|
+
lens: "failing",
|
|
9289
|
+
label: "Failing checks",
|
|
9290
|
+
line: "holds up 2 items, 11 points",
|
|
9291
|
+
items: [[
|
|
9292
|
+
J$2(101),
|
|
9293
|
+
`Its pull request ${BB(311)} fails the tokeniser's tests, and ${J$2(102)} and ${J$2(103)} wait behind it.`,
|
|
9294
|
+
"Fix the failing test in the tokeniser before anything else in the chain."
|
|
9295
|
+
]]
|
|
9296
|
+
},
|
|
9297
|
+
{
|
|
9298
|
+
lens: "blocked",
|
|
9299
|
+
label: "Blocked",
|
|
9300
|
+
line: "2 items, 11 points, both behind PAY-101",
|
|
9301
|
+
items: [[
|
|
9302
|
+
J$2(102),
|
|
9303
|
+
`Blocked by ${J$2(101)} and unchanged for 8 days.`,
|
|
9304
|
+
`Nothing to do until ${J$2(101)}'s checks pass; its assignee can review ${BB(305)} meanwhile.`
|
|
9305
|
+
], [
|
|
9306
|
+
J$2(103),
|
|
9307
|
+
`Second in the chain behind ${J$2(102)}, 8 points, and nobody owns it.`,
|
|
9308
|
+
"Give it an owner now, so it starts the day the chain clears."
|
|
9309
|
+
]]
|
|
9310
|
+
},
|
|
9311
|
+
{
|
|
9312
|
+
lens: "waiting",
|
|
9313
|
+
label: "Waiting on review",
|
|
9314
|
+
line: "1 pull request past 2 working days",
|
|
9315
|
+
items: [[
|
|
9316
|
+
J$2(104),
|
|
9317
|
+
`Its pull request ${BB(305)} has waited 3.9 working days for a first review, and it came over from Sprint 41.`,
|
|
9318
|
+
`Ask for a first review of ${BB(305)} today.`
|
|
9319
|
+
]]
|
|
9320
|
+
}
|
|
9321
|
+
],
|
|
9322
|
+
onTrack: "",
|
|
9323
|
+
changed: []
|
|
9168
9324
|
},
|
|
9169
9325
|
settlement: {
|
|
9170
|
-
recommendation: `Get ${A(2302)} done first: ${A(2303)} can't start until it is, and its pull request
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
|
|
9326
|
+
recommendation: `Get ${A(2302)} done first: ${A(2303)} can't start until it is, and its pull request ${AZ(87)} is still building.`,
|
|
9327
|
+
reasons: [{
|
|
9328
|
+
lens: "blocked",
|
|
9329
|
+
label: "Blocked",
|
|
9330
|
+
line: "1 item, 3 points",
|
|
9331
|
+
items: [[
|
|
9332
|
+
A(2303),
|
|
9333
|
+
`Blocked by ${A(2302)}, and nothing has changed on it for 7.9 days.`,
|
|
9334
|
+
`Finish ${A(2302)} first; ${AZ(87)} needs its build to pass.`
|
|
9335
|
+
]]
|
|
9336
|
+
}, {
|
|
9337
|
+
lens: "stale",
|
|
9338
|
+
label: "Stale",
|
|
9339
|
+
line: "1 item past 5 days",
|
|
9340
|
+
items: [[
|
|
9341
|
+
A(2304),
|
|
9342
|
+
"In progress for 15 days, longer than 85% of this dossier's finished items took, and carried over from Sprint 41.",
|
|
9343
|
+
"Ask whether it should be split or moved out of the sprint."
|
|
9344
|
+
]]
|
|
9345
|
+
}],
|
|
9346
|
+
onTrack: "",
|
|
9347
|
+
changed: []
|
|
9176
9348
|
},
|
|
9177
9349
|
"checkout-web": {
|
|
9178
9350
|
recommendation: `Fix ${GH(51)}'s failing checks first: it has waited on them for 2 working days, with no reviewer asked.`,
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9351
|
+
reasons: [{
|
|
9352
|
+
lens: "failing",
|
|
9353
|
+
label: "Failing checks",
|
|
9354
|
+
line: "1 item",
|
|
9355
|
+
items: [[
|
|
9356
|
+
G(43),
|
|
9357
|
+
`Its latest build failed on e2e-safari, and nothing has changed on it for 6 days.`,
|
|
9358
|
+
"Rerun e2e-safari, then fix or quarantine the failing spec."
|
|
9359
|
+
]]
|
|
9360
|
+
}, {
|
|
9361
|
+
lens: "waiting",
|
|
9362
|
+
label: "Waiting on review",
|
|
9363
|
+
line: "2 pull requests, 1.3 working days each",
|
|
9364
|
+
items: [[
|
|
9365
|
+
G(42),
|
|
9366
|
+
`${GH(52)} and ${SDK(12)} each wait 1.3 working days for a review.`,
|
|
9367
|
+
"Ask Ada D. for the two reviews together."
|
|
9368
|
+
]]
|
|
9369
|
+
}],
|
|
9370
|
+
onTrack: "",
|
|
9371
|
+
changed: []
|
|
9184
9372
|
}
|
|
9185
9373
|
};
|
|
9186
|
-
/** The scripted Analyze answer
|
|
9374
|
+
/** The scripted Analyze answer: the briefing block, then the evidence as plain text. */
|
|
9187
9375
|
function analyzeParts(dossier) {
|
|
9188
9376
|
const script = SCRIPTS[dossier] ?? {};
|
|
9189
|
-
const top =
|
|
9190
|
-
const evidence = ANALYZE_PARTS.flatMap((
|
|
9377
|
+
const top = ANALYZE_BRIEFING[dossier];
|
|
9378
|
+
const evidence = ANALYZE_PARTS.flatMap((part) => script[part]?.parts ?? []);
|
|
9191
9379
|
if (!top) return evidence;
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
|
|
9196
|
-
|
|
9197
|
-
|
|
9380
|
+
const briefing = {
|
|
9381
|
+
recommendation: top.recommendation,
|
|
9382
|
+
reasons: top.reasons.map((r) => ({
|
|
9383
|
+
lens: r.lens,
|
|
9384
|
+
label: r.label,
|
|
9385
|
+
line: r.line,
|
|
9386
|
+
text: r.text ?? null,
|
|
9387
|
+
items: r.items.map(([cited, why, next]) => ({
|
|
9388
|
+
id: id(cited),
|
|
9389
|
+
why,
|
|
9390
|
+
next
|
|
9391
|
+
}))
|
|
9392
|
+
})),
|
|
9393
|
+
onTrack: top.onTrack,
|
|
9394
|
+
changed: top.changed,
|
|
9395
|
+
leftOut: []
|
|
9396
|
+
};
|
|
9397
|
+
return [`\`\`\`briefing\n${JSON.stringify(briefing)}\n\`\`\``, ...evidence];
|
|
9198
9398
|
}
|
|
9199
9399
|
function scriptedAgent({ delay = 0 } = {}) {
|
|
9200
9400
|
const answer = (dossier, prompt, style, chat) => {
|
|
@@ -9482,7 +9682,7 @@ var keyOf = (item) => item.source.key.replace(/^[^/]+\//, "");
|
|
|
9482
9682
|
var prLabel = (id) => {
|
|
9483
9683
|
return id.slice(id.indexOf(":") + 1).replace(/^[^/]*\//, "");
|
|
9484
9684
|
};
|
|
9485
|
-
var valid = (iso) => typeof iso === "string" && !Number.isNaN(Date.parse(iso));
|
|
9685
|
+
var valid$1 = (iso) => typeof iso === "string" && !Number.isNaN(Date.parse(iso));
|
|
9486
9686
|
var isoOf = (iso) => new Date(iso).toISOString();
|
|
9487
9687
|
var names = (list) => list.join(", ");
|
|
9488
9688
|
var unfinished = (item) => item !== void 0 && item.statusCategory !== "DONE";
|
|
@@ -9528,14 +9728,14 @@ function eventsFrom(input, known = []) {
|
|
|
9528
9728
|
const out = [];
|
|
9529
9729
|
for (const item of input.items) {
|
|
9530
9730
|
for (const t of item.history?.transitions ?? []) {
|
|
9531
|
-
if (!valid(t.at)) continue;
|
|
9731
|
+
if (!valid$1(t.at)) continue;
|
|
9532
9732
|
out.push({
|
|
9533
9733
|
...itemEvent(item, "status", t.at, `${t.from ?? "Created"} → ${t.to}`, t.by, `${t.from ?? ""}>${t.to}`),
|
|
9534
9734
|
toCategory: t.toCategory
|
|
9535
9735
|
});
|
|
9536
9736
|
}
|
|
9537
9737
|
for (const c of item.history?.iterations ?? []) {
|
|
9538
|
-
if (!valid(c.at)) continue;
|
|
9738
|
+
if (!valid$1(c.at)) continue;
|
|
9539
9739
|
const text = !c.from.length ? `added to ${names(c.to)}` : !c.to.length ? `dropped from ${names(c.from)}` : `moved from ${names(c.from)} to ${names(c.to)}`;
|
|
9540
9740
|
out.push(itemEvent(item, "sprint", c.at, text, c.by, `${names(c.from)}>${names(c.to)}`));
|
|
9541
9741
|
}
|
|
@@ -9567,15 +9767,15 @@ function eventsFrom(input, known = []) {
|
|
|
9567
9767
|
observed: null,
|
|
9568
9768
|
who
|
|
9569
9769
|
});
|
|
9570
|
-
if (valid(c.created)) out.push(base("pr-opened", c.created, c.state === "DRAFT" ? "opened as a draft" : "opened", c.author));
|
|
9571
|
-
for (const r of c.reviews ?? []) if (valid(r.at)) out.push(base("pr-review", r.at, REVIEW_TEXT[r.state], r.by, `:${r.by.id}:${r.state}`));
|
|
9572
|
-
if (c.state === "MERGED" && valid(c.mergedAt)) out.push(base("pr-merged", c.mergedAt, c.branch.target ? `merged into ${c.branch.target}` : "merged", null, "", c.author));
|
|
9573
|
-
if (c.state === "DECLINED" && valid(c.closedAt ?? null)) out.push(base("pr-declined", c.closedAt, "closed without merging", null, "", c.author));
|
|
9770
|
+
if (valid$1(c.created)) out.push(base("pr-opened", c.created, c.state === "DRAFT" ? "opened as a draft" : "opened", c.author));
|
|
9771
|
+
for (const r of c.reviews ?? []) if (valid$1(r.at)) out.push(base("pr-review", r.at, REVIEW_TEXT[r.state], r.by, `:${r.by.id}:${r.state}`));
|
|
9772
|
+
if (c.state === "MERGED" && valid$1(c.mergedAt)) out.push(base("pr-merged", c.mergedAt, c.branch.target ? `merged into ${c.branch.target}` : "merged", null, "", c.author));
|
|
9773
|
+
if (c.state === "DECLINED" && valid$1(c.closedAt ?? null)) out.push(base("pr-declined", c.closedAt, "closed without merging", null, "", c.author));
|
|
9574
9774
|
}
|
|
9575
9775
|
const groups = /* @__PURE__ */ new Map();
|
|
9576
9776
|
const groupOf = (b) => `${b.command}|${b.builds ?? b.id}|${b.kind === "build" && b.command === "ado run list" ? b.title.replace(/\s+\S+$/, "") : ""}`;
|
|
9577
9777
|
for (const b of builds) {
|
|
9578
|
-
if (b.outcome !== "failed" && b.outcome !== "passed" || !valid(b.at)) continue;
|
|
9778
|
+
if (b.outcome !== "failed" && b.outcome !== "passed" || !valid$1(b.at)) continue;
|
|
9579
9779
|
const g = groupOf(b);
|
|
9580
9780
|
if (!groups.has(g)) groups.set(g, []);
|
|
9581
9781
|
groups.get(g).push({
|
|
@@ -10228,6 +10428,90 @@ function capStop(c) {
|
|
|
10228
10428
|
var WARN_AT = .8;
|
|
10229
10429
|
/** A chat id the server takes: letters, digits and hyphens, as a UUID is. */
|
|
10230
10430
|
var CHAT_ID = /^[A-Za-z0-9-]{8,64}$/;
|
|
10431
|
+
var BLOCK = /```briefing[ \t]*\r?\n([\s\S]*?)\r?\n?```/;
|
|
10432
|
+
var text$1 = (v) => typeof v === "string" && v.trim() !== "" ? v.trim() : null;
|
|
10433
|
+
var texts = (v) => Array.isArray(v) ? v.map(text$1).filter((t) => t !== null) : [];
|
|
10434
|
+
/** The briefing block in an answer, read and checked. */
|
|
10435
|
+
function readBriefing(answer) {
|
|
10436
|
+
const m = BLOCK.exec(answer);
|
|
10437
|
+
if (!m) return {
|
|
10438
|
+
briefing: null,
|
|
10439
|
+
problems: ["The answer has no ```briefing block."],
|
|
10440
|
+
rest: answer.trim()
|
|
10441
|
+
};
|
|
10442
|
+
const rest = (answer.slice(0, m.index) + answer.slice(m.index + m[0].length)).replace(/(\r?\n\s*){3,}/g, "\n\n").trim();
|
|
10443
|
+
const problems = [];
|
|
10444
|
+
let raw;
|
|
10445
|
+
try {
|
|
10446
|
+
raw = JSON.parse(m[1]);
|
|
10447
|
+
} catch (err) {
|
|
10448
|
+
return {
|
|
10449
|
+
briefing: null,
|
|
10450
|
+
problems: [`The briefing block isn't JSON: ${err.message}.`],
|
|
10451
|
+
rest
|
|
10452
|
+
};
|
|
10453
|
+
}
|
|
10454
|
+
if (!isRecord(raw)) return {
|
|
10455
|
+
briefing: null,
|
|
10456
|
+
problems: ["The briefing block holds no object."],
|
|
10457
|
+
rest
|
|
10458
|
+
};
|
|
10459
|
+
const recommendation = text$1(raw.recommendation);
|
|
10460
|
+
if (!recommendation) return {
|
|
10461
|
+
briefing: null,
|
|
10462
|
+
problems: ["The briefing has no recommendation."],
|
|
10463
|
+
rest
|
|
10464
|
+
};
|
|
10465
|
+
const reasons = [];
|
|
10466
|
+
(Array.isArray(raw.reasons) ? raw.reasons : []).forEach((r, i) => {
|
|
10467
|
+
if (!isRecord(r)) return void problems.push(`Reason ${i + 1} isn't an object, so it was left out.`);
|
|
10468
|
+
const items = [];
|
|
10469
|
+
(Array.isArray(r.items) ? r.items : []).forEach((it, j) => {
|
|
10470
|
+
const id = isRecord(it) ? text$1(it.id) : null;
|
|
10471
|
+
const why = isRecord(it) ? text$1(it.why) : null;
|
|
10472
|
+
if (!id || !why) return void problems.push(`Item ${j + 1} of reason ${i + 1} has no ${id ? "why" : "id"}, so it was left out.`);
|
|
10473
|
+
items.push({
|
|
10474
|
+
id,
|
|
10475
|
+
why,
|
|
10476
|
+
next: text$1(it.next)
|
|
10477
|
+
});
|
|
10478
|
+
});
|
|
10479
|
+
const label = text$1(r.label) ?? text$1(r.lens);
|
|
10480
|
+
const reasonText = text$1(r.text);
|
|
10481
|
+
if (!label || !items.length && !reasonText) return void problems.push(`Reason ${i + 1} has no ${label ? "items and no text" : "label"}, so it was left out.`);
|
|
10482
|
+
reasons.push({
|
|
10483
|
+
lens: text$1(r.lens) ?? "other",
|
|
10484
|
+
label,
|
|
10485
|
+
line: text$1(r.line) ?? "",
|
|
10486
|
+
text: reasonText,
|
|
10487
|
+
items
|
|
10488
|
+
});
|
|
10489
|
+
});
|
|
10490
|
+
if (reasons.length > 5) problems.push(`The briefing has ${reasons.length} reasons; the first 5 are shown.`);
|
|
10491
|
+
const seen = /* @__PURE__ */ new Set();
|
|
10492
|
+
for (const r of reasons) for (const it of r.items) {
|
|
10493
|
+
if (seen.has(it.id)) problems.push(`${it.id} is under more than one reason.`);
|
|
10494
|
+
seen.add(it.id);
|
|
10495
|
+
}
|
|
10496
|
+
const leftOut = (Array.isArray(raw.leftOut) ? raw.leftOut : []).flatMap((l) => {
|
|
10497
|
+
const id = isRecord(l) ? text$1(l.id) : null;
|
|
10498
|
+
return id ? [{
|
|
10499
|
+
id,
|
|
10500
|
+
why: isRecord(l) && text$1(l.why) || ""
|
|
10501
|
+
}] : [];
|
|
10502
|
+
});
|
|
10503
|
+
return {
|
|
10504
|
+
briefing: {
|
|
10505
|
+
recommendation,
|
|
10506
|
+
reasons: reasons.slice(0, 5),
|
|
10507
|
+
onTrack: text$1(raw.onTrack),
|
|
10508
|
+
changed: texts(raw.changed),
|
|
10509
|
+
leftOut
|
|
10510
|
+
},
|
|
10511
|
+
problems,
|
|
10512
|
+
rest
|
|
10513
|
+
};
|
|
10514
|
+
}
|
|
10231
10515
|
//#endregion
|
|
10232
10516
|
//#region src/proposal.ts
|
|
10233
10517
|
/** One positional list for several commands, as [command, fields] entries. */
|
|
@@ -10245,34 +10529,34 @@ var POSITIONAL_FIELDS = new Map([
|
|
|
10245
10529
|
...positional(["app"], "contrast app findings", "contrast app libraries"),
|
|
10246
10530
|
...positional(["buildId"], "saucelabs build get", "saucelabs build jobs"),
|
|
10247
10531
|
...positional(["commentId"], "github pr delete-comment", "github pr delete-review-comment"),
|
|
10248
|
-
...positional(["commit"], "ado commit status", "bitbucket commit
|
|
10532
|
+
...positional(["commit"], "ado commit status", "bitbucket commit get", "bitbucket commit status"),
|
|
10249
10533
|
...positional(["deviceId"], "saucelabs device get"),
|
|
10250
10534
|
...positional(["fileKeyOrUrl"], "figma file comments", "figma file get", "figma file versions"),
|
|
10251
10535
|
...positional(["flag"], "splitio flag archive", "splitio flag get", "splitio flag kill", "splitio flag restore", "splitio flag set-default", "splitio flag set-rule", "splitio flag toggle", "splitio flag update"),
|
|
10252
10536
|
...positional(["id", "attachmentId"], "ado work-item download"),
|
|
10253
|
-
...positional(["id", "commentId"], "bitbucket pr delete-comment", "bitbucket pr reply", "bitbucket pr resolve"
|
|
10537
|
+
...positional(["id", "commentId"], "bitbucket pr delete-comment", "bitbucket pr reply", "bitbucket pr resolve"),
|
|
10254
10538
|
...positional([
|
|
10255
10539
|
"id",
|
|
10256
10540
|
"threadId",
|
|
10257
10541
|
"commentId"
|
|
10258
10542
|
], "ado pr delete-comment"),
|
|
10259
|
-
...positional(["id", "threadId"], "ado pr reply", "ado pr resolve"
|
|
10260
|
-
...positional(["id"], "ado pipeline get", "ado pipeline run", "ado pr abandon", "ado pr approve", "ado pr builds", "ado pr comment", "ado pr comment-inline", "ado pr comments", "ado pr diff", "ado pr files", "ado pr get", "ado pr merge", "ado pr reviewers", "ado pr unapprove", "ado pr update", "ado pr wait-for-author", "ado run cancel", "ado run get", "ado run logs", "ado work-item assign", "ado work-item attach", "ado work-item attachments", "ado work-item comment", "ado work-item comments", "ado work-item get", "ado work-item get-many", "ado work-item history", "ado work-item link", "ado work-item tag", "ado work-item transition", "ado work-item untag", "ado work-item update", "
|
|
10543
|
+
...positional(["id", "threadId"], "ado pr reply", "ado pr resolve"),
|
|
10544
|
+
...positional(["id"], "ado backlog items", "ado board get", "ado pipeline get", "ado pipeline run", "ado pr abandon", "ado pr approve", "ado pr builds", "ado pr comment", "ado pr comment-inline", "ado pr comments", "ado pr diff", "ado pr files", "ado pr get", "ado pr merge", "ado pr reviewers", "ado pr threads", "ado pr unapprove", "ado pr update", "ado pr wait-for-author", "ado run cancel", "ado run get", "ado run logs", "ado sprint items", "ado work-item assign", "ado work-item attach", "ado work-item attachments", "ado work-item comment", "ado work-item comments", "ado work-item get", "ado work-item get-many", "ado work-item history", "ado work-item link", "ado work-item tag", "ado work-item transition", "ado work-item untag", "ado work-item update", "alation column get", "alation datasource get", "alation document get", "alation document update", "alation folder get", "alation job get", "alation schema get", "alation table get", "bitbucket pr add-reviewer", "bitbucket pr approve", "bitbucket pr builds", "bitbucket pr comment", "bitbucket pr comment-inline", "bitbucket pr comments", "bitbucket pr decline", "bitbucket pr diff", "bitbucket pr files", "bitbucket pr get", "bitbucket pr merge", "bitbucket pr needs-work", "bitbucket pr reviewers", "bitbucket pr unapprove", "bitbucket pr update", "checkmarx project get", "checkmarx scan get", "checkmarx scan stats", "confluence attachment delete", "confluence attachment download", "confluence page attach", "confluence page attachments", "confluence page children", "confluence page comment", "confluence page comments", "confluence page delete", "confluence page get", "confluence page history", "confluence page label", "confluence page labels", "confluence page unlabel", "confluence page update", "dynatrace entity get", "dynatrace problem get", "dynatrace trace get", "kibana dashboard export", "kibana rule get", "sde project get", "splitio change-request get"),
|
|
10261
10545
|
...positional(["index"], "elasticsearch index count", "elasticsearch index search"),
|
|
10262
10546
|
...positional(["jobId"], "saucelabs job assets", "saucelabs job build", "saucelabs job delete", "saucelabs job get", "saucelabs job stop", "saucelabs job update", "saucelabs rdc-job delete", "saucelabs rdc-job get", "saucelabs rdc-job stop", "saucelabs rdc-job update"),
|
|
10263
|
-
...positional(["key", "attachmentId"], "jira issue download"
|
|
10264
|
-
...positional(["key"], "confluence space get", "
|
|
10265
|
-
...positional(["method", "path"], "ado
|
|
10547
|
+
...positional(["key", "attachmentId"], "jira issue download"),
|
|
10548
|
+
...positional(["key"], "confluence space get", "jira issue assign", "jira issue attach", "jira issue attachments", "jira issue comment", "jira issue comments", "jira issue get", "jira issue history", "jira issue label", "jira issue link", "jira issue log-work", "jira issue set-sprint", "jira issue transition", "jira issue transitions", "jira issue unlabel", "jira issue update"),
|
|
10549
|
+
...positional(["method", "path"], "ado api", "bitbucket api", "jira api"),
|
|
10266
10550
|
...positional(["name", "number"], "artifactory build get", "jenkins run get", "jenkins run logs"),
|
|
10267
|
-
...positional(["name"], "ado project get", "
|
|
10551
|
+
...positional(["name"], "ado project get", "artifactory build runs", "jenkins pipeline get", "jenkins pipeline run", "jenkins pipeline runs"),
|
|
10268
10552
|
...positional(["number", "commentId"], "github pr reply"),
|
|
10269
10553
|
...positional(["number"], "github issue assign", "github issue get", "github issue history", "github issue label", "github issue unassign", "github issue unlabel", "github pr add-reviewers", "github pr approve", "github pr close", "github pr comment", "github pr comment-inline", "github pr comments", "github pr diff", "github pr disable-auto-merge", "github pr draft", "github pr enable-auto-merge", "github pr enqueue", "github pr files", "github pr get", "github pr merge", "github pr ready", "github pr remove-reviewers", "github pr reopen", "github pr request-changes", "github pr review-comments", "github pr reviewers", "github pr reviews", "github pr status", "github pr threads", "github pr update"),
|
|
10270
|
-
...positional(["path"], "bitbucket
|
|
10271
|
-
...positional(["pipeline", "step"], "bitbucket
|
|
10272
|
-
...positional(["pipeline"], "bitbucket
|
|
10554
|
+
...positional(["path"], "bitbucket file get", "bitbucket file list", "github repo file"),
|
|
10555
|
+
...positional(["pipeline", "step"], "bitbucket pipeline logs"),
|
|
10556
|
+
...positional(["pipeline"], "bitbucket pipeline get", "bitbucket pipeline steps"),
|
|
10273
10557
|
...positional(["plugin"], "skills marketplace disable", "skills marketplace enable", "skills marketplace sync"),
|
|
10274
10558
|
...positional(["pod"], "openshift pod logs"),
|
|
10275
|
-
...positional(["project"], "github project fields", "github project items", "jira
|
|
10559
|
+
...positional(["project"], "github project fields", "github project items", "jira project get"),
|
|
10276
10560
|
...positional(["projectId"], "figma project files"),
|
|
10277
10561
|
...positional(["publicId"], "sonatypeiq application get"),
|
|
10278
10562
|
...positional(["query"], "alation search"),
|
|
@@ -10410,7 +10694,9 @@ function named(text, connections) {
|
|
|
10410
10694
|
/** The finished answer: parts, citations, proposals, and what the checks flagged. */
|
|
10411
10695
|
function finish(raw, f) {
|
|
10412
10696
|
const blocks = [...raw.matchAll(FENCE)].map((m) => m[1]);
|
|
10413
|
-
const
|
|
10697
|
+
const stripped = raw.replace(FENCE, "").replace(OPEN_FENCE, "");
|
|
10698
|
+
const read = stripped.includes("```briefing") ? readBriefing(stripped) : null;
|
|
10699
|
+
const parts = partsOf(read ? read.rest : stripped);
|
|
10414
10700
|
const warnings = [];
|
|
10415
10701
|
const proposals = [];
|
|
10416
10702
|
for (const [i, block] of blocks.entries()) {
|
|
@@ -10426,7 +10712,27 @@ function finish(raw, f) {
|
|
|
10426
10712
|
const connections = new Set([...ledgerIds].map((id) => id.slice(0, id.indexOf(":"))));
|
|
10427
10713
|
const keyOf = new Set([...ledgerIds].map((id) => id.slice(id.indexOf(":") + 1)));
|
|
10428
10714
|
const unverified = /* @__PURE__ */ new Set();
|
|
10429
|
-
const
|
|
10715
|
+
const b = read?.briefing;
|
|
10716
|
+
const briefed = b ? [
|
|
10717
|
+
b.recommendation,
|
|
10718
|
+
b.onTrack ?? "",
|
|
10719
|
+
...b.changed,
|
|
10720
|
+
...b.reasons.flatMap((r) => [
|
|
10721
|
+
r.line,
|
|
10722
|
+
r.text ?? "",
|
|
10723
|
+
...r.items.flatMap((i) => [
|
|
10724
|
+
i.id,
|
|
10725
|
+
i.why,
|
|
10726
|
+
i.next ?? ""
|
|
10727
|
+
])
|
|
10728
|
+
]),
|
|
10729
|
+
...b.leftOut.flatMap((l) => [l.id, l.why])
|
|
10730
|
+
] : [];
|
|
10731
|
+
const { cited, bare, keys } = named([
|
|
10732
|
+
...parts.map((p) => p.text),
|
|
10733
|
+
...proposals.map((p) => p.reason),
|
|
10734
|
+
...briefed
|
|
10735
|
+
].join("\n\n"), connections);
|
|
10430
10736
|
for (const id of [
|
|
10431
10737
|
...cited,
|
|
10432
10738
|
...bare,
|
|
@@ -10434,9 +10740,10 @@ function finish(raw, f) {
|
|
|
10434
10740
|
]) if (!ledgerIds.has(id)) unverified.add(id);
|
|
10435
10741
|
const projects = new Set([...keyOf].map((k) => /^([A-Z][A-Z0-9]{1,9})-\d+$/.exec(k)?.[1]).filter(Boolean));
|
|
10436
10742
|
for (const key of keys) if (projects.has(key.split("-")[0]) && !keyOf.has(key) && ![...unverified].some((id) => id.endsWith(`:${key}`))) unverified.add(key);
|
|
10437
|
-
const citations = citationsOf(parts);
|
|
10743
|
+
const citations = [.../* @__PURE__ */ new Set([...citationsOf(parts), ...b ? [...b.reasons.flatMap((r) => r.items.map((i) => i.id)), ...citationsOf(briefed.map((text) => ({ text })))] : []])];
|
|
10438
10744
|
if (unverified.size) warnings.unshift(`This answer names ${unverified.size === 1 ? "an item" : `${unverified.size} items`} its tools never returned: ${[...unverified].join(", ")}. Treat ${unverified.size === 1 ? "it" : "them"} as unverified.`);
|
|
10439
|
-
if (
|
|
10745
|
+
if (read?.problems.length) warnings.push(...read.problems.map((p) => `The briefing: ${p}`));
|
|
10746
|
+
if (parts.length && !citations.length && !read?.briefing && ledgerIds.size) warnings.push("This answer cites none of the items its tools read, so nothing in it is traced to a source.");
|
|
10440
10747
|
if (parts.length && !ledgerIds.size) warnings.push("The agent's tools returned no work items, so this answer rests on none.");
|
|
10441
10748
|
return {
|
|
10442
10749
|
prompt: f.prompt,
|
|
@@ -10445,7 +10752,11 @@ function finish(raw, f) {
|
|
|
10445
10752
|
citations,
|
|
10446
10753
|
proposals,
|
|
10447
10754
|
unverified: [...unverified],
|
|
10448
|
-
warnings
|
|
10755
|
+
warnings,
|
|
10756
|
+
...read ? {
|
|
10757
|
+
briefing: read.briefing,
|
|
10758
|
+
briefingProblems: read.problems
|
|
10759
|
+
} : {}
|
|
10449
10760
|
};
|
|
10450
10761
|
}
|
|
10451
10762
|
//#endregion
|
|
@@ -11169,6 +11480,36 @@ function withHistory(text, history) {
|
|
|
11169
11480
|
var STANDUP = /^\s*write\s+up\s+the\s+stand-?up\s+for\s+(\d{4}-\d{2}-\d{2})(?:\s+to\s+(\d{4}-\d{2}-\d{2}))?\s*[.?!]?\s*$/i;
|
|
11170
11481
|
/** The instructions behind it: the report's facts only, in its order, each sentence naming its fact numbers. */
|
|
11171
11482
|
var standupPrompt = (dossier, from, to) => `Write up the stand-up for the dossier "${dossier}" from ${from} to ${to} (UTC days). Call standup_report with from "${from}" and to "${to}" and use only what it returns. Write it as a few short paragraphs a team can read aloud in a minute: first the team lines, then each person with anything in their lists, in the report's order, saying what they got done, what is in progress, what is blocked and what is next. Keep every fact as the report gives it: add nothing it doesn't say, and leave out nothing that is blocked. End each sentence with the fact numbers it rests on in parentheses, such as (F3, F7), and cite every work item and pull request by its id. If the report's gaps say the worklog can't vouch for part of the range, say so in one sentence first. Describe the work, never the people: no praise, no blame and no comparison.`;
|
|
11483
|
+
/**
|
|
11484
|
+
* Analyze's question, from toil (#494): `dossiers analyze prompt --host toil-ui`
|
|
11485
|
+
* composes the standard method with the dossier's own lenses and focus, the
|
|
11486
|
+
* focus labelled with where it came from, and asks for a briefing block the
|
|
11487
|
+
* page lays out. A toil without that command (Toil UI ahead of its release)
|
|
11488
|
+
* gets the question this file kept before, which the page still reads, and the
|
|
11489
|
+
* answer says so in a warning.
|
|
11490
|
+
*/
|
|
11491
|
+
async function analyzeQuestion(execute, dossier) {
|
|
11492
|
+
const e = await execute("dossiers analyze prompt", {
|
|
11493
|
+
dossier,
|
|
11494
|
+
host: "toil-ui"
|
|
11495
|
+
}, {
|
|
11496
|
+
readOnly: true,
|
|
11497
|
+
caller: "toil-ui"
|
|
11498
|
+
});
|
|
11499
|
+
const prompt = e.ok && typeof e.data === "object" && e.data !== null ? e.data.prompt : void 0;
|
|
11500
|
+
if (typeof prompt === "string") return {
|
|
11501
|
+
label: ANALYZE_LABEL,
|
|
11502
|
+
text: prompt,
|
|
11503
|
+
warning: null
|
|
11504
|
+
};
|
|
11505
|
+
const why = e.ok ? "it returned no prompt" : e.error.message;
|
|
11506
|
+
const fix = !e.ok && /unknown command|isn't a command|no command/i.test(e.error.message) ? "Upgrade toil to use the dossier's Analyze settings." : e.ok ? "Upgrade toil, or report it: a toil with the command returns a prompt." : e.error.fix ?? "";
|
|
11507
|
+
return {
|
|
11508
|
+
label: ANALYZE_LABEL,
|
|
11509
|
+
text: analyzePrompt(dossier),
|
|
11510
|
+
warning: `Analyze used Toil UI's own question, not the dossier's: toil dossiers analyze prompt failed (${why}).${fix ? ` ${fix}` : ""}`
|
|
11511
|
+
};
|
|
11512
|
+
}
|
|
11172
11513
|
/** The question for a starter id or Analyze (#343), or the typed text as it is; "Prepare my 1:1 notes for <person>" typed out gets the 1:1 instructions, and "Write up the stand-up for <from> to <to>" the stand-up's. */
|
|
11173
11514
|
function promptFor(dossier, prompt) {
|
|
11174
11515
|
if (prompt === "analyze") return {
|
|
@@ -11417,12 +11758,7 @@ function fixtureFeedbackEnvelope(fields, send) {
|
|
|
11417
11758
|
* person's press from its page. A sync never stores them, so the cache passes
|
|
11418
11759
|
* them to toil, read-only, like the dossiers.
|
|
11419
11760
|
*/
|
|
11420
|
-
var WORKFLOW_READS = [
|
|
11421
|
-
"jira issue transitions",
|
|
11422
|
-
"jira-cloud issue transitions",
|
|
11423
|
-
"ado work-item states",
|
|
11424
|
-
"ado-cloud work-item states"
|
|
11425
|
-
];
|
|
11761
|
+
var WORKFLOW_READS = ["jira issue transitions", "ado work-item states"];
|
|
11426
11762
|
/**
|
|
11427
11763
|
* The commands the views read, and the only ones `/api/execute` runs. They are
|
|
11428
11764
|
* the calls src/load.ts makes; test/server.test.ts holds this list to every
|
|
@@ -11433,21 +11769,14 @@ var READ_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
11433
11769
|
"dossiers show",
|
|
11434
11770
|
"jira issue search",
|
|
11435
11771
|
"jira issue history",
|
|
11436
|
-
"jira-cloud issue search",
|
|
11437
|
-
"jira-cloud issue history",
|
|
11438
11772
|
"ado work-item iterations",
|
|
11439
11773
|
"ado work-item search",
|
|
11440
11774
|
"ado work-item get-many",
|
|
11441
11775
|
"ado work-item history",
|
|
11776
|
+
"ado work-item feed",
|
|
11442
11777
|
"ado pr list",
|
|
11443
11778
|
"ado pr get",
|
|
11444
11779
|
"ado run list",
|
|
11445
|
-
"ado-cloud work-item iterations",
|
|
11446
|
-
"ado-cloud work-item search",
|
|
11447
|
-
"ado-cloud work-item get-many",
|
|
11448
|
-
"ado-cloud work-item history",
|
|
11449
|
-
"ado-cloud pr list",
|
|
11450
|
-
"ado-cloud pr get",
|
|
11451
11780
|
"github project items",
|
|
11452
11781
|
"github issue get",
|
|
11453
11782
|
"github issue list",
|
|
@@ -11457,8 +11786,6 @@ var READ_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
11457
11786
|
"github repo file",
|
|
11458
11787
|
"bitbucket pr list",
|
|
11459
11788
|
"bitbucket pr get",
|
|
11460
|
-
"bitbucket-cloud pr list",
|
|
11461
|
-
"bitbucket-cloud pr get",
|
|
11462
11789
|
"jenkins pipeline runs",
|
|
11463
11790
|
"openshift deployment list",
|
|
11464
11791
|
...WORKFLOW_READS
|
|
@@ -11528,7 +11855,7 @@ function sqliteStore(cache, execute, toil) {
|
|
|
11528
11855
|
contractVersion: toil.contractVersion
|
|
11529
11856
|
};
|
|
11530
11857
|
const dossier = typeof input.dossier === "string" ? input.dossier : null;
|
|
11531
|
-
const stored = dossier ? cache().response(dossier, command, input) : null;
|
|
11858
|
+
const stored = dossier ? cache().response(dossier, command, withWindow(input, windowFor(cache().retentionDays))) : null;
|
|
11532
11859
|
if (!stored) return {
|
|
11533
11860
|
ok: false,
|
|
11534
11861
|
data: null,
|
|
@@ -11543,7 +11870,7 @@ function sqliteStore(cache, execute, toil) {
|
|
|
11543
11870
|
if (source?.status !== "failed") return stored.envelope;
|
|
11544
11871
|
const warning = {
|
|
11545
11872
|
code: "STALE",
|
|
11546
|
-
message: `The latest sync of ${stored.area} failed (${source.error ?? "no message"}), so this is the copy synced ${stored.syncedAt}.`
|
|
11873
|
+
message: `The latest sync of ${stored.area} failed (${source.error ?? "no message"}), so this is the copy synced ${source.lastSuccessAt ?? stored.syncedAt}.`
|
|
11547
11874
|
};
|
|
11548
11875
|
return {
|
|
11549
11876
|
...stored.envelope,
|
|
@@ -11804,7 +12131,7 @@ function buildStandup(input) {
|
|
|
11804
12131
|
for (const c of input.pullRequests) {
|
|
11805
12132
|
if (c.state !== "OPEN") continue;
|
|
11806
12133
|
const wait = waitOf(c, asOf);
|
|
11807
|
-
if (wait.on !== "review" || wait.days === null || wait.days <
|
|
12134
|
+
if (wait.on !== "review" || wait.days === null || wait.days < PICKUP_DAYS) continue;
|
|
11808
12135
|
const days = Math.round(wait.days * 10) / 10;
|
|
11809
12136
|
const label = c.id.slice(c.id.indexOf(":") + 1).replace(/^[^/]*\//, "");
|
|
11810
12137
|
put(prGroup(c.id, c.source.area, c.author).group, "blocked", {
|
|
@@ -11990,7 +12317,7 @@ function cacheData(cache, dossier) {
|
|
|
11990
12317
|
items: () => cache.items(dossier),
|
|
11991
12318
|
transitions: (id) => cache.transitions(dossier, id),
|
|
11992
12319
|
changes: () => cache.changes(dossier),
|
|
11993
|
-
syncedAt: () => state.
|
|
12320
|
+
syncedAt: () => state.lastSavedAt
|
|
11994
12321
|
};
|
|
11995
12322
|
}
|
|
11996
12323
|
/** `dossiers show` through toil, read-only and labelled as Toil UI: the people tools' `ReadDossier`. */
|
|
@@ -12020,9 +12347,6 @@ var LIVE_COMMANDS = [
|
|
|
12020
12347
|
"jira issue search",
|
|
12021
12348
|
"jira issue get",
|
|
12022
12349
|
"jira issue history",
|
|
12023
|
-
"jira-cloud issue search",
|
|
12024
|
-
"jira-cloud issue get",
|
|
12025
|
-
"jira-cloud issue history",
|
|
12026
12350
|
"ado work-item search",
|
|
12027
12351
|
"ado work-item get",
|
|
12028
12352
|
"ado work-item get-many",
|
|
@@ -12031,13 +12355,6 @@ var LIVE_COMMANDS = [
|
|
|
12031
12355
|
"ado pr list",
|
|
12032
12356
|
"ado pr get",
|
|
12033
12357
|
"ado run list",
|
|
12034
|
-
"ado-cloud work-item search",
|
|
12035
|
-
"ado-cloud work-item get",
|
|
12036
|
-
"ado-cloud work-item get-many",
|
|
12037
|
-
"ado-cloud work-item history",
|
|
12038
|
-
"ado-cloud work-item iterations",
|
|
12039
|
-
"ado-cloud pr list",
|
|
12040
|
-
"ado-cloud pr get",
|
|
12041
12358
|
"github issue get",
|
|
12042
12359
|
"github issue history",
|
|
12043
12360
|
"github project items",
|
|
@@ -12046,8 +12363,6 @@ var LIVE_COMMANDS = [
|
|
|
12046
12363
|
"github commit checks",
|
|
12047
12364
|
"bitbucket pr list",
|
|
12048
12365
|
"bitbucket pr get",
|
|
12049
|
-
"bitbucket-cloud pr list",
|
|
12050
|
-
"bitbucket-cloud pr get",
|
|
12051
12366
|
"jenkins pipeline runs",
|
|
12052
12367
|
"openshift deployment list"
|
|
12053
12368
|
];
|
|
@@ -13918,7 +14233,7 @@ var FIELDS = /* @__PURE__ */ new Set([
|
|
|
13918
14233
|
"models",
|
|
13919
14234
|
"cliPaths"
|
|
13920
14235
|
]);
|
|
13921
|
-
var NAMES = [
|
|
14236
|
+
var NAMES$1 = [
|
|
13922
14237
|
"claude",
|
|
13923
14238
|
"copilot",
|
|
13924
14239
|
"codex"
|
|
@@ -13993,7 +14308,7 @@ function perAdapter(value, field, check) {
|
|
|
13993
14308
|
if (typeof value !== "object" || Array.isArray(value)) throw new AgentError(`${field} must be an object of adapter to value.`, `Send { "claude": …, "copilot": …, "codex": … }, or leave ${field} out.`);
|
|
13994
14309
|
const out = {};
|
|
13995
14310
|
for (const [k, v] of Object.entries(value)) {
|
|
13996
|
-
if (!NAMES.includes(k)) throw new AgentError(`${field} has no adapter ${JSON.stringify(k)}.`, `Its keys are ${NAMES.join(", ")}.`);
|
|
14311
|
+
if (!NAMES$1.includes(k)) throw new AgentError(`${field} has no adapter ${JSON.stringify(k)}.`, `Its keys are ${NAMES$1.join(", ")}.`);
|
|
13997
14312
|
const checked = check(v, k);
|
|
13998
14313
|
if (checked !== null) out[k] = checked;
|
|
13999
14314
|
}
|
|
@@ -14058,7 +14373,7 @@ var THEME_VOICES = new Map([
|
|
|
14058
14373
|
{
|
|
14059
14374
|
name: "plain",
|
|
14060
14375
|
label: "Plain",
|
|
14061
|
-
description: "Light and quiet
|
|
14376
|
+
description: "Light and quiet: toil's rounded brand face, Fredoka, on headings and figures, and IBM Plex Sans to read. The accessibility baseline every other theme is held to.",
|
|
14062
14377
|
schemes: {
|
|
14063
14378
|
"light": {
|
|
14064
14379
|
"bg": "#ffffff",
|
|
@@ -14111,24 +14426,43 @@ var THEME_VOICES = new Map([
|
|
|
14111
14426
|
{
|
|
14112
14427
|
name: "crate",
|
|
14113
14428
|
label: "Crate",
|
|
14114
|
-
description: "The toil site's look: its near-black, the drafting grid and the blue glow, the blue accent gradient, dust drifting in the glow, and the crate in its hard hat when there's nothing to show yet.",
|
|
14115
|
-
schemes: {
|
|
14116
|
-
"
|
|
14117
|
-
|
|
14118
|
-
|
|
14119
|
-
|
|
14120
|
-
|
|
14121
|
-
|
|
14122
|
-
|
|
14123
|
-
|
|
14124
|
-
|
|
14125
|
-
|
|
14126
|
-
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
|
|
14130
|
-
|
|
14131
|
-
|
|
14429
|
+
description: "The toil site's look: its near-black, or warm drafting paper in light, the drafting grid and the blue glow, the blue accent gradient, dust drifting in the glow, and the crate in its hard hat when there's nothing to show yet.",
|
|
14430
|
+
schemes: {
|
|
14431
|
+
"dark": {
|
|
14432
|
+
"bg": "#0f1115",
|
|
14433
|
+
"surface": "#171a21",
|
|
14434
|
+
"raised": "#1e222b",
|
|
14435
|
+
"ink": "#e8eaed",
|
|
14436
|
+
"muted": "#a7afba",
|
|
14437
|
+
"line": "#3a414d",
|
|
14438
|
+
"accent": "#8cc4ff",
|
|
14439
|
+
"accentInk": "#0b1220",
|
|
14440
|
+
"link": "#c2e0ff",
|
|
14441
|
+
"focus": "#8cc4ff",
|
|
14442
|
+
"ok": "#6fd394",
|
|
14443
|
+
"warn": "#f0b849",
|
|
14444
|
+
"danger": "#ff8a80",
|
|
14445
|
+
"bannerBg": "#1e222b",
|
|
14446
|
+
"bannerInk": "#c2e0ff"
|
|
14447
|
+
},
|
|
14448
|
+
"light": {
|
|
14449
|
+
"bg": "#f4f2ed",
|
|
14450
|
+
"surface": "#faf9f5",
|
|
14451
|
+
"raised": "#ffffff",
|
|
14452
|
+
"ink": "#1a1e26",
|
|
14453
|
+
"muted": "#505865",
|
|
14454
|
+
"line": "#cfcac0",
|
|
14455
|
+
"accent": "#1b66c4",
|
|
14456
|
+
"accentInk": "#ffffff",
|
|
14457
|
+
"link": "#0e4a96",
|
|
14458
|
+
"focus": "#1b66c4",
|
|
14459
|
+
"ok": "#146c2e",
|
|
14460
|
+
"warn": "#7a4a00",
|
|
14461
|
+
"danger": "#b42318",
|
|
14462
|
+
"bannerBg": "#fdf0c4",
|
|
14463
|
+
"bannerInk": "#3d2c00"
|
|
14464
|
+
}
|
|
14465
|
+
},
|
|
14132
14466
|
fonts: {
|
|
14133
14467
|
"body": "'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif",
|
|
14134
14468
|
"display": "'Source Serif 4', Georgia, 'Times New Roman', serif",
|
|
@@ -14269,24 +14603,43 @@ var THEME_VOICES = new Map([
|
|
|
14269
14603
|
{
|
|
14270
14604
|
name: "harvest",
|
|
14271
14605
|
label: "Harvest",
|
|
14272
|
-
description: "A 16-bit farm: a pixel font, wooden sign panels, a sky that runs from dawn on the sprint's first day to dusk on its last, and crops that grow a stage with each column an item moves.",
|
|
14273
|
-
schemes: {
|
|
14274
|
-
"
|
|
14275
|
-
|
|
14276
|
-
|
|
14277
|
-
|
|
14278
|
-
|
|
14279
|
-
|
|
14280
|
-
|
|
14281
|
-
|
|
14282
|
-
|
|
14283
|
-
|
|
14284
|
-
|
|
14285
|
-
|
|
14286
|
-
|
|
14287
|
-
|
|
14288
|
-
|
|
14289
|
-
|
|
14606
|
+
description: "A 16-bit farm, by day or by lantern light: a pixel font, wooden sign panels, a sky that runs from dawn on the sprint's first day to dusk on its last, and crops that grow a stage with each column an item moves.",
|
|
14607
|
+
schemes: {
|
|
14608
|
+
"light": {
|
|
14609
|
+
"bg": "#efe3c2",
|
|
14610
|
+
"surface": "#f6ecd2",
|
|
14611
|
+
"raised": "#fdf6e3",
|
|
14612
|
+
"ink": "#2b1a0e",
|
|
14613
|
+
"muted": "#5c3f24",
|
|
14614
|
+
"line": "#b08a5a",
|
|
14615
|
+
"accent": "#2f6b1f",
|
|
14616
|
+
"accentInk": "#ffffff",
|
|
14617
|
+
"link": "#8a3410",
|
|
14618
|
+
"focus": "#1f55a8",
|
|
14619
|
+
"ok": "#2c6a1c",
|
|
14620
|
+
"warn": "#7a4800",
|
|
14621
|
+
"danger": "#a3200f",
|
|
14622
|
+
"bannerBg": "#3b2614",
|
|
14623
|
+
"bannerInk": "#fbe7b5"
|
|
14624
|
+
},
|
|
14625
|
+
"dark": {
|
|
14626
|
+
"bg": "#151d17",
|
|
14627
|
+
"surface": "#1e2a20",
|
|
14628
|
+
"raised": "#283628",
|
|
14629
|
+
"ink": "#f3e4bf",
|
|
14630
|
+
"muted": "#cdb58a",
|
|
14631
|
+
"line": "#80613c",
|
|
14632
|
+
"accent": "#8fd46a",
|
|
14633
|
+
"accentInk": "#10200c",
|
|
14634
|
+
"link": "#f0b060",
|
|
14635
|
+
"focus": "#7db4f2",
|
|
14636
|
+
"ok": "#8fd46a",
|
|
14637
|
+
"warn": "#f2c04a",
|
|
14638
|
+
"danger": "#ff8f7a",
|
|
14639
|
+
"bannerBg": "#2a1a0c",
|
|
14640
|
+
"bannerInk": "#fbe7b5"
|
|
14641
|
+
}
|
|
14642
|
+
},
|
|
14290
14643
|
fonts: {
|
|
14291
14644
|
"body": "'Pixelify Sans', system-ui, -apple-system, 'Segoe UI', sans-serif",
|
|
14292
14645
|
"display": "'Pixelify Sans', system-ui, -apple-system, 'Segoe UI', sans-serif",
|
|
@@ -14443,23 +14796,42 @@ var THEME_VOICES = new Map([
|
|
|
14443
14796
|
name: "starship",
|
|
14444
14797
|
label: "Starship",
|
|
14445
14798
|
description: "A starship's bridge console: HUD frames, scanlines and a slow starfield over a nebula, holo panels with a glow, sprint health as ship's readouts, and the dependency graph as a star chart.",
|
|
14446
|
-
schemes: {
|
|
14447
|
-
"
|
|
14448
|
-
|
|
14449
|
-
|
|
14450
|
-
|
|
14451
|
-
|
|
14452
|
-
|
|
14453
|
-
|
|
14454
|
-
|
|
14455
|
-
|
|
14456
|
-
|
|
14457
|
-
|
|
14458
|
-
|
|
14459
|
-
|
|
14460
|
-
|
|
14461
|
-
|
|
14462
|
-
|
|
14799
|
+
schemes: {
|
|
14800
|
+
"dark": {
|
|
14801
|
+
"bg": "#05070f",
|
|
14802
|
+
"surface": "#0a1222",
|
|
14803
|
+
"raised": "#101b31",
|
|
14804
|
+
"ink": "#e6f1ff",
|
|
14805
|
+
"muted": "#9fb4cd",
|
|
14806
|
+
"line": "#2a4262",
|
|
14807
|
+
"accent": "#36d6ff",
|
|
14808
|
+
"accentInk": "#00121c",
|
|
14809
|
+
"link": "#7fe3ff",
|
|
14810
|
+
"focus": "#ffcf4a",
|
|
14811
|
+
"ok": "#5df2a6",
|
|
14812
|
+
"warn": "#ffc857",
|
|
14813
|
+
"danger": "#ff7a8e",
|
|
14814
|
+
"bannerBg": "#0a1222",
|
|
14815
|
+
"bannerInk": "#7fe3ff"
|
|
14816
|
+
},
|
|
14817
|
+
"light": {
|
|
14818
|
+
"bg": "#eaf1f9",
|
|
14819
|
+
"surface": "#f6f9fd",
|
|
14820
|
+
"raised": "#ffffff",
|
|
14821
|
+
"ink": "#0a1a2e",
|
|
14822
|
+
"muted": "#3d566f",
|
|
14823
|
+
"line": "#7f9bb9",
|
|
14824
|
+
"accent": "#00708f",
|
|
14825
|
+
"accentInk": "#ffffff",
|
|
14826
|
+
"link": "#00607f",
|
|
14827
|
+
"focus": "#8a5a00",
|
|
14828
|
+
"ok": "#0b7a46",
|
|
14829
|
+
"warn": "#8a5a00",
|
|
14830
|
+
"danger": "#b3213d",
|
|
14831
|
+
"bannerBg": "#dbe8f5",
|
|
14832
|
+
"bannerInk": "#00506b"
|
|
14833
|
+
}
|
|
14834
|
+
},
|
|
14463
14835
|
fonts: {
|
|
14464
14836
|
"body": "'Exo 2', system-ui, -apple-system, 'Segoe UI', sans-serif",
|
|
14465
14837
|
"display": "'Orbitron', 'Exo 2', system-ui, sans-serif",
|
|
@@ -14613,23 +14985,42 @@ var THEME_VOICES = new Map([
|
|
|
14613
14985
|
name: "realm",
|
|
14614
14986
|
label: "Realm",
|
|
14615
14987
|
description: "A grimdark house ledger kept as a tabletop campaign: soot and iron around aged vellum, leather-bound folios with wax-sealed headings, a dungeon map at the foot of every page, a d20 rolling while a view loads, the dependency graph as an engraved war-table map, an item's fields as a character sheet, and the agent as the dungeon master.",
|
|
14616
|
-
schemes: {
|
|
14617
|
-
"
|
|
14618
|
-
|
|
14619
|
-
|
|
14620
|
-
|
|
14621
|
-
|
|
14622
|
-
|
|
14623
|
-
|
|
14624
|
-
|
|
14625
|
-
|
|
14626
|
-
|
|
14627
|
-
|
|
14628
|
-
|
|
14629
|
-
|
|
14630
|
-
|
|
14631
|
-
|
|
14632
|
-
|
|
14988
|
+
schemes: {
|
|
14989
|
+
"light": {
|
|
14990
|
+
"bg": "#cbbd9e",
|
|
14991
|
+
"surface": "#e2d7bf",
|
|
14992
|
+
"raised": "#ece4d2",
|
|
14993
|
+
"ink": "#1a1410",
|
|
14994
|
+
"muted": "#46392c",
|
|
14995
|
+
"line": "#8a7558",
|
|
14996
|
+
"accent": "#6e1c18",
|
|
14997
|
+
"accentInk": "#f1e8d4",
|
|
14998
|
+
"link": "#2b3f52",
|
|
14999
|
+
"focus": "#24405e",
|
|
15000
|
+
"ok": "#2b4a22",
|
|
15001
|
+
"warn": "#663f00",
|
|
15002
|
+
"danger": "#7f1a12",
|
|
15003
|
+
"bannerBg": "#1a1715",
|
|
15004
|
+
"bannerInk": "#e6dcc6"
|
|
15005
|
+
},
|
|
15006
|
+
"dark": {
|
|
15007
|
+
"bg": "#1c1712",
|
|
15008
|
+
"surface": "#2a231b",
|
|
15009
|
+
"raised": "#342b21",
|
|
15010
|
+
"ink": "#ece1c8",
|
|
15011
|
+
"muted": "#bdae92",
|
|
15012
|
+
"line": "#8f7d62",
|
|
15013
|
+
"accent": "#d4705a",
|
|
15014
|
+
"accentInk": "#1a1410",
|
|
15015
|
+
"link": "#8fb4d4",
|
|
15016
|
+
"focus": "#8fb9e8",
|
|
15017
|
+
"ok": "#8fc47a",
|
|
15018
|
+
"warn": "#e0a64a",
|
|
15019
|
+
"danger": "#f08a78",
|
|
15020
|
+
"bannerBg": "#0f0c0a",
|
|
15021
|
+
"bannerInk": "#e6dcc6"
|
|
15022
|
+
}
|
|
15023
|
+
},
|
|
14633
15024
|
fonts: {
|
|
14634
15025
|
"body": "'EB Garamond', Georgia, 'Times New Roman', serif",
|
|
14635
15026
|
"display": "'Grenze Gotisch', Georgia, 'Times New Roman', serif",
|
|
@@ -14808,24 +15199,43 @@ var THEME_VOICES = new Map([
|
|
|
14808
15199
|
{
|
|
14809
15200
|
name: "sprawl",
|
|
14810
15201
|
label: "Sprawl",
|
|
14811
|
-
description: "A terminal at heart in a rain-soaked megacity: monospace type and a block cursor, faint scanlines and a CRT edge glow, neon magenta and cyan on deep blue-black, the skyline at the foot of the page, rain on the glass, the dependency graph as a net map, and the agent as a netrunner.",
|
|
14812
|
-
schemes: {
|
|
14813
|
-
"
|
|
14814
|
-
|
|
14815
|
-
|
|
14816
|
-
|
|
14817
|
-
|
|
14818
|
-
|
|
14819
|
-
|
|
14820
|
-
|
|
14821
|
-
|
|
14822
|
-
|
|
14823
|
-
|
|
14824
|
-
|
|
14825
|
-
|
|
14826
|
-
|
|
14827
|
-
|
|
14828
|
-
|
|
15202
|
+
description: "A terminal at heart in a rain-soaked megacity: monospace type and a block cursor, faint scanlines and a CRT edge glow, neon magenta and cyan on deep blue-black, or the city at dawn in light, the skyline at the foot of the page, rain on the glass, the dependency graph as a net map, and the agent as a netrunner.",
|
|
15203
|
+
schemes: {
|
|
15204
|
+
"dark": {
|
|
15205
|
+
"bg": "#07060f",
|
|
15206
|
+
"surface": "#0e0c1d",
|
|
15207
|
+
"raised": "#17142c",
|
|
15208
|
+
"ink": "#eaf6ff",
|
|
15209
|
+
"muted": "#a8a3cf",
|
|
15210
|
+
"line": "#3b2f6b",
|
|
15211
|
+
"accent": "#ff2e88",
|
|
15212
|
+
"accentInk": "#12020a",
|
|
15213
|
+
"link": "#3ff0ff",
|
|
15214
|
+
"focus": "#f2ff4a",
|
|
15215
|
+
"ok": "#39ff9c",
|
|
15216
|
+
"warn": "#ffd23f",
|
|
15217
|
+
"danger": "#ff6470",
|
|
15218
|
+
"bannerBg": "#0e0c1d",
|
|
15219
|
+
"bannerInk": "#3ff0ff"
|
|
15220
|
+
},
|
|
15221
|
+
"light": {
|
|
15222
|
+
"bg": "#e9e7f2",
|
|
15223
|
+
"surface": "#f4f2fa",
|
|
15224
|
+
"raised": "#ffffff",
|
|
15225
|
+
"ink": "#14102a",
|
|
15226
|
+
"muted": "#4a4570",
|
|
15227
|
+
"line": "#8f88bd",
|
|
15228
|
+
"accent": "#b80f62",
|
|
15229
|
+
"accentInk": "#ffffff",
|
|
15230
|
+
"link": "#00667a",
|
|
15231
|
+
"focus": "#5b21c9",
|
|
15232
|
+
"ok": "#0a6e3e",
|
|
15233
|
+
"warn": "#80530a",
|
|
15234
|
+
"danger": "#bd1530",
|
|
15235
|
+
"bannerBg": "#d5f1f5",
|
|
15236
|
+
"bannerInk": "#00424f"
|
|
15237
|
+
}
|
|
15238
|
+
},
|
|
14829
15239
|
fonts: {
|
|
14830
15240
|
"body": "'Fira Code', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace",
|
|
14831
15241
|
"display": "'Chakra Petch', 'Fira Code', ui-monospace, monospace",
|
|
@@ -14838,6 +15248,7 @@ var THEME_VOICES = new Map([
|
|
|
14838
15248
|
assets: {
|
|
14839
15249
|
"skyline": "assets/skyline.webp",
|
|
14840
15250
|
"netMap": "assets/net-map.svg",
|
|
15251
|
+
"netMapLight": "assets/net-map-light.svg",
|
|
14841
15252
|
"netrunner": "assets/netrunner.svg",
|
|
14842
15253
|
"blackIce": "assets/black-ice.svg",
|
|
14843
15254
|
"loading": "assets/jack-in.webp",
|
|
@@ -14982,23 +15393,42 @@ var THEME_VOICES = new Map([
|
|
|
14982
15393
|
name: "frontier",
|
|
14983
15394
|
label: "Frontier",
|
|
14984
15395
|
description: "Steampunk on the wild west frontier: brass, copper and riveted iron over sun-bleached desert wood, panels framed in riveted brass plate, pressure gauges on the tallies, the dependency graph as a railroad survey map, dust and drifting steam, and the agent as a dry telegraph operator.",
|
|
14985
|
-
schemes: {
|
|
14986
|
-
"
|
|
14987
|
-
|
|
14988
|
-
|
|
14989
|
-
|
|
14990
|
-
|
|
14991
|
-
|
|
14992
|
-
|
|
14993
|
-
|
|
14994
|
-
|
|
14995
|
-
|
|
14996
|
-
|
|
14997
|
-
|
|
14998
|
-
|
|
14999
|
-
|
|
15000
|
-
|
|
15001
|
-
|
|
15396
|
+
schemes: {
|
|
15397
|
+
"light": {
|
|
15398
|
+
"bg": "#d6c4a0",
|
|
15399
|
+
"surface": "#efe3c8",
|
|
15400
|
+
"raised": "#f6eedb",
|
|
15401
|
+
"ink": "#22170d",
|
|
15402
|
+
"muted": "#4b3925",
|
|
15403
|
+
"line": "#97794f",
|
|
15404
|
+
"accent": "#8a3812",
|
|
15405
|
+
"accentInk": "#fbf1de",
|
|
15406
|
+
"link": "#1f4859",
|
|
15407
|
+
"focus": "#1e4e85",
|
|
15408
|
+
"ok": "#2e5a1c",
|
|
15409
|
+
"warn": "#683f00",
|
|
15410
|
+
"danger": "#8c1c10",
|
|
15411
|
+
"bannerBg": "#1f1b17",
|
|
15412
|
+
"bannerInk": "#ecd9ad"
|
|
15413
|
+
},
|
|
15414
|
+
"dark": {
|
|
15415
|
+
"bg": "#15181f",
|
|
15416
|
+
"surface": "#241f1a",
|
|
15417
|
+
"raised": "#2e2820",
|
|
15418
|
+
"ink": "#f1e4c6",
|
|
15419
|
+
"muted": "#cdb998",
|
|
15420
|
+
"line": "#7c6646",
|
|
15421
|
+
"accent": "#e2a23f",
|
|
15422
|
+
"accentInk": "#1c1209",
|
|
15423
|
+
"link": "#8ec3d6",
|
|
15424
|
+
"focus": "#9bbdf2",
|
|
15425
|
+
"ok": "#8cc46a",
|
|
15426
|
+
"warn": "#e6b552",
|
|
15427
|
+
"danger": "#f08a72",
|
|
15428
|
+
"bannerBg": "#0f0d0b",
|
|
15429
|
+
"bannerInk": "#ecd9ad"
|
|
15430
|
+
}
|
|
15431
|
+
},
|
|
15002
15432
|
fonts: {
|
|
15003
15433
|
"body": "'Bitter', Georgia, 'Times New Roman', serif",
|
|
15004
15434
|
"display": "'Rye', 'Bitter', Georgia, serif",
|
|
@@ -15157,23 +15587,42 @@ var THEME_VOICES = new Map([
|
|
|
15157
15587
|
name: "overworld",
|
|
15158
15588
|
label: "Overworld",
|
|
15159
15589
|
description: "A top-down 16-bit adventure: an overworld map at the page's edges, panels as dungeon rooms walled in stone, a heart meter for the days left in the sprint and a gem counter for its points, chests that open as quests are done, and the agent as an old sage in a cave.",
|
|
15160
|
-
schemes: {
|
|
15161
|
-
"
|
|
15162
|
-
|
|
15163
|
-
|
|
15164
|
-
|
|
15165
|
-
|
|
15166
|
-
|
|
15167
|
-
|
|
15168
|
-
|
|
15169
|
-
|
|
15170
|
-
|
|
15171
|
-
|
|
15172
|
-
|
|
15173
|
-
|
|
15174
|
-
|
|
15175
|
-
|
|
15176
|
-
|
|
15590
|
+
schemes: {
|
|
15591
|
+
"dark": {
|
|
15592
|
+
"bg": "#111c16",
|
|
15593
|
+
"surface": "#1a2620",
|
|
15594
|
+
"raised": "#223129",
|
|
15595
|
+
"ink": "#f3efdc",
|
|
15596
|
+
"muted": "#bcc7b4",
|
|
15597
|
+
"line": "#4d6355",
|
|
15598
|
+
"accent": "#5cc46e",
|
|
15599
|
+
"accentInk": "#0b120e",
|
|
15600
|
+
"link": "#f2c94c",
|
|
15601
|
+
"focus": "#ffd75e",
|
|
15602
|
+
"ok": "#7ed98f",
|
|
15603
|
+
"warn": "#f2b84b",
|
|
15604
|
+
"danger": "#ff8a7a",
|
|
15605
|
+
"bannerBg": "#0b120e",
|
|
15606
|
+
"bannerInk": "#f3efdc"
|
|
15607
|
+
},
|
|
15608
|
+
"light": {
|
|
15609
|
+
"bg": "#e9efd6",
|
|
15610
|
+
"surface": "#f7f4e2",
|
|
15611
|
+
"raised": "#fffbe9",
|
|
15612
|
+
"ink": "#241c14",
|
|
15613
|
+
"muted": "#46564a",
|
|
15614
|
+
"line": "#7d8d76",
|
|
15615
|
+
"accent": "#1a7a4a",
|
|
15616
|
+
"accentInk": "#ffffff",
|
|
15617
|
+
"link": "#7a5000",
|
|
15618
|
+
"focus": "#8a5a00",
|
|
15619
|
+
"ok": "#1d6a31",
|
|
15620
|
+
"warn": "#8a5500",
|
|
15621
|
+
"danger": "#b0231a",
|
|
15622
|
+
"bannerBg": "#1f3a2a",
|
|
15623
|
+
"bannerInk": "#f7f4e2"
|
|
15624
|
+
}
|
|
15625
|
+
},
|
|
15177
15626
|
fonts: {
|
|
15178
15627
|
"body": "'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif",
|
|
15179
15628
|
"display": "'Press Start 2P', 'IBM Plex Sans', system-ui, sans-serif",
|
|
@@ -15504,7 +15953,11 @@ var AgentHost = class {
|
|
|
15504
15953
|
const data = this.o.data(dossier);
|
|
15505
15954
|
if (!data) throw new AgentError(`Toil UI hasn't synced ${dossier} yet, so the agent has nothing to read.`, "Press Sync now in the Sync panel, then ask again.");
|
|
15506
15955
|
const ledger = new Ledger();
|
|
15507
|
-
const
|
|
15956
|
+
const asking = prompt === "analyze" ? await analyzeQuestion(this.o.execute, dossier) : {
|
|
15957
|
+
...promptFor(dossier, prompt),
|
|
15958
|
+
warning: null
|
|
15959
|
+
};
|
|
15960
|
+
const { label, text: question } = asking;
|
|
15508
15961
|
const { text, carried } = withHistory(question, extra.history);
|
|
15509
15962
|
const by = this.byOf(runtime);
|
|
15510
15963
|
const who = {
|
|
@@ -15552,14 +16005,16 @@ var AgentHost = class {
|
|
|
15552
16005
|
}
|
|
15553
16006
|
}).then(async ({ text: final, usage }) => {
|
|
15554
16007
|
const session = held ? await this.checked(held).catch(() => null) : null;
|
|
16008
|
+
const done = finish(final, {
|
|
16009
|
+
dossier,
|
|
16010
|
+
prompt: label,
|
|
16011
|
+
by,
|
|
16012
|
+
ledger,
|
|
16013
|
+
writes: this.writes
|
|
16014
|
+
});
|
|
16015
|
+
if (asking.warning) done.warnings = [...done.warnings ?? [], asking.warning];
|
|
15555
16016
|
out.push({
|
|
15556
|
-
...
|
|
15557
|
-
dossier,
|
|
15558
|
-
prompt: label,
|
|
15559
|
-
by,
|
|
15560
|
-
ledger,
|
|
15561
|
-
writes: this.writes
|
|
15562
|
-
}),
|
|
16017
|
+
...done,
|
|
15563
16018
|
...who,
|
|
15564
16019
|
usage,
|
|
15565
16020
|
...session ? { session } : {}
|
|
@@ -16077,7 +16532,13 @@ function snapshotOf(items, now) {
|
|
|
16077
16532
|
}
|
|
16078
16533
|
/** An Analyze answer, finished, as a record for the history. */
|
|
16079
16534
|
function recordOf(answer, o) {
|
|
16080
|
-
const
|
|
16535
|
+
const text = textOfParts(answer.parts);
|
|
16536
|
+
const read = answer.briefing !== void 0 ? {
|
|
16537
|
+
briefing: answer.briefing,
|
|
16538
|
+
problems: answer.briefingProblems ?? []
|
|
16539
|
+
} : text.includes("```briefing") ? readBriefing(text) : null;
|
|
16540
|
+
const b = read?.briefing ?? null;
|
|
16541
|
+
const s = b ? null : structureOf(text);
|
|
16081
16542
|
return {
|
|
16082
16543
|
id: o.id,
|
|
16083
16544
|
dossier: o.dossier,
|
|
@@ -16087,8 +16548,13 @@ function recordOf(answer, o) {
|
|
|
16087
16548
|
model: answer.model ?? null,
|
|
16088
16549
|
by: answer.by,
|
|
16089
16550
|
usage: answer.usage ?? null,
|
|
16090
|
-
recommendation: s?.recommendation ?? null,
|
|
16091
|
-
issues:
|
|
16551
|
+
recommendation: b?.recommendation ?? s?.recommendation ?? null,
|
|
16552
|
+
issues: b ? b.reasons.slice(0, 3).map((r) => ({
|
|
16553
|
+
title: r.label,
|
|
16554
|
+
text: r.text ?? r.line
|
|
16555
|
+
})) : s?.issues ?? [],
|
|
16556
|
+
briefing: b,
|
|
16557
|
+
briefingProblems: read?.problems ?? [],
|
|
16092
16558
|
parts: answer.parts,
|
|
16093
16559
|
citations: answer.citations.length ? answer.citations : citationsOf(answer.parts),
|
|
16094
16560
|
unverified: answer.unverified ?? [],
|
|
@@ -16158,7 +16624,10 @@ function historyOf$1(records) {
|
|
|
16158
16624
|
issues: r.issues,
|
|
16159
16625
|
citations: r.citations,
|
|
16160
16626
|
unverified: r.unverified.length,
|
|
16161
|
-
changes: changesBetween(oldest[i - 1] ?? null, r)
|
|
16627
|
+
changes: changesBetween(oldest[i - 1] ?? null, r),
|
|
16628
|
+
briefing: r.briefing ?? null,
|
|
16629
|
+
briefingProblems: r.briefingProblems ?? [],
|
|
16630
|
+
proposals: r.proposals
|
|
16162
16631
|
})).reverse();
|
|
16163
16632
|
}
|
|
16164
16633
|
/** One record opened, with what changed since the one before it. */
|
|
@@ -16399,6 +16868,16 @@ var MIGRATIONS = [
|
|
|
16399
16868
|
PRIMARY KEY (dossier, id)
|
|
16400
16869
|
);
|
|
16401
16870
|
CREATE INDEX analyses_at ON analyses (dossier, at);
|
|
16871
|
+
`
|
|
16872
|
+
},
|
|
16873
|
+
{
|
|
16874
|
+
version: 5,
|
|
16875
|
+
description: "a stored response's digest, so a sync rewrites only what changed, when each source was last read whole, and when a dossier's data was last saved (#493)",
|
|
16876
|
+
sql: `
|
|
16877
|
+
ALTER TABLE responses ADD COLUMN digest TEXT;
|
|
16878
|
+
ALTER TABLE sources ADD COLUMN full_read_at TEXT;
|
|
16879
|
+
ALTER TABLE dossiers ADD COLUMN last_saved_at TEXT;
|
|
16880
|
+
UPDATE dossiers SET last_saved_at = last_sync_at;
|
|
16402
16881
|
`
|
|
16403
16882
|
}
|
|
16404
16883
|
];
|
|
@@ -16410,8 +16889,16 @@ var CacheError = class extends Error {
|
|
|
16410
16889
|
this.fix = fix;
|
|
16411
16890
|
}
|
|
16412
16891
|
};
|
|
16413
|
-
/**
|
|
16414
|
-
|
|
16892
|
+
/** The command whose `updatedSince` is a clock reading, not a question: the revision feed's start date moves with the day. */
|
|
16893
|
+
var FEED_COMMAND = "ado work-item feed";
|
|
16894
|
+
/**
|
|
16895
|
+
* One string per command and input, whatever order the input's keys came in.
|
|
16896
|
+
* For the revision feed alone, `updatedSince` is left out (it says when the
|
|
16897
|
+
* call was made, and the sync adds its own to a delta read without ever
|
|
16898
|
+
* recording it); on any other command it still tells one answer from another.
|
|
16899
|
+
*/
|
|
16900
|
+
function inputKey(input, command) {
|
|
16901
|
+
if (command === FEED_COMMAND) input = Object.fromEntries(Object.entries(input).filter(([k]) => k !== "updatedSince"));
|
|
16415
16902
|
const sort = (v) => Array.isArray(v) ? v.map(sort) : v && typeof v === "object" ? Object.fromEntries(Object.entries(v).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([k, x]) => [k, sort(x)])) : v;
|
|
16416
16903
|
return JSON.stringify(sort(input));
|
|
16417
16904
|
}
|
|
@@ -16427,6 +16914,17 @@ var WORKLOG_TABLES = [
|
|
|
16427
16914
|
];
|
|
16428
16915
|
/** How far before the last good sync a newly listed fact may be and still count as news: the clocks may disagree (#419). */
|
|
16429
16916
|
var NEWS_SKEW_MS = 3e5;
|
|
16917
|
+
/** What makes two envelopes the same answer: everything but how long the call took and the requests it made. */
|
|
16918
|
+
function digestOf(env) {
|
|
16919
|
+
return createHash("sha256").update(JSON.stringify([
|
|
16920
|
+
env.ok,
|
|
16921
|
+
env.data,
|
|
16922
|
+
env.error,
|
|
16923
|
+
env.meta.warnings ?? null,
|
|
16924
|
+
env.meta.context ?? null
|
|
16925
|
+
])).digest("hex");
|
|
16926
|
+
}
|
|
16927
|
+
var byId = (a, b) => a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
|
|
16430
16928
|
/** The tables kept per dossier that a sync never rewrites: the worklog's, and the analyses (#395). */
|
|
16431
16929
|
var KEPT_TABLES = [...WORKLOG_TABLES, "analyses"];
|
|
16432
16930
|
/** The one message every OS gives for a wipe while Toil UI runs. */
|
|
@@ -16610,7 +17108,7 @@ var Cache = class Cache {
|
|
|
16610
17108
|
}
|
|
16611
17109
|
/** The envelope a call got on its last good sync. */
|
|
16612
17110
|
response(dossier, command, input) {
|
|
16613
|
-
const row = this.db.prepare("SELECT envelope, area, synced_at FROM responses WHERE dossier = ? AND command = ? AND input_key = ?").get(dossier, command, inputKey(input));
|
|
17111
|
+
const row = this.db.prepare("SELECT envelope, area, synced_at FROM responses WHERE dossier = ? AND command = ? AND input_key = ?").get(dossier, command, inputKey(input, command));
|
|
16614
17112
|
return row ? {
|
|
16615
17113
|
envelope: JSON.parse(row.envelope),
|
|
16616
17114
|
area: row.area,
|
|
@@ -16626,6 +17124,14 @@ var Cache = class Cache {
|
|
|
16626
17124
|
syncedAt: row.synced_at
|
|
16627
17125
|
} : null;
|
|
16628
17126
|
}
|
|
17127
|
+
/** Every stored envelope for a command in a dossier, whatever its input. */
|
|
17128
|
+
all(dossier, command) {
|
|
17129
|
+
return this.db.prepare("SELECT envelope, area, synced_at FROM responses WHERE dossier = ? AND command = ? ORDER BY synced_at DESC").all(dossier, command).map((row) => ({
|
|
17130
|
+
envelope: JSON.parse(row.envelope),
|
|
17131
|
+
area: row.area,
|
|
17132
|
+
syncedAt: row.synced_at
|
|
17133
|
+
}));
|
|
17134
|
+
}
|
|
16629
17135
|
source(dossier, area) {
|
|
16630
17136
|
const row = this.db.prepare("SELECT * FROM sources WHERE dossier = ? AND area = ?").get(dossier, area);
|
|
16631
17137
|
return row ? sourceOf(row) : null;
|
|
@@ -16637,6 +17143,7 @@ var Cache = class Cache {
|
|
|
16637
17143
|
return dossiers.map((d) => ({
|
|
16638
17144
|
name: d.name,
|
|
16639
17145
|
lastSyncAt: d.last_sync_at,
|
|
17146
|
+
lastSavedAt: d.last_saved_at ?? null,
|
|
16640
17147
|
status: d.status,
|
|
16641
17148
|
error: d.error,
|
|
16642
17149
|
sources: sources.filter((s) => s.dossier === d.name).map(sourceOf)
|
|
@@ -16713,7 +17220,7 @@ var Cache = class Cache {
|
|
|
16713
17220
|
if (input.dossier === from) input.dossier = to;
|
|
16714
17221
|
const envelope = JSON.parse(r.envelope);
|
|
16715
17222
|
if (envelope.meta?.context?.dossier?.name === from) envelope.meta.context.dossier.name = to;
|
|
16716
|
-
moved += Number(move.run(to, inputKey(input), JSON.stringify(envelope), from, r.command, r.input_key).changes);
|
|
17223
|
+
moved += Number(move.run(to, inputKey(input, r.command), JSON.stringify(envelope), from, r.command, r.input_key).changes);
|
|
16717
17224
|
}
|
|
16718
17225
|
for (const table of [
|
|
16719
17226
|
"items",
|
|
@@ -16746,7 +17253,7 @@ var Cache = class Cache {
|
|
|
16746
17253
|
dossierNames() {
|
|
16747
17254
|
return this.db.prepare("SELECT name FROM dossiers UNION SELECT DISTINCT dossier FROM responses ORDER BY 1").all().map((r) => r.name);
|
|
16748
17255
|
}
|
|
16749
|
-
/** A dossier whose `dossiers show` failed: its last
|
|
17256
|
+
/** A dossier whose `dossiers show` failed: its last attempt and error, and nothing else touched. `last_saved_at` stays, so a failing sync keeps no data alive. */
|
|
16750
17257
|
saveFailure(dossier, at, error) {
|
|
16751
17258
|
this.db.prepare("INSERT INTO dossiers (name, last_sync_at, status, error) VALUES (?, ?, ?, ?) ON CONFLICT (name) DO UPDATE SET last_sync_at = excluded.last_sync_at, status = excluded.status, error = excluded.error").run(dossier, at, "failed", error);
|
|
16752
17259
|
}
|
|
@@ -16768,9 +17275,12 @@ var Cache = class Cache {
|
|
|
16768
17275
|
this.transaction(() => {
|
|
16769
17276
|
const previous = this.db.prepare("SELECT name FROM dossiers WHERE name = ?").get(save.dossier);
|
|
16770
17277
|
const lastGood = this.db.prepare("SELECT MAX(at) AS at FROM sync_runs WHERE dossier = ? AND ok = 1").get(save.dossier).at;
|
|
17278
|
+
const refresh = (/* @__PURE__ */ new Date(Date.parse(at) - this.retentionDays * DAY / 4)).toISOString();
|
|
17279
|
+
const itemRows = this.db.prepare("SELECT id, item FROM items WHERE dossier = ? ORDER BY id").all(save.dossier);
|
|
17280
|
+
const refRows = this.db.prepare("SELECT kind, id, ref FROM change_refs WHERE dossier = ?").all(save.dossier);
|
|
16771
17281
|
const before = previous ? {
|
|
16772
|
-
items:
|
|
16773
|
-
deployments:
|
|
17282
|
+
items: itemRows.map((r) => JSON.parse(r.item)),
|
|
17283
|
+
deployments: refRows.filter((c) => c.kind === "deployment").sort(byId).map((c) => JSON.parse(c.ref))
|
|
16774
17284
|
} : null;
|
|
16775
17285
|
const builds = this.db.prepare("SELECT event FROM worklog_events WHERE dossier = ? AND kind LIKE 'build-%'").all(save.dossier).map((r) => JSON.parse(r.event));
|
|
16776
17286
|
const facts = [...eventsFrom({
|
|
@@ -16782,35 +17292,95 @@ var Cache = class Cache {
|
|
|
16782
17292
|
}, at, lastGood)];
|
|
16783
17293
|
const fact = this.db.prepare(`INSERT INTO worklog_events (dossier, key, day, at, kind, event, synced_at) VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
16784
17294
|
ON CONFLICT (dossier, key) DO UPDATE SET day = excluded.day, at = excluded.at, kind = excluded.kind, event = excluded.event, synced_at = excluded.synced_at`);
|
|
16785
|
-
const known = new
|
|
17295
|
+
const known = new Map(this.db.prepare("SELECT key, event, synced_at FROM worklog_events WHERE dossier = ?").all(save.dossier).map((r) => [r.key, r]));
|
|
16786
17296
|
const since = lastGood ? Date.parse(lastGood) - NEWS_SKEW_MS : null;
|
|
16787
17297
|
news = previous && since !== null ? facts.filter((e) => !known.has(e.key) && (e.observed !== null || Date.parse(e.at) >= since)) : [];
|
|
16788
|
-
for (const e of facts)
|
|
17298
|
+
for (const e of facts) {
|
|
17299
|
+
const text = JSON.stringify(e);
|
|
17300
|
+
const old = known.get(e.key);
|
|
17301
|
+
if (old && old.event === text && old.synced_at >= refresh) continue;
|
|
17302
|
+
fact.run(save.dossier, e.key, dayOf(e.at), e.at, e.kind, text, at);
|
|
17303
|
+
}
|
|
16789
17304
|
const run = this.db.prepare("INSERT OR REPLACE INTO sync_runs (dossier, area, at, ok, error) VALUES (?, ?, ?, ?, ?)");
|
|
16790
17305
|
for (const s of save.sources) run.run(save.dossier, s.area, at, s.ok ? 1 : 0, s.error);
|
|
16791
|
-
const
|
|
16792
|
-
|
|
16793
|
-
const
|
|
16794
|
-
|
|
16795
|
-
|
|
16796
|
-
|
|
16797
|
-
|
|
16798
|
-
|
|
16799
|
-
|
|
17306
|
+
const stored = new Map(this.db.prepare("SELECT command, input_key, area, digest FROM responses WHERE dossier = ?").all(save.dossier).map((r) => [`${r.command}\n${r.input_key}`, r]));
|
|
17307
|
+
const okAreas = save.sources.filter((s) => s.ok).map((s) => s.area);
|
|
17308
|
+
const put = this.db.prepare("INSERT INTO responses (dossier, command, input_key, area, envelope, synced_at, digest) VALUES (?, ?, ?, ?, ?, ?, ?) ON CONFLICT (dossier, command, input_key) DO UPDATE SET area = excluded.area, envelope = excluded.envelope, synced_at = excluded.synced_at, digest = excluded.digest");
|
|
17309
|
+
const touch = this.db.prepare("UPDATE responses SET synced_at = ? WHERE dossier = ? AND command = ? AND input_key = ? AND synced_at < ?");
|
|
17310
|
+
const wanted = /* @__PURE__ */ new Set();
|
|
17311
|
+
for (const r of save.responses) {
|
|
17312
|
+
const key = inputKey(r.input, r.command);
|
|
17313
|
+
const id = `${r.command}\n${key}`;
|
|
17314
|
+
wanted.add(id);
|
|
17315
|
+
const old = stored.get(id);
|
|
17316
|
+
const digest = r.unchanged && old?.digest ? old.digest : digestOf(r.envelope);
|
|
17317
|
+
if (old && old.digest === digest) {
|
|
17318
|
+
if (!okAreas.includes(old.area)) touch.run(at, save.dossier, r.command, key, refresh);
|
|
17319
|
+
continue;
|
|
17320
|
+
}
|
|
17321
|
+
put.run(save.dossier, r.command, key, areaOf(r.command), JSON.stringify(r.envelope), at, digest);
|
|
17322
|
+
}
|
|
17323
|
+
const drop = this.db.prepare("DELETE FROM responses WHERE dossier = ? AND command = ? AND input_key = ?");
|
|
17324
|
+
for (const [id, r] of stored) if (!wanted.has(id) && okAreas.includes(r.area)) drop.run(save.dossier, id.slice(0, id.indexOf("\n")), id.slice(id.indexOf("\n") + 1));
|
|
17325
|
+
if (okAreas.length) this.db.prepare(`UPDATE responses SET synced_at = ? WHERE dossier = ? AND synced_at < ? AND area IN (${okAreas.map(() => "?").join(", ")})`).run(at, save.dossier, refresh, ...okAreas);
|
|
17326
|
+
const oldItems = new Map(itemRows.map((r) => [r.id, r.item]));
|
|
17327
|
+
const nowItems = new Map(save.items.map((i) => [i.id, i]));
|
|
16800
17328
|
const item = this.db.prepare("INSERT OR REPLACE INTO items (dossier, id, area, connection, native_key, type, status_category, updated, item, synced_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
|
17329
|
+
const dropTransitions = this.db.prepare("DELETE FROM transitions WHERE dossier = ? AND item_id = ?");
|
|
16801
17330
|
const transition = this.db.prepare("INSERT OR REPLACE INTO transitions (dossier, item_id, seq, from_status, to_status, from_category, to_category, at, by_name, synced_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
|
16802
|
-
for (const i of
|
|
16803
|
-
|
|
17331
|
+
for (const [id, i] of nowItems) {
|
|
17332
|
+
const text = JSON.stringify(i);
|
|
17333
|
+
if (oldItems.get(id) === text) continue;
|
|
17334
|
+
item.run(save.dossier, i.id, i.source.area, i.source.connection, i.source.key, i.type, i.statusCategory, i.updated, text, at);
|
|
17335
|
+
dropTransitions.run(save.dossier, id);
|
|
16804
17336
|
(i.history?.transitions ?? []).forEach((t, seq) => transition.run(save.dossier, i.id, seq, t.from, t.to, t.fromCategory, t.toCategory, t.at, t.by?.name ?? null, at));
|
|
16805
17337
|
}
|
|
17338
|
+
const dropItem = this.db.prepare("DELETE FROM items WHERE dossier = ? AND id = ?");
|
|
17339
|
+
for (const id of oldItems.keys()) if (!nowItems.has(id)) dropItem.run(save.dossier, id);
|
|
17340
|
+
this.db.prepare("DELETE FROM transitions WHERE dossier = ? AND item_id NOT IN (SELECT id FROM items WHERE dossier = ?)").run(save.dossier, save.dossier);
|
|
17341
|
+
const nowRefs = /* @__PURE__ */ new Map();
|
|
17342
|
+
for (const c of save.changes) nowRefs.set(`${c.kind}\n${c.id}`, {
|
|
17343
|
+
kind: c.kind,
|
|
17344
|
+
id: c.id,
|
|
17345
|
+
text: JSON.stringify(c),
|
|
17346
|
+
values: [
|
|
17347
|
+
c.source,
|
|
17348
|
+
c.command,
|
|
17349
|
+
c.state,
|
|
17350
|
+
c.outcome,
|
|
17351
|
+
c.at || null,
|
|
17352
|
+
JSON.stringify(c.items)
|
|
17353
|
+
]
|
|
17354
|
+
});
|
|
17355
|
+
for (const d of save.deployments) nowRefs.set(`deployment\n${d.id}`, {
|
|
17356
|
+
kind: "deployment",
|
|
17357
|
+
id: d.id,
|
|
17358
|
+
text: JSON.stringify(d),
|
|
17359
|
+
values: [
|
|
17360
|
+
d.source,
|
|
17361
|
+
d.command,
|
|
17362
|
+
d.state,
|
|
17363
|
+
d.outcome,
|
|
17364
|
+
null,
|
|
17365
|
+
JSON.stringify(d.items)
|
|
17366
|
+
]
|
|
17367
|
+
});
|
|
17368
|
+
const oldRefs = new Map(refRows.map((r) => [`${r.kind}\n${r.id}`, r.ref]));
|
|
16806
17369
|
const change = this.db.prepare("INSERT OR REPLACE INTO change_refs (dossier, id, kind, area, command, state, outcome, at, items, ref, synced_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
|
16807
|
-
for (const c of
|
|
16808
|
-
|
|
16809
|
-
const
|
|
17370
|
+
for (const [key, c] of nowRefs) if (oldRefs.get(key) !== c.text) change.run(save.dossier, c.id, c.kind, ...c.values, c.text, at);
|
|
17371
|
+
const dropRef = this.db.prepare("DELETE FROM change_refs WHERE dossier = ? AND kind = ? AND id = ?");
|
|
17372
|
+
for (const key of oldRefs.keys()) if (!nowRefs.has(key)) dropRef.run(save.dossier, key.slice(0, key.indexOf("\n")), key.slice(key.indexOf("\n") + 1));
|
|
17373
|
+
for (const table of [
|
|
17374
|
+
"items",
|
|
17375
|
+
"transitions",
|
|
17376
|
+
"change_refs"
|
|
17377
|
+
]) this.db.prepare(`UPDATE ${table} SET synced_at = ? WHERE dossier = ? AND synced_at < ?`).run(at, save.dossier, refresh);
|
|
17378
|
+
const source = this.db.prepare(`INSERT INTO sources (dossier, area, status, last_attempt_at, last_success_at, watermark, full_read_at, error, fix, calls) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
16810
17379
|
ON CONFLICT (dossier, area) DO UPDATE SET status = excluded.status, last_attempt_at = excluded.last_attempt_at,
|
|
16811
17380
|
last_success_at = COALESCE(excluded.last_success_at, sources.last_success_at), watermark = COALESCE(excluded.watermark, sources.watermark),
|
|
17381
|
+
full_read_at = COALESCE(excluded.full_read_at, sources.full_read_at),
|
|
16812
17382
|
error = excluded.error, fix = excluded.fix, calls = excluded.calls`);
|
|
16813
|
-
for (const s of save.sources) source.run(save.dossier, s.area, s.ok ? "ok" : "failed", at, s.ok ? at : null, s.ok ? s.watermark : null, s.error, s.fix, s.calls);
|
|
17383
|
+
for (const s of save.sources) source.run(save.dossier, s.area, s.ok ? "ok" : "failed", at, s.ok ? at : null, s.ok ? s.watermark : null, s.ok ? s.fullReadAt ?? null : null, s.error, s.fix, s.calls);
|
|
16814
17384
|
const areas = save.sources.map((s) => s.area);
|
|
16815
17385
|
for (const old of this.db.prepare("SELECT area FROM sources WHERE dossier = ?").all(save.dossier)) if (!areas.includes(old.area)) {
|
|
16816
17386
|
this.db.prepare("DELETE FROM sources WHERE dossier = ? AND area = ?").run(save.dossier, old.area);
|
|
@@ -16819,7 +17389,7 @@ var Cache = class Cache {
|
|
|
16819
17389
|
const failed = save.sources.filter((s) => !s.ok);
|
|
16820
17390
|
const status = failed.length === 0 ? "ok" : failed.length === save.sources.length ? "failed" : "partial";
|
|
16821
17391
|
const error = failed.length ? failed.map((s) => `${s.area}: ${s.error ?? "failed"}`).join(" ") : null;
|
|
16822
|
-
this.db.prepare("INSERT INTO dossiers (name, last_sync_at, status, error) VALUES (?, ?, ?, ?) ON CONFLICT (name) DO UPDATE SET last_sync_at = excluded.last_sync_at, status = excluded.status, error = excluded.error").run(save.dossier, at, status, error);
|
|
17392
|
+
this.db.prepare("INSERT INTO dossiers (name, last_sync_at, last_saved_at, status, error) VALUES (?, ?, ?, ?, ?) ON CONFLICT (name) DO UPDATE SET last_sync_at = excluded.last_sync_at, last_saved_at = excluded.last_saved_at, status = excluded.status, error = excluded.error").run(save.dossier, at, at, status, error);
|
|
16823
17393
|
});
|
|
16824
17394
|
this.prune();
|
|
16825
17395
|
return news;
|
|
@@ -16865,21 +17435,40 @@ var Cache = class Cache {
|
|
|
16865
17435
|
analyses(dossier) {
|
|
16866
17436
|
return this.db.prepare("SELECT record FROM analyses WHERE dossier = ? ORDER BY at, id").all(dossier).map((r) => JSON.parse(r.record));
|
|
16867
17437
|
}
|
|
16868
|
-
/**
|
|
17438
|
+
/**
|
|
17439
|
+
* Deletes what is older than the retention period. Returns how many went.
|
|
17440
|
+
* Everything a sync writes goes per dossier, together, by one date: `dossiers.last_saved_at`, the last time a sync
|
|
17441
|
+
* saved data (a failed `dossiers show` moves `last_sync_at`, the last attempt, and leaves this alone, so a failing sync
|
|
17442
|
+
* keeps nothing alive). A dossier is kept while last_saved_at >= now - retention. A dossier that is not kept loses its
|
|
17443
|
+
* responses, items, transitions, change refs, worklog facts and sources, and then its row, in this one transaction, so
|
|
17444
|
+
* a dossier is never half there. (One that only ever failed has no last_saved_at; its row goes by last_sync_at.) The
|
|
17445
|
+
* rows' own synced_at values differ by up to a quarter of the period (saveDossier refreshes only the unchanged rows it
|
|
17446
|
+
* finds old), so they can't decide on their own. The rest goes by its own date.
|
|
17447
|
+
*
|
|
17448
|
+
* Worklog facts also go by their own date, 1.25 x retention. saveDossier only upserts a fact, so one that no sync produces
|
|
17449
|
+
* any more (its item left the sync) would otherwise live as long as the dossier keeps saving. A fact a sync still
|
|
17450
|
+
* produces is refreshed at a save whenever it is more than retention/4 old. While the dossier is kept its last save was
|
|
17451
|
+
* at or after now - retention, and at that save the fact's synced_at became at least save - retention/4, so it is at or
|
|
17452
|
+
* after now - 1.25 x retention and this rule never touches it. A fact nothing produces goes about 1.25 x retention after
|
|
17453
|
+
* it was last seen. Once saves stop, the whole dossier goes at retention, before this rule matters.
|
|
17454
|
+
*/
|
|
16869
17455
|
prune() {
|
|
16870
17456
|
const cutoff = (/* @__PURE__ */ new Date(this.now().getTime() - this.retentionDays * DAY)).toISOString();
|
|
16871
17457
|
let removed = 0;
|
|
16872
17458
|
this.transaction(() => {
|
|
17459
|
+
const kept = "SELECT name FROM dossiers WHERE last_saved_at >= ?";
|
|
16873
17460
|
for (const table of [
|
|
16874
17461
|
"responses",
|
|
16875
17462
|
"items",
|
|
16876
17463
|
"transitions",
|
|
16877
|
-
"change_refs"
|
|
16878
|
-
|
|
16879
|
-
|
|
16880
|
-
removed += Number(this.db.prepare(
|
|
17464
|
+
"change_refs",
|
|
17465
|
+
"worklog_events",
|
|
17466
|
+
"sources"
|
|
17467
|
+
]) removed += Number(this.db.prepare(`DELETE FROM ${table} WHERE dossier NOT IN (${kept})`).run(cutoff).changes);
|
|
17468
|
+
const stale = (/* @__PURE__ */ new Date(this.now().getTime() - this.retentionDays * 1.25 * DAY)).toISOString();
|
|
17469
|
+
removed += Number(this.db.prepare("DELETE FROM worklog_events WHERE synced_at < ?").run(stale).changes);
|
|
17470
|
+
removed += Number(this.db.prepare("DELETE FROM dossiers WHERE last_saved_at < ? OR (last_saved_at IS NULL AND last_sync_at < ?)").run(cutoff, cutoff).changes);
|
|
16881
17471
|
if (this.db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'usage'").get()) removed += Number(this.db.prepare("DELETE FROM usage WHERE at < ?").run(cutoff).changes);
|
|
16882
|
-
removed += Number(this.db.prepare("DELETE FROM worklog_events WHERE synced_at < ?").run(cutoff).changes);
|
|
16883
17472
|
removed += Number(this.db.prepare("DELETE FROM sync_runs WHERE at < ?").run(cutoff).changes);
|
|
16884
17473
|
removed += Number(this.db.prepare("DELETE FROM agent_runs WHERE started_at < ?").run(cutoff).changes);
|
|
16885
17474
|
removed += Number(this.db.prepare("DELETE FROM notes WHERE at < ?").run(cutoff).changes);
|
|
@@ -16946,6 +17535,7 @@ function sourceOf(r) {
|
|
|
16946
17535
|
lastAttemptAt: r.last_attempt_at,
|
|
16947
17536
|
lastSuccessAt: r.last_success_at,
|
|
16948
17537
|
watermark: r.watermark,
|
|
17538
|
+
fullReadAt: r.full_read_at ?? null,
|
|
16949
17539
|
error: r.error,
|
|
16950
17540
|
fix: r.fix,
|
|
16951
17541
|
calls: Number(r.calls),
|
|
@@ -17058,8 +17648,8 @@ function memoryAnalyses(seed = []) {
|
|
|
17058
17648
|
* page only reads: nothing it sends can write a record. Minutes taken by
|
|
17059
17649
|
* the clerk, never by the people being minuted.
|
|
17060
17650
|
*/
|
|
17061
|
-
/** An answer that is whole: not a partial still streaming, and with something in it. */
|
|
17062
|
-
var isWhole = (a) => !!a && !a.activity && a.parts.length > 0;
|
|
17651
|
+
/** An answer that is whole: not a partial still streaming, and with something in it, prose or a briefing (#494). */
|
|
17652
|
+
var isWhole = (a) => !!a && !a.activity && (a.parts.length > 0 || Boolean(a.briefing));
|
|
17063
17653
|
/** The cache's history: what a real Toil UI keeps. `cache` is a getter, since a wipe swaps the file underneath. */
|
|
17064
17654
|
function cacheAnalyses(cache, now = () => (/* @__PURE__ */ new Date()).toISOString()) {
|
|
17065
17655
|
return {
|
|
@@ -17237,23 +17827,18 @@ var recs = (v) => Array.isArray(v) ? v.filter(isRec) : [];
|
|
|
17237
17827
|
var SEARCHES = {
|
|
17238
17828
|
"jira issue search": {
|
|
17239
17829
|
list: "issues",
|
|
17240
|
-
id: (r) => String(r.key)
|
|
17241
|
-
|
|
17242
|
-
"jira-cloud issue search": {
|
|
17243
|
-
list: "issues",
|
|
17244
|
-
id: (r) => String(r.key)
|
|
17830
|
+
id: (r) => String(r.key),
|
|
17831
|
+
reconcile: true
|
|
17245
17832
|
},
|
|
17246
17833
|
"ado work-item search": {
|
|
17247
17834
|
list: "workItems",
|
|
17248
|
-
id: (r) => String(r.id)
|
|
17249
|
-
|
|
17250
|
-
"ado-cloud work-item search": {
|
|
17251
|
-
list: "workItems",
|
|
17252
|
-
id: (r) => String(r.id)
|
|
17835
|
+
id: (r) => String(r.id),
|
|
17836
|
+
reconcile: true
|
|
17253
17837
|
},
|
|
17254
17838
|
"github issue list": {
|
|
17255
17839
|
list: null,
|
|
17256
|
-
id: (r) => String(r.number)
|
|
17840
|
+
id: (r) => String(r.number),
|
|
17841
|
+
reconcile: false
|
|
17257
17842
|
}
|
|
17258
17843
|
};
|
|
17259
17844
|
/** A batch get by ids: the input field holding them, and where the answer lists the items. */
|
|
@@ -17263,11 +17848,6 @@ var BATCHES = {
|
|
|
17263
17848
|
list: "value",
|
|
17264
17849
|
id: (r) => String(r.id)
|
|
17265
17850
|
},
|
|
17266
|
-
"ado-cloud work-item get-many": {
|
|
17267
|
-
field: "id",
|
|
17268
|
-
list: "value",
|
|
17269
|
-
id: (r) => String(r.id)
|
|
17270
|
-
},
|
|
17271
17851
|
"github issue get": {
|
|
17272
17852
|
field: "number",
|
|
17273
17853
|
list: "issues",
|
|
@@ -17277,29 +17857,26 @@ var BATCHES = {
|
|
|
17277
17857
|
/** One item's history: the input field naming the item. */
|
|
17278
17858
|
var HISTORIES = {
|
|
17279
17859
|
"jira issue history": "key",
|
|
17280
|
-
"jira-cloud issue history": "key",
|
|
17281
17860
|
"ado work-item history": "id",
|
|
17282
|
-
"ado-cloud work-item history": "id",
|
|
17283
17861
|
"github issue history": "number"
|
|
17284
17862
|
};
|
|
17285
17863
|
var BOARD = "github project items";
|
|
17864
|
+
/** Azure DevOps' feed of every revision since a date, which stands in for each item's history (src/ado-revisions.ts). */
|
|
17865
|
+
var ADO_FEED = "ado work-item feed";
|
|
17866
|
+
var ADO_SEARCH = "ado work-item search";
|
|
17286
17867
|
/** Commands whose NOT_FOUND says the thing isn't there, which is worth knowing: the loader looks for CODEOWNERS where GitHub would. */
|
|
17287
17868
|
var ABSENT_IS_AN_ANSWER = /* @__PURE__ */ new Set(["github repo file"]);
|
|
17288
17869
|
/** Each host's pull request list, which `updatedSince` narrows, and how a pull request in it is named. */
|
|
17289
17870
|
var PR_LISTS = {
|
|
17290
17871
|
"github pr list": (r) => String(r.number),
|
|
17291
17872
|
"bitbucket pr list": (r) => String(r.id),
|
|
17292
|
-
"
|
|
17293
|
-
"ado pr list": (r) => String(r.pullRequestId),
|
|
17294
|
-
"ado-cloud pr list": (r) => String(r.pullRequestId)
|
|
17873
|
+
"ado pr list": (r) => String(r.pullRequestId)
|
|
17295
17874
|
};
|
|
17296
17875
|
/** Each host's pull request get, and the input field naming the pull request. */
|
|
17297
17876
|
var PR_GETS = {
|
|
17298
17877
|
"github pr get": "number",
|
|
17299
17878
|
"bitbucket pr get": "id",
|
|
17300
|
-
"
|
|
17301
|
-
"ado pr get": "id",
|
|
17302
|
-
"ado-cloud pr get": "id"
|
|
17879
|
+
"ado pr get": "id"
|
|
17303
17880
|
};
|
|
17304
17881
|
/** A pull request record that is merged, declined or abandoned, by whichever host's words it uses. */
|
|
17305
17882
|
var closedPr = (data) => isRec(data) && (data.state === "closed" || [
|
|
@@ -17307,6 +17884,17 @@ var closedPr = (data) => isRec(data) && (data.state === "closed" || [
|
|
|
17307
17884
|
"DECLINED",
|
|
17308
17885
|
"SUPERSEDED"
|
|
17309
17886
|
].includes(String(data.state)) || data.status === "completed" || data.status === "abandoned");
|
|
17887
|
+
/** Envelopes the sync handed back as the last copy, untouched: the cache needn't compare them with what it holds. */
|
|
17888
|
+
var reusedEnvelopes = /* @__PURE__ */ new WeakSet();
|
|
17889
|
+
var reuse = (env) => (reusedEnvelopes.add(env), env);
|
|
17890
|
+
/** The same search asking for ids only, where the command can: a listing to reconcile with, not to read. */
|
|
17891
|
+
var idsOnly = (command, input) => {
|
|
17892
|
+
if (!command.endsWith("issue search")) return input;
|
|
17893
|
+
return {
|
|
17894
|
+
...Object.fromEntries(Object.entries(input).filter(([k]) => k !== "changelog")),
|
|
17895
|
+
fields: "key"
|
|
17896
|
+
};
|
|
17897
|
+
};
|
|
17310
17898
|
/** Two pages of one listing as one answer: lists concatenated, the rest from the newer page. */
|
|
17311
17899
|
function joinPages(a, b) {
|
|
17312
17900
|
if (Array.isArray(a) && Array.isArray(b)) return [...a, ...b];
|
|
@@ -17335,6 +17923,7 @@ var SyncService = class {
|
|
|
17335
17923
|
now;
|
|
17336
17924
|
maxPages;
|
|
17337
17925
|
onFinished;
|
|
17926
|
+
onForget;
|
|
17338
17927
|
job = idle();
|
|
17339
17928
|
current = null;
|
|
17340
17929
|
controller = null;
|
|
@@ -17345,6 +17934,7 @@ var SyncService = class {
|
|
|
17345
17934
|
this.now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
17346
17935
|
this.maxPages = options.maxPages ?? 200;
|
|
17347
17936
|
this.onFinished = options.onFinished;
|
|
17937
|
+
this.onForget = options.onForget;
|
|
17348
17938
|
}
|
|
17349
17939
|
status() {
|
|
17350
17940
|
return {
|
|
@@ -17412,7 +18002,14 @@ var SyncService = class {
|
|
|
17412
18002
|
const names = recs(list.data.dossiers).filter((d) => d.shadowedBy === null || d.shadowedBy === void 0).map((d) => String(d.name));
|
|
17413
18003
|
if (only !== void 0 && !names.includes(only)) throw new Error(`toil has no dossier named ${JSON.stringify(only)}. Run toil dossiers list to see them.`);
|
|
17414
18004
|
if (only === void 0) {
|
|
17415
|
-
for (const old of this.cache.dossierNames()) if (!names.includes(old))
|
|
18005
|
+
for (const old of this.cache.dossierNames()) if (!names.includes(old)) {
|
|
18006
|
+
this.cache.forget(old);
|
|
18007
|
+
try {
|
|
18008
|
+
this.onForget?.(old);
|
|
18009
|
+
} catch (e) {
|
|
18010
|
+
this.say(`${old}: couldn't forget its other records: ${e instanceof Error ? e.message : String(e)}`);
|
|
18011
|
+
}
|
|
18012
|
+
}
|
|
17416
18013
|
}
|
|
17417
18014
|
const targets = only === void 0 ? names : [only];
|
|
17418
18015
|
job.dossiersTotal = targets.length;
|
|
@@ -17502,7 +18099,11 @@ var SyncService = class {
|
|
|
17502
18099
|
const syncing = (command, input = {}) => this.answer(run, command, input, signal);
|
|
17503
18100
|
let loaded;
|
|
17504
18101
|
try {
|
|
17505
|
-
loaded = await loadDossier(syncing, name, {
|
|
18102
|
+
loaded = await loadDossier(syncing, name, {
|
|
18103
|
+
mapOwi: this.mapOwi,
|
|
18104
|
+
windowDays: windowFor(this.cache.retentionDays),
|
|
18105
|
+
now: this.now
|
|
18106
|
+
});
|
|
17506
18107
|
} catch (e) {
|
|
17507
18108
|
const message = e instanceof Error ? e.message : String(e);
|
|
17508
18109
|
this.cache.saveFailure(name, this.now().toISOString(), message);
|
|
@@ -17515,6 +18116,7 @@ var SyncService = class {
|
|
|
17515
18116
|
error: s.error?.message ?? null,
|
|
17516
18117
|
fix: s.error?.fix ?? null,
|
|
17517
18118
|
watermark: s.error === null ? (/* @__PURE__ */ new Date(Date.parse(run.startedAt) - SKEW_MS)).toISOString() : null,
|
|
18119
|
+
fullReadAt: s.error === null && s.searches > 0 && s.fullSearches === s.searches ? run.startedAt : null,
|
|
17518
18120
|
calls: s.calls
|
|
17519
18121
|
}));
|
|
17520
18122
|
const news = this.cache.saveDossier({
|
|
@@ -17542,7 +18144,9 @@ var SyncService = class {
|
|
|
17542
18144
|
calls: 0,
|
|
17543
18145
|
error: null,
|
|
17544
18146
|
changed: null,
|
|
17545
|
-
changedPrs: null
|
|
18147
|
+
changedPrs: null,
|
|
18148
|
+
searches: 0,
|
|
18149
|
+
fullSearches: 0
|
|
17546
18150
|
};
|
|
17547
18151
|
run.sources.set(area, s);
|
|
17548
18152
|
}
|
|
@@ -17562,7 +18166,8 @@ var SyncService = class {
|
|
|
17562
18166
|
run.responses.push({
|
|
17563
18167
|
command,
|
|
17564
18168
|
input,
|
|
17565
|
-
envelope: env
|
|
18169
|
+
envelope: env,
|
|
18170
|
+
...reusedEnvelopes.has(env) ? { unchanged: true } : {}
|
|
17566
18171
|
});
|
|
17567
18172
|
return env;
|
|
17568
18173
|
}
|
|
@@ -17576,11 +18181,17 @@ var SyncService = class {
|
|
|
17576
18181
|
}
|
|
17577
18182
|
async fetch(run, source, command, input, signal) {
|
|
17578
18183
|
const { dossier } = run;
|
|
17579
|
-
const
|
|
18184
|
+
const state = this.cache.source(dossier, source.area);
|
|
18185
|
+
const watermark = state?.watermark ?? null;
|
|
17580
18186
|
const search = SEARCHES[command];
|
|
17581
18187
|
if (search) {
|
|
18188
|
+
source.searches++;
|
|
17582
18189
|
const last = this.cache.response(dossier, command, input);
|
|
17583
|
-
if (!watermark || !last?.envelope.ok)
|
|
18190
|
+
if (!watermark || !last?.envelope.ok) {
|
|
18191
|
+
const whole = await this.call(command, input, signal);
|
|
18192
|
+
if (whole.ok) source.fullSearches++;
|
|
18193
|
+
return whole;
|
|
18194
|
+
}
|
|
17584
18195
|
const delta = await this.call(command, {
|
|
17585
18196
|
...input,
|
|
17586
18197
|
updatedSince: watermark
|
|
@@ -17590,7 +18201,21 @@ var SyncService = class {
|
|
|
17590
18201
|
const fresh = listOf(delta.data);
|
|
17591
18202
|
source.changed = /* @__PURE__ */ new Set([...source.changed ?? [], ...fresh.map(search.id)]);
|
|
17592
18203
|
this.say(`${dossier}: ${command} since ${watermark}: ${fresh.length} changed`);
|
|
17593
|
-
|
|
18204
|
+
let merged = mergeById(listOf(last.envelope.data), fresh, search.id);
|
|
18205
|
+
let removed = 0;
|
|
18206
|
+
const fullReadAt = state?.fullReadAt ?? null;
|
|
18207
|
+
if (search.reconcile && (fullReadAt === null || Date.parse(run.startedAt) - Date.parse(fullReadAt) >= 864e5)) {
|
|
18208
|
+
const whole = await this.call(command, idsOnly(command, input), signal);
|
|
18209
|
+
if (whole.ok) {
|
|
18210
|
+
const present = new Set(listOf(whole.data).map(search.id));
|
|
18211
|
+
const kept = merged.filter((r) => present.has(search.id(r)));
|
|
18212
|
+
removed = merged.length - kept.length;
|
|
18213
|
+
merged = kept;
|
|
18214
|
+
source.fullSearches++;
|
|
18215
|
+
if (removed) this.say(`${dossier}: ${command} listed whole: ${removed} no longer there`);
|
|
18216
|
+
} else this.say(`${dossier}: ${command} listed whole failed, ${whole.error.message}; keeping the changes since ${watermark}, trying again next sync`);
|
|
18217
|
+
}
|
|
18218
|
+
if (!fresh.length && !removed) return reuse(last.envelope);
|
|
17594
18219
|
if (search.list === null) return {
|
|
17595
18220
|
...delta,
|
|
17596
18221
|
data: merged
|
|
@@ -17606,6 +18231,33 @@ var SyncService = class {
|
|
|
17606
18231
|
data
|
|
17607
18232
|
};
|
|
17608
18233
|
}
|
|
18234
|
+
if (command === ADO_FEED) {
|
|
18235
|
+
const last = this.cache.response(dossier, command, input);
|
|
18236
|
+
if (!watermark || !last?.envelope.ok || !Array.isArray(last.envelope.data)) return this.call(command, input, signal);
|
|
18237
|
+
const fullReadAt = state?.fullReadAt ?? null;
|
|
18238
|
+
if (fullReadAt === null || Date.parse(run.startedAt) - Date.parse(fullReadAt) >= 864e5) {
|
|
18239
|
+
const whole = await this.call(command, input, signal);
|
|
18240
|
+
if (whole.ok && Array.isArray(whole.data)) {
|
|
18241
|
+
this.say(`${dossier}: ${command} read whole: ${whole.data.length} revisions`);
|
|
18242
|
+
return whole;
|
|
18243
|
+
}
|
|
18244
|
+
this.say(`${dossier}: ${command} read whole failed${whole.ok ? "" : `, ${whole.error.message}`}; keeping the changes since ${watermark}, trying again next sync`);
|
|
18245
|
+
}
|
|
18246
|
+
const delta = await this.call(command, {
|
|
18247
|
+
...input,
|
|
18248
|
+
updatedSince: watermark
|
|
18249
|
+
}, signal);
|
|
18250
|
+
if (!delta.ok || !Array.isArray(delta.data)) return delta;
|
|
18251
|
+
this.say(`${dossier}: ${command} since ${watermark}: ${delta.data.length} revisions`);
|
|
18252
|
+
const search = run.responses.find((r) => r.command === ADO_SEARCH && r.envelope.ok);
|
|
18253
|
+
const keep = search ? new Set(recs(search.envelope.data.workItems).map((w) => Number(w.id))) : void 0;
|
|
18254
|
+
const merged = mergeFeed(recs(last.envelope.data), recs(delta.data), keep);
|
|
18255
|
+
if (!delta.data.length && merged.length === last.envelope.data.length) return reuse(last.envelope);
|
|
18256
|
+
return {
|
|
18257
|
+
...delta,
|
|
18258
|
+
data: merged
|
|
18259
|
+
};
|
|
18260
|
+
}
|
|
17609
18261
|
const prId = PR_LISTS[command];
|
|
17610
18262
|
if (prId) {
|
|
17611
18263
|
const last = this.cache.response(dossier, command, input);
|
|
@@ -17628,7 +18280,7 @@ var SyncService = class {
|
|
|
17628
18280
|
const last = this.cache.response(dossier, command, input);
|
|
17629
18281
|
if (last?.envelope.ok && closedPr(last.envelope.data)) {
|
|
17630
18282
|
this.job.reused++;
|
|
17631
|
-
return last.envelope;
|
|
18283
|
+
return reuse(last.envelope);
|
|
17632
18284
|
}
|
|
17633
18285
|
}
|
|
17634
18286
|
if (command === BOARD) {
|
|
@@ -17646,13 +18298,17 @@ var SyncService = class {
|
|
|
17646
18298
|
const batch = BATCHES[command];
|
|
17647
18299
|
if (batch && Array.isArray(input[batch.field]) && input[batch.field].length > 1) {
|
|
17648
18300
|
const wanted = input[batch.field].map(String);
|
|
17649
|
-
const
|
|
18301
|
+
const stored = this.cache.all(dossier, command).filter((r) => r.envelope.ok);
|
|
18302
|
+
const last = stored[0];
|
|
17650
18303
|
const changed = source.changed;
|
|
17651
|
-
if (changed === null || !last
|
|
17652
|
-
const cached = new Map(
|
|
18304
|
+
if (changed === null || !last) return this.call(command, input, signal);
|
|
18305
|
+
const cached = /* @__PURE__ */ new Map();
|
|
18306
|
+
for (const row of stored) for (const r of recs(row.envelope.data[batch.list])) if (!cached.has(batch.id(r))) cached.set(batch.id(r), r);
|
|
17653
18307
|
const toFetch = wanted.filter((id) => changed.has(id) || !cached.has(id));
|
|
17654
18308
|
if (!toFetch.length) {
|
|
17655
18309
|
this.job.reused++;
|
|
18310
|
+
const all = recs(last.envelope.data[batch.list]);
|
|
18311
|
+
if (stored.length === 1 && all.length === wanted.length && all.every((r, n) => batch.id(r) === wanted[n])) return reuse(last.envelope);
|
|
17656
18312
|
return {
|
|
17657
18313
|
...last.envelope,
|
|
17658
18314
|
data: {
|
|
@@ -17686,7 +18342,7 @@ var SyncService = class {
|
|
|
17686
18342
|
const last = this.cache.response(dossier, command, input);
|
|
17687
18343
|
if (last?.envelope.ok) {
|
|
17688
18344
|
this.job.reused++;
|
|
17689
|
-
return last.envelope;
|
|
18345
|
+
return reuse(last.envelope);
|
|
17690
18346
|
}
|
|
17691
18347
|
}
|
|
17692
18348
|
return this.call(command, input, signal);
|
|
@@ -17747,7 +18403,7 @@ function publishProposals(dossier, what, path, areas) {
|
|
|
17747
18403
|
const out = [];
|
|
17748
18404
|
const reason = `The ${thing} exported to ${path}, as it stands. Check it reads as you want before it's posted: it is the cache's record, facts only.`;
|
|
17749
18405
|
const space = areas.confluence?.inputs.space;
|
|
17750
|
-
if (space) out.push({
|
|
18406
|
+
if (space && areas.confluence?.connection?.deployment !== "cloud") out.push({
|
|
17751
18407
|
id: `${thing}:${dossier}:${span}:confluence`,
|
|
17752
18408
|
from: "worklog",
|
|
17753
18409
|
item: `${dossier}:${span}`,
|
|
@@ -18634,11 +19290,17 @@ DIRECTIVES.filter((d) => !d.startsWith("frame-ancestors")).join("; ");
|
|
|
18634
19290
|
*
|
|
18635
19291
|
* - **The launch token.** Each start makes a random token and prints one URL
|
|
18636
19292
|
* that carries it, as Jupyter does. The page trades it (`POST api/session`)
|
|
18637
|
-
* for a session id
|
|
18638
|
-
*
|
|
18639
|
-
*
|
|
18640
|
-
*
|
|
18641
|
-
*
|
|
19293
|
+
* for a session id and sends it as `X-Toil-UI-Session` on every API call; the
|
|
19294
|
+
* API answers nothing without one. No cookie is ever set: browsers send
|
|
19295
|
+
* cookies to every port on a host, so one would reach any other server on
|
|
19296
|
+
* 127.0.0.1. The page keeps the id in `sessionStorage` instead (#485), which
|
|
19297
|
+
* is scoped to this exact origin and never sent by the browser, so a reload
|
|
19298
|
+
* resumes through `GET api/session`; a new tab takes the launch URL again
|
|
19299
|
+
* (a duplicated or browser-restored tab can carry the id), and a restart of
|
|
19300
|
+
* this server (sessions are in memory) always ends it. The token stays: it
|
|
19301
|
+
* is what keeps other local processes and users out of an API that runs toil
|
|
19302
|
+
* with the person's connections. The static files hold no data and need no
|
|
19303
|
+
* session.
|
|
18642
19304
|
* - **The Host header.** Only the exact `127.0.0.1:<port>` (or `[::1]:<port>`)
|
|
18643
19305
|
* the server printed is answered, so a page using DNS rebinding to reach the
|
|
18644
19306
|
* port is refused before anything else is read.
|
|
@@ -18710,6 +19372,30 @@ function kept(keeper, dossier, startedAt) {
|
|
|
18710
19372
|
stream
|
|
18711
19373
|
};
|
|
18712
19374
|
}
|
|
19375
|
+
/**
|
|
19376
|
+
* Remembers the adapter for a dossier (#494) once its Analyze answer is whole, and only then: a stopped
|
|
19377
|
+
* or failed run says nothing about what the person prefers. A memory that can't be written never fails the answer.
|
|
19378
|
+
*/
|
|
19379
|
+
function rememberer(store, dossier, adapter) {
|
|
19380
|
+
const one = (answer) => {
|
|
19381
|
+
if (!isWhole(answer)) return;
|
|
19382
|
+
try {
|
|
19383
|
+
store.set(dossier, adapter);
|
|
19384
|
+
} catch {}
|
|
19385
|
+
};
|
|
19386
|
+
async function* stream(answers, signal) {
|
|
19387
|
+
let last;
|
|
19388
|
+
for await (const a of answers) {
|
|
19389
|
+
last = a;
|
|
19390
|
+
yield a;
|
|
19391
|
+
}
|
|
19392
|
+
if (!signal.aborted && last) one(last);
|
|
19393
|
+
}
|
|
19394
|
+
return {
|
|
19395
|
+
one,
|
|
19396
|
+
stream
|
|
19397
|
+
};
|
|
19398
|
+
}
|
|
18713
19399
|
/** The session id the page got for the launch token, on every API call. Never a cookie. */
|
|
18714
19400
|
var SESSION_HEADER = "x-toil-ui-session";
|
|
18715
19401
|
var TYPES = {
|
|
@@ -19026,7 +19712,7 @@ function createUiServer(options) {
|
|
|
19026
19712
|
const csrf = req.headers[CSRF_HEADER];
|
|
19027
19713
|
if (typeof csrf !== "string" || !same(csrf, session.csrf)) throw new HttpError(403, "The request didn't carry this session's CSRF token.", `Send the csrf value ${base}api/session gave in the ${CSRF_HEADER} header.`);
|
|
19028
19714
|
};
|
|
19029
|
-
/** `POST api/session`: the launch token for a new session id, which the page keeps in
|
|
19715
|
+
/** `POST api/session`: the launch token for a new session id, which the page keeps in its tab's `sessionStorage` (#485). */
|
|
19030
19716
|
const signIn = async (req, res) => {
|
|
19031
19717
|
checkOrigin(req);
|
|
19032
19718
|
const body = await readJson(req);
|
|
@@ -19123,7 +19809,7 @@ function createUiServer(options) {
|
|
|
19123
19809
|
if (key === "POST session") return signIn(req, res);
|
|
19124
19810
|
if (key === "POST agent/mcp") return mcpCall(req, res, ctx);
|
|
19125
19811
|
const signedIn = sessionOf(req);
|
|
19126
|
-
if (!signedIn) throw new HttpError(401, `The API answers only a page signed in to this launch, with its session id in ${SESSION_HEADER}.`, "Open the URL toil-ui printed when it started; a
|
|
19812
|
+
if (!signedIn) throw new HttpError(401, `The API answers only a page signed in to this launch, with its session id in ${SESSION_HEADER}.`, "Open the URL toil-ui printed when it started; a tab keeps its session across a reload, but not across a restart of toil-ui.");
|
|
19127
19813
|
if (req.method === "POST") {
|
|
19128
19814
|
checkOrigin(req);
|
|
19129
19815
|
checkCsrf(req, signedIn.session);
|
|
@@ -19160,12 +19846,15 @@ function createUiServer(options) {
|
|
|
19160
19846
|
const chat = chatOf(body.chat);
|
|
19161
19847
|
const extra = extraOf(body);
|
|
19162
19848
|
const keep = body.prompt === "analyze" && options.analyses ? kept(options.analyses, body.dossier, (/* @__PURE__ */ new Date()).toISOString()) : null;
|
|
19849
|
+
const remember = body.prompt === "analyze" && extra.adapter && options.dossierAgents ? rememberer(options.dossierAgents, body.dossier, extra.adapter) : null;
|
|
19163
19850
|
if (body.stream === true && agent.stream) {
|
|
19164
19851
|
const answers = agent.stream(ctx, body.dossier, body.prompt, style, chat, extra);
|
|
19165
|
-
|
|
19852
|
+
const remembered = remember ? remember.stream(answers, ctx.signal) : answers;
|
|
19853
|
+
return streamAnswer(res, keep ? keep.stream(remembered, ctx.signal) : remembered);
|
|
19166
19854
|
}
|
|
19167
19855
|
try {
|
|
19168
19856
|
const answer = await agent.ask(ctx, body.dossier, body.prompt, style, chat, extra);
|
|
19857
|
+
if (remember && !ctx.signal.aborted) remember.one(answer);
|
|
19169
19858
|
json(res, 200, keep && !ctx.signal.aborted ? await keep.one(answer) : answer);
|
|
19170
19859
|
} catch (e) {
|
|
19171
19860
|
json(res, 502, { error: agentFailure(e) });
|
|
@@ -19225,10 +19914,18 @@ function createUiServer(options) {
|
|
|
19225
19914
|
json(res, 200, control().status());
|
|
19226
19915
|
return;
|
|
19227
19916
|
case "GET agent/adapters":
|
|
19228
|
-
|
|
19229
|
-
|
|
19230
|
-
|
|
19231
|
-
|
|
19917
|
+
{
|
|
19918
|
+
const list = agent.adapterOptions?.() ?? {
|
|
19919
|
+
chosen: null,
|
|
19920
|
+
options: []
|
|
19921
|
+
};
|
|
19922
|
+
const dossier = url.searchParams.get("dossier");
|
|
19923
|
+
const remembered = dossier && options.dossierAgents ? options.dossierAgents.get(dossier) : null;
|
|
19924
|
+
json(res, 200, remembered ? {
|
|
19925
|
+
...list,
|
|
19926
|
+
remembered
|
|
19927
|
+
} : list);
|
|
19928
|
+
}
|
|
19232
19929
|
return;
|
|
19233
19930
|
case "GET agent/install":
|
|
19234
19931
|
json(res, 200, control().installPlan(installAdapter(url.searchParams.get("adapter"))));
|
|
@@ -19421,6 +20118,89 @@ function createUiServer(options) {
|
|
|
19421
20118
|
}
|
|
19422
20119
|
};
|
|
19423
20120
|
}
|
|
20121
|
+
//#endregion
|
|
20122
|
+
//#region server/agents/dossier-agents.ts
|
|
20123
|
+
/**
|
|
20124
|
+
* The agent last used for each dossier's Analyze (#494). Toil UI's own state,
|
|
20125
|
+
* so it lives in its data folder (`~/.toil-ui/dossier-agents.json`) beside the
|
|
20126
|
+
* global default in `agent.json`, never in toil's dossier file and never in
|
|
20127
|
+
* the browser: a second browser, or a restart, sees the same memory. The file
|
|
20128
|
+
* holds an adapter's name per dossier name and nothing else, so it has no
|
|
20129
|
+
* room for a key. A stale entry (a dossier renamed or removed behind Toil
|
|
20130
|
+
* UI's back) is only ever a name nobody asks for. A seating chart for
|
|
20131
|
+
* software that was told to sit wherever it sat last time.
|
|
20132
|
+
*/
|
|
20133
|
+
var NAMES = [
|
|
20134
|
+
"claude",
|
|
20135
|
+
"copilot",
|
|
20136
|
+
"codex"
|
|
20137
|
+
];
|
|
20138
|
+
/** toil's dossier names (the same rule the server checks a rename with). */
|
|
20139
|
+
var DOSSIER$2 = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;
|
|
20140
|
+
var MAX_DOSSIER = 200;
|
|
20141
|
+
var dossierAgentsFile = (dataDir) => nodePath.join(dataDir, "dossier-agents.json");
|
|
20142
|
+
var DossierAgents = class {
|
|
20143
|
+
dataDir;
|
|
20144
|
+
agents;
|
|
20145
|
+
constructor(dataDir) {
|
|
20146
|
+
this.dataDir = dataDir;
|
|
20147
|
+
this.agents = readAgents(dossierAgentsFile(dataDir));
|
|
20148
|
+
}
|
|
20149
|
+
/** The adapter last used for the dossier, or null. */
|
|
20150
|
+
get(dossier) {
|
|
20151
|
+
return this.agents.get(dossier) ?? null;
|
|
20152
|
+
}
|
|
20153
|
+
/** Remembers an adapter for a dossier; a name that is not an adapter or a dossier is ignored. */
|
|
20154
|
+
set(dossier, adapter) {
|
|
20155
|
+
if (!valid(dossier) || !NAMES.includes(adapter)) return false;
|
|
20156
|
+
if (this.agents.get(dossier) === adapter) return true;
|
|
20157
|
+
this.agents.set(dossier, adapter);
|
|
20158
|
+
this.save();
|
|
20159
|
+
return true;
|
|
20160
|
+
}
|
|
20161
|
+
/** A dossier toil renamed: its memory moves to the new name, replacing any left under it. */
|
|
20162
|
+
rename(from, to) {
|
|
20163
|
+
if (from === to || !valid(to)) return;
|
|
20164
|
+
const adapter = this.agents.get(from);
|
|
20165
|
+
const had = this.agents.delete(to);
|
|
20166
|
+
if (adapter === void 0) {
|
|
20167
|
+
if (had) this.save();
|
|
20168
|
+
return;
|
|
20169
|
+
}
|
|
20170
|
+
this.agents.delete(from);
|
|
20171
|
+
this.agents.set(to, adapter);
|
|
20172
|
+
this.save();
|
|
20173
|
+
}
|
|
20174
|
+
/** A dossier toil no longer has. */
|
|
20175
|
+
forget(dossier) {
|
|
20176
|
+
if (this.agents.delete(dossier)) this.save();
|
|
20177
|
+
}
|
|
20178
|
+
/** Writes owner-only through a temporary file, so a crash never leaves half of one. */
|
|
20179
|
+
save() {
|
|
20180
|
+
mkdirSync(this.dataDir, {
|
|
20181
|
+
recursive: true,
|
|
20182
|
+
mode: 448
|
|
20183
|
+
});
|
|
20184
|
+
const file = dossierAgentsFile(this.dataDir);
|
|
20185
|
+
const temp = `${file}.${process.pid}.tmp`;
|
|
20186
|
+
writeFileSync(temp, `${JSON.stringify({
|
|
20187
|
+
version: 1,
|
|
20188
|
+
agents: Object.fromEntries(this.agents)
|
|
20189
|
+
}, null, 2)}\n`, { mode: 384 });
|
|
20190
|
+
renameSync(temp, file);
|
|
20191
|
+
}
|
|
20192
|
+
};
|
|
20193
|
+
var valid = (dossier) => dossier.length <= MAX_DOSSIER && DOSSIER$2.test(dossier);
|
|
20194
|
+
/** What the file holds, entry by entry; a missing or broken file is no memory, never a failed start. */
|
|
20195
|
+
function readAgents(file) {
|
|
20196
|
+
const out = /* @__PURE__ */ new Map();
|
|
20197
|
+
try {
|
|
20198
|
+
const parsed = JSON.parse(readFileSync(file, "utf8"));
|
|
20199
|
+
if (typeof parsed.agents !== "object" || parsed.agents === null || Array.isArray(parsed.agents)) return out;
|
|
20200
|
+
for (const [dossier, adapter] of Object.entries(parsed.agents)) if (valid(dossier) && typeof adapter === "string" && NAMES.includes(adapter)) out.set(dossier, adapter);
|
|
20201
|
+
} catch {}
|
|
20202
|
+
return out;
|
|
20203
|
+
}
|
|
19424
20204
|
var MAX_RETENTION_DAYS = 3650;
|
|
19425
20205
|
/** v1 binds loopback only (#206, Local first). */
|
|
19426
20206
|
var LOOPBACK = /* @__PURE__ */ new Set(["127.0.0.1", "::1"]);
|
|
@@ -19446,7 +20226,7 @@ Options:
|
|
|
19446
20226
|
--port <n> Port; 0 (default) lets the OS pick a free one. Env: TOIL_UI_PORT
|
|
19447
20227
|
--base-path <path> Path the app is served under (default /). Env: TOIL_UI_BASE_PATH
|
|
19448
20228
|
--data-dir <dir> Toil UI's own folder (default ~/.toil-ui). Env: TOIL_UI_DATA_DIR
|
|
19449
|
-
--retention-days <n> Days the cache keeps synced data (default 30). Env: TOIL_UI_RETENTION_DAYS
|
|
20229
|
+
--retention-days <n> Days the cache keeps synced data, and how far back closed Jira and Azure DevOps items are read (at least 42) (default 30). Env: TOIL_UI_RETENTION_DAYS
|
|
19450
20230
|
--sample Serve sample data and the scripted agent, not toil.
|
|
19451
20231
|
--version Print the version.
|
|
19452
20232
|
--help Print this help.
|
|
@@ -20855,7 +21635,7 @@ var common = (dossier, mode, now) => [
|
|
|
20855
21635
|
"3. Cite every work item you mention by its OWI id in double square brackets, such as [[jira:PAY-101]], and every pull request by its change id, exactly as your tools returned it. The server checks every id against your tool results and flags any it never saw.",
|
|
20856
21636
|
"4. Your tools only read. When the work calls for a change to the tracker, write it as a proposal for a person to apply, in a fenced block like this, one block per change:",
|
|
20857
21637
|
"```proposal",
|
|
20858
|
-
"{\"item\": \"<owi id>\", \"title\": \"<one line>\", \"reason\": \"<why, citing [[ids]]>\", \"command\": \"<the toil write command, such as ado
|
|
21638
|
+
"{\"item\": \"<owi id>\", \"title\": \"<one line>\", \"reason\": \"<why, citing [[ids]]>\", \"command\": \"<the toil write command, such as ado work-item update, or null if toil has none>\", \"input\": {\"<field>\": \"<value>\"}, \"note\": \"<anything to check first, or null>\"}",
|
|
20859
21639
|
"```",
|
|
20860
21640
|
" The input is the toil command's MCP input, without the dossier and without allowWrite: call proposal_fields with the command first and use only its fields. Never say a change was made: it is only proposed.",
|
|
20861
21641
|
"5. Anything you need a person to answer goes on a line of its own that starts QUESTION: followed by the question.",
|
|
@@ -21007,13 +21787,6 @@ var workFolder = (dataDir, id) => join(dataDir, "cache", "work", id);
|
|
|
21007
21787
|
var cloneOf = (folder) => join(folder, "repo");
|
|
21008
21788
|
/** The tracker command that posts a comment on an item, by area, where toil has one; its input from the item and the text. */
|
|
21009
21789
|
var COMMENT = {
|
|
21010
|
-
"ado-cloud": (key, body) => ({
|
|
21011
|
-
command: "ado-cloud work-item comment",
|
|
21012
|
-
input: {
|
|
21013
|
-
id: Number(key),
|
|
21014
|
-
body
|
|
21015
|
-
}
|
|
21016
|
-
}),
|
|
21017
21790
|
github: (key, body) => {
|
|
21018
21791
|
const m = /^([^/]+)\/([^#]+)#(\d+)$/.exec(key);
|
|
21019
21792
|
return {
|
|
@@ -21042,13 +21815,6 @@ var COMMENT = {
|
|
|
21042
21815
|
key,
|
|
21043
21816
|
body
|
|
21044
21817
|
}
|
|
21045
|
-
}),
|
|
21046
|
-
"jira-cloud": (key, body) => ({
|
|
21047
|
-
command: "jira-cloud issue comment",
|
|
21048
|
-
input: {
|
|
21049
|
-
key,
|
|
21050
|
-
body
|
|
21051
|
-
}
|
|
21052
21818
|
})
|
|
21053
21819
|
};
|
|
21054
21820
|
/** A report as one comment: its paragraphs, citations written as the ids they name. */
|
|
@@ -21565,7 +22331,7 @@ async function main() {
|
|
|
21565
22331
|
return 0;
|
|
21566
22332
|
}
|
|
21567
22333
|
if (parsed.version) {
|
|
21568
|
-
process.stdout.write(`0.1.0-beta.
|
|
22334
|
+
process.stdout.write(`0.1.0-beta.3 (toil ${version})\n`);
|
|
21569
22335
|
return 0;
|
|
21570
22336
|
}
|
|
21571
22337
|
const { settings } = parsed;
|
|
@@ -21583,6 +22349,7 @@ async function main() {
|
|
|
21583
22349
|
let cache;
|
|
21584
22350
|
let sync;
|
|
21585
22351
|
let worklog;
|
|
22352
|
+
const dossierAgents = settings.sample ? void 0 : new DossierAgents(settings.dataDir);
|
|
21586
22353
|
if (!settings.sample) {
|
|
21587
22354
|
try {
|
|
21588
22355
|
cache = await Cache.open(settings.dataDir, { retentionDays: settings.retentionDays });
|
|
@@ -21602,7 +22369,8 @@ async function main() {
|
|
|
21602
22369
|
cache,
|
|
21603
22370
|
execute,
|
|
21604
22371
|
mapOwi,
|
|
21605
|
-
onFinished: () => pages.reconcileAll()
|
|
22372
|
+
onFinished: () => pages.reconcileAll(),
|
|
22373
|
+
onForget: (dossier) => dossierAgents?.forget(dossier)
|
|
21606
22374
|
});
|
|
21607
22375
|
await worklog.reconcileAll().catch((e) => process.stderr.write(`toil-ui: couldn't fold the worklog pages again: ${e instanceof Error ? e.message : String(e)}\n`));
|
|
21608
22376
|
}
|
|
@@ -21624,8 +22392,8 @@ async function main() {
|
|
|
21624
22392
|
commit: typeof toilCommit === "string" ? toilCommit : null
|
|
21625
22393
|
},
|
|
21626
22394
|
toilUi: {
|
|
21627
|
-
version: "0.1.0-beta.
|
|
21628
|
-
commit: "
|
|
22395
|
+
version: "0.1.0-beta.3",
|
|
22396
|
+
commit: "a8ca2c90f7942fbcd4cf98e643a97c83742330c4"
|
|
21629
22397
|
}
|
|
21630
22398
|
},
|
|
21631
22399
|
toilBundle: toilBundle(),
|
|
@@ -21660,7 +22428,7 @@ async function main() {
|
|
|
21660
22428
|
};
|
|
21661
22429
|
const host = cache ? new AgentHost({
|
|
21662
22430
|
dataDir: settings.dataDir,
|
|
21663
|
-
version: "0.1.0-beta.
|
|
22431
|
+
version: "0.1.0-beta.3",
|
|
21664
22432
|
data: (dossier) => {
|
|
21665
22433
|
const data = cacheData(cache, dossier);
|
|
21666
22434
|
return data && worklog ? {
|
|
@@ -21695,7 +22463,7 @@ async function main() {
|
|
|
21695
22463
|
execute,
|
|
21696
22464
|
mapIds,
|
|
21697
22465
|
data,
|
|
21698
|
-
version: "0.1.0-beta.
|
|
22466
|
+
version: "0.1.0-beta.3",
|
|
21699
22467
|
toilVersion: version,
|
|
21700
22468
|
...fingerprints ? { fingerprints } : {}
|
|
21701
22469
|
}),
|
|
@@ -21754,12 +22522,14 @@ async function main() {
|
|
|
21754
22522
|
};
|
|
21755
22523
|
step("its cache", () => cache.rename(from, to));
|
|
21756
22524
|
step("its assignments", () => assignments.queue.renameDossier(from, to));
|
|
22525
|
+
step("its Analyze agent", () => dossierAgents?.rename(from, to));
|
|
21757
22526
|
await worklog.reconcileAll().catch((e) => problems.push(`Toil UI couldn't fold the worklog again under ${to}: ${e instanceof Error ? e.message : String(e)}`));
|
|
21758
22527
|
return problems;
|
|
21759
22528
|
}
|
|
21760
22529
|
} : void 0;
|
|
21761
22530
|
const ui = createUiServer({
|
|
21762
22531
|
...renames ? { renames } : {},
|
|
22532
|
+
...dossierAgents ? { dossierAgents } : {},
|
|
21763
22533
|
settings,
|
|
21764
22534
|
store: cache ? sqliteStore(() => cache, execute, toil) : fixtureStore(),
|
|
21765
22535
|
agent: host ?? fixtureAgent(),
|
|
@@ -21771,7 +22541,7 @@ async function main() {
|
|
|
21771
22541
|
assignments,
|
|
21772
22542
|
...fingerprints ? { serverStatus: () => fingerprints.server() } : {},
|
|
21773
22543
|
appDir: fileURLToPath(new URL("../app/", import.meta.url)),
|
|
21774
|
-
version: "0.1.0-beta.
|
|
22544
|
+
version: "0.1.0-beta.3",
|
|
21775
22545
|
toil,
|
|
21776
22546
|
config: settings.sample ? {
|
|
21777
22547
|
areas: FIXTURE_AREAS,
|
|
@@ -21792,7 +22562,7 @@ async function main() {
|
|
|
21792
22562
|
return 1;
|
|
21793
22563
|
}
|
|
21794
22564
|
process.stdout.write([
|
|
21795
|
-
`Toil UI 0.1.0-beta.
|
|
22565
|
+
`Toil UI 0.1.0-beta.3 (beta, local only), on toil ${version}`,
|
|
21796
22566
|
settings.sample ? "Serving sample data and the scripted agent; nothing connects to a tracker." : "Syncing through toil, read-only, with your own connections and dossiers. Only its Settings pages, and a dossier's name and description edited in place, change anything: toil's own connections and dossiers, when you ask. The worklog keeps its pages and your notes in its data folder, and writes anywhere else only when you export one. Feedback goes to Imagile only when you send it.",
|
|
21797
22567
|
...cache ? [`The cache is ${cache.paths.db}, kept ${settings.retentionDays} days after each sync; toil-ui wipe deletes it.`] : [],
|
|
21798
22568
|
"",
|