@zixt/host 0.0.57 → 0.0.59
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 +69 -9
- 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.59",
|
|
35
35
|
type: "module",
|
|
36
36
|
exports: {
|
|
37
37
|
".": "./src/client.ts",
|
|
@@ -16087,6 +16087,16 @@ var Task = external_exports.object({
|
|
|
16087
16087
|
* thread-backed work from standalone rows without a second lookup.
|
|
16088
16088
|
*/
|
|
16089
16089
|
conversationId: ConversationId.nullable().default(null),
|
|
16090
|
+
/**
|
|
16091
|
+
* UI-8c: which coordinated workstream this Task belongs to. Zixt records one
|
|
16092
|
+
* workstream per Manager delegation turn, so Tasks the Manager split out of
|
|
16093
|
+
* a single request are grouped as parallel work and independent requests in
|
|
16094
|
+
* the same thread are not. Null means this Task is its own workstream: that
|
|
16095
|
+
* is the deliberate fallback for engine-born work and for rows written
|
|
16096
|
+
* before the field existed, because inventing a shared group is worse than
|
|
16097
|
+
* showing one more row.
|
|
16098
|
+
*/
|
|
16099
|
+
workstreamId: external_exports.string().min(1).max(120).nullable().default(null),
|
|
16090
16100
|
/** Formal human review is opt-in per Task; ordinary Chat defaults to none. */
|
|
16091
16101
|
reviewMode: TaskReviewMode.default("none"),
|
|
16092
16102
|
/** Assignment epoch — bumped every time the task is (re)assigned (PRD §7.4). */
|
|
@@ -18288,12 +18298,27 @@ var ManagerTaskRailRepresentative = external_exports.object({
|
|
|
18288
18298
|
createdAt: external_exports.string(),
|
|
18289
18299
|
updatedAt: external_exports.string()
|
|
18290
18300
|
}).strict();
|
|
18301
|
+
var MANAGER_RAIL_WORKSTREAM_LIMIT = 10;
|
|
18302
|
+
var ManagerTaskRailWorkstream = external_exports.object({
|
|
18303
|
+
workstreamId: external_exports.string().min(1).max(160),
|
|
18304
|
+
/** The workstream's newest live Task title, already role-projected. */
|
|
18305
|
+
title: external_exports.string().max(1e3),
|
|
18306
|
+
representative: ManagerTaskRailRepresentative
|
|
18307
|
+
}).strict();
|
|
18291
18308
|
var ManagerTaskRailSummary = external_exports.object({
|
|
18292
18309
|
conversationId: ConversationId,
|
|
18293
18310
|
hasChildren: external_exports.boolean(),
|
|
18294
18311
|
hasAgentMatch: external_exports.boolean(),
|
|
18295
18312
|
hasStatusMatch: external_exports.boolean(),
|
|
18296
|
-
representative: ManagerTaskRailRepresentative.nullable()
|
|
18313
|
+
representative: ManagerTaskRailRepresentative.nullable(),
|
|
18314
|
+
/**
|
|
18315
|
+
* Live workstreams this thread carries besides the one its own row
|
|
18316
|
+
* represents. Defaulted so a browser that outruns a deploy degrades to the
|
|
18317
|
+
* previous single-row behavior instead of failing the whole rail read.
|
|
18318
|
+
*/
|
|
18319
|
+
workstreams: external_exports.array(ManagerTaskRailWorkstream).max(MANAGER_RAIL_WORKSTREAM_LIMIT).default([]),
|
|
18320
|
+
/** True when more live workstreams exist than the rail will spin out. */
|
|
18321
|
+
workstreamsTruncated: external_exports.boolean().default(false)
|
|
18297
18322
|
}).strict();
|
|
18298
18323
|
var ManagerTaskRailSummariesResponse = external_exports.object({ summaries: external_exports.array(ManagerTaskRailSummary).max(CONVERSATION_LIST_LIMIT) }).strict();
|
|
18299
18324
|
var ConversationDetailResponse = external_exports.object({
|
|
@@ -34693,9 +34718,8 @@ async function pullRequestBaseRepositories(gitCommand, cwd, checkoutRepository,
|
|
|
34693
34718
|
add(checkoutRepository);
|
|
34694
34719
|
return repositories;
|
|
34695
34720
|
}
|
|
34696
|
-
function parsePullRequest(
|
|
34721
|
+
function parsePullRequest(value, expectedBaseRepository, expectedHeadRepository, expectedHeadBranch) {
|
|
34697
34722
|
try {
|
|
34698
|
-
const value = JSON.parse(output);
|
|
34699
34723
|
const state = typeof value["state"] === "string" ? value["state"].toLowerCase() : "";
|
|
34700
34724
|
const number4 = Number(value["number"]);
|
|
34701
34725
|
const location = canonicalPullRequestLocation(value["url"], number4);
|
|
@@ -34718,10 +34742,41 @@ function parsePullRequest(output, expectedBaseRepository, expectedHeadRepository
|
|
|
34718
34742
|
return void 0;
|
|
34719
34743
|
}
|
|
34720
34744
|
}
|
|
34745
|
+
var PULL_REQUEST_LIST_LIMIT = 20;
|
|
34746
|
+
var PULL_REQUEST_STATE_RANK = {
|
|
34747
|
+
// A still-open pull request is the branch's current truth even when an
|
|
34748
|
+
// earlier one from the same branch already merged; a closed one is the
|
|
34749
|
+
// weakest evidence because it says only that somebody gave up on it.
|
|
34750
|
+
open: 3,
|
|
34751
|
+
merged: 2,
|
|
34752
|
+
closed: 1
|
|
34753
|
+
};
|
|
34754
|
+
function selectPullRequest(output, expectedBaseRepository, expectedHeadRepository, expectedHeadBranch) {
|
|
34755
|
+
let value;
|
|
34756
|
+
try {
|
|
34757
|
+
value = JSON.parse(output);
|
|
34758
|
+
} catch {
|
|
34759
|
+
return void 0;
|
|
34760
|
+
}
|
|
34761
|
+
if (!Array.isArray(value)) return void 0;
|
|
34762
|
+
let best;
|
|
34763
|
+
for (const entry of value.slice(0, PULL_REQUEST_LIST_LIMIT)) {
|
|
34764
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) continue;
|
|
34765
|
+
const parsed = parsePullRequest(
|
|
34766
|
+
entry,
|
|
34767
|
+
expectedBaseRepository,
|
|
34768
|
+
expectedHeadRepository,
|
|
34769
|
+
expectedHeadBranch
|
|
34770
|
+
);
|
|
34771
|
+
if (!parsed) continue;
|
|
34772
|
+
if (!best || PULL_REQUEST_STATE_RANK[parsed.state] > PULL_REQUEST_STATE_RANK[best.state] || PULL_REQUEST_STATE_RANK[parsed.state] === PULL_REQUEST_STATE_RANK[best.state] && parsed.number > best.number) {
|
|
34773
|
+
best = parsed;
|
|
34774
|
+
}
|
|
34775
|
+
}
|
|
34776
|
+
return best;
|
|
34777
|
+
}
|
|
34721
34778
|
async function pullRequest(command, gitCommand, repositoryCwd, commandCwd, repository, branch, signal) {
|
|
34722
34779
|
if (!command || !repository || !branch) return void 0;
|
|
34723
|
-
const headOwner = repository.split("/")[0];
|
|
34724
|
-
const selector = `${headOwner}:${branch}`;
|
|
34725
34780
|
const baseRepositories = await pullRequestBaseRepositories(
|
|
34726
34781
|
gitCommand,
|
|
34727
34782
|
repositoryCwd,
|
|
@@ -34734,10 +34789,15 @@ async function pullRequest(command, gitCommand, repositoryCwd, commandCwd, repos
|
|
|
34734
34789
|
[
|
|
34735
34790
|
...command.prefixArgs ?? [],
|
|
34736
34791
|
"pr",
|
|
34737
|
-
"
|
|
34738
|
-
selector,
|
|
34792
|
+
"list",
|
|
34739
34793
|
"--repo",
|
|
34740
34794
|
baseRepository,
|
|
34795
|
+
"--head",
|
|
34796
|
+
branch,
|
|
34797
|
+
"--state",
|
|
34798
|
+
"all",
|
|
34799
|
+
"--limit",
|
|
34800
|
+
String(PULL_REQUEST_LIST_LIMIT),
|
|
34741
34801
|
"--json",
|
|
34742
34802
|
"number,title,url,state,isDraft,baseRefName,headRefName,headRepository,headRepositoryOwner"
|
|
34743
34803
|
],
|
|
@@ -34746,7 +34806,7 @@ async function pullRequest(command, gitCommand, repositoryCwd, commandCwd, repos
|
|
|
34746
34806
|
signal
|
|
34747
34807
|
);
|
|
34748
34808
|
if (!output) continue;
|
|
34749
|
-
const parsed =
|
|
34809
|
+
const parsed = selectPullRequest(output, baseRepository, repository, branch);
|
|
34750
34810
|
if (parsed) return parsed;
|
|
34751
34811
|
}
|
|
34752
34812
|
return void 0;
|