poe-code 3.0.268 → 3.0.270
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/cli/commands/agent.js +3 -31
- package/dist/cli/commands/agent.js.map +1 -1
- package/dist/index.js +297 -294
- package/dist/index.js.map +4 -4
- package/dist/metafile.json +1 -1
- package/dist/providers/gemini-cli.js +10 -8
- package/dist/providers/gemini-cli.js.map +2 -2
- package/dist/providers/poe-agent.js +277 -250
- package/dist/providers/poe-agent.js.map +4 -4
- package/package.json +1 -1
- package/packages/agent-code-review/dist/config.js +15 -1
- package/packages/agent-code-review/dist/document-schemas.js +1 -4
- package/packages/agent-code-review/dist/mcp.js +16 -4
- package/packages/agent-code-review/dist/review-store.js +9 -2
- package/packages/agent-spawn/dist/acp/session-update-converter.d.ts +7 -4
- package/packages/agent-spawn/dist/acp/session-update-converter.js +16 -14
- package/packages/agent-spawn/dist/acp/types.d.ts +15 -3
- package/packages/agent-spawn/dist/index.d.ts +2 -0
- package/packages/agent-spawn/dist/index.js +1 -0
package/dist/index.js
CHANGED
|
@@ -32759,7 +32759,7 @@ function createToolRenderState() {
|
|
|
32759
32759
|
}
|
|
32760
32760
|
function toRenderKind(kind) {
|
|
32761
32761
|
if (kind === "execute") return "exec";
|
|
32762
|
-
if (kind === "write") return "edit";
|
|
32762
|
+
if (kind === "write" || kind === "edit") return "edit";
|
|
32763
32763
|
if (kind === "read") return "read";
|
|
32764
32764
|
return "other";
|
|
32765
32765
|
}
|
|
@@ -32818,15 +32818,17 @@ function sessionUpdateToEvents(update, state) {
|
|
|
32818
32818
|
return [];
|
|
32819
32819
|
}
|
|
32820
32820
|
state.startedToolCalls.add(update.toolCallId);
|
|
32821
|
-
return [
|
|
32822
|
-
|
|
32823
|
-
|
|
32824
|
-
|
|
32825
|
-
|
|
32826
|
-
|
|
32821
|
+
return [
|
|
32822
|
+
{
|
|
32823
|
+
event: "tool_start",
|
|
32824
|
+
kind: renderKind,
|
|
32825
|
+
title: title2,
|
|
32826
|
+
id: update.toolCallId
|
|
32827
|
+
}
|
|
32828
|
+
];
|
|
32827
32829
|
}
|
|
32828
32830
|
if (update.sessionUpdate === "tool_call_update") {
|
|
32829
|
-
const renderKind =
|
|
32831
|
+
const renderKind = (update.kind == null ? void 0 : toRenderKind(update.kind)) || state.toolCallKinds.get(update.toolCallId) || "other";
|
|
32830
32832
|
state.toolCallKinds.set(update.toolCallId, renderKind);
|
|
32831
32833
|
const events = [];
|
|
32832
32834
|
const toolTitle = toToolTitle(
|
|
@@ -35608,6 +35610,7 @@ var init_src17 = __esm({
|
|
|
35608
35610
|
init_spawn_interactive();
|
|
35609
35611
|
init_autonomous();
|
|
35610
35612
|
init_renderer2();
|
|
35613
|
+
init_session_update_converter();
|
|
35611
35614
|
init_replay();
|
|
35612
35615
|
init_spawn();
|
|
35613
35616
|
init_spawn_acp();
|
|
@@ -52499,6 +52502,252 @@ var init_config_scope2 = __esm({
|
|
|
52499
52502
|
}
|
|
52500
52503
|
});
|
|
52501
52504
|
|
|
52505
|
+
// packages/agent-code-review/src/document-schemas.ts
|
|
52506
|
+
import { basename as basename3 } from "node:path";
|
|
52507
|
+
import { parse as load, stringify as stringify3 } from "yaml";
|
|
52508
|
+
function requireSafeDocumentSegment(value, field) {
|
|
52509
|
+
if (typeof value !== "string" || value.trim() !== value || value.normalize("NFKC") !== value || !SAFE_SEGMENT_RE.test(value) || value.startsWith(".") || value === "." || value === "..") {
|
|
52510
|
+
throw new Error(`${field} must be a safe path segment.`);
|
|
52511
|
+
}
|
|
52512
|
+
return value;
|
|
52513
|
+
}
|
|
52514
|
+
function requireGitHubActorName(value, field) {
|
|
52515
|
+
if (typeof value !== "string" || !SAFE_GITHUB_ACTOR_RE.test(value)) {
|
|
52516
|
+
throw new Error(`${field} must be a safe GitHub actor name.`);
|
|
52517
|
+
}
|
|
52518
|
+
return value;
|
|
52519
|
+
}
|
|
52520
|
+
function parseCodeReviewProfileMarkdown(content, filePath) {
|
|
52521
|
+
const parsed = parseOptionalFrontmatter(content, filePath);
|
|
52522
|
+
if (!parsed.frontmatter) {
|
|
52523
|
+
return { content: parsed.body };
|
|
52524
|
+
}
|
|
52525
|
+
const metadata = requireMapping(parsed.frontmatter, filePath, "frontmatter");
|
|
52526
|
+
requireOnlyFields(metadata, filePath, "frontmatter", ["version", "name"]);
|
|
52527
|
+
requireVersion(metadata.version, filePath, "frontmatter.version");
|
|
52528
|
+
const name = requireSafeDocumentSegment(metadata.name, `${filePath}: frontmatter.name`);
|
|
52529
|
+
if (basename3(filePath, ".md") !== name) {
|
|
52530
|
+
throw invalidField(filePath, "frontmatter.name", "must match the filename");
|
|
52531
|
+
}
|
|
52532
|
+
return { content: parsed.body, metadata: { version: 1, name } };
|
|
52533
|
+
}
|
|
52534
|
+
function parseCodeReviewPromptMarkdown(content, filePath, role) {
|
|
52535
|
+
const parsed = parseOptionalFrontmatter(content, filePath);
|
|
52536
|
+
if (!parsed.frontmatter) {
|
|
52537
|
+
return { content: parsed.body };
|
|
52538
|
+
}
|
|
52539
|
+
const metadata = requireMapping(parsed.frontmatter, filePath, "frontmatter");
|
|
52540
|
+
requireOnlyFields(metadata, filePath, "frontmatter", ["version", "role"]);
|
|
52541
|
+
requireVersion(metadata.version, filePath, "frontmatter.version");
|
|
52542
|
+
if (!CODE_REVIEW_PROMPT_ROLES.includes(metadata.role)) {
|
|
52543
|
+
throw invalidField(filePath, "frontmatter.role", "is not a supported role");
|
|
52544
|
+
}
|
|
52545
|
+
const promptRole = metadata.role;
|
|
52546
|
+
if (role !== void 0 && promptRole !== role) {
|
|
52547
|
+
throw invalidField(filePath, "frontmatter.role", `must equal ${role}`);
|
|
52548
|
+
}
|
|
52549
|
+
return { content: parsed.body, metadata: { version: 1, role: promptRole } };
|
|
52550
|
+
}
|
|
52551
|
+
function parseCodeReviewIngestSource(content, filePath = "code-review ingest source.yaml") {
|
|
52552
|
+
try {
|
|
52553
|
+
const source = requireMapping(load(content), filePath, "document");
|
|
52554
|
+
requireOnlyFields(source, filePath, "document", [
|
|
52555
|
+
"version",
|
|
52556
|
+
"username",
|
|
52557
|
+
"repos",
|
|
52558
|
+
"fetched_at",
|
|
52559
|
+
"output_profile_path",
|
|
52560
|
+
"pagination",
|
|
52561
|
+
"rate_limit"
|
|
52562
|
+
]);
|
|
52563
|
+
requireVersion(source.version, filePath, "version");
|
|
52564
|
+
const username = requireGitHubActorName(source.username, `${filePath}: username`);
|
|
52565
|
+
if (!Array.isArray(source.repos) || source.repos.length === 0) {
|
|
52566
|
+
throw invalidField(filePath, "repos", "must be a non-empty array");
|
|
52567
|
+
}
|
|
52568
|
+
const repos = source.repos.map((repo, index) => requireRepo(repo, filePath, `repos[${index}]`));
|
|
52569
|
+
const fetchedAt = requireDate(source.fetched_at, filePath, "fetched_at");
|
|
52570
|
+
if (typeof source.output_profile_path !== "string" || !source.output_profile_path) {
|
|
52571
|
+
throw invalidField(filePath, "output_profile_path", "must be a non-empty string");
|
|
52572
|
+
}
|
|
52573
|
+
const pagination = requireMapping(source.pagination, filePath, "pagination");
|
|
52574
|
+
requireOnlyFields(pagination, filePath, "pagination", [
|
|
52575
|
+
"partial",
|
|
52576
|
+
"comments_written",
|
|
52577
|
+
"resume_endpoint"
|
|
52578
|
+
]);
|
|
52579
|
+
if (typeof pagination.partial !== "boolean") {
|
|
52580
|
+
throw invalidField(filePath, "pagination.partial", "must be a boolean");
|
|
52581
|
+
}
|
|
52582
|
+
const commentsWritten = requireNonNegativeInteger(
|
|
52583
|
+
pagination.comments_written,
|
|
52584
|
+
filePath,
|
|
52585
|
+
"pagination.comments_written"
|
|
52586
|
+
);
|
|
52587
|
+
const resumeEndpoint = optionalString(
|
|
52588
|
+
pagination.resume_endpoint,
|
|
52589
|
+
filePath,
|
|
52590
|
+
"pagination.resume_endpoint"
|
|
52591
|
+
);
|
|
52592
|
+
let rateLimit = null;
|
|
52593
|
+
if (source.rate_limit !== null) {
|
|
52594
|
+
const rate = requireMapping(source.rate_limit, filePath, "rate_limit");
|
|
52595
|
+
requireOnlyFields(rate, filePath, "rate_limit", [
|
|
52596
|
+
"repo",
|
|
52597
|
+
"limit",
|
|
52598
|
+
"remaining",
|
|
52599
|
+
"reset_at",
|
|
52600
|
+
"retry_after",
|
|
52601
|
+
"partial_results",
|
|
52602
|
+
"reason"
|
|
52603
|
+
]);
|
|
52604
|
+
const reason = optionalString(rate.reason, filePath, "rate_limit.reason");
|
|
52605
|
+
if (reason !== void 0 && !["low_remaining", "primary", "secondary"].includes(
|
|
52606
|
+
reason
|
|
52607
|
+
)) {
|
|
52608
|
+
throw invalidField(filePath, "rate_limit.reason", "is not supported");
|
|
52609
|
+
}
|
|
52610
|
+
rateLimit = {
|
|
52611
|
+
repo: requireRepo(rate.repo, filePath, "rate_limit.repo"),
|
|
52612
|
+
limit: rate.limit === null || rate.limit === void 0 ? null : requireNonNegativeInteger(rate.limit, filePath, "rate_limit.limit"),
|
|
52613
|
+
remaining: rate.remaining === null ? null : requireNonNegativeInteger(rate.remaining, filePath, "rate_limit.remaining"),
|
|
52614
|
+
resetAt: rate.reset_at === null ? null : requireDate(rate.reset_at, filePath, "rate_limit.reset_at"),
|
|
52615
|
+
retryAfter: rate.retry_after === null || rate.retry_after === void 0 ? null : optionalString(rate.retry_after, filePath, "rate_limit.retry_after") ?? null,
|
|
52616
|
+
partialResults: requireNonNegativeInteger(
|
|
52617
|
+
rate.partial_results,
|
|
52618
|
+
filePath,
|
|
52619
|
+
"rate_limit.partial_results"
|
|
52620
|
+
),
|
|
52621
|
+
reason: reason ?? "low_remaining"
|
|
52622
|
+
};
|
|
52623
|
+
}
|
|
52624
|
+
return {
|
|
52625
|
+
version: 1,
|
|
52626
|
+
username,
|
|
52627
|
+
repos,
|
|
52628
|
+
fetchedAt,
|
|
52629
|
+
outputProfilePath: source.output_profile_path,
|
|
52630
|
+
pagination: {
|
|
52631
|
+
partial: pagination.partial,
|
|
52632
|
+
commentsWritten,
|
|
52633
|
+
...resumeEndpoint === void 0 ? {} : { resumeEndpoint }
|
|
52634
|
+
},
|
|
52635
|
+
rateLimit
|
|
52636
|
+
};
|
|
52637
|
+
} catch (error3) {
|
|
52638
|
+
if (error3 instanceof Error && error3.message.startsWith(`${filePath}:`)) {
|
|
52639
|
+
throw error3;
|
|
52640
|
+
}
|
|
52641
|
+
throw new Error(`${filePath}: invalid YAML: ${errorMessage3(error3)}`);
|
|
52642
|
+
}
|
|
52643
|
+
}
|
|
52644
|
+
function serializeCodeReviewIngestSource(source, filePath = "code-review ingest source.yaml") {
|
|
52645
|
+
const content = stringify3(
|
|
52646
|
+
{
|
|
52647
|
+
version: source.version,
|
|
52648
|
+
username: source.username,
|
|
52649
|
+
repos: source.repos,
|
|
52650
|
+
fetched_at: source.fetchedAt,
|
|
52651
|
+
pagination: {
|
|
52652
|
+
partial: source.pagination.partial,
|
|
52653
|
+
comments_written: source.pagination.commentsWritten,
|
|
52654
|
+
...source.pagination.resumeEndpoint === void 0 ? {} : { resume_endpoint: source.pagination.resumeEndpoint }
|
|
52655
|
+
},
|
|
52656
|
+
rate_limit: source.rateLimit === null ? null : {
|
|
52657
|
+
repo: source.rateLimit.repo,
|
|
52658
|
+
limit: source.rateLimit.limit,
|
|
52659
|
+
remaining: source.rateLimit.remaining,
|
|
52660
|
+
reset_at: source.rateLimit.resetAt,
|
|
52661
|
+
retry_after: source.rateLimit.retryAfter,
|
|
52662
|
+
partial_results: source.rateLimit.partialResults,
|
|
52663
|
+
reason: source.rateLimit.reason
|
|
52664
|
+
},
|
|
52665
|
+
output_profile_path: source.outputProfilePath
|
|
52666
|
+
},
|
|
52667
|
+
{ aliasDuplicateObjects: false, lineWidth: 0 }
|
|
52668
|
+
);
|
|
52669
|
+
parseCodeReviewIngestSource(content, filePath);
|
|
52670
|
+
return content;
|
|
52671
|
+
}
|
|
52672
|
+
function parseOptionalFrontmatter(content, filePath) {
|
|
52673
|
+
const match = content.match(FRONTMATTER_RE);
|
|
52674
|
+
if (!match) {
|
|
52675
|
+
return { body: content };
|
|
52676
|
+
}
|
|
52677
|
+
try {
|
|
52678
|
+
return { frontmatter: load(match[1]), body: match[2] };
|
|
52679
|
+
} catch (error3) {
|
|
52680
|
+
throw new Error(`${filePath}: invalid frontmatter YAML: ${errorMessage3(error3)}`);
|
|
52681
|
+
}
|
|
52682
|
+
}
|
|
52683
|
+
function requireMapping(value, filePath, field) {
|
|
52684
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
52685
|
+
throw invalidField(filePath, field, "must be a YAML mapping");
|
|
52686
|
+
}
|
|
52687
|
+
return value;
|
|
52688
|
+
}
|
|
52689
|
+
function requireVersion(value, filePath, field) {
|
|
52690
|
+
if (value !== 1) {
|
|
52691
|
+
throw invalidField(filePath, field, "must equal 1");
|
|
52692
|
+
}
|
|
52693
|
+
}
|
|
52694
|
+
function requireOnlyFields(value, filePath, field, allowedFields) {
|
|
52695
|
+
const allowed = new Set(allowedFields);
|
|
52696
|
+
for (const key2 of Object.keys(value)) {
|
|
52697
|
+
if (!allowed.has(key2)) {
|
|
52698
|
+
throw invalidField(filePath, `${field}.${key2}`, "is not supported");
|
|
52699
|
+
}
|
|
52700
|
+
}
|
|
52701
|
+
}
|
|
52702
|
+
function requireRepo(value, filePath, field) {
|
|
52703
|
+
if (typeof value !== "string" || !/^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/.test(value)) {
|
|
52704
|
+
throw invalidField(filePath, field, "must be a safe owner/repository name");
|
|
52705
|
+
}
|
|
52706
|
+
return value;
|
|
52707
|
+
}
|
|
52708
|
+
function requireDate(value, filePath, field) {
|
|
52709
|
+
if (typeof value !== "string" || Number.isNaN(Date.parse(value))) {
|
|
52710
|
+
throw invalidField(filePath, field, "must be a valid timestamp");
|
|
52711
|
+
}
|
|
52712
|
+
return value;
|
|
52713
|
+
}
|
|
52714
|
+
function requireNonNegativeInteger(value, filePath, field) {
|
|
52715
|
+
if (!Number.isSafeInteger(value) || value < 0) {
|
|
52716
|
+
throw invalidField(filePath, field, "must be a non-negative integer");
|
|
52717
|
+
}
|
|
52718
|
+
return value;
|
|
52719
|
+
}
|
|
52720
|
+
function optionalString(value, filePath, field) {
|
|
52721
|
+
if (value === void 0) {
|
|
52722
|
+
return void 0;
|
|
52723
|
+
}
|
|
52724
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
52725
|
+
throw invalidField(filePath, field, "must be a non-empty string");
|
|
52726
|
+
}
|
|
52727
|
+
return value;
|
|
52728
|
+
}
|
|
52729
|
+
function invalidField(filePath, field, reason) {
|
|
52730
|
+
return new Error(`${filePath}: ${field} ${reason}.`);
|
|
52731
|
+
}
|
|
52732
|
+
function errorMessage3(error3) {
|
|
52733
|
+
return error3 instanceof Error ? error3.message : String(error3);
|
|
52734
|
+
}
|
|
52735
|
+
var CODE_REVIEW_PROMPT_ROLES, FRONTMATTER_RE, SAFE_SEGMENT_RE, SAFE_GITHUB_ACTOR_RE;
|
|
52736
|
+
var init_document_schemas = __esm({
|
|
52737
|
+
"packages/agent-code-review/src/document-schemas.ts"() {
|
|
52738
|
+
"use strict";
|
|
52739
|
+
CODE_REVIEW_PROMPT_ROLES = [
|
|
52740
|
+
"orchestrator",
|
|
52741
|
+
"subagent",
|
|
52742
|
+
"agent",
|
|
52743
|
+
"profile-synthesis"
|
|
52744
|
+
];
|
|
52745
|
+
FRONTMATTER_RE = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)([\s\S]*)$/;
|
|
52746
|
+
SAFE_SEGMENT_RE = /^[A-Za-z0-9._-]+$/;
|
|
52747
|
+
SAFE_GITHUB_ACTOR_RE = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?$/;
|
|
52748
|
+
}
|
|
52749
|
+
});
|
|
52750
|
+
|
|
52502
52751
|
// packages/agent-code-review/src/error-codes.ts
|
|
52503
52752
|
function hasOwnErrorCode14(error3, code) {
|
|
52504
52753
|
return error3 instanceof Error && Object.prototype.hasOwnProperty.call(error3, "code") && error3.code === code;
|
|
@@ -53638,255 +53887,6 @@ var init_src25 = __esm({
|
|
|
53638
53887
|
}
|
|
53639
53888
|
});
|
|
53640
53889
|
|
|
53641
|
-
// packages/agent-code-review/src/document-schemas.ts
|
|
53642
|
-
import { basename as basename3 } from "node:path";
|
|
53643
|
-
import { parse as load, stringify as stringify3 } from "yaml";
|
|
53644
|
-
function requireSafeDocumentSegment(value, field) {
|
|
53645
|
-
if (typeof value !== "string" || value.trim() !== value || value.normalize("NFKC") !== value || !SAFE_SEGMENT_RE.test(value) || value.startsWith(".") || value === "." || value === "..") {
|
|
53646
|
-
throw new Error(`${field} must be a safe path segment.`);
|
|
53647
|
-
}
|
|
53648
|
-
return value;
|
|
53649
|
-
}
|
|
53650
|
-
function requireGitHubActorName(value, field) {
|
|
53651
|
-
if (typeof value !== "string" || !SAFE_GITHUB_ACTOR_RE.test(value)) {
|
|
53652
|
-
throw new Error(`${field} must be a safe GitHub actor name.`);
|
|
53653
|
-
}
|
|
53654
|
-
return value;
|
|
53655
|
-
}
|
|
53656
|
-
function parseCodeReviewProfileMarkdown(content, filePath) {
|
|
53657
|
-
const parsed = parseOptionalFrontmatter(content, filePath);
|
|
53658
|
-
if (!parsed.frontmatter) {
|
|
53659
|
-
return { content: parsed.body };
|
|
53660
|
-
}
|
|
53661
|
-
const metadata = requireMapping(parsed.frontmatter, filePath, "frontmatter");
|
|
53662
|
-
requireOnlyFields(metadata, filePath, "frontmatter", ["version", "name"]);
|
|
53663
|
-
requireVersion(metadata.version, filePath, "frontmatter.version");
|
|
53664
|
-
const name = requireSafeDocumentSegment(metadata.name, `${filePath}: frontmatter.name`);
|
|
53665
|
-
if (basename3(filePath, ".md") !== name) {
|
|
53666
|
-
throw invalidField(filePath, "frontmatter.name", "must match the filename");
|
|
53667
|
-
}
|
|
53668
|
-
return { content: parsed.body, metadata: { version: 1, name } };
|
|
53669
|
-
}
|
|
53670
|
-
function parseCodeReviewPromptMarkdown(content, filePath, role) {
|
|
53671
|
-
const parsed = parseOptionalFrontmatter(content, filePath);
|
|
53672
|
-
if (!parsed.frontmatter) {
|
|
53673
|
-
return { content: parsed.body };
|
|
53674
|
-
}
|
|
53675
|
-
const metadata = requireMapping(parsed.frontmatter, filePath, "frontmatter");
|
|
53676
|
-
requireOnlyFields(metadata, filePath, "frontmatter", ["version", "role"]);
|
|
53677
|
-
requireVersion(metadata.version, filePath, "frontmatter.version");
|
|
53678
|
-
if (!CODE_REVIEW_PROMPT_ROLES.includes(metadata.role)) {
|
|
53679
|
-
throw invalidField(filePath, "frontmatter.role", "is not a supported role");
|
|
53680
|
-
}
|
|
53681
|
-
const promptRole = metadata.role;
|
|
53682
|
-
if (role !== void 0 && promptRole !== role) {
|
|
53683
|
-
throw invalidField(filePath, "frontmatter.role", `must equal ${role}`);
|
|
53684
|
-
}
|
|
53685
|
-
return { content: parsed.body, metadata: { version: 1, role: promptRole } };
|
|
53686
|
-
}
|
|
53687
|
-
function parseCodeReviewIngestSource(content, filePath = "code-review ingest source.yaml") {
|
|
53688
|
-
try {
|
|
53689
|
-
const source = requireMapping(load(content), filePath, "document");
|
|
53690
|
-
requireOnlyFields(source, filePath, "document", [
|
|
53691
|
-
"version",
|
|
53692
|
-
"username",
|
|
53693
|
-
"repos",
|
|
53694
|
-
"fetched_at",
|
|
53695
|
-
"output_profile_path",
|
|
53696
|
-
"pagination",
|
|
53697
|
-
"rate_limit"
|
|
53698
|
-
]);
|
|
53699
|
-
requireVersion(source.version, filePath, "version");
|
|
53700
|
-
const username = requireGitHubActorName(source.username, `${filePath}: username`);
|
|
53701
|
-
if (!Array.isArray(source.repos) || source.repos.length === 0) {
|
|
53702
|
-
throw invalidField(filePath, "repos", "must be a non-empty array");
|
|
53703
|
-
}
|
|
53704
|
-
const repos = source.repos.map((repo, index) => requireRepo(repo, filePath, `repos[${index}]`));
|
|
53705
|
-
const fetchedAt = requireDate(source.fetched_at, filePath, "fetched_at");
|
|
53706
|
-
if (typeof source.output_profile_path !== "string" || !source.output_profile_path) {
|
|
53707
|
-
throw invalidField(filePath, "output_profile_path", "must be a non-empty string");
|
|
53708
|
-
}
|
|
53709
|
-
const pagination = requireMapping(source.pagination, filePath, "pagination");
|
|
53710
|
-
requireOnlyFields(pagination, filePath, "pagination", [
|
|
53711
|
-
"partial",
|
|
53712
|
-
"comments_written",
|
|
53713
|
-
"resume_endpoint"
|
|
53714
|
-
]);
|
|
53715
|
-
if (typeof pagination.partial !== "boolean") {
|
|
53716
|
-
throw invalidField(filePath, "pagination.partial", "must be a boolean");
|
|
53717
|
-
}
|
|
53718
|
-
const commentsWritten = requireNonNegativeInteger(
|
|
53719
|
-
pagination.comments_written,
|
|
53720
|
-
filePath,
|
|
53721
|
-
"pagination.comments_written"
|
|
53722
|
-
);
|
|
53723
|
-
const resumeEndpoint = optionalString(
|
|
53724
|
-
pagination.resume_endpoint,
|
|
53725
|
-
filePath,
|
|
53726
|
-
"pagination.resume_endpoint"
|
|
53727
|
-
);
|
|
53728
|
-
let rateLimit = null;
|
|
53729
|
-
if (source.rate_limit !== null) {
|
|
53730
|
-
const rate = requireMapping(source.rate_limit, filePath, "rate_limit");
|
|
53731
|
-
requireOnlyFields(rate, filePath, "rate_limit", [
|
|
53732
|
-
"repo",
|
|
53733
|
-
"limit",
|
|
53734
|
-
"remaining",
|
|
53735
|
-
"reset_at",
|
|
53736
|
-
"retry_after",
|
|
53737
|
-
"partial_results",
|
|
53738
|
-
"reason"
|
|
53739
|
-
]);
|
|
53740
|
-
const reason = optionalString(rate.reason, filePath, "rate_limit.reason");
|
|
53741
|
-
if (reason !== void 0 && !["low_remaining", "primary", "secondary"].includes(
|
|
53742
|
-
reason
|
|
53743
|
-
)) {
|
|
53744
|
-
throw invalidField(filePath, "rate_limit.reason", "is not supported");
|
|
53745
|
-
}
|
|
53746
|
-
rateLimit = {
|
|
53747
|
-
repo: requireRepo(rate.repo, filePath, "rate_limit.repo"),
|
|
53748
|
-
limit: rate.limit === null || rate.limit === void 0 ? null : requireNonNegativeInteger(rate.limit, filePath, "rate_limit.limit"),
|
|
53749
|
-
remaining: rate.remaining === null ? null : requireNonNegativeInteger(rate.remaining, filePath, "rate_limit.remaining"),
|
|
53750
|
-
resetAt: rate.reset_at === null ? null : requireDate(rate.reset_at, filePath, "rate_limit.reset_at"),
|
|
53751
|
-
retryAfter: rate.retry_after === null || rate.retry_after === void 0 ? null : optionalString(rate.retry_after, filePath, "rate_limit.retry_after") ?? null,
|
|
53752
|
-
partialResults: requireNonNegativeInteger(
|
|
53753
|
-
rate.partial_results,
|
|
53754
|
-
filePath,
|
|
53755
|
-
"rate_limit.partial_results"
|
|
53756
|
-
),
|
|
53757
|
-
reason: reason ?? "low_remaining"
|
|
53758
|
-
};
|
|
53759
|
-
}
|
|
53760
|
-
return {
|
|
53761
|
-
version: 1,
|
|
53762
|
-
username,
|
|
53763
|
-
repos,
|
|
53764
|
-
fetchedAt,
|
|
53765
|
-
outputProfilePath: source.output_profile_path,
|
|
53766
|
-
pagination: {
|
|
53767
|
-
partial: pagination.partial,
|
|
53768
|
-
commentsWritten,
|
|
53769
|
-
...resumeEndpoint === void 0 ? {} : { resumeEndpoint }
|
|
53770
|
-
},
|
|
53771
|
-
rateLimit
|
|
53772
|
-
};
|
|
53773
|
-
} catch (error3) {
|
|
53774
|
-
if (error3 instanceof Error && error3.message.startsWith(`${filePath}:`)) {
|
|
53775
|
-
throw error3;
|
|
53776
|
-
}
|
|
53777
|
-
throw new Error(`${filePath}: invalid YAML: ${errorMessage3(error3)}`);
|
|
53778
|
-
}
|
|
53779
|
-
}
|
|
53780
|
-
function serializeCodeReviewIngestSource(source, filePath = "code-review ingest source.yaml") {
|
|
53781
|
-
const content = stringify3(
|
|
53782
|
-
{
|
|
53783
|
-
version: source.version,
|
|
53784
|
-
username: source.username,
|
|
53785
|
-
repos: source.repos,
|
|
53786
|
-
fetched_at: source.fetchedAt,
|
|
53787
|
-
pagination: {
|
|
53788
|
-
partial: source.pagination.partial,
|
|
53789
|
-
comments_written: source.pagination.commentsWritten,
|
|
53790
|
-
...source.pagination.resumeEndpoint === void 0 ? {} : { resume_endpoint: source.pagination.resumeEndpoint }
|
|
53791
|
-
},
|
|
53792
|
-
rate_limit: source.rateLimit === null ? null : {
|
|
53793
|
-
repo: source.rateLimit.repo,
|
|
53794
|
-
limit: source.rateLimit.limit,
|
|
53795
|
-
remaining: source.rateLimit.remaining,
|
|
53796
|
-
reset_at: source.rateLimit.resetAt,
|
|
53797
|
-
retry_after: source.rateLimit.retryAfter,
|
|
53798
|
-
partial_results: source.rateLimit.partialResults,
|
|
53799
|
-
reason: source.rateLimit.reason
|
|
53800
|
-
},
|
|
53801
|
-
output_profile_path: source.outputProfilePath
|
|
53802
|
-
},
|
|
53803
|
-
{ aliasDuplicateObjects: false, lineWidth: 0 }
|
|
53804
|
-
);
|
|
53805
|
-
parseCodeReviewIngestSource(content, filePath);
|
|
53806
|
-
return content;
|
|
53807
|
-
}
|
|
53808
|
-
function parseOptionalFrontmatter(content, filePath) {
|
|
53809
|
-
const match = content.match(FRONTMATTER_RE);
|
|
53810
|
-
if (!match) {
|
|
53811
|
-
if (/^---\r?\n/.test(content)) {
|
|
53812
|
-
throw new Error(`${filePath}: frontmatter is missing a closing --- delimiter.`);
|
|
53813
|
-
}
|
|
53814
|
-
return { body: content };
|
|
53815
|
-
}
|
|
53816
|
-
try {
|
|
53817
|
-
return { frontmatter: load(match[1]), body: match[2] };
|
|
53818
|
-
} catch (error3) {
|
|
53819
|
-
throw new Error(`${filePath}: invalid frontmatter YAML: ${errorMessage3(error3)}`);
|
|
53820
|
-
}
|
|
53821
|
-
}
|
|
53822
|
-
function requireMapping(value, filePath, field) {
|
|
53823
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
53824
|
-
throw invalidField(filePath, field, "must be a YAML mapping");
|
|
53825
|
-
}
|
|
53826
|
-
return value;
|
|
53827
|
-
}
|
|
53828
|
-
function requireVersion(value, filePath, field) {
|
|
53829
|
-
if (value !== 1) {
|
|
53830
|
-
throw invalidField(filePath, field, "must equal 1");
|
|
53831
|
-
}
|
|
53832
|
-
}
|
|
53833
|
-
function requireOnlyFields(value, filePath, field, allowedFields) {
|
|
53834
|
-
const allowed = new Set(allowedFields);
|
|
53835
|
-
for (const key2 of Object.keys(value)) {
|
|
53836
|
-
if (!allowed.has(key2)) {
|
|
53837
|
-
throw invalidField(filePath, `${field}.${key2}`, "is not supported");
|
|
53838
|
-
}
|
|
53839
|
-
}
|
|
53840
|
-
}
|
|
53841
|
-
function requireRepo(value, filePath, field) {
|
|
53842
|
-
if (typeof value !== "string" || !/^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/.test(value)) {
|
|
53843
|
-
throw invalidField(filePath, field, "must be a safe owner/repository name");
|
|
53844
|
-
}
|
|
53845
|
-
return value;
|
|
53846
|
-
}
|
|
53847
|
-
function requireDate(value, filePath, field) {
|
|
53848
|
-
if (typeof value !== "string" || Number.isNaN(Date.parse(value))) {
|
|
53849
|
-
throw invalidField(filePath, field, "must be a valid timestamp");
|
|
53850
|
-
}
|
|
53851
|
-
return value;
|
|
53852
|
-
}
|
|
53853
|
-
function requireNonNegativeInteger(value, filePath, field) {
|
|
53854
|
-
if (!Number.isSafeInteger(value) || value < 0) {
|
|
53855
|
-
throw invalidField(filePath, field, "must be a non-negative integer");
|
|
53856
|
-
}
|
|
53857
|
-
return value;
|
|
53858
|
-
}
|
|
53859
|
-
function optionalString(value, filePath, field) {
|
|
53860
|
-
if (value === void 0) {
|
|
53861
|
-
return void 0;
|
|
53862
|
-
}
|
|
53863
|
-
if (typeof value !== "string" || value.length === 0) {
|
|
53864
|
-
throw invalidField(filePath, field, "must be a non-empty string");
|
|
53865
|
-
}
|
|
53866
|
-
return value;
|
|
53867
|
-
}
|
|
53868
|
-
function invalidField(filePath, field, reason) {
|
|
53869
|
-
return new Error(`${filePath}: ${field} ${reason}.`);
|
|
53870
|
-
}
|
|
53871
|
-
function errorMessage3(error3) {
|
|
53872
|
-
return error3 instanceof Error ? error3.message : String(error3);
|
|
53873
|
-
}
|
|
53874
|
-
var CODE_REVIEW_PROMPT_ROLES, FRONTMATTER_RE, SAFE_SEGMENT_RE, SAFE_GITHUB_ACTOR_RE;
|
|
53875
|
-
var init_document_schemas = __esm({
|
|
53876
|
-
"packages/agent-code-review/src/document-schemas.ts"() {
|
|
53877
|
-
"use strict";
|
|
53878
|
-
CODE_REVIEW_PROMPT_ROLES = [
|
|
53879
|
-
"orchestrator",
|
|
53880
|
-
"subagent",
|
|
53881
|
-
"agent",
|
|
53882
|
-
"profile-synthesis"
|
|
53883
|
-
];
|
|
53884
|
-
FRONTMATTER_RE = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)([\s\S]*)$/;
|
|
53885
|
-
SAFE_SEGMENT_RE = /^[A-Za-z0-9._-]+$/;
|
|
53886
|
-
SAFE_GITHUB_ACTOR_RE = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})$/;
|
|
53887
|
-
}
|
|
53888
|
-
});
|
|
53889
|
-
|
|
53890
53890
|
// packages/agent-code-review/src/review-state.ts
|
|
53891
53891
|
import { parse as load2, stringify as stringify4 } from "yaml";
|
|
53892
53892
|
function parseCodeReviewState(content, filePath = "code-review review YAML") {
|
|
@@ -54383,8 +54383,8 @@ async function withFileLock2(lockPath, lockTimeoutMs, operation) {
|
|
|
54383
54383
|
}
|
|
54384
54384
|
async function isStaleLock(lockPath, lockTimeoutMs) {
|
|
54385
54385
|
try {
|
|
54386
|
-
const ownerPid =
|
|
54387
|
-
if (
|
|
54386
|
+
const ownerPid = parseLockOwnerPid((await readFile10(lockPath, "utf8")).trim());
|
|
54387
|
+
if (ownerPid !== void 0) {
|
|
54388
54388
|
return !isRunningProcess(ownerPid);
|
|
54389
54389
|
}
|
|
54390
54390
|
return Date.now() - (await stat6(lockPath)).mtimeMs >= lockTimeoutMs;
|
|
@@ -54395,6 +54395,13 @@ async function isStaleLock(lockPath, lockTimeoutMs) {
|
|
|
54395
54395
|
throw error3;
|
|
54396
54396
|
}
|
|
54397
54397
|
}
|
|
54398
|
+
function parseLockOwnerPid(value) {
|
|
54399
|
+
const processId = Number(value);
|
|
54400
|
+
if (!Number.isSafeInteger(processId) || processId <= 0) {
|
|
54401
|
+
return void 0;
|
|
54402
|
+
}
|
|
54403
|
+
return String(processId) === value ? processId : void 0;
|
|
54404
|
+
}
|
|
54398
54405
|
function isRunningProcess(processId) {
|
|
54399
54406
|
try {
|
|
54400
54407
|
process.kill(processId, 0);
|
|
@@ -54969,7 +54976,7 @@ async function resolveCodeReviewRunOptions(input, configOptions) {
|
|
|
54969
54976
|
),
|
|
54970
54977
|
...inputProfilePath === void 0 ? {} : { profilePath: inputProfilePath },
|
|
54971
54978
|
...inputPromptPath === void 0 ? {} : { promptPath: inputPromptPath },
|
|
54972
|
-
...inputProfiles === void 0 ? {} : { profiles: inputProfiles },
|
|
54979
|
+
...inputProfiles === void 0 ? {} : { profiles: requireProfileFilters(inputProfiles) },
|
|
54973
54980
|
...inputAdditionalFeedback === void 0 ? {} : { additionalFeedback: inputAdditionalFeedback }
|
|
54974
54981
|
};
|
|
54975
54982
|
}
|
|
@@ -55022,6 +55029,18 @@ function requireNonEmptyString(value, field) {
|
|
|
55022
55029
|
}
|
|
55023
55030
|
return normalized;
|
|
55024
55031
|
}
|
|
55032
|
+
function requireProfileFilters(value) {
|
|
55033
|
+
if (!Array.isArray(value)) {
|
|
55034
|
+
throw new Error("profiles must be an array of safe profile names.");
|
|
55035
|
+
}
|
|
55036
|
+
return value.map((profile) => {
|
|
55037
|
+
try {
|
|
55038
|
+
return requireSafeDocumentSegment(profile, "profiles");
|
|
55039
|
+
} catch {
|
|
55040
|
+
throw new Error("profiles must be an array of safe profile names.");
|
|
55041
|
+
}
|
|
55042
|
+
});
|
|
55043
|
+
}
|
|
55025
55044
|
function isMissingFileError5(error3) {
|
|
55026
55045
|
return hasOwnErrorCode14(error3, "ENOENT");
|
|
55027
55046
|
}
|
|
@@ -55031,6 +55050,7 @@ var init_config4 = __esm({
|
|
|
55031
55050
|
"use strict";
|
|
55032
55051
|
init_src9();
|
|
55033
55052
|
init_config_scope2();
|
|
55053
|
+
init_document_schemas();
|
|
55034
55054
|
init_error_codes11();
|
|
55035
55055
|
init_review_store();
|
|
55036
55056
|
poeCoreAgentScope = defineScope("core", {
|
|
@@ -61159,7 +61179,7 @@ function createCodeReviewAgentMcpGroup(context, dependencies = {}) {
|
|
|
61159
61179
|
handler: async ({ params }) => {
|
|
61160
61180
|
const pr = canonicalPullRequestUrl(params.pr);
|
|
61161
61181
|
const draft = validateDraft2(params);
|
|
61162
|
-
const currentState = await ensureState(store, context, pr);
|
|
61182
|
+
const currentState = context.role === "orchestrator" ? await ensureState(store, context, pr) : await requireState(store, context, pr);
|
|
61163
61183
|
if (context.role === "orchestrator") {
|
|
61164
61184
|
const unfinishedProfiles = Object.values(currentState.subagents).filter(({ status }) => status === "pending" || status === "running").map(({ profile }) => profile);
|
|
61165
61185
|
if (unfinishedProfiles.length > 0) {
|
|
@@ -61354,7 +61374,11 @@ function createCodeReviewAgentMcpGroup(context, dependencies = {}) {
|
|
|
61354
61374
|
pr: prParam,
|
|
61355
61375
|
index: inlineCommentIndexSchema,
|
|
61356
61376
|
path: S.String({ description: "Repository-relative path in the PR diff." }),
|
|
61357
|
-
line: S.Number({
|
|
61377
|
+
line: S.Number({
|
|
61378
|
+
description: "Right-side line number in the PR diff.",
|
|
61379
|
+
jsonType: "integer",
|
|
61380
|
+
minimum: 1
|
|
61381
|
+
}),
|
|
61358
61382
|
body: S.String({ description: "Inline review comment body." })
|
|
61359
61383
|
}),
|
|
61360
61384
|
handler: async ({ params }) => {
|
|
@@ -61520,11 +61544,17 @@ var init_mcp3 = __esm({
|
|
|
61520
61544
|
CODE_REVIEW_AGENT_MCP_ROLES = ["agent", "orchestrator", "subagent"];
|
|
61521
61545
|
inlineCommentSchema = S.Object({
|
|
61522
61546
|
path: S.String({ description: "Repository-relative path in the PR diff." }),
|
|
61523
|
-
line: S.Number({
|
|
61547
|
+
line: S.Number({
|
|
61548
|
+
description: "Right-side line number in the PR diff.",
|
|
61549
|
+
jsonType: "integer",
|
|
61550
|
+
minimum: 1
|
|
61551
|
+
}),
|
|
61524
61552
|
body: S.String({ description: "Inline review comment body." })
|
|
61525
61553
|
});
|
|
61526
61554
|
inlineCommentIndexSchema = S.Number({
|
|
61527
|
-
description: "Zero-based merged review inline comment index."
|
|
61555
|
+
description: "Zero-based merged review inline comment index.",
|
|
61556
|
+
jsonType: "integer",
|
|
61557
|
+
minimum: 0
|
|
61528
61558
|
});
|
|
61529
61559
|
prParam = S.String({ description: "GitHub pull request URL." });
|
|
61530
61560
|
}
|
|
@@ -91260,10 +91290,10 @@ function registerAgentCommand(program, container) {
|
|
|
91260
91290
|
apiKey: options.apiKey,
|
|
91261
91291
|
cwd: container.env.cwd
|
|
91262
91292
|
});
|
|
91263
|
-
const
|
|
91293
|
+
const toolRenderState = createToolRenderState();
|
|
91264
91294
|
const response = await session.sendMessage(prompt, {
|
|
91265
91295
|
onSessionUpdate(update) {
|
|
91266
|
-
for (const event of
|
|
91296
|
+
for (const event of sessionUpdateToEvents(update, toolRenderState)) {
|
|
91267
91297
|
renderAcpEvent(event);
|
|
91268
91298
|
}
|
|
91269
91299
|
}
|
|
@@ -91283,33 +91313,6 @@ function registerAgentCommand(program, container) {
|
|
|
91283
91313
|
}
|
|
91284
91314
|
});
|
|
91285
91315
|
}
|
|
91286
|
-
function toAcpEvents(update, started) {
|
|
91287
|
-
if (update.sessionUpdate === "tool_call") {
|
|
91288
|
-
if (started.has(update.toolCallId)) return [];
|
|
91289
|
-
started.add(update.toolCallId);
|
|
91290
|
-
return [
|
|
91291
|
-
{
|
|
91292
|
-
event: "tool_start",
|
|
91293
|
-
kind: "exec",
|
|
91294
|
-
title: update.title,
|
|
91295
|
-
id: update.toolCallId
|
|
91296
|
-
}
|
|
91297
|
-
];
|
|
91298
|
-
}
|
|
91299
|
-
if (update.sessionUpdate === "tool_call_update") {
|
|
91300
|
-
if (update.status === "completed" || update.status === "failed") {
|
|
91301
|
-
return [
|
|
91302
|
-
{
|
|
91303
|
-
event: "tool_complete",
|
|
91304
|
-
kind: "exec",
|
|
91305
|
-
path: typeof update.rawOutput === "string" ? update.rawOutput : "",
|
|
91306
|
-
id: update.toolCallId
|
|
91307
|
-
}
|
|
91308
|
-
];
|
|
91309
|
-
}
|
|
91310
|
-
}
|
|
91311
|
-
return [];
|
|
91312
|
-
}
|
|
91313
91316
|
var init_agent2 = __esm({
|
|
91314
91317
|
"src/cli/commands/agent.ts"() {
|
|
91315
91318
|
"use strict";
|
|
@@ -136049,7 +136052,7 @@ var init_package2 = __esm({
|
|
|
136049
136052
|
"package.json"() {
|
|
136050
136053
|
package_default2 = {
|
|
136051
136054
|
name: "poe-code",
|
|
136052
|
-
version: "3.0.
|
|
136055
|
+
version: "3.0.270",
|
|
136053
136056
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
136054
136057
|
type: "module",
|
|
136055
136058
|
main: "./dist/index.js",
|