@nathanstephenson/flow 0.1.10-beta.7 → 0.1.10-beta.9
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/build/backend-worker-chunks/{claude-THGSOTC2.mjs → claude-X57GT57M.mjs} +12 -4
- package/build/backend-worker-chunks/{pi-5LAWIJNE.mjs → pi-IZ3GX6HN.mjs} +5 -1
- package/build/backend-worker.mjs +7 -4
- package/dist/backend/claude/index.js +15 -4
- package/dist/backend/mcp.js +4 -1
- package/dist/backend/pi/index.js +6 -1
- package/dist/backend/worker/index.js +8 -3
- package/dist/build-id +1 -1
- package/dist/cli/bootstrap.js +1 -1
- package/dist/client/connection.js +46 -0
- package/dist/client/project-name.js +3 -1
- package/dist/client/reduce.js +1 -0
- package/dist/client/scope-kind.js +4 -0
- package/dist/daemon/changes.js +22 -12
- package/dist/daemon/git.js +10 -1
- package/dist/daemon/host.js +263 -47
- package/dist/daemon/pull-request.js +92 -34
- package/dist/daemon/repository.js +26 -9
- package/dist/daemon/runtime.js +2 -0
- package/dist/daemon/server.js +25 -0
- package/dist/daemon/stack.js +37 -3
- package/dist/daemon/tour.js +7 -1
- package/dist/daemon/workflow-environment.js +6 -4
- package/dist/daemon/workflow-executions.js +1 -1
- package/dist/isolation/filesystem.js +1 -1
- package/dist/protocol/spend.js +1 -1
- package/dist/protocol/stack.js +14 -1
- package/dist/workflows/executors.js +2 -1
- package/package.json +1 -1
- package/web/dist/assets/index-CHFNROUs.js +51 -0
- package/web/dist/assets/index-D9AneSPi.css +2 -0
- package/web/dist/assets/{select-C-BND5Jn.js → select-COVn-75j.js} +1 -1
- package/web/dist/assets/{settings-mcp-CBXZt_cf.js → settings-mcp-BHZwEeJF.js} +1 -1
- package/web/dist/assets/{settings-secrets-29ZG3w6p.js → settings-secrets-NGSRhEbU.js} +1 -1
- package/web/dist/assets/settings-workflows-uew3ONyO.js +23 -0
- package/web/dist/assets/{workflow-api-DkUjAZ4w.js → workflow-api-3z2Qqsmo.js} +1 -1
- package/web/dist/assets/{workflows-DdogjBu3.js → workflows-hcZXxss1.js} +14 -14
- package/web/dist/assets/{workflows-pane-B0dyuSuz.js → workflows-pane-DntY7Dcw.js} +1 -1
- package/web/dist/index.html +5 -5
- package/web/dist/assets/index-5E7qbtVD.js +0 -51
- package/web/dist/assets/index-BvkM2cWL.css +0 -2
- package/web/dist/assets/settings-workflows-CE11fxNj.js +0 -23
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { api, connection, gh, page } from "./github.js";
|
|
2
|
-
import { githubRepository, localRepository, resolvePullRequest, resolveRepository } from "./repository.js";
|
|
2
|
+
import { githubRepository, localRepository, mergeMethods, mergeSettingsFields, pullRequestByNumber, resolvePullRequest, resolveRepository, writers } from "./repository.js";
|
|
3
3
|
import { cleanStack } from "./stack.js";
|
|
4
4
|
import { pushTarget, remoteHead } from "./push.js";
|
|
5
5
|
import { localStack, stackParent } from "./stack-metadata.js";
|
|
6
|
-
import { head, isRepository, run, GIT_WRITE_TIMEOUT_MS } from "./git.js";
|
|
6
|
+
import { head, isRepository, run, GIT_READ_TIMEOUT_MS, GIT_WRITE_TIMEOUT_MS } from "./git.js";
|
|
7
7
|
const commentFields = "id author{login} body url createdAt";
|
|
8
8
|
const threadFields = "id path line isOutdated isResolved viewerCanReply viewerCanResolve viewerCanUnresolve";
|
|
9
9
|
const threadCommentFields = `${commentFields} diffHunk`;
|
|
10
10
|
const checkFields = "... on CheckRun{name status conclusion detailsUrl} ... on StatusContext{context state targetUrl}";
|
|
11
|
-
const detailsQuery = `query($id:ID!){node(id:$id){... on PullRequest{id number url title body state isDraft reviewDecision updatedAt author{login} headRefName headRefOid headRepository{id nameWithOwner} baseRefName mergeable mergeStateStatus locked repository{
|
|
12
|
-
const writers = ["ADMIN", "MAINTAIN", "WRITE"];
|
|
11
|
+
const detailsQuery = `query($id:ID!){node(id:$id){... on PullRequest{id number url title body state isDraft reviewDecision updatedAt author{login} headRefName headRefOid headRepository{id nameWithOwner} baseRefName mergeable mergeStateStatus locked repository{${mergeSettingsFields}} comments(first:100){nodes{${commentFields}} ${page}} reviews(first:100){nodes{${commentFields} state} ${page}} reviewThreads(first:100){nodes{${threadFields} comments(first:100){nodes{${threadCommentFields}} ${page}}} ${page}} commits(last:1){nodes{commit{statusCheckRollup{id contexts(first:100){nodes{${checkFields}} ${page}}}}}}}}}`;
|
|
13
12
|
const comment = (value) => ({ ...value, author: value.author?.login ?? "[deleted]" });
|
|
14
13
|
function check(node) {
|
|
15
14
|
const url = node.detailsUrl || node.targetUrl || "";
|
|
@@ -28,14 +27,8 @@ async function details(scope, ref, github) {
|
|
|
28
27
|
threads.push({ ...thread, diffHunk: all[0]?.diffHunk ?? "", comments: all.map(comment) });
|
|
29
28
|
}
|
|
30
29
|
const rollup = commits.nodes[0]?.commit.statusCheckRollup;
|
|
31
|
-
const writer = !repository.isArchived && writers.includes(repository.viewerPermission ?? "");
|
|
32
|
-
const mergeMethods = !writer ? [] : [
|
|
33
|
-
...(repository.mergeCommitAllowed ? ["MERGE"] : []),
|
|
34
|
-
...(repository.squashMergeAllowed ? ["SQUASH"] : []),
|
|
35
|
-
...(repository.rebaseMergeAllowed ? ["REBASE"] : []),
|
|
36
|
-
];
|
|
37
30
|
return { headRepositoryId: headRepository?.id, pr: {
|
|
38
|
-
...fields, repo: ref.repo, author: author?.login ?? "[deleted]", mergeMethods,
|
|
31
|
+
...fields, repo: ref.repo, author: author?.login ?? "[deleted]", mergeMethods: mergeMethods(repository),
|
|
39
32
|
...(headRepository ? { headRepository: headRepository.nameWithOwner } : {}),
|
|
40
33
|
viewerCanComment: !repository.isArchived && (!locked || writers.includes(repository.viewerPermission ?? "")),
|
|
41
34
|
comments: (await connection(scope, github, comments, id, "PullRequest", "comments", commentFields)).map(comment),
|
|
@@ -61,6 +54,29 @@ export async function pullRequest(scope, known, github = gh) {
|
|
|
61
54
|
const resolved = await resolvePullRequest(scope, repository, branch.value.name, github);
|
|
62
55
|
return resolved ? (await details(scope, resolved, github))?.pr ?? null : null;
|
|
63
56
|
}
|
|
57
|
+
export async function projectPullRequest(scope, number, github = gh) {
|
|
58
|
+
if (!Number.isSafeInteger(number) || number < 1)
|
|
59
|
+
throw new Error("Invalid pull request number.");
|
|
60
|
+
const repository = await resolveRepository(scope, undefined, github);
|
|
61
|
+
const found = await pullRequestByNumber(scope, repository.base.repo, number, github);
|
|
62
|
+
return found ? (await details(scope, found, github))?.pr ?? null : null;
|
|
63
|
+
}
|
|
64
|
+
const listFields = "id number title state isDraft updatedAt author{login} reviewRequests(first:100){nodes{requestedReviewer{... on User{login}}}}";
|
|
65
|
+
/** Open Pull Requests of the base repository, or with `query`, all of them whose title matches. */
|
|
66
|
+
export async function listPullRequests(scope, github = gh, query) {
|
|
67
|
+
const repo = (await resolveRepository(scope, undefined, github)).base.repo;
|
|
68
|
+
const [owner, name] = repo.split("/");
|
|
69
|
+
const item = (viewer) => ({ author, reviewRequests, repository: _, ...node }) => ({
|
|
70
|
+
...node, repo, author: author?.login ?? "[deleted]",
|
|
71
|
+
reviewRequested: reviewRequests.nodes.some(request => request.requestedReviewer?.login === viewer),
|
|
72
|
+
});
|
|
73
|
+
if (query) {
|
|
74
|
+
const data = await api(scope, github, `query($q:String!){viewer{login} search(type:ISSUE,first:50,query:$q){nodes{... on PullRequest{${listFields} repository{nameWithOwner}}}}}`, { q: `repo:${repo} is:pr in:title sort:updated-desc ${query}` });
|
|
75
|
+
return data.search.nodes.filter((node) => node.repository?.nameWithOwner.toLowerCase() === repo.toLowerCase()).map(item(data.viewer.login));
|
|
76
|
+
}
|
|
77
|
+
const data = await api(scope, github, `query($owner:String!,$name:String!){viewer{login} repository(owner:$owner,name:$name){pullRequests(states:OPEN,first:100,orderBy:{field:UPDATED_AT,direction:DESC}){nodes{${listFields}}}}}`, { owner: owner, name: name });
|
|
78
|
+
return data.repository.pullRequests.nodes.map(item(data.viewer.login)).sort((a, b) => Number(b.reviewRequested) - Number(a.reviewRequested));
|
|
79
|
+
}
|
|
64
80
|
async function git(scope, args) {
|
|
65
81
|
const result = await run(scope, args, GIT_WRITE_TIMEOUT_MS);
|
|
66
82
|
if (!result.ok)
|
|
@@ -95,6 +111,44 @@ function validate(ref) {
|
|
|
95
111
|
if (!ref || typeof ref.repo !== "string" || !/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(ref.repo) || !Number.isSafeInteger(ref.number) || ref.number < 1 || !validId(ref.id))
|
|
96
112
|
throw new Error("Invalid pull request reference.");
|
|
97
113
|
}
|
|
114
|
+
export const projectTarget = async (scope, ref, github) => {
|
|
115
|
+
validate(ref);
|
|
116
|
+
const repository = await resolveRepository(scope, undefined, github);
|
|
117
|
+
const pr = ref.repo === repository.base.repo ? await pullRequestByNumber(scope, ref.repo, ref.number, github) : undefined;
|
|
118
|
+
if (!pr || pr.id !== ref.id)
|
|
119
|
+
throw new Error("The pull request has changed. Reload it before continuing.");
|
|
120
|
+
return pr;
|
|
121
|
+
};
|
|
122
|
+
export async function remoteUrl(scope, repo) {
|
|
123
|
+
for (const remote of (await git(scope, ["remote"])).split("\n").filter(Boolean)) {
|
|
124
|
+
const url = await git(scope, ["remote", "get-url", remote]);
|
|
125
|
+
if (githubRepository(url)?.toLowerCase() === repo.toLowerCase())
|
|
126
|
+
return { remote, url };
|
|
127
|
+
}
|
|
128
|
+
return { url: `https://github.com/${repo}.git` };
|
|
129
|
+
}
|
|
130
|
+
export async function fetchBranch(scope, remote, branch) {
|
|
131
|
+
await git(scope, ["check-ref-format", `refs/heads/${branch}`]);
|
|
132
|
+
await git(scope, ["fetch", "--no-tags", remote, `+refs/heads/${branch}:refs/remotes/${remote}/${branch}`]);
|
|
133
|
+
return await git(scope, ["rev-parse", `refs/remotes/${remote}/${branch}`]);
|
|
134
|
+
}
|
|
135
|
+
export async function dropUnchangedBranch(scope, branch, oid) {
|
|
136
|
+
const current = await run(scope, ["rev-parse", "--verify", "--quiet", `refs/heads/${branch}`], GIT_READ_TIMEOUT_MS);
|
|
137
|
+
if (current.ok && current.value.trim() === oid)
|
|
138
|
+
await run(scope, ["branch", "-D", "--", branch], GIT_WRITE_TIMEOUT_MS);
|
|
139
|
+
}
|
|
140
|
+
const hasCommit = async (scope, oid) => (await run(scope, ["cat-file", "-e", `${oid}^{commit}`], GIT_READ_TIMEOUT_MS)).ok;
|
|
141
|
+
export async function pullRequestRange(scope, ref, github = gh) {
|
|
142
|
+
validate(ref);
|
|
143
|
+
const pr = await projectTarget(scope, ref, github);
|
|
144
|
+
if (!await hasCommit(scope, pr.headRefOid) || !await hasCommit(scope, pr.baseRefOid)) {
|
|
145
|
+
await git(scope, ["check-ref-format", `refs/heads/${pr.baseBranch}`]);
|
|
146
|
+
await git(scope, ["fetch", "--no-tags", "--no-write-fetch-head", (await remoteUrl(scope, pr.repo)).url, `refs/pull/${pr.number}/head`, `refs/heads/${pr.baseBranch}`]);
|
|
147
|
+
if (!await hasCommit(scope, pr.headRefOid) || !await hasCommit(scope, pr.baseRefOid))
|
|
148
|
+
throw new Error("The pull request has changed. Reload it before continuing.");
|
|
149
|
+
}
|
|
150
|
+
return { base: pr.baseRefOid, head: pr.headRefOid, pr };
|
|
151
|
+
}
|
|
98
152
|
async function target(scope, ref, github) {
|
|
99
153
|
const selected = await head(scope);
|
|
100
154
|
const branch = selected.ok && !selected.value.detached ? selected.value.name : undefined;
|
|
@@ -103,7 +157,7 @@ async function target(scope, ref, github) {
|
|
|
103
157
|
throw new Error("The branch's pull request has changed. Reload it before continuing.");
|
|
104
158
|
return { ...pr, branch: branch };
|
|
105
159
|
}
|
|
106
|
-
export async function changePullRequest(scope, action, input, github = gh) {
|
|
160
|
+
export async function changePullRequest(scope, action, input, github = gh, find = target) {
|
|
107
161
|
validate(input?.pr);
|
|
108
162
|
if (action !== "rebase" && action !== "merge")
|
|
109
163
|
throw new Error("Invalid pull request action.");
|
|
@@ -111,9 +165,11 @@ export async function changePullRequest(scope, action, input, github = gh) {
|
|
|
111
165
|
throw new Error("Invalid pull request action.");
|
|
112
166
|
if (action === "merge" && !["MERGE", "SQUASH", "REBASE"].includes(input.method ?? ""))
|
|
113
167
|
throw new Error("Invalid merge method.");
|
|
168
|
+
if (action === "rebase" && find !== target)
|
|
169
|
+
throw new Error("Rebase this pull request from an Agent Session on its branch.");
|
|
114
170
|
if (action === "rebase")
|
|
115
171
|
await cleanStack(scope);
|
|
116
|
-
const pr = await target(scope, input.pr, github);
|
|
172
|
+
const pr = await (action === "merge" ? find : target)(scope, input.pr, github);
|
|
117
173
|
if (pr.state !== "OPEN" || pr.headRefOid !== input.headOid || pr.baseBranch !== input.baseBranch)
|
|
118
174
|
throw new Error("The pull request has changed. Reload it before continuing.");
|
|
119
175
|
if (action === "merge") {
|
|
@@ -124,15 +180,7 @@ export async function changePullRequest(scope, action, input, github = gh) {
|
|
|
124
180
|
}
|
|
125
181
|
await git(scope, ["check-ref-format", `refs/heads/${pr.baseBranch}`]);
|
|
126
182
|
const before = await git(scope, ["rev-parse", "HEAD"]);
|
|
127
|
-
|
|
128
|
-
for (const remote of (await git(scope, ["remote"])).split("\n").filter(Boolean)) {
|
|
129
|
-
const url = await git(scope, ["remote", "get-url", remote]);
|
|
130
|
-
const repo = githubRepository(url);
|
|
131
|
-
if (repo?.toLowerCase() === pr.repo.toLowerCase()) {
|
|
132
|
-
baseUrl = url;
|
|
133
|
-
break;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
183
|
+
const baseUrl = (await remoteUrl(scope, pr.repo)).url;
|
|
136
184
|
await git(scope, ["fetch", "--no-tags", baseUrl, `refs/heads/${pr.baseBranch}`]);
|
|
137
185
|
const base = await git(scope, ["rev-parse", "FETCH_HEAD"]);
|
|
138
186
|
const latest = await target(scope, input.pr, github);
|
|
@@ -153,11 +201,11 @@ async function requireThread(scope, pr, thread, github) {
|
|
|
153
201
|
if (data.node?.pullRequest?.id !== pr.id)
|
|
154
202
|
throw new Error("This review thread is not on this pull request. Reload it before continuing.");
|
|
155
203
|
}
|
|
156
|
-
export async function commentPullRequest(scope, input, github = gh) {
|
|
204
|
+
export async function commentPullRequest(scope, input, github = gh, find = target) {
|
|
157
205
|
validate(input?.pr);
|
|
158
206
|
if (typeof input.body !== "string" || !input.body.trim() || (input.threadId !== undefined && !validId(input.threadId)))
|
|
159
207
|
throw new Error("Invalid comment input.");
|
|
160
|
-
const pr = await
|
|
208
|
+
const pr = await find(scope, input.pr, github);
|
|
161
209
|
if (input.threadId !== undefined) {
|
|
162
210
|
await requireThread(scope, pr, input.threadId, github);
|
|
163
211
|
await api(scope, github, "mutation($id:ID!,$body:String!){addPullRequestReviewThreadReply(input:{pullRequestReviewThreadId:$id,body:$body}){comment{id}}}", { id: input.threadId, body: input.body });
|
|
@@ -165,45 +213,45 @@ export async function commentPullRequest(scope, input, github = gh) {
|
|
|
165
213
|
else
|
|
166
214
|
await api(scope, github, "mutation($id:ID!,$body:String!){addComment(input:{subjectId:$id,body:$body}){commentEdge{node{id}}}}", { id: pr.id, body: input.body });
|
|
167
215
|
}
|
|
168
|
-
export async function resolvePullRequestThread(scope, input, github = gh) {
|
|
216
|
+
export async function resolvePullRequestThread(scope, input, github = gh, find = target) {
|
|
169
217
|
validate(input?.pr);
|
|
170
218
|
if (!validId(input.threadId) || typeof input.resolved !== "boolean")
|
|
171
219
|
throw new Error("Invalid thread input.");
|
|
172
|
-
await requireThread(scope, await
|
|
220
|
+
await requireThread(scope, await find(scope, input.pr, github), input.threadId, github);
|
|
173
221
|
const operation = input.resolved ? "resolveReviewThread" : "unresolveReviewThread";
|
|
174
222
|
await api(scope, github, `mutation($id:ID!){${operation}(input:{threadId:$id}){thread{id}}}`, { id: input.threadId });
|
|
175
223
|
}
|
|
176
|
-
export async function editPullRequest(scope, input, github = gh) {
|
|
224
|
+
export async function editPullRequest(scope, input, github = gh, find = target) {
|
|
177
225
|
validate(input?.pr);
|
|
178
226
|
if (typeof input.title !== "string" || !input.title.trim() || typeof input.body !== "string")
|
|
179
227
|
throw new Error("Enter a pull request title.");
|
|
180
|
-
const pr = await
|
|
228
|
+
const pr = await find(scope, input.pr, github);
|
|
181
229
|
await api(scope, github, "mutation($id:ID!,$title:String!,$body:String!){updatePullRequest(input:{pullRequestId:$id,title:$title,body:$body}){pullRequest{id}}}", { id: pr.id, title: input.title, body: input.body });
|
|
182
230
|
}
|
|
183
|
-
export async function setPullRequestDraft(scope, input, github = gh) {
|
|
231
|
+
export async function setPullRequestDraft(scope, input, github = gh, find = target) {
|
|
184
232
|
validate(input?.pr);
|
|
185
233
|
if (typeof input.draft !== "boolean")
|
|
186
234
|
throw new Error("Invalid draft input.");
|
|
187
|
-
const pr = await
|
|
235
|
+
const pr = await find(scope, input.pr, github);
|
|
188
236
|
const operation = input.draft ? "convertPullRequestToDraft" : "markPullRequestReadyForReview";
|
|
189
237
|
await api(scope, github, `mutation($id:ID!){${operation}(input:{pullRequestId:$id}){pullRequest{id}}}`, { id: pr.id });
|
|
190
238
|
}
|
|
191
|
-
export async function rerunPullRequestChecks(scope, input, github = gh) {
|
|
239
|
+
export async function rerunPullRequestChecks(scope, input, github = gh, find = target) {
|
|
192
240
|
validate(input?.pr);
|
|
193
241
|
if (!Number.isSafeInteger(input.runId) || input.runId < 1)
|
|
194
242
|
throw new Error("Invalid run ID.");
|
|
195
|
-
const pr = await
|
|
243
|
+
const pr = await find(scope, input.pr, github);
|
|
196
244
|
const run = JSON.parse(await github(scope, ["api", `repos/${pr.repo}/actions/runs/${input.runId}`]));
|
|
197
245
|
if (run.head_sha !== pr.headRefOid)
|
|
198
246
|
throw new Error("This run is not for the current head of the pull request. Reload it before you re-run checks.");
|
|
199
247
|
await github(scope, ["run", "rerun", String(input.runId), "--failed", "--repo", pr.repo]);
|
|
200
248
|
}
|
|
201
249
|
const checkLogLines = 80;
|
|
202
|
-
export async function checkLog(scope, ref, jobId, github = gh) {
|
|
250
|
+
export async function checkLog(scope, ref, jobId, github = gh, find = target) {
|
|
203
251
|
validate(ref);
|
|
204
252
|
if (!Number.isSafeInteger(jobId) || jobId < 1)
|
|
205
253
|
throw new Error("Invalid job ID.");
|
|
206
|
-
const pr = await
|
|
254
|
+
const pr = await find(scope, ref, github);
|
|
207
255
|
const job = JSON.parse(await github(scope, ["api", `repos/${pr.repo}/actions/jobs/${jobId}`]));
|
|
208
256
|
if (job.head_sha !== pr.headRefOid)
|
|
209
257
|
throw new Error("This job is not for the current head of the pull request. Reload it before you add its log.");
|
|
@@ -223,3 +271,13 @@ export async function checkLog(scope, ref, jobId, github = gh) {
|
|
|
223
271
|
const start = Math.max(0, end - checkLogLines);
|
|
224
272
|
return { text: lines.slice(start, end).join("\n"), truncated: start > 0 || end < lines.length };
|
|
225
273
|
}
|
|
274
|
+
const reviewEvents = ["APPROVE", "REQUEST_CHANGES", "COMMENT"];
|
|
275
|
+
export async function submitReview(scope, input, github = gh, find = target) {
|
|
276
|
+
validate(input?.pr);
|
|
277
|
+
if (!reviewEvents.includes(input.event) || typeof input.body !== "string")
|
|
278
|
+
throw new Error("Invalid review input.");
|
|
279
|
+
if (input.event !== "APPROVE" && !input.body.trim())
|
|
280
|
+
throw new Error("Enter a comment for this review.");
|
|
281
|
+
const pr = await find(scope, input.pr, github);
|
|
282
|
+
await api(scope, github, "mutation($id:ID!,$event:PullRequestReviewEvent!,$body:String){addPullRequestReview(input:{pullRequestId:$id,event:$event,body:$body}){pullRequestReview{id}}}", { id: pr.id, event: input.event, body: input.body });
|
|
283
|
+
}
|
|
@@ -90,17 +90,34 @@ function checks(rollup) {
|
|
|
90
90
|
return "failing";
|
|
91
91
|
return "pending";
|
|
92
92
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const data = await api(scope, github, "query($owner:String!,$name:String!,$branch:String!){repository(owner:$owner,name:$name){pullRequests(headRefName:$branch,first:100,orderBy:{field:UPDATED_AT,direction:DESC}){nodes{id number url title baseRefName headRefOid state isDraft reviewDecision updatedAt closedAt headRepository{id} commits(last:1){nodes{commit{statusCheckRollup{state contexts(first:0){checkRunCountsByState{state count} statusContextCountsByState{state count}}}}}} reviewThreads(first:100){nodes{isResolved}}}}}}", { owner: owner, name: name, branch });
|
|
96
|
-
const matches = data.repository.pullRequests.nodes.filter(pr => pr.headRepository?.id === repository.head.id);
|
|
97
|
-
matches.sort((a, b) => Number(b.state === "OPEN") - Number(a.state === "OPEN") || (b.closedAt ?? b.updatedAt).localeCompare(a.closedAt ?? a.updatedAt));
|
|
98
|
-
const pr = matches[0];
|
|
99
|
-
if (!pr)
|
|
100
|
-
return undefined;
|
|
93
|
+
const candidateFields = "id number url title baseRefName headRefOid baseRefOid headRefName state isDraft reviewDecision updatedAt closedAt headRepository{id} commits(last:1){nodes{commit{statusCheckRollup{state contexts(first:0){checkRunCountsByState{state count} statusContextCountsByState{state count}}}}}} reviewThreads(first:100){nodes{isResolved}}";
|
|
94
|
+
function resolved(repo, pr) {
|
|
101
95
|
return {
|
|
102
|
-
repo
|
|
96
|
+
repo, id: pr.id, number: pr.number, url: pr.url, title: pr.title, baseBranch: pr.baseRefName, headRefOid: pr.headRefOid, baseRefOid: pr.baseRefOid, headRefName: pr.headRefName, headRepository: pr.headRepository, state: pr.state, isDraft: pr.isDraft,
|
|
103
97
|
checks: checks(pr.commits.nodes[0]?.commit.statusCheckRollup), checksCompleted: completed(pr.commits.nodes[0]?.commit.statusCheckRollup?.contexts), reviewDecision: pr.reviewDecision,
|
|
104
98
|
unresolvedThreads: pr.reviewThreads.nodes.filter(thread => !thread.isResolved).length, updatedAt: pr.updatedAt,
|
|
105
99
|
};
|
|
106
100
|
}
|
|
101
|
+
export async function resolvePullRequest(scope, repository, branch, github = gh) {
|
|
102
|
+
const [owner, name] = repository.base.repo.split("/");
|
|
103
|
+
const data = await api(scope, github, `query($owner:String!,$name:String!,$branch:String!){repository(owner:$owner,name:$name){pullRequests(headRefName:$branch,first:100,orderBy:{field:UPDATED_AT,direction:DESC}){nodes{${candidateFields}}}}}`, { owner: owner, name: name, branch });
|
|
104
|
+
const matches = data.repository.pullRequests.nodes.filter(pr => pr.headRepository?.id === repository.head.id);
|
|
105
|
+
matches.sort((a, b) => Number(b.state === "OPEN") - Number(a.state === "OPEN") || (b.closedAt ?? b.updatedAt).localeCompare(a.closedAt ?? a.updatedAt));
|
|
106
|
+
return matches[0] && resolved(repository.base.repo, matches[0]);
|
|
107
|
+
}
|
|
108
|
+
export async function pullRequestByNumber(scope, repo, number, github = gh) {
|
|
109
|
+
const [owner, name] = repo.split("/");
|
|
110
|
+
const data = await api(scope, github, `query($owner:String!,$name:String!,$number:Int!){repository(owner:$owner,name:$name){pullRequest(number:$number){${candidateFields}}}}`, { owner: owner, name: name, number });
|
|
111
|
+
return data.repository.pullRequest ? resolved(repo, data.repository.pullRequest) : undefined;
|
|
112
|
+
}
|
|
113
|
+
export const writers = ["ADMIN", "MAINTAIN", "WRITE"];
|
|
114
|
+
export const mergeSettingsFields = "isArchived viewerPermission mergeCommitAllowed squashMergeAllowed rebaseMergeAllowed";
|
|
115
|
+
export function mergeMethods(repository) {
|
|
116
|
+
if (repository.isArchived || !writers.includes(repository.viewerPermission ?? ""))
|
|
117
|
+
return [];
|
|
118
|
+
return [
|
|
119
|
+
...(repository.mergeCommitAllowed ? ["MERGE"] : []),
|
|
120
|
+
...(repository.squashMergeAllowed ? ["SQUASH"] : []),
|
|
121
|
+
...(repository.rebaseMergeAllowed ? ["REBASE"] : []),
|
|
122
|
+
];
|
|
123
|
+
}
|
package/dist/daemon/runtime.js
CHANGED
|
@@ -11,6 +11,7 @@ import { WorkflowBuilderService } from './workflow-builder.js';
|
|
|
11
11
|
import { workflowCatalogue } from './workflow-routes.js';
|
|
12
12
|
import { WorkflowMcpAuthoringService } from './workflow-mcp-authoring.js';
|
|
13
13
|
import { SessionHost } from './host.js';
|
|
14
|
+
import { includedProjects } from './projects.js';
|
|
14
15
|
import { McpAuth } from './mcp-auth.js';
|
|
15
16
|
import { serve } from './server.js';
|
|
16
17
|
import { ShellRegistry } from './shell.js';
|
|
@@ -50,6 +51,7 @@ export async function startRuntime(options) {
|
|
|
50
51
|
mcpConnections: config.mcpConnections, mcpAuth,
|
|
51
52
|
filesystemIsolationMode: config.filesystemIsolationMode, sandboxSupport: config.sandboxSupport,
|
|
52
53
|
sandboxSharing: config.sandboxSharing, updateSourceBranch: config.updateSourceBranch, projectRoot: config.projectRoot,
|
|
54
|
+
projectPaths: () => includedProjects(config.rawProjectRoot(), config.projectInclude()).map(project => project.path),
|
|
53
55
|
standingAuthorisations: config.standingAuthorisations, allowTool: config.allowTool,
|
|
54
56
|
defaultBackend: config.defaultBackend, defaultModel: config.defaultModel,
|
|
55
57
|
defaultEffort: config.defaultEffort, defaultPermissionMode: config.defaultPermissionMode, autoCompaction: config.autoCompaction, compactionModel: config.compactionModel, summaryModel: config.summaryModel, tourModel: config.tourModel,
|
package/dist/daemon/server.js
CHANGED
|
@@ -551,6 +551,10 @@ ${ICON_LINKS}</head><body><script>window.location.replace(${JSON.stringify(locat
|
|
|
551
551
|
servePresentation(response, options.host, presentationMatch[1], url.searchParams, presentationMatch[2] !== undefined, authentication.kind === "browser" ? options.oidc : undefined, authentication.kind === "browser" ? authentication.sessionId : undefined);
|
|
552
552
|
return;
|
|
553
553
|
}
|
|
554
|
+
if (request.method === "GET" && url.pathname === "/api/attention/events") {
|
|
555
|
+
streamAttention(response, options.host, authentication.kind === "browser" ? options.oidc : undefined, authentication.kind === "browser" ? authentication.sessionId : undefined);
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
554
558
|
const eventsMatch = /^\/api\/sessions\/([^/]+)\/events$/.exec(url.pathname);
|
|
555
559
|
const sessionId = eventsMatch?.[1];
|
|
556
560
|
if (request.method === "GET" && sessionId) {
|
|
@@ -959,6 +963,27 @@ function streamEvents(response, host, sessionId, since, oidc, browserSessionId)
|
|
|
959
963
|
detachAuth?.();
|
|
960
964
|
});
|
|
961
965
|
}
|
|
966
|
+
function streamAttention(response, host, oidc, browserSessionId) {
|
|
967
|
+
response.writeHead(200, {
|
|
968
|
+
"content-type": "text/event-stream",
|
|
969
|
+
"cache-control": "no-store",
|
|
970
|
+
connection: "keep-alive",
|
|
971
|
+
});
|
|
972
|
+
response.flushHeaders();
|
|
973
|
+
const unsubscribe = host.onAttentionRaised((raised) => {
|
|
974
|
+
response.write(`data: ${JSON.stringify(raised)}\n\n`);
|
|
975
|
+
});
|
|
976
|
+
const heartbeat = setInterval(() => response.write(": keepalive\n\n"), 15_000);
|
|
977
|
+
heartbeat.unref();
|
|
978
|
+
const detachAuth = oidc && browserSessionId
|
|
979
|
+
? oidc.registerConnection(browserSessionId, () => response.end())
|
|
980
|
+
: undefined;
|
|
981
|
+
response.on("close", () => {
|
|
982
|
+
clearInterval(heartbeat);
|
|
983
|
+
unsubscribe();
|
|
984
|
+
detachAuth?.();
|
|
985
|
+
});
|
|
986
|
+
}
|
|
962
987
|
/** Bearer access is deliberately independent of OIDC so remote CLI clients keep working. */
|
|
963
988
|
async function authenticateRequest(request, options) {
|
|
964
989
|
if (tokenMatches(options.token, presentedBearer(request)))
|
package/dist/daemon/stack.js
CHANGED
|
@@ -2,9 +2,10 @@ import { commonGitPath, localStack, localStacks } from "./stack-metadata.js";
|
|
|
2
2
|
import { access } from "node:fs/promises";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
|
-
import { localRepository, resolveRepository } from "./repository.js";
|
|
5
|
+
import { localRepository, mergeMethods, mergeSettingsFields, resolveRepository } from "./repository.js";
|
|
6
6
|
import { api, gh } from "./github.js";
|
|
7
7
|
import { head, localBranches, run, GIT_READ_TIMEOUT_MS, GIT_WRITE_TIMEOUT_MS } from "./git.js";
|
|
8
|
+
import { stackMergeBlock } from "../protocol/stack.js";
|
|
8
9
|
async function git(scope, args, write = false) {
|
|
9
10
|
const result = await run(scope, args, write ? GIT_WRITE_TIMEOUT_MS : GIT_READ_TIMEOUT_MS);
|
|
10
11
|
if (!result.ok)
|
|
@@ -67,7 +68,7 @@ export async function stackStatus(scope, github = gh) {
|
|
|
67
68
|
if (stacks.some(stack => stack.trunk.branch === branch))
|
|
68
69
|
return { ...status, notice: trunkNotice };
|
|
69
70
|
try {
|
|
70
|
-
return { ...status, view: parseStack(await runStack(scope, ["view", "--json"], github)) };
|
|
71
|
+
return { ...status, view: await withTracking(scope, parseStack(await runStack(scope, ["view", "--json"], github))) };
|
|
71
72
|
}
|
|
72
73
|
catch (error) {
|
|
73
74
|
if (!notInStack.test(String(error)))
|
|
@@ -79,6 +80,33 @@ export async function stackStatus(scope, github = gh) {
|
|
|
79
80
|
const stacked = new Set(stacks.flatMap(stack => stack.branches.map(member => member.branch)));
|
|
80
81
|
return { ...status, create: { current: branch, ...(trunk ? { trunk } : {}), branches: listed.value, unstacked: listed.value.filter(name => !stacked.has(name)) } };
|
|
81
82
|
}
|
|
83
|
+
async function withTracking(scope, view) {
|
|
84
|
+
const tracking = new Map((await git(scope, ["for-each-ref", "--format=%(refname:short)%00%(upstream)%00%(upstream:track,nobracket)", "refs/heads"])).split("\n").map(line => line.split("\0")).map(([name, upstream, track]) => [name, upstream ? track ?? "" : undefined]));
|
|
85
|
+
for (const branch of view.branches) {
|
|
86
|
+
const track = tracking.get(branch.name);
|
|
87
|
+
if (track === undefined || track === "gone")
|
|
88
|
+
continue;
|
|
89
|
+
branch.ahead = Number(/ahead (\d+)/.exec(track)?.[1] ?? 0);
|
|
90
|
+
branch.behind = Number(/behind (\d+)/.exec(track)?.[1] ?? 0);
|
|
91
|
+
}
|
|
92
|
+
return view;
|
|
93
|
+
}
|
|
94
|
+
export async function stackMergeMethods(scope, view, github = gh) {
|
|
95
|
+
const [owner, name] = (await resolveRepository(scope, view.currentBranch, github)).base.repo.split("/");
|
|
96
|
+
const { repository } = await api(scope, github, `query($owner:String!,$name:String!){repository(owner:$owner,name:$name){${mergeSettingsFields}}}`, { owner: owner, name: name });
|
|
97
|
+
return mergeMethods(repository);
|
|
98
|
+
}
|
|
99
|
+
const mergeFlags = { MERGE: "--merge", SQUASH: "--squash", REBASE: "--rebase" };
|
|
100
|
+
export async function mergeableStack(scope, github = gh) {
|
|
101
|
+
const { view, notice } = await stackStatus(scope, github);
|
|
102
|
+
if (!view)
|
|
103
|
+
throw new Error(notice ?? "This branch is not in a stack.");
|
|
104
|
+
await stackTitles(scope, view, github);
|
|
105
|
+
const block = stackMergeBlock(view);
|
|
106
|
+
if (block)
|
|
107
|
+
throw new Error(block);
|
|
108
|
+
return view;
|
|
109
|
+
}
|
|
82
110
|
const titles = new Map();
|
|
83
111
|
async function readTitles(scope, branch, numbers, github) {
|
|
84
112
|
const [owner, name] = (await resolveRepository(scope, branch, github)).base.repo.split("/");
|
|
@@ -171,7 +199,7 @@ async function validateInit(scope, trunk, branches, github) {
|
|
|
171
199
|
}
|
|
172
200
|
export async function changeStack(scope, input, github = gh) {
|
|
173
201
|
const { action } = input;
|
|
174
|
-
if (!["init", "add", "checkout", "rebase", "continue", "abort", "submit", "sync"].includes(action))
|
|
202
|
+
if (!["init", "add", "checkout", "rebase", "continue", "abort", "submit", "sync", "merge"].includes(action))
|
|
175
203
|
throw new Error("Unknown Stack action.");
|
|
176
204
|
if (action === "continue" || action === "abort") {
|
|
177
205
|
const state = await stackStatus(scope, github);
|
|
@@ -209,6 +237,12 @@ export async function changeStack(scope, input, github = gh) {
|
|
|
209
237
|
args.splice(0, 1, "rebase", `--${action}`);
|
|
210
238
|
if (action === "submit")
|
|
211
239
|
args.push("--auto");
|
|
240
|
+
if (action === "merge") {
|
|
241
|
+
if (!input.method || !Object.hasOwn(mergeFlags, input.method))
|
|
242
|
+
throw new Error("Invalid merge method.");
|
|
243
|
+
await mergeableStack(scope, github);
|
|
244
|
+
args.push("--yes", mergeFlags[input.method]);
|
|
245
|
+
}
|
|
212
246
|
return runStack(scope, args, github);
|
|
213
247
|
}
|
|
214
248
|
export const stackConflictMessage = "Resolve the current gh stack rebase conflicts in this Scope. Inspect the Stack rebase state and conflict files first. Preserve the intended changes and stage only resolved files. Run gh stack rebase --continue only after git diff --name-only --diff-filter=U is empty and all conflicts are resolved. Repeat for further conflicts; stop and report if the intended resolution is unclear. This request permits local conflict repair and Stack rebase continuation only. Do not push, submit, sync, merge, or restructure the stack. Report the result so I can review it before any separate Sync confirmation.";
|
package/dist/daemon/tour.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { head, run, GIT_READ_TIMEOUT_MS } from "./git.js";
|
|
2
2
|
import { gh } from "./github.js";
|
|
3
|
-
import { changes, changesText } from "./changes.js";
|
|
3
|
+
import { changes, changesText, rangeText } from "./changes.js";
|
|
4
4
|
import { resolveRepository } from "./repository.js";
|
|
5
5
|
export const TOUR_INSTRUCTIONS = [
|
|
6
6
|
"Give an in-depth tour of this branch's committed changes, with the diff shown for each change you discuss.",
|
|
@@ -31,6 +31,12 @@ export async function tourInput(scope, github = gh) {
|
|
|
31
31
|
input: `Branch: ${branch.value.name}\nBase: ${listed.base}\n${await changesText(scope, "branch", undefined, undefined, github)}`,
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
+
export async function pullRequestTourInput(scope, range, pr) {
|
|
35
|
+
const text = await rangeText(scope, range.base, range.head);
|
|
36
|
+
if (!text)
|
|
37
|
+
throw new Error("This pull request has no committed changes to tour.");
|
|
38
|
+
return `Branch: ${pr.headRefName}\nBase: ${pr.baseRefName}\n${text}`;
|
|
39
|
+
}
|
|
34
40
|
export function tourText(raw) {
|
|
35
41
|
try {
|
|
36
42
|
const parsed = JSON.parse(raw);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync, mkdirSync } from 'node:fs';
|
|
1
|
+
import { existsSync, mkdirSync, realpathSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import { isSea } from 'node:sea';
|
|
@@ -27,7 +27,8 @@ export class WorkflowEnvironment {
|
|
|
27
27
|
mode;
|
|
28
28
|
stateDir;
|
|
29
29
|
readablePaths;
|
|
30
|
-
|
|
30
|
+
scopeReadOnly;
|
|
31
|
+
constructor(host, ownerId, scope, connectionIds, mode, stateDir, readablePaths = [], scopeReadOnly = false) {
|
|
31
32
|
this.host = host;
|
|
32
33
|
this.ownerId = ownerId;
|
|
33
34
|
this.scope = scope;
|
|
@@ -35,6 +36,7 @@ export class WorkflowEnvironment {
|
|
|
35
36
|
this.mode = mode;
|
|
36
37
|
this.stateDir = stateDir;
|
|
37
38
|
this.readablePaths = readablePaths;
|
|
39
|
+
this.scopeReadOnly = scopeReadOnly;
|
|
38
40
|
}
|
|
39
41
|
async prepare(signal) {
|
|
40
42
|
this.lifetime.signal.throwIfAborted();
|
|
@@ -79,7 +81,7 @@ export class WorkflowEnvironment {
|
|
|
79
81
|
if (roots && !roots.slice(0, 3).some(root => this.scope === root || this.scope.startsWith(root + '/')))
|
|
80
82
|
throw new Error('Scope is outside shared Sandbox roots');
|
|
81
83
|
const attachment = shared ? this.host.scheduledSandboxMounts(this.scope) : { writable: [], readable: [] };
|
|
82
|
-
const mounts = sandboxMounts([...(roots ?? [this.scope, this.stateDir]), ...attachment.writable], [packageRoot, ...this.readablePaths, ...nodeExecutionAssets([bundle]), ...attachment.readable]);
|
|
84
|
+
const mounts = sandboxMounts([...(roots ?? (this.scopeReadOnly ? [this.stateDir] : [this.scope, this.stateDir])), ...attachment.writable], [...(this.scopeReadOnly ? [this.scope] : []), packageRoot, ...this.readablePaths, ...nodeExecutionAssets([bundle]), ...attachment.readable]);
|
|
83
85
|
if (shared) {
|
|
84
86
|
const lease = await shared.acquire(support.provider, roots[0], mounts, signal);
|
|
85
87
|
this.sandbox = lease.sandbox;
|
|
@@ -87,7 +89,7 @@ export class WorkflowEnvironment {
|
|
|
87
89
|
}
|
|
88
90
|
else {
|
|
89
91
|
this.ownedProvider = support.provider;
|
|
90
|
-
this.sandbox = await createSandbox(support.provider, { name: `flow-${this.ownerId}`, workspace: this.scope, mounts, env: {} }, join(this.stateDir, 'sandbox.json'), signal);
|
|
92
|
+
this.sandbox = await createSandbox(support.provider, { name: `flow-${this.ownerId}`, workspace: this.scopeReadOnly ? realpathSync(this.stateDir) : this.scope, mounts, env: {} }, join(this.stateDir, 'sandbox.json'), signal);
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
95
|
signal.throwIfAborted();
|
|
@@ -168,7 +168,7 @@ export class WorkflowExecutionService {
|
|
|
168
168
|
this.code = {};
|
|
169
169
|
this.ready = (async () => {
|
|
170
170
|
try {
|
|
171
|
-
const executors = await createCodeExecutors({ ...this.filesystemPolicy(), sandbox: (sessionId) => this.host.workflowSandbox(sessionId), isolationMode: options.isolationMode, runtimePath: this.runtimePath, nodePath: options.nodePath ?? '', resolveSecret: async (name, signal) => this.secrets.resolve(name, signal) });
|
|
171
|
+
const executors = await createCodeExecutors({ ...this.filesystemPolicy(), sandbox: (sessionId) => this.host.workflowSandbox(sessionId), readOnly: (sessionId) => this.host.isReadOnly(sessionId), isolationMode: options.isolationMode, runtimePath: this.runtimePath, nodePath: options.nodePath ?? '', resolveSecret: async (name, signal) => this.secrets.resolve(name, signal) });
|
|
172
172
|
if (key !== this.runtimeKey)
|
|
173
173
|
return;
|
|
174
174
|
this.code = executors;
|
|
@@ -307,7 +307,7 @@ export async function prepareFilesystemIsolation(options) {
|
|
|
307
307
|
const privateHome = join(scratch, "home");
|
|
308
308
|
mkdirSync(join(privateHome, ".pi/agent"), { recursive: true, mode: 0o700 });
|
|
309
309
|
mkdirSync(join(privateHome, ".claude"), { mode: 0o700 });
|
|
310
|
-
args.push("--bind-fd", pinned(scope, options.expectedScopeIdentity), scope, "--dir", virtualRoot, "--bind-fd", pinned(privateHome), virtualHome, "--dir", `${virtualRoot}/run`, "--bind-fd", pinned(backend), virtualState);
|
|
310
|
+
args.push(options.scopeReadOnly ? "--ro-bind-fd" : "--bind-fd", pinned(scope, options.expectedScopeIdentity), scope, "--dir", virtualRoot, "--bind-fd", pinned(privateHome), virtualHome, "--dir", `${virtualRoot}/run`, "--bind-fd", pinned(backend), virtualState);
|
|
311
311
|
for (const path of directoryMasks)
|
|
312
312
|
args.push("--remount-ro", path);
|
|
313
313
|
const stage = (source, destination) => {
|
package/dist/protocol/spend.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const SPEND_SOURCES = ["session", "workflow", "naming", "publish", "builder"];
|
|
1
|
+
export const SPEND_SOURCES = ["session", "workflow", "naming", "publish", "tour", "builder"];
|
|
2
2
|
export const SPEND_WINDOWS = ["day", "week", "month", "lifetime"];
|
package/dist/protocol/stack.js
CHANGED
|
@@ -1 +1,14 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export function stackMergeBlock(view) {
|
|
2
|
+
const open = view.branches.filter(branch => !branch.isMerged);
|
|
3
|
+
if (!open.length)
|
|
4
|
+
return "All pull requests of this stack are merged.";
|
|
5
|
+
for (const { name, pr } of open) {
|
|
6
|
+
if (!pr)
|
|
7
|
+
return `${name} has no pull request. Submit the stack first.`;
|
|
8
|
+
if (pr.state !== "OPEN")
|
|
9
|
+
return `#${pr.number} is ${pr.state.toLowerCase()}.`;
|
|
10
|
+
if (pr.isDraft)
|
|
11
|
+
return `#${pr.number} is a draft. Mark it ready for review first.`;
|
|
12
|
+
}
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
@@ -113,7 +113,8 @@ export async function createCodeExecutors(options) {
|
|
|
113
113
|
CLAUDE_CONFIG_DIR: process.env.CLAUDE_CONFIG_DIR };
|
|
114
114
|
const launch = sandbox?.command(scope, ['/bin/bash', ...args], environment);
|
|
115
115
|
const isolation = isolationEnabled && !sandbox ? await prepareFilesystemIsolation({ scope, expectedScope: resolve(context.scope),
|
|
116
|
-
...stateRoot, command: '/bin/bash', args, env, readablePaths: [nodePath, runtimePath], credentials: 'none'
|
|
116
|
+
...stateRoot, command: '/bin/bash', args, env, readablePaths: [nodePath, runtimePath], credentials: 'none',
|
|
117
|
+
scopeReadOnly: context.sessionId !== undefined && !!options.readOnly?.(context.sessionId) }) : undefined;
|
|
117
118
|
const release = sandbox?.hold();
|
|
118
119
|
try {
|
|
119
120
|
context.signal.throwIfAborted();
|