@zixt/host 0.0.60 → 0.0.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +58 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ import { homedir } from "node:os";
|
|
|
31
31
|
// package.json
|
|
32
32
|
var package_default = {
|
|
33
33
|
name: "@zixt/host",
|
|
34
|
-
version: "0.0.
|
|
34
|
+
version: "0.0.62",
|
|
35
35
|
type: "module",
|
|
36
36
|
exports: {
|
|
37
37
|
".": "./src/client.ts",
|
|
@@ -16152,6 +16152,7 @@ var taskGitSummaryLabel = (maxLength, label) => external_exports.string().min(1)
|
|
|
16152
16152
|
isSafeSingleLineDisplayText,
|
|
16153
16153
|
`${label} must not contain control, line-separator, or bidirectional formatting characters`
|
|
16154
16154
|
);
|
|
16155
|
+
var PullRequestLookup = external_exports.enum(["observed", "unavailable"]);
|
|
16155
16156
|
var TaskGitSummary = external_exports.object({
|
|
16156
16157
|
repositories: external_exports.array(
|
|
16157
16158
|
external_exports.object({
|
|
@@ -16166,6 +16167,12 @@ var TaskGitSummary = external_exports.object({
|
|
|
16166
16167
|
ahead: external_exports.number().int().min(0),
|
|
16167
16168
|
behind: external_exports.number().int().min(0),
|
|
16168
16169
|
changedFiles: external_exports.number().int().min(0),
|
|
16170
|
+
/**
|
|
16171
|
+
* Whether Zixt could actually ask GitHub about this branch.
|
|
16172
|
+
* Absent is a Host that never reported it, which is also "Zixt
|
|
16173
|
+
* does not know" — never evidence that no pull request exists.
|
|
16174
|
+
*/
|
|
16175
|
+
pullRequestLookup: PullRequestLookup.optional(),
|
|
16169
16176
|
pullRequest: external_exports.object({
|
|
16170
16177
|
number: external_exports.number().int().min(1),
|
|
16171
16178
|
url: external_exports.string().max(2e3).regex(
|
|
@@ -16318,9 +16325,14 @@ var TaskProgressStep = external_exports.object({
|
|
|
16318
16325
|
kind: TaskTimingPhaseKind,
|
|
16319
16326
|
state: TaskProgressStepState,
|
|
16320
16327
|
/** Time spent in this step so far; 0 for pending and skipped steps. */
|
|
16321
|
-
durationMs: external_exports.number().int().min(0)
|
|
16328
|
+
durationMs: external_exports.number().int().min(0),
|
|
16329
|
+
/**
|
|
16330
|
+
* What comparable finished Tasks spent here, from their recorded shares
|
|
16331
|
+
* rather than an even split across steps. 0 when no cohort supports one.
|
|
16332
|
+
*/
|
|
16333
|
+
expectedMs: external_exports.number().int().min(0)
|
|
16322
16334
|
}).strict();
|
|
16323
|
-
var TaskProgressBasis = external_exports.enum(["none", "steps", "history"]);
|
|
16335
|
+
var TaskProgressBasis = external_exports.enum(["none", "steps", "history", "phase_history"]);
|
|
16324
16336
|
var TaskProgressConfidence = external_exports.enum(["none", "low", "medium"]);
|
|
16325
16337
|
var TaskProgressCaveat = external_exports.enum([
|
|
16326
16338
|
/** A person owes an answer or a decision; nothing is running. */
|
|
@@ -16338,14 +16350,27 @@ var TaskProgressCaveat = external_exports.enum([
|
|
|
16338
16350
|
/** No comparable finished Task exists, so no time can be predicted at all. */
|
|
16339
16351
|
"no_history"
|
|
16340
16352
|
]);
|
|
16353
|
+
var TaskProgressSampleScope = external_exports.enum([
|
|
16354
|
+
/** Same teammate, same repository, similar size of request. */
|
|
16355
|
+
"agent_repository_size",
|
|
16356
|
+
/** Same teammate, same repository. */
|
|
16357
|
+
"agent_repository",
|
|
16358
|
+
/** Same teammate, any work. */
|
|
16359
|
+
"agent",
|
|
16360
|
+
/** Anyone in the organization. */
|
|
16361
|
+
"organization"
|
|
16362
|
+
]);
|
|
16341
16363
|
var TaskProgressSample = external_exports.object({
|
|
16342
16364
|
size: external_exports.number().int().min(1),
|
|
16343
|
-
|
|
16344
|
-
|
|
16365
|
+
scope: TaskProgressSampleScope,
|
|
16366
|
+
/** One in five comparable Tasks finished their work within this. */
|
|
16367
|
+
p20Ms: external_exports.number().int().min(0).default(0),
|
|
16345
16368
|
/** Middle working time of the sample. */
|
|
16346
16369
|
medianMs: external_exports.number().int().min(0),
|
|
16347
16370
|
/** Four in five comparable Tasks finished their work within this. */
|
|
16348
|
-
p80Ms: external_exports.number().int().min(0)
|
|
16371
|
+
p80Ms: external_exports.number().int().min(0),
|
|
16372
|
+
/** Newest observation in the cohort; the estimate ages with its evidence. */
|
|
16373
|
+
newestAt: IsoDate.nullable().default(null)
|
|
16349
16374
|
}).strict();
|
|
16350
16375
|
var TaskProgressEstimate = external_exports.object({
|
|
16351
16376
|
schemaVersion: external_exports.literal(1),
|
|
@@ -16537,6 +16562,12 @@ var TaskWorkingContextBase = external_exports.object({
|
|
|
16537
16562
|
changedFiles: external_exports.number().int().min(0),
|
|
16538
16563
|
/** Present only for a safely parsed github.com remote. */
|
|
16539
16564
|
githubRepository: GithubRepositoryName.optional(),
|
|
16565
|
+
/**
|
|
16566
|
+
* Whether the authenticated branch read reached GitHub at all.
|
|
16567
|
+
* Absence of a pull request only means "there is none" when this
|
|
16568
|
+
* says `observed`.
|
|
16569
|
+
*/
|
|
16570
|
+
pullRequestLookup: PullRequestLookup.optional(),
|
|
16540
16571
|
/** Present only when GitHub associates this exact branch with a PR. */
|
|
16541
16572
|
pullRequest: external_exports.object({
|
|
16542
16573
|
number: external_exports.number().int().min(1),
|
|
@@ -34818,9 +34849,9 @@ function selectPullRequest(output, expectedBaseRepository, expectedHeadRepositor
|
|
|
34818
34849
|
try {
|
|
34819
34850
|
value = JSON.parse(output);
|
|
34820
34851
|
} catch {
|
|
34821
|
-
return
|
|
34852
|
+
return { lookup: "unavailable" };
|
|
34822
34853
|
}
|
|
34823
|
-
if (!Array.isArray(value)) return
|
|
34854
|
+
if (!Array.isArray(value)) return { lookup: "unavailable" };
|
|
34824
34855
|
let best;
|
|
34825
34856
|
for (const entry of value.slice(0, PULL_REQUEST_LIST_LIMIT)) {
|
|
34826
34857
|
if (!entry || typeof entry !== "object" || Array.isArray(entry)) continue;
|
|
@@ -34835,16 +34866,17 @@ function selectPullRequest(output, expectedBaseRepository, expectedHeadRepositor
|
|
|
34835
34866
|
best = parsed;
|
|
34836
34867
|
}
|
|
34837
34868
|
}
|
|
34838
|
-
return best;
|
|
34869
|
+
return { lookup: "observed", ...best ? { pullRequest: best } : {} };
|
|
34839
34870
|
}
|
|
34840
34871
|
async function pullRequest(command, gitCommand, repositoryCwd, commandCwd, repository, branch, signal) {
|
|
34841
|
-
if (!command || !repository || !branch) return
|
|
34872
|
+
if (!command || !repository || !branch) return { lookup: "unavailable" };
|
|
34842
34873
|
const baseRepositories = await pullRequestBaseRepositories(
|
|
34843
34874
|
gitCommand,
|
|
34844
34875
|
repositoryCwd,
|
|
34845
34876
|
repository,
|
|
34846
34877
|
signal
|
|
34847
34878
|
);
|
|
34879
|
+
let answered = false;
|
|
34848
34880
|
for (const baseRepository of baseRepositories) {
|
|
34849
34881
|
const output = await run(
|
|
34850
34882
|
command.executablePath,
|
|
@@ -34868,10 +34900,11 @@ async function pullRequest(command, gitCommand, repositoryCwd, commandCwd, repos
|
|
|
34868
34900
|
signal
|
|
34869
34901
|
);
|
|
34870
34902
|
if (!output) continue;
|
|
34871
|
-
const
|
|
34872
|
-
if (
|
|
34903
|
+
const observation = selectPullRequest(output, baseRepository, repository, branch);
|
|
34904
|
+
if (observation.lookup === "observed") answered = true;
|
|
34905
|
+
if (observation.pullRequest) return observation;
|
|
34873
34906
|
}
|
|
34874
|
-
return
|
|
34907
|
+
return { lookup: answered ? "observed" : "unavailable" };
|
|
34875
34908
|
}
|
|
34876
34909
|
async function repositoryState(directory, git, env, signal) {
|
|
34877
34910
|
if (!git.available || !git.executablePath) return null;
|
|
@@ -35016,9 +35049,10 @@ var WorkingContextPullRequestCache = class {
|
|
|
35016
35049
|
}
|
|
35017
35050
|
#entries = /* @__PURE__ */ new Map();
|
|
35018
35051
|
async enrich(context, command, options = {}) {
|
|
35019
|
-
if (!
|
|
35052
|
+
if (!context.repositories || context.repositories.length === 0) return context;
|
|
35020
35053
|
const repositories = await Promise.all(
|
|
35021
35054
|
context.repositories.map(async (repository) => {
|
|
35055
|
+
if (!command) return { ...repository, pullRequestLookup: "unavailable" };
|
|
35022
35056
|
if (!repository.githubRepository || !repository.branch) return repository;
|
|
35023
35057
|
const key = JSON.stringify([
|
|
35024
35058
|
repository.githubRepository.toLocaleLowerCase("en-US"),
|
|
@@ -35026,7 +35060,7 @@ var WorkingContextPullRequestCache = class {
|
|
|
35026
35060
|
repository.headSha
|
|
35027
35061
|
]);
|
|
35028
35062
|
const cached2 = this.#entries.get(key);
|
|
35029
|
-
let observed = cached2?.
|
|
35063
|
+
let observed = cached2?.observation ?? { lookup: "unavailable" };
|
|
35030
35064
|
if (options.force || !cached2 || this.now() - cached2.checkedAt >= this.ttlMs) {
|
|
35031
35065
|
observed = await pullRequest(
|
|
35032
35066
|
command,
|
|
@@ -35039,7 +35073,7 @@ var WorkingContextPullRequestCache = class {
|
|
|
35039
35073
|
);
|
|
35040
35074
|
if (!options.signal?.aborted) {
|
|
35041
35075
|
this.#entries.delete(key);
|
|
35042
|
-
this.#entries.set(key, { checkedAt: this.now(),
|
|
35076
|
+
this.#entries.set(key, { checkedAt: this.now(), observation: observed });
|
|
35043
35077
|
while (this.#entries.size > Math.max(1, this.maxEntries)) {
|
|
35044
35078
|
const oldest = this.#entries.keys().next().value;
|
|
35045
35079
|
if (oldest === void 0) break;
|
|
@@ -35047,7 +35081,14 @@ var WorkingContextPullRequestCache = class {
|
|
|
35047
35081
|
}
|
|
35048
35082
|
}
|
|
35049
35083
|
}
|
|
35050
|
-
|
|
35084
|
+
if (observed.lookup === "unavailable") {
|
|
35085
|
+
return repository.pullRequest || repository.pullRequestLookup === "observed" ? repository : { ...repository, pullRequestLookup: "unavailable" };
|
|
35086
|
+
}
|
|
35087
|
+
return {
|
|
35088
|
+
...repository,
|
|
35089
|
+
pullRequestLookup: observed.lookup,
|
|
35090
|
+
...observed.pullRequest ? { pullRequest: observed.pullRequest } : {}
|
|
35091
|
+
};
|
|
35051
35092
|
})
|
|
35052
35093
|
);
|
|
35053
35094
|
return TaskWorkingContextObservation.parse({ ...context, repositories });
|