replicas-engine 0.1.1416 → 0.1.1418
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/src/{asp-host-TFSRRQ4S.js → asp-host-DUVSLJEM.js} +5 -5
- package/dist/src/{chunk-BQDT3CJD.js → chunk-3Q4DI7DY.js} +1 -1
- package/dist/src/{chunk-GYZTIXZK.js → chunk-DU7JP5SF.js} +2 -2
- package/dist/src/{chunk-VIYU4HQB.js → chunk-FKQ7A4TM.js} +315 -196
- package/dist/src/{chunk-347EQ6HQ.js → chunk-FQQ2ES7B.js} +3 -3
- package/dist/src/{chunk-GSTNPMZP.js → chunk-GFEPXBG6.js} +1 -1
- package/dist/src/{chunk-EJVJNVP6.js → chunk-QRYLSOKE.js} +6 -6
- package/dist/src/{chunk-UMNRMFNT.js → chunk-VGOGENEN.js} +2 -2
- package/dist/src/{chunk-UDSFMXPX.js → chunk-XCB5FR74.js} +2 -2
- package/dist/src/command-protection-hook.js +4 -4
- package/dist/src/headless-agent.js +4 -4
- package/dist/src/index.js +22 -21
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/dist/src/subagent-mcp.js +1 -1
- package/package.json +1 -1
|
@@ -1116,17 +1116,17 @@ var require_luxon = __commonJS({
|
|
|
1116
1116
|
constructor(dt, intl, opts) {
|
|
1117
1117
|
this.opts = opts;
|
|
1118
1118
|
this.originalZone = void 0;
|
|
1119
|
-
let
|
|
1119
|
+
let z35 = void 0;
|
|
1120
1120
|
if (this.opts.timeZone) {
|
|
1121
1121
|
this.dt = dt;
|
|
1122
1122
|
} else if (dt.zone.type === "fixed") {
|
|
1123
1123
|
const gmtOffset = -1 * (dt.offset / 60);
|
|
1124
1124
|
const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`;
|
|
1125
1125
|
if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) {
|
|
1126
|
-
|
|
1126
|
+
z35 = offsetZ;
|
|
1127
1127
|
this.dt = dt;
|
|
1128
1128
|
} else {
|
|
1129
|
-
|
|
1129
|
+
z35 = "UTC";
|
|
1130
1130
|
this.dt = dt.offset === 0 ? dt : dt.setZone("UTC").plus({
|
|
1131
1131
|
minutes: dt.offset
|
|
1132
1132
|
});
|
|
@@ -1136,9 +1136,9 @@ var require_luxon = __commonJS({
|
|
|
1136
1136
|
this.dt = dt;
|
|
1137
1137
|
} else if (dt.zone.type === "iana") {
|
|
1138
1138
|
this.dt = dt;
|
|
1139
|
-
|
|
1139
|
+
z35 = dt.zone.name;
|
|
1140
1140
|
} else {
|
|
1141
|
-
|
|
1141
|
+
z35 = "UTC";
|
|
1142
1142
|
this.dt = dt.setZone("UTC").plus({
|
|
1143
1143
|
minutes: dt.offset
|
|
1144
1144
|
});
|
|
@@ -1147,7 +1147,7 @@ var require_luxon = __commonJS({
|
|
|
1147
1147
|
const intlOpts = {
|
|
1148
1148
|
...this.opts
|
|
1149
1149
|
};
|
|
1150
|
-
intlOpts.timeZone = intlOpts.timeZone ||
|
|
1150
|
+
intlOpts.timeZone = intlOpts.timeZone || z35;
|
|
1151
1151
|
this.dtf = getCachedDTF(intl, intlOpts);
|
|
1152
1152
|
}
|
|
1153
1153
|
format() {
|
|
@@ -3129,12 +3129,12 @@ var require_luxon = __commonJS({
|
|
|
3129
3129
|
* @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 }
|
|
3130
3130
|
* @return {Duration}
|
|
3131
3131
|
*/
|
|
3132
|
-
static fromISO(
|
|
3133
|
-
const [parsed] = parseISODuration(
|
|
3132
|
+
static fromISO(text4, opts) {
|
|
3133
|
+
const [parsed] = parseISODuration(text4);
|
|
3134
3134
|
if (parsed) {
|
|
3135
3135
|
return _Duration.fromObject(parsed, opts);
|
|
3136
3136
|
} else {
|
|
3137
|
-
return _Duration.invalid("unparsable", `the input "${
|
|
3137
|
+
return _Duration.invalid("unparsable", `the input "${text4}" can't be parsed as ISO 8601`);
|
|
3138
3138
|
}
|
|
3139
3139
|
}
|
|
3140
3140
|
/**
|
|
@@ -3153,12 +3153,12 @@ var require_luxon = __commonJS({
|
|
|
3153
3153
|
* @example Duration.fromISOTime('T1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }
|
|
3154
3154
|
* @return {Duration}
|
|
3155
3155
|
*/
|
|
3156
|
-
static fromISOTime(
|
|
3157
|
-
const [parsed] = parseISOTimeOnly(
|
|
3156
|
+
static fromISOTime(text4, opts) {
|
|
3157
|
+
const [parsed] = parseISOTimeOnly(text4);
|
|
3158
3158
|
if (parsed) {
|
|
3159
3159
|
return _Duration.fromObject(parsed, opts);
|
|
3160
3160
|
} else {
|
|
3161
|
-
return _Duration.invalid("unparsable", `the input "${
|
|
3161
|
+
return _Duration.invalid("unparsable", `the input "${text4}" can't be parsed as ISO 8601`);
|
|
3162
3162
|
}
|
|
3163
3163
|
}
|
|
3164
3164
|
/**
|
|
@@ -3823,8 +3823,8 @@ var require_luxon = __commonJS({
|
|
|
3823
3823
|
* @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals
|
|
3824
3824
|
* @return {Interval}
|
|
3825
3825
|
*/
|
|
3826
|
-
static fromISO(
|
|
3827
|
-
const [s2, e] = (
|
|
3826
|
+
static fromISO(text4, opts) {
|
|
3827
|
+
const [s2, e] = (text4 || "").split("/", 2);
|
|
3828
3828
|
if (s2 && e) {
|
|
3829
3829
|
let start, startIsValid;
|
|
3830
3830
|
try {
|
|
@@ -3855,7 +3855,7 @@ var require_luxon = __commonJS({
|
|
|
3855
3855
|
}
|
|
3856
3856
|
}
|
|
3857
3857
|
}
|
|
3858
|
-
return _Interval.invalid("unparsable", `the input "${
|
|
3858
|
+
return _Interval.invalid("unparsable", `the input "${text4}" can't be parsed as ISO 8601`);
|
|
3859
3859
|
}
|
|
3860
3860
|
/**
|
|
3861
3861
|
* Check if an object is an Interval. Works across context boundaries
|
|
@@ -5085,7 +5085,7 @@ var require_luxon = __commonJS({
|
|
|
5085
5085
|
o
|
|
5086
5086
|
};
|
|
5087
5087
|
}
|
|
5088
|
-
function parseDataToDateTime(parsed, parsedZone, opts, format,
|
|
5088
|
+
function parseDataToDateTime(parsed, parsedZone, opts, format, text4, specificOffset) {
|
|
5089
5089
|
const {
|
|
5090
5090
|
setZone,
|
|
5091
5091
|
zone
|
|
@@ -5098,7 +5098,7 @@ var require_luxon = __commonJS({
|
|
|
5098
5098
|
});
|
|
5099
5099
|
return setZone ? inst : inst.setZone(zone);
|
|
5100
5100
|
} else {
|
|
5101
|
-
return DateTime.invalid(new Invalid("unparsable", `the input "${
|
|
5101
|
+
return DateTime.invalid(new Invalid("unparsable", `the input "${text4}" can't be parsed as ${format}`));
|
|
5102
5102
|
}
|
|
5103
5103
|
}
|
|
5104
5104
|
function toTechFormat(dt, format, allowZ = true) {
|
|
@@ -5620,9 +5620,9 @@ var require_luxon = __commonJS({
|
|
|
5620
5620
|
* @example DateTime.fromISO('2016-W05-4')
|
|
5621
5621
|
* @return {DateTime}
|
|
5622
5622
|
*/
|
|
5623
|
-
static fromISO(
|
|
5624
|
-
const [vals, parsedZone] = parseISODate(
|
|
5625
|
-
return parseDataToDateTime(vals, parsedZone, opts, "ISO 8601",
|
|
5623
|
+
static fromISO(text4, opts = {}) {
|
|
5624
|
+
const [vals, parsedZone] = parseISODate(text4);
|
|
5625
|
+
return parseDataToDateTime(vals, parsedZone, opts, "ISO 8601", text4);
|
|
5626
5626
|
}
|
|
5627
5627
|
/**
|
|
5628
5628
|
* Create a DateTime from an RFC 2822 string
|
|
@@ -5639,9 +5639,9 @@ var require_luxon = __commonJS({
|
|
|
5639
5639
|
* @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z')
|
|
5640
5640
|
* @return {DateTime}
|
|
5641
5641
|
*/
|
|
5642
|
-
static fromRFC2822(
|
|
5643
|
-
const [vals, parsedZone] = parseRFC2822Date(
|
|
5644
|
-
return parseDataToDateTime(vals, parsedZone, opts, "RFC 2822",
|
|
5642
|
+
static fromRFC2822(text4, opts = {}) {
|
|
5643
|
+
const [vals, parsedZone] = parseRFC2822Date(text4);
|
|
5644
|
+
return parseDataToDateTime(vals, parsedZone, opts, "RFC 2822", text4);
|
|
5645
5645
|
}
|
|
5646
5646
|
/**
|
|
5647
5647
|
* Create a DateTime from an HTTP header date
|
|
@@ -5659,8 +5659,8 @@ var require_luxon = __commonJS({
|
|
|
5659
5659
|
* @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994')
|
|
5660
5660
|
* @return {DateTime}
|
|
5661
5661
|
*/
|
|
5662
|
-
static fromHTTP(
|
|
5663
|
-
const [vals, parsedZone] = parseHTTPDate(
|
|
5662
|
+
static fromHTTP(text4, opts = {}) {
|
|
5663
|
+
const [vals, parsedZone] = parseHTTPDate(text4);
|
|
5664
5664
|
return parseDataToDateTime(vals, parsedZone, opts, "HTTP", opts);
|
|
5665
5665
|
}
|
|
5666
5666
|
/**
|
|
@@ -5677,8 +5677,8 @@ var require_luxon = __commonJS({
|
|
|
5677
5677
|
* @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance
|
|
5678
5678
|
* @return {DateTime}
|
|
5679
5679
|
*/
|
|
5680
|
-
static fromFormat(
|
|
5681
|
-
if (isUndefined(
|
|
5680
|
+
static fromFormat(text4, fmt, opts = {}) {
|
|
5681
|
+
if (isUndefined(text4) || isUndefined(fmt)) {
|
|
5682
5682
|
throw new InvalidArgumentError("fromFormat requires an input string and a format");
|
|
5683
5683
|
}
|
|
5684
5684
|
const {
|
|
@@ -5688,18 +5688,18 @@ var require_luxon = __commonJS({
|
|
|
5688
5688
|
locale,
|
|
5689
5689
|
numberingSystem,
|
|
5690
5690
|
defaultToEN: true
|
|
5691
|
-
}), [vals, parsedZone, specificOffset, invalid] = parseFromTokens(localeToUse,
|
|
5691
|
+
}), [vals, parsedZone, specificOffset, invalid] = parseFromTokens(localeToUse, text4, fmt);
|
|
5692
5692
|
if (invalid) {
|
|
5693
5693
|
return _DateTime.invalid(invalid);
|
|
5694
5694
|
} else {
|
|
5695
|
-
return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`,
|
|
5695
|
+
return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`, text4, specificOffset);
|
|
5696
5696
|
}
|
|
5697
5697
|
}
|
|
5698
5698
|
/**
|
|
5699
5699
|
* @deprecated use fromFormat instead
|
|
5700
5700
|
*/
|
|
5701
|
-
static fromString(
|
|
5702
|
-
return _DateTime.fromFormat(
|
|
5701
|
+
static fromString(text4, fmt, opts = {}) {
|
|
5702
|
+
return _DateTime.fromFormat(text4, fmt, opts);
|
|
5703
5703
|
}
|
|
5704
5704
|
/**
|
|
5705
5705
|
* Create a DateTime from a SQL date, time, or datetime
|
|
@@ -5722,9 +5722,9 @@ var require_luxon = __commonJS({
|
|
|
5722
5722
|
* @example DateTime.fromSQL('09:12:34.342')
|
|
5723
5723
|
* @return {DateTime}
|
|
5724
5724
|
*/
|
|
5725
|
-
static fromSQL(
|
|
5726
|
-
const [vals, parsedZone] = parseSQL(
|
|
5727
|
-
return parseDataToDateTime(vals, parsedZone, opts, "SQL",
|
|
5725
|
+
static fromSQL(text4, opts = {}) {
|
|
5726
|
+
const [vals, parsedZone] = parseSQL(text4);
|
|
5727
|
+
return parseDataToDateTime(vals, parsedZone, opts, "SQL", text4);
|
|
5728
5728
|
}
|
|
5729
5729
|
/**
|
|
5730
5730
|
* Create an invalid DateTime.
|
|
@@ -6909,7 +6909,7 @@ var require_luxon = __commonJS({
|
|
|
6909
6909
|
* @param {Object} options - options taken by fromFormat()
|
|
6910
6910
|
* @return {Object}
|
|
6911
6911
|
*/
|
|
6912
|
-
static fromFormatExplain(
|
|
6912
|
+
static fromFormatExplain(text4, fmt, options = {}) {
|
|
6913
6913
|
const {
|
|
6914
6914
|
locale = null,
|
|
6915
6915
|
numberingSystem = null
|
|
@@ -6918,13 +6918,13 @@ var require_luxon = __commonJS({
|
|
|
6918
6918
|
numberingSystem,
|
|
6919
6919
|
defaultToEN: true
|
|
6920
6920
|
});
|
|
6921
|
-
return explainFromTokens(localeToUse,
|
|
6921
|
+
return explainFromTokens(localeToUse, text4, fmt);
|
|
6922
6922
|
}
|
|
6923
6923
|
/**
|
|
6924
6924
|
* @deprecated use fromFormatExplain instead
|
|
6925
6925
|
*/
|
|
6926
|
-
static fromStringExplain(
|
|
6927
|
-
return _DateTime.fromFormatExplain(
|
|
6926
|
+
static fromStringExplain(text4, fmt, options = {}) {
|
|
6927
|
+
return _DateTime.fromFormatExplain(text4, fmt, options);
|
|
6928
6928
|
}
|
|
6929
6929
|
/**
|
|
6930
6930
|
* Build a parser for `fmt` using the given locale. This parser can be passed
|
|
@@ -6959,8 +6959,8 @@ var require_luxon = __commonJS({
|
|
|
6959
6959
|
* @param {Object} opts - options taken by fromFormat()
|
|
6960
6960
|
* @returns {DateTime}
|
|
6961
6961
|
*/
|
|
6962
|
-
static fromFormatParser(
|
|
6963
|
-
if (isUndefined(
|
|
6962
|
+
static fromFormatParser(text4, formatParser, opts = {}) {
|
|
6963
|
+
if (isUndefined(text4) || isUndefined(formatParser)) {
|
|
6964
6964
|
throw new InvalidArgumentError("fromFormatParser requires an input string and a format parser");
|
|
6965
6965
|
}
|
|
6966
6966
|
const {
|
|
@@ -6979,11 +6979,11 @@ var require_luxon = __commonJS({
|
|
|
6979
6979
|
zone,
|
|
6980
6980
|
specificOffset,
|
|
6981
6981
|
invalidReason
|
|
6982
|
-
} = formatParser.explainFromTokens(
|
|
6982
|
+
} = formatParser.explainFromTokens(text4);
|
|
6983
6983
|
if (invalidReason) {
|
|
6984
6984
|
return _DateTime.invalid(invalidReason);
|
|
6985
6985
|
} else {
|
|
6986
|
-
return parseDataToDateTime(result, zone, opts, `format ${formatParser.format}`,
|
|
6986
|
+
return parseDataToDateTime(result, zone, opts, `format ${formatParser.format}`, text4, specificOffset);
|
|
6987
6987
|
}
|
|
6988
6988
|
}
|
|
6989
6989
|
// FORMAT PRESETS
|
|
@@ -8507,8 +8507,8 @@ var require_CronExpression = __commonJS({
|
|
|
8507
8507
|
return false;
|
|
8508
8508
|
}
|
|
8509
8509
|
if (this.#checkDstTransition(currentDate)) {
|
|
8510
|
-
const
|
|
8511
|
-
for (let i = 0; i <
|
|
8510
|
+
const steps2 = reverse ? currentHour - nextHour : nextHour - currentHour;
|
|
8511
|
+
for (let i = 0; i < steps2; i++) {
|
|
8512
8512
|
currentDate.applyDateOperation(dateMathVerb, CronDate_1.TimeUnit.Hour, hours.length);
|
|
8513
8513
|
if (!reverse && currentDate.getHours() >= nextHour)
|
|
8514
8514
|
break;
|
|
@@ -9096,8 +9096,8 @@ var require_CronFileParser = __commonJS({
|
|
|
9096
9096
|
expressions: [],
|
|
9097
9097
|
errors: {}
|
|
9098
9098
|
};
|
|
9099
|
-
for (const
|
|
9100
|
-
const entry =
|
|
9099
|
+
for (const block2 of blocks) {
|
|
9100
|
+
const entry = block2.trim();
|
|
9101
9101
|
if (entry.length === 0 || entry.startsWith("#")) {
|
|
9102
9102
|
continue;
|
|
9103
9103
|
}
|
|
@@ -10128,8 +10128,8 @@ var RATE_LIMIT_PATTERNS = [
|
|
|
10128
10128
|
];
|
|
10129
10129
|
var HTTP_429_PATTERN = /(?:^|[^0-9])429(?:$|[^0-9])/;
|
|
10130
10130
|
var HTTP_CONTEXT_PATTERN = /(api error|request|response|status|http)/;
|
|
10131
|
-
function detectAgentQuotaLimit(
|
|
10132
|
-
const normalized =
|
|
10131
|
+
function detectAgentQuotaLimit(text4) {
|
|
10132
|
+
const normalized = text4.toLowerCase();
|
|
10133
10133
|
if (!normalized) return null;
|
|
10134
10134
|
if (OUT_OF_CREDITS_PATTERNS.some((pattern) => pattern.test(normalized))) return "out_of_credits";
|
|
10135
10135
|
if (RATE_LIMIT_PATTERNS.some((pattern) => pattern.test(normalized))) return "rate_limit";
|
|
@@ -10654,14 +10654,14 @@ function coerceClaudePartialMessagePayload(payload) {
|
|
|
10654
10654
|
const streamId = payload.streamId;
|
|
10655
10655
|
if (typeof streamId !== "string" || !streamId) return null;
|
|
10656
10656
|
const parentToolUseId = payload.parent_tool_use_id;
|
|
10657
|
-
const
|
|
10657
|
+
const text4 = typeof payload.text === "string" && payload.text ? payload.text : void 0;
|
|
10658
10658
|
const thinking = typeof payload.thinking === "string" && payload.thinking ? payload.thinking : void 0;
|
|
10659
10659
|
const tool = isRecord(payload.tool) && typeof payload.tool.id === "string" && typeof payload.tool.name === "string" ? typeof payload.tool.filePath === "string" ? { id: payload.tool.id, name: payload.tool.name, filePath: payload.tool.filePath } : typeof payload.tool.command === "string" ? { id: payload.tool.id, name: payload.tool.name, command: payload.tool.command } : void 0 : void 0;
|
|
10660
|
-
if (!
|
|
10660
|
+
if (!text4 && !thinking && !tool) return null;
|
|
10661
10661
|
return {
|
|
10662
10662
|
streamId,
|
|
10663
10663
|
parent_tool_use_id: typeof parentToolUseId === "string" ? parentToolUseId : null,
|
|
10664
|
-
...
|
|
10664
|
+
...text4 ? { text: text4 } : {},
|
|
10665
10665
|
...thinking ? { thinking } : {},
|
|
10666
10666
|
...tool ? { tool } : {},
|
|
10667
10667
|
status: payload.status === "completed" ? "completed" : "in_progress"
|
|
@@ -11584,8 +11584,8 @@ var PICK_WINDOW_MS = 21 * DAY_MS;
|
|
|
11584
11584
|
// ../shared/src/auth-fallback.ts
|
|
11585
11585
|
function describeCredential(provider2, credential) {
|
|
11586
11586
|
const { ownerName, email, ordinal: ordinal2 } = credential.account ?? {};
|
|
11587
|
-
const
|
|
11588
|
-
const owner = credential.scope === CREDENTIAL_SCOPE.USER ? ownerName ? `${ownerName}'s personal ${
|
|
11587
|
+
const label2 = `${getCredentialMethodLabel(provider2, credential.method)}${ordinal2 ? ` #${ordinal2}` : ""}`;
|
|
11588
|
+
const owner = credential.scope === CREDENTIAL_SCOPE.USER ? ownerName ? `${ownerName}'s personal ${label2}` : `your ${label2}` : credential.scope === CREDENTIAL_SCOPE.ORG ? `the organization's ${label2}` : `the ${label2}`;
|
|
11589
11589
|
return email ? `${owner} (${email})` : owner;
|
|
11590
11590
|
}
|
|
11591
11591
|
function describeAuthFallback(payload) {
|
|
@@ -11643,7 +11643,7 @@ var fallbackPlanStepSchema = z12.discriminatedUnion("kind", [
|
|
|
11643
11643
|
fallbackHarnessStepSchema
|
|
11644
11644
|
]);
|
|
11645
11645
|
var fallbackPlanResponseSchema = z12.object({
|
|
11646
|
-
steps: z12.array(z12.unknown()).transform((
|
|
11646
|
+
steps: z12.array(z12.unknown()).transform((steps2) => steps2.flatMap((step) => fallbackPlanStepSchema.safeParse(step).data ?? []))
|
|
11647
11647
|
});
|
|
11648
11648
|
|
|
11649
11649
|
// ../shared/src/chat-fork.ts
|
|
@@ -11894,6 +11894,8 @@ var REPLICAS_MCP_TOOLS = {
|
|
|
11894
11894
|
readSubagent: "read_subagent",
|
|
11895
11895
|
archiveSubagent: "archive_subagent",
|
|
11896
11896
|
waitForSubagents: "wait_for_subagents",
|
|
11897
|
+
getBoard: "get_board",
|
|
11898
|
+
updateBoard: "update_board",
|
|
11897
11899
|
getLinearRouting: "get_linear_routing",
|
|
11898
11900
|
setLinearRouting: "set_linear_routing",
|
|
11899
11901
|
clearLinearRouting: "clear_linear_routing",
|
|
@@ -14610,13 +14612,18 @@ function wrapInTag(content, tag) {
|
|
|
14610
14612
|
${content}
|
|
14611
14613
|
</${tag}>`;
|
|
14612
14614
|
}
|
|
14613
|
-
function removeTag(
|
|
14615
|
+
function removeTag(text4, tag) {
|
|
14614
14616
|
const regex = new RegExp(`<${tag}>[\\s\\S]*?</${tag}>`, "g");
|
|
14615
|
-
return
|
|
14617
|
+
return text4.replace(regex, "").trim();
|
|
14616
14618
|
}
|
|
14617
|
-
function stripReplicasInstructionBlock(
|
|
14618
|
-
return removeTag(
|
|
14619
|
+
function stripReplicasInstructionBlock(text4) {
|
|
14620
|
+
return removeTag(text4, REPLICAS_INSTRUCTIONS_TAG);
|
|
14619
14621
|
}
|
|
14622
|
+
var BOARD_RULES = `- The board, a live status page you keep with \`${REPLICAS_MCP_TOOLS.updateBoard}\` in the Ships pane beside this chat, is the user's one view of the work: keep it covering every ship, pull request, deploy, blocker and ask. Show ships, pull requests and Linear tickets as ship, pr and linear blocks, which stay current on their own, instead of describing their status. Start with sections Needs you, Ready to review, Working, Shipping and Done, and add blocks and buttons whenever they help the user act.
|
|
14623
|
+
- A ship with open pull requests is not done when it sends \`finished\`: Replicas fixes their CI failures and review comments automatically, then sends \`ready\` or \`needs_attention\`. On \`needs_attention\`, direct the ship, or put the decision to the user if it needs one.
|
|
14624
|
+
- On every ship event, update the board, act with tools if other work waits on it, such as starting the next task once a pull request merges, and end your turn with no text at all. Never write an acknowledgement such as "Noted.", even if earlier turns did.
|
|
14625
|
+
- Write in chat only to answer the user, or to ask a decision in a line or two. Put each decision on the board too, as a choice when it has clear options, and ask it in chat once. Never restate the board in chat: no status tables, per-ship lists or summaries of what ships did; link the pull request you mean and leave status to the board.
|
|
14626
|
+
`;
|
|
14620
14627
|
var MOTHERSHIP_INSTRUCTIONS_BLOCK = new RegExp(`\\s*<${MOTHERSHIP_INSTRUCTIONS_TAG}>\\n([\\s\\S]*?)\\n</${MOTHERSHIP_INSTRUCTIONS_TAG}>`);
|
|
14621
14628
|
function splitMothershipInstructions(customInstructions) {
|
|
14622
14629
|
const match = customInstructions?.match(MOTHERSHIP_INSTRUCTIONS_BLOCK);
|
|
@@ -14693,8 +14700,8 @@ ${body}
|
|
|
14693
14700
|
</${TAG}>`;
|
|
14694
14701
|
}).join("\n\n");
|
|
14695
14702
|
}
|
|
14696
|
-
function extractMothershipEvents(
|
|
14697
|
-
return [...
|
|
14703
|
+
function extractMothershipEvents(text4) {
|
|
14704
|
+
return [...text4.matchAll(BLOCK)].flatMap((match) => {
|
|
14698
14705
|
const attributes = Object.fromEntries([...match[1].matchAll(ATTRIBUTE)].map(([, key, value]) => [key, unescapeAttribute(value)]));
|
|
14699
14706
|
if (!attributes.kind || !attributes.id || !attributes.agent_id) return [];
|
|
14700
14707
|
const kind = MOTHERSHIP_EVENT_KINDS.find((candidate) => candidate === attributes.kind) ?? UNKNOWN_EVENT_KIND;
|
|
@@ -14713,12 +14720,12 @@ function extractMothershipEvents(text3) {
|
|
|
14713
14720
|
}];
|
|
14714
14721
|
});
|
|
14715
14722
|
}
|
|
14716
|
-
function parseMothershipEvents(
|
|
14717
|
-
const events = extractMothershipEvents(
|
|
14718
|
-
return events.length > 0 &&
|
|
14723
|
+
function parseMothershipEvents(text4) {
|
|
14724
|
+
const events = extractMothershipEvents(text4);
|
|
14725
|
+
return events.length > 0 && text4.replace(BLOCK, "").replaceAll(MERGED_MESSAGE_SEPARATOR.trim(), "").trim() === "" ? events : null;
|
|
14719
14726
|
}
|
|
14720
|
-
function isMothershipEventMessage(
|
|
14721
|
-
return
|
|
14727
|
+
function isMothershipEventMessage(text4) {
|
|
14728
|
+
return text4.trimStart().startsWith(`<${TAG} `);
|
|
14722
14729
|
}
|
|
14723
14730
|
|
|
14724
14731
|
// ../shared/src/display-message/types.ts
|
|
@@ -14755,11 +14762,11 @@ function coerceBackgroundTaskPayload(payload) {
|
|
|
14755
14762
|
const workflowAgents = Array.isArray(payload.workflow_progress) ? payload.workflow_progress.flatMap((entry) => {
|
|
14756
14763
|
if (!isRecord(entry) || entry.type !== "workflow_agent") return [];
|
|
14757
14764
|
const agentId = optionalString(entry.agentId);
|
|
14758
|
-
const
|
|
14759
|
-
if (!agentId || !
|
|
14765
|
+
const label2 = optionalString(entry.label);
|
|
14766
|
+
if (!agentId || !label2) return [];
|
|
14760
14767
|
return [{
|
|
14761
14768
|
agentId,
|
|
14762
|
-
label,
|
|
14769
|
+
label: label2,
|
|
14763
14770
|
model: optionalString(entry.model),
|
|
14764
14771
|
state: optionalString(entry.state),
|
|
14765
14772
|
promptPreview: optionalString(entry.promptPreview),
|
|
@@ -14944,8 +14951,8 @@ function indexOrEnd(src, search, from) {
|
|
|
14944
14951
|
const index = src.indexOf(search, from);
|
|
14945
14952
|
return index < 0 ? src.length : index;
|
|
14946
14953
|
}
|
|
14947
|
-
function decodeAnsiC(
|
|
14948
|
-
return
|
|
14954
|
+
function decodeAnsiC(text4) {
|
|
14955
|
+
return text4.replace(/\\(x[0-9a-fA-F]{1,2}|u[0-9a-fA-F]{1,4}|[0-7]{1,3}|[\s\S])/g, (_match, escape) => {
|
|
14949
14956
|
if (escape[0] === "x" || escape[0] === "u") return String.fromCharCode(parseInt(escape.slice(1), 16));
|
|
14950
14957
|
if (/^[0-7]/.test(escape)) return String.fromCharCode(parseInt(escape, 8));
|
|
14951
14958
|
return ANSI_C_ESCAPES[escape] ?? escape;
|
|
@@ -14962,8 +14969,8 @@ function staticOutput(argv, stdin) {
|
|
|
14962
14969
|
if (flags.includes("n")) newline = false;
|
|
14963
14970
|
if (flags.includes("e")) escapes = true;
|
|
14964
14971
|
}
|
|
14965
|
-
const
|
|
14966
|
-
return (escapes ? decodeAnsiC(
|
|
14972
|
+
const text4 = args.join(" ");
|
|
14973
|
+
return (escapes ? decodeAnsiC(text4) : text4) + (newline ? "\n" : "");
|
|
14967
14974
|
}
|
|
14968
14975
|
if (name === "printf" && args.length > 0) {
|
|
14969
14976
|
const format = decodeAnsiC(args[0]);
|
|
@@ -15123,8 +15130,8 @@ function parseUntil(scope, start, closeParen) {
|
|
|
15123
15130
|
let quoted = false;
|
|
15124
15131
|
let redirect = null;
|
|
15125
15132
|
let parens = 0;
|
|
15126
|
-
const append = (
|
|
15127
|
-
word = (word ?? "") +
|
|
15133
|
+
const append = (text4, isQuoted = false) => {
|
|
15134
|
+
word = (word ?? "") + text4;
|
|
15128
15135
|
quoted ||= isQuoted;
|
|
15129
15136
|
};
|
|
15130
15137
|
const endWord = () => {
|
|
@@ -15340,10 +15347,10 @@ function planItemsFromMessage(message2) {
|
|
|
15340
15347
|
if (!todos) return null;
|
|
15341
15348
|
return todos.flatMap((todo) => {
|
|
15342
15349
|
if (!todo || typeof todo !== "object") return [];
|
|
15343
|
-
const
|
|
15350
|
+
const text4 = "content" in todo && typeof todo.content === "string" ? todo.content : "text" in todo && typeof todo.text === "string" ? todo.text : null;
|
|
15344
15351
|
const status = "status" in todo ? todo.status : null;
|
|
15345
|
-
if (!
|
|
15346
|
-
return [{ text:
|
|
15352
|
+
if (!text4) return [];
|
|
15353
|
+
return [{ text: text4, status: status === "completed" || status === "in_progress" ? status : "pending" }];
|
|
15347
15354
|
});
|
|
15348
15355
|
}
|
|
15349
15356
|
function peerChatName(message2) {
|
|
@@ -15406,24 +15413,24 @@ function lineCountFromOutput(output) {
|
|
|
15406
15413
|
}
|
|
15407
15414
|
return lines;
|
|
15408
15415
|
}
|
|
15409
|
-
function fileContentDiff(path, content,
|
|
15416
|
+
function fileContentDiff(path, content, action2) {
|
|
15410
15417
|
const lines = content.replace(/\n$/, "").split("\n");
|
|
15411
15418
|
return [
|
|
15412
|
-
`--- ${
|
|
15413
|
-
`+++ ${
|
|
15414
|
-
|
|
15415
|
-
...lines.map((line) => `${
|
|
15419
|
+
`--- ${action2 === "add" ? "/dev/null" : `a/${path}`}`,
|
|
15420
|
+
`+++ ${action2 === "add" ? `b/${path}` : "/dev/null"}`,
|
|
15421
|
+
action2 === "add" ? `@@ -0,0 +1,${lines.length} @@` : `@@ -1,${lines.length} +0,0 @@`,
|
|
15422
|
+
...lines.map((line) => `${action2 === "add" ? "+" : "-"}${line}`)
|
|
15416
15423
|
].join("\n");
|
|
15417
15424
|
}
|
|
15418
|
-
function isRawFileContent(diff,
|
|
15425
|
+
function isRawFileContent(diff, action2) {
|
|
15419
15426
|
const lines = diff.split("\n");
|
|
15420
|
-
return !lines[0].startsWith("diff --git ") && !(lines[0].startsWith("--- ") && lines[1]?.startsWith("+++ ")) && !(
|
|
15427
|
+
return !lines[0].startsWith("diff --git ") && !(lines[0].startsWith("--- ") && lines[1]?.startsWith("+++ ")) && !(action2 === "add" && lines.every((line) => line === "" || line.startsWith("+")));
|
|
15421
15428
|
}
|
|
15422
|
-
function operationDiffStats({ diff, action }) {
|
|
15429
|
+
function operationDiffStats({ diff, action: action2 }) {
|
|
15423
15430
|
if (!diff) return void 0;
|
|
15424
|
-
if (
|
|
15431
|
+
if (action2 === "update" || !isRawFileContent(diff, action2)) return getDiffStats(diff);
|
|
15425
15432
|
const lines = diff.replace(/\n$/, "").split("\n").length;
|
|
15426
|
-
return
|
|
15433
|
+
return action2 === "add" ? { added: lines, removed: 0 } : { added: 0, removed: lines };
|
|
15427
15434
|
}
|
|
15428
15435
|
function getDiffStats(diff) {
|
|
15429
15436
|
let added = 0;
|
|
@@ -15774,8 +15781,8 @@ function shellPayload(command) {
|
|
|
15774
15781
|
function commandLabel(command) {
|
|
15775
15782
|
const lines = shellPayload(command.slice(0, COMMAND_PARSE_LIMIT)).replace(/^cd\s+\S+\s*&&\s*/, "").split("\n").filter((line) => line.trim());
|
|
15776
15783
|
const shown = lines.length > 1 && /(["']|<<-?\s*['"]?\w+['"]?)\s*$/.test(lines[0]) ? 2 : 1;
|
|
15777
|
-
const
|
|
15778
|
-
return lines.length > shown ? `${
|
|
15784
|
+
const label2 = lines.slice(0, shown).map((line) => line.trim()).join(" ");
|
|
15785
|
+
return lines.length > shown ? `${label2} \u2026` : label2;
|
|
15779
15786
|
}
|
|
15780
15787
|
var BACKGROUND_META = {
|
|
15781
15788
|
in_progress: "Running in background",
|
|
@@ -15932,7 +15939,9 @@ var REPLICAS_API_STEPS = {
|
|
|
15932
15939
|
[REPLICAS_MCP_TOOLS.createAutomation]: { icon: "clock", live: "Creating automation", done: "Created automation" },
|
|
15933
15940
|
[REPLICAS_MCP_TOOLS.getLinearRouting]: { icon: "search", live: "Checking Linear routing", done: "Checked Linear routing" },
|
|
15934
15941
|
[REPLICAS_MCP_TOOLS.setLinearRouting]: { icon: "wrench", live: "Setting Linear routing", done: "Set Linear routing" },
|
|
15935
|
-
[REPLICAS_MCP_TOOLS.clearLinearRouting]: { icon: "trash", live: "Clearing Linear routing", done: "Cleared Linear routing" }
|
|
15942
|
+
[REPLICAS_MCP_TOOLS.clearLinearRouting]: { icon: "trash", live: "Clearing Linear routing", done: "Cleared Linear routing" },
|
|
15943
|
+
[REPLICAS_MCP_TOOLS.getBoard]: { icon: "book", live: "Reading board", done: "Read board" },
|
|
15944
|
+
[REPLICAS_MCP_TOOLS.updateBoard]: { icon: "file-pen", live: "Updating board", done: "Updated board" }
|
|
15936
15945
|
};
|
|
15937
15946
|
var INTERNAL_TOOLS = /* @__PURE__ */ new Set(["ToolSearch", "ListAgents", "ListMcpResourcesTool", "ReadMcpResourceTool", "TaskOutput", "BashOutput"]);
|
|
15938
15947
|
function describeToolCall(message2, base) {
|
|
@@ -15980,13 +15989,13 @@ function describeToolCall(message2, base) {
|
|
|
15980
15989
|
const command = replicasTool === REPLICAS_MCP_TOOLS.runCommand ? inputString(input, "command") : void 0;
|
|
15981
15990
|
const name = inputString(input, "name") ?? inputString(replicaFields, "name");
|
|
15982
15991
|
const workspaceId = inputString(input, "id") ?? inputString(replicaFields, "id");
|
|
15983
|
-
const
|
|
15992
|
+
const label2 = command ? commandLabel(command) : inputString(input, "title") ?? (replicasTool === REPLICAS_MCP_TOOLS.createAutomation ? name : void 0);
|
|
15984
15993
|
return {
|
|
15985
15994
|
...base,
|
|
15986
15995
|
key,
|
|
15987
15996
|
category: "tool",
|
|
15988
15997
|
...replicasStep,
|
|
15989
|
-
target:
|
|
15998
|
+
target: label2 ? { text: label2, plain: !command } : void 0,
|
|
15990
15999
|
workspace: workspaceId && UUID_RE.test(workspaceId) ? { id: workspaceId, name } : void 0,
|
|
15991
16000
|
detail: message2.input || message2.output ? "io" : void 0
|
|
15992
16001
|
};
|
|
@@ -16044,12 +16053,12 @@ function describeSteps(message2, { durations, backgroundTasks }) {
|
|
|
16044
16053
|
const background = backgroundId ? backgroundTasks?.get(backgroundId) : void 0;
|
|
16045
16054
|
const cached = stepCache.get(message2);
|
|
16046
16055
|
if (cached && cached.durationMs === durationMs && cached.background === background) return cached.steps;
|
|
16047
|
-
const
|
|
16056
|
+
const steps2 = describeMessageSteps(message2, durationMs, background).map((step) => ({
|
|
16048
16057
|
...step,
|
|
16049
16058
|
stats: step.operation && !step.failed ? operationDiffStats(step.operation) : void 0
|
|
16050
16059
|
}));
|
|
16051
|
-
stepCache.set(message2, { durationMs, background, steps });
|
|
16052
|
-
return
|
|
16060
|
+
stepCache.set(message2, { durationMs, background, steps: steps2 });
|
|
16061
|
+
return steps2;
|
|
16053
16062
|
}
|
|
16054
16063
|
var NO_DURATIONS = /* @__PURE__ */ new Map();
|
|
16055
16064
|
function plainStepLabel(step) {
|
|
@@ -16100,7 +16109,7 @@ function parseAnnotationsNote(body) {
|
|
|
16100
16109
|
var APPSHOT_NOTE_REGEX = /(?:^|\n\n)<replicas_appshot app="([^"\n]*)" window="([^"\n]*)" image="(\d+)">\n([^\n<]*)(?:\n\n([^<]*))?\n<\/replicas_appshot>$/;
|
|
16101
16110
|
var TRUNCATED_APPSHOT_NOTE_REGEX = /(?:^|\n\n)<replicas_appshot app="([^"\n]*)(?:" window="([^"\n]*)(?:" image="(\d*))?)?[^<]*(?:<\/?[a-z_]*)?$/;
|
|
16102
16111
|
var XML_UNESCAPES = { "&": "&", "<": "<", ">": ">", """: '"', "'": "'" };
|
|
16103
|
-
var unescapeXml = (
|
|
16112
|
+
var unescapeXml = (text4) => text4.replace(/&(?:amp|lt|gt|quot|#39);/g, (entity) => XML_UNESCAPES[entity]);
|
|
16104
16113
|
function parseAppshot(match) {
|
|
16105
16114
|
return {
|
|
16106
16115
|
appName: unescapeXml(match[1] ?? ""),
|
|
@@ -16112,9 +16121,9 @@ function parseAppshot(match) {
|
|
|
16112
16121
|
}
|
|
16113
16122
|
var WALKTHROUGH_NOTE_REGEX = /(?:^|\n\n)<replicas_walkthrough path="([^"\n]+)" duration_seconds="(\d+)" audio="(true|false)">\n[^<]*\n<\/replicas_walkthrough>$/;
|
|
16114
16123
|
var TRUNCATED_WALKTHROUGH_NOTE_REGEX = /(?:^|\n\n)<replicas_walkthrough path="([^"\n]*)(?:" duration_seconds="(\d*))?(?:" audio="(true)?)?[^<]*(?:<\/?[a-z_]*)?$/;
|
|
16115
|
-
function stripAttachmentNote(
|
|
16116
|
-
const match =
|
|
16117
|
-
let content = match ?
|
|
16124
|
+
function stripAttachmentNote(text4) {
|
|
16125
|
+
const match = text4.match(/(?:^|\n\n)<replicas_attachments>\nUploaded files are available at:((?:\n- .*)*)(?:\n<\/?[a-z_]*>?)?$/) ?? text4.match(/(?:^|\n\n)Uploaded files are available at:((?:\n- .*)*)$/);
|
|
16126
|
+
let content = match ? text4.replace(match[0], "").trim() : text4;
|
|
16118
16127
|
const takeTrailingNotes = (noteRegex, truncatedRegex, parse) => {
|
|
16119
16128
|
const notes = [];
|
|
16120
16129
|
const truncated = noteRegex.test(content) ? null : content.match(truncatedRegex);
|
|
@@ -16193,7 +16202,7 @@ function codexTurnMessages(turn) {
|
|
|
16193
16202
|
return [{
|
|
16194
16203
|
type: "reasoning",
|
|
16195
16204
|
id: turn.id,
|
|
16196
|
-
text: reasoning.map(({ text:
|
|
16205
|
+
text: reasoning.map(({ text: text4 }) => text4.trim()).join("\n\n"),
|
|
16197
16206
|
timestamp: reasoning[0].timestamp,
|
|
16198
16207
|
status: reasoning.at(-1)?.status ?? "completed"
|
|
16199
16208
|
}];
|
|
@@ -16699,7 +16708,7 @@ function parseCodexEvents(events) {
|
|
|
16699
16708
|
// ../shared/src/display-message/parsers/cursor-parser.ts
|
|
16700
16709
|
function getTextContent(value) {
|
|
16701
16710
|
if (!Array.isArray(value)) return "";
|
|
16702
|
-
return value.map((
|
|
16711
|
+
return value.map((block2) => isRecord(block2) && block2.type === "text" && typeof block2.text === "string" ? block2.text : "").join("");
|
|
16703
16712
|
}
|
|
16704
16713
|
function cursorStatusToDisplayStatus(status) {
|
|
16705
16714
|
return status === "completed" || status === "FINISHED" ? "completed" : status === "error" || status === "ERROR" || status === "CANCELLED" || status === "EXPIRED" ? "failed" : "in_progress";
|
|
@@ -16713,8 +16722,8 @@ function getCursorAssistantText(event) {
|
|
|
16713
16722
|
return getTextContent(message2?.content);
|
|
16714
16723
|
}
|
|
16715
16724
|
function getCursorThinkingText(event) {
|
|
16716
|
-
const
|
|
16717
|
-
if (typeof
|
|
16725
|
+
const text4 = event.payload.text;
|
|
16726
|
+
if (typeof text4 === "string") return text4;
|
|
16718
16727
|
const message2 = isRecord(event.payload.message) ? event.payload.message : null;
|
|
16719
16728
|
return typeof message2?.text === "string" ? message2.text : "";
|
|
16720
16729
|
}
|
|
@@ -16765,8 +16774,8 @@ function parseCursorEvents(events) {
|
|
|
16765
16774
|
continue;
|
|
16766
16775
|
}
|
|
16767
16776
|
if (event.type === "cursor-assistant") {
|
|
16768
|
-
const
|
|
16769
|
-
if (
|
|
16777
|
+
const text4 = getCursorAssistantText(event);
|
|
16778
|
+
if (text4) {
|
|
16770
16779
|
const runId = cursorRunId(event);
|
|
16771
16780
|
if (!activeAssistant || activeAssistant.runId !== runId) {
|
|
16772
16781
|
const segment = runAssistantSegments.get(runId) ?? 0;
|
|
@@ -16785,15 +16794,15 @@ function parseCursorEvents(events) {
|
|
|
16785
16794
|
if (message2?.type === "agent") {
|
|
16786
16795
|
messages[activeAssistant.index] = {
|
|
16787
16796
|
...message2,
|
|
16788
|
-
content: `${message2.content}${
|
|
16797
|
+
content: `${message2.content}${text4}`
|
|
16789
16798
|
};
|
|
16790
16799
|
}
|
|
16791
16800
|
}
|
|
16792
16801
|
continue;
|
|
16793
16802
|
}
|
|
16794
16803
|
if (event.type === "cursor-thinking") {
|
|
16795
|
-
const
|
|
16796
|
-
if (
|
|
16804
|
+
const text4 = getCursorThinkingText(event);
|
|
16805
|
+
if (text4.trim()) {
|
|
16797
16806
|
const runId = cursorRunId(event);
|
|
16798
16807
|
if (!activeThinking || activeThinking.runId !== runId) {
|
|
16799
16808
|
const segment = runThinkingSegments.get(runId) ?? 0;
|
|
@@ -16813,7 +16822,7 @@ function parseCursorEvents(events) {
|
|
|
16813
16822
|
if (message2?.type === "reasoning") {
|
|
16814
16823
|
messages[activeThinking.index] = {
|
|
16815
16824
|
...message2,
|
|
16816
|
-
content: `${message2.content}${
|
|
16825
|
+
content: `${message2.content}${text4}`,
|
|
16817
16826
|
status: "in_progress"
|
|
16818
16827
|
};
|
|
16819
16828
|
}
|
|
@@ -16845,12 +16854,12 @@ function parseCursorEvents(events) {
|
|
|
16845
16854
|
}
|
|
16846
16855
|
if (event.type === "cursor-task") {
|
|
16847
16856
|
activeAssistant = null;
|
|
16848
|
-
const
|
|
16849
|
-
if (typeof
|
|
16857
|
+
const text4 = event.payload.text;
|
|
16858
|
+
if (typeof text4 === "string" && text4.trim()) {
|
|
16850
16859
|
messages.push({
|
|
16851
16860
|
id: `cursor-task-${event.timestamp}-${messages.length}`,
|
|
16852
16861
|
type: "agent",
|
|
16853
|
-
content:
|
|
16862
|
+
content: text4,
|
|
16854
16863
|
timestamp: event.timestamp
|
|
16855
16864
|
});
|
|
16856
16865
|
}
|
|
@@ -16937,8 +16946,8 @@ function extractErrorText(error) {
|
|
|
16937
16946
|
collect(error);
|
|
16938
16947
|
return parts.filter(Boolean).join("\n");
|
|
16939
16948
|
}
|
|
16940
|
-
function isTransientErrorText(
|
|
16941
|
-
const normalized =
|
|
16949
|
+
function isTransientErrorText(text4, options = {}) {
|
|
16950
|
+
const normalized = text4.toLowerCase();
|
|
16942
16951
|
if (!normalized) return false;
|
|
16943
16952
|
if (TRANSIENT_NETWORK_ERROR_PATTERNS.some((pattern) => pattern.test(normalized))) return true;
|
|
16944
16953
|
if (options.includeRateLimit && /rate limit/.test(normalized)) return true;
|
|
@@ -16960,8 +16969,8 @@ var SERVER_ERROR_TEXT_PATTERN = /internal ?server ?error|server ?error|service u
|
|
|
16960
16969
|
var INFERENCE_ERROR_DETAIL_MAX = 600;
|
|
16961
16970
|
var INFERENCE_ERROR_RETRY_HINT = "This is usually temporary \u2014 retry the message.";
|
|
16962
16971
|
function formatInferenceError(message2, context = {}) {
|
|
16963
|
-
const
|
|
16964
|
-
const source =
|
|
16972
|
+
const label2 = context.provider ? INFERENCE_PROVIDER_LABELS[context.provider] ?? context.provider : null;
|
|
16973
|
+
const source = label2 ? `${label2}${context.model ? ` (${context.model})` : ""} request failed${typeof context.status === "number" ? ` with HTTP ${context.status}` : ""}` : null;
|
|
16965
16974
|
let body = source ? message2 ? `${source}: ${message2}` : `${source}.` : message2;
|
|
16966
16975
|
const detail = context.detail?.trim();
|
|
16967
16976
|
if (detail && !body.includes(detail)) {
|
|
@@ -17061,24 +17070,24 @@ function parseOpencodeEvents(events) {
|
|
|
17061
17070
|
const time = isRecord(part.time) ? part.time : null;
|
|
17062
17071
|
const timestamp = timestampFromMs(time?.start, event.timestamp);
|
|
17063
17072
|
if (part.type === "text") {
|
|
17064
|
-
const
|
|
17065
|
-
if (
|
|
17073
|
+
const text4 = typeof part.text === "string" ? part.text : "";
|
|
17074
|
+
if (text4.trim()) {
|
|
17066
17075
|
upsertDisplayMessage(messages, {
|
|
17067
17076
|
id,
|
|
17068
17077
|
type: "agent",
|
|
17069
|
-
content:
|
|
17078
|
+
content: text4,
|
|
17070
17079
|
timestamp
|
|
17071
17080
|
});
|
|
17072
17081
|
}
|
|
17073
17082
|
continue;
|
|
17074
17083
|
}
|
|
17075
17084
|
if (part.type === "reasoning") {
|
|
17076
|
-
const
|
|
17077
|
-
if (
|
|
17085
|
+
const text4 = typeof part.text === "string" ? part.text : "";
|
|
17086
|
+
if (text4.trim()) {
|
|
17078
17087
|
upsertDisplayMessage(messages, {
|
|
17079
17088
|
id,
|
|
17080
17089
|
type: "reasoning",
|
|
17081
|
-
content:
|
|
17090
|
+
content: text4,
|
|
17082
17091
|
status: time?.end ? "completed" : "in_progress",
|
|
17083
17092
|
timestamp
|
|
17084
17093
|
});
|
|
@@ -17243,7 +17252,7 @@ function assistantErrorMessage(value) {
|
|
|
17243
17252
|
}
|
|
17244
17253
|
function parsePiEvents(events) {
|
|
17245
17254
|
const messages = [];
|
|
17246
|
-
const
|
|
17255
|
+
const text4 = /* @__PURE__ */ new Map();
|
|
17247
17256
|
const thinking = /* @__PURE__ */ new Map();
|
|
17248
17257
|
let activeMessageId = "assistant";
|
|
17249
17258
|
for (const event of events) {
|
|
@@ -17274,9 +17283,9 @@ function parsePiEvents(events) {
|
|
|
17274
17283
|
if (event.type === "pi-message_update") {
|
|
17275
17284
|
const payload = nestedPayload(event);
|
|
17276
17285
|
const id = typeof payload.id === "string" ? payload.id : activeMessageId;
|
|
17277
|
-
if (payload.type === "text_delta" && typeof payload.delta === "string")
|
|
17286
|
+
if (payload.type === "text_delta" && typeof payload.delta === "string") text4.set(id, `${text4.get(id) ?? ""}${payload.delta}`);
|
|
17278
17287
|
if (payload.type === "thinking_delta" && typeof payload.delta === "string") thinking.set(id, `${thinking.get(id) ?? ""}${payload.delta}`);
|
|
17279
|
-
const textContent =
|
|
17288
|
+
const textContent = text4.get(id);
|
|
17280
17289
|
const thinkingContent = thinking.get(id);
|
|
17281
17290
|
if (textContent !== void 0) upsertDisplayMessage(messages, { id: `pi-${id}`, type: "agent", content: textContent, timestamp: event.timestamp });
|
|
17282
17291
|
if (thinkingContent !== void 0) upsertDisplayMessage(messages, { id: `pi-thinking-${id}`, type: "reasoning", content: thinkingContent, status: "in_progress", timestamp: event.timestamp });
|
|
@@ -17339,7 +17348,7 @@ function normalizeContentBlocks(content) {
|
|
|
17339
17348
|
if (typeof content === "string") {
|
|
17340
17349
|
return content ? [{ type: "text", text: content }] : [];
|
|
17341
17350
|
}
|
|
17342
|
-
return Array.isArray(content) ? content.filter((
|
|
17351
|
+
return Array.isArray(content) ? content.filter((block2) => isRecord(block2) && typeof block2.type === "string") : [];
|
|
17343
17352
|
}
|
|
17344
17353
|
function parseStringField(value) {
|
|
17345
17354
|
if (typeof value !== "string") return null;
|
|
@@ -17420,13 +17429,13 @@ var TaskAccumulator = class {
|
|
|
17420
17429
|
}
|
|
17421
17430
|
return out;
|
|
17422
17431
|
}
|
|
17423
|
-
processContentBlock(
|
|
17424
|
-
if (!isRecord(
|
|
17425
|
-
if (
|
|
17426
|
-
return this.processToolUse(
|
|
17432
|
+
processContentBlock(block2) {
|
|
17433
|
+
if (!isRecord(block2)) return false;
|
|
17434
|
+
if (block2.type === "tool_use" && typeof block2.name === "string" && typeof block2.id === "string") {
|
|
17435
|
+
return this.processToolUse(block2.name, block2.id, toAccumulatorInput(block2.input));
|
|
17427
17436
|
}
|
|
17428
|
-
if (
|
|
17429
|
-
return this.processCreateResult(
|
|
17437
|
+
if (block2.type === "tool_result" && typeof block2.tool_use_id === "string") {
|
|
17438
|
+
return this.processCreateResult(block2.tool_use_id, block2.content);
|
|
17430
17439
|
}
|
|
17431
17440
|
return false;
|
|
17432
17441
|
}
|
|
@@ -17438,12 +17447,12 @@ var COMMAND_TOOL_NAMES = /* @__PURE__ */ new Set(["Bash", "bash", "shell"]);
|
|
|
17438
17447
|
var FILE_TOOL_NAMES = /* @__PURE__ */ new Set(["Write", "Edit"]);
|
|
17439
17448
|
var toolMessageTemplates = /* @__PURE__ */ new WeakMap();
|
|
17440
17449
|
var toolResults = /* @__PURE__ */ new WeakMap();
|
|
17441
|
-
function fileOrCommandMessage(
|
|
17442
|
-
let template = toolMessageTemplates.get(
|
|
17450
|
+
function fileOrCommandMessage(block2, timestamp) {
|
|
17451
|
+
let template = toolMessageTemplates.get(block2);
|
|
17443
17452
|
if (!template) {
|
|
17444
|
-
const input = typeof
|
|
17445
|
-
template = toolMessageTemplate(
|
|
17446
|
-
toolMessageTemplates.set(
|
|
17453
|
+
const input = typeof block2.input === "string" ? safeJsonParse(block2.input, {}) : block2.input ?? {};
|
|
17454
|
+
template = toolMessageTemplate(block2.name ?? "", block2.id ?? "", input);
|
|
17455
|
+
toolMessageTemplates.set(block2, template);
|
|
17447
17456
|
}
|
|
17448
17457
|
return { ...template, timestamp };
|
|
17449
17458
|
}
|
|
@@ -17542,8 +17551,8 @@ function isClaudeResultError(payload) {
|
|
|
17542
17551
|
var LOCAL_COMMAND_ECHO_REGEX = /^<(?:command-name|command-message|local-command-stdout|local-command-stderr)>/;
|
|
17543
17552
|
function readClaudeUserPrompt(payload, content) {
|
|
17544
17553
|
if (payload.isSynthetic || content.some((c) => c.type === "tool_result" && c.tool_use_id)) return void 0;
|
|
17545
|
-
const
|
|
17546
|
-
if (LOCAL_COMMAND_ECHO_REGEX.test(
|
|
17554
|
+
const text4 = content.filter((c) => c.type === "text").map((c) => c.text || "").join("\n");
|
|
17555
|
+
if (LOCAL_COMMAND_ECHO_REGEX.test(text4.trim())) return void 0;
|
|
17547
17556
|
const images = content.filter((c) => c.type === "image" && c.source).map((c) => {
|
|
17548
17557
|
const source = c.source;
|
|
17549
17558
|
return {
|
|
@@ -17553,7 +17562,7 @@ function readClaudeUserPrompt(payload, content) {
|
|
|
17553
17562
|
...c.replicasOmitted ? { replicasOmitted: c.replicasOmitted } : {}
|
|
17554
17563
|
};
|
|
17555
17564
|
}).filter((img) => img.data || img.replicasOmitted);
|
|
17556
|
-
return
|
|
17565
|
+
return text4 || images.length > 0 ? { text: text4, images } : void 0;
|
|
17557
17566
|
}
|
|
17558
17567
|
function parseClaudeEvents(events, parentToolUseId) {
|
|
17559
17568
|
const messages = [];
|
|
@@ -17770,13 +17779,13 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
17770
17779
|
if (liveStreamId !== null && liveStreamId !== messageId) {
|
|
17771
17780
|
supersededStreamIds.add(liveStreamId);
|
|
17772
17781
|
}
|
|
17773
|
-
if (contentBlocks.some((
|
|
17782
|
+
if (contentBlocks.some((block2) => block2.type === "text" && block2.text)) {
|
|
17774
17783
|
completedStreamIds.add(messageId);
|
|
17775
17784
|
liveStreamId = null;
|
|
17776
17785
|
}
|
|
17777
17786
|
}
|
|
17778
17787
|
const thinkingBlocks = contentBlocks.flatMap(
|
|
17779
|
-
(
|
|
17788
|
+
(block2) => block2.type === "thinking" && typeof block2.thinking === "string" ? [block2.thinking] : []
|
|
17780
17789
|
);
|
|
17781
17790
|
if (thinkingBlocks.length > 0) {
|
|
17782
17791
|
const allThinking = [...assistantThinking.get(messageKey) ?? [], ...thinkingBlocks];
|
|
@@ -17795,14 +17804,14 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
17795
17804
|
upsertMessage(reasoningMessage);
|
|
17796
17805
|
}
|
|
17797
17806
|
}
|
|
17798
|
-
contentBlocks.forEach((
|
|
17799
|
-
if (
|
|
17807
|
+
contentBlocks.forEach((block2) => {
|
|
17808
|
+
if (block2.type === "text" && block2.text) {
|
|
17800
17809
|
const textIndex = assistantTextCounts.get(messageKey) ?? 0;
|
|
17801
17810
|
assistantTextCounts.set(messageKey, textIndex + 1);
|
|
17802
17811
|
const agentMessage = {
|
|
17803
17812
|
id: `agent-${messageKey}-${textIndex}`,
|
|
17804
17813
|
type: "agent",
|
|
17805
|
-
content:
|
|
17814
|
+
content: block2.text,
|
|
17806
17815
|
timestamp: event.timestamp
|
|
17807
17816
|
};
|
|
17808
17817
|
if (streamRefs?.agent !== void 0) {
|
|
@@ -17812,10 +17821,10 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
17812
17821
|
upsertMessage(agentMessage);
|
|
17813
17822
|
}
|
|
17814
17823
|
}
|
|
17815
|
-
if (
|
|
17816
|
-
const toolName =
|
|
17817
|
-
const toolInput =
|
|
17818
|
-
const toolUseId =
|
|
17824
|
+
if (block2.type === "tool_use" && block2.id) {
|
|
17825
|
+
const toolName = block2.name || "unknown";
|
|
17826
|
+
const toolInput = block2.input || {};
|
|
17827
|
+
const toolUseId = block2.id;
|
|
17819
17828
|
toolCallMap.set(toolUseId, {
|
|
17820
17829
|
messageIndex: messages.length,
|
|
17821
17830
|
toolName,
|
|
@@ -17834,9 +17843,9 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
17834
17843
|
nestedEvents
|
|
17835
17844
|
}));
|
|
17836
17845
|
} else if (COMMAND_TOOL_NAMES.has(toolName) || FILE_TOOL_NAMES.has(toolName)) {
|
|
17837
|
-
messages.push(fileOrCommandMessage(
|
|
17846
|
+
messages.push(fileOrCommandMessage(block2, event.timestamp));
|
|
17838
17847
|
} else if (toolName === "TaskCreate" || toolName === "TaskUpdate" || toolName === "TaskList") {
|
|
17839
|
-
taskAccumulator.processContentBlock(
|
|
17848
|
+
taskAccumulator.processContentBlock(block2);
|
|
17840
17849
|
const snapshot = taskSnapshot();
|
|
17841
17850
|
if (snapshot.length > 0) {
|
|
17842
17851
|
messages.push({
|
|
@@ -18606,9 +18615,9 @@ function getChatHistoryTurnId(event) {
|
|
|
18606
18615
|
}
|
|
18607
18616
|
var COMPACT_BODY_MAX_BYTES = 2 * 1024;
|
|
18608
18617
|
var COMPACT_PREVIEW_CHARS = 1024;
|
|
18609
|
-
function isStructuredToolOutput(
|
|
18610
|
-
if (extractMothershipEvents(
|
|
18611
|
-
const trimmed =
|
|
18618
|
+
function isStructuredToolOutput(text4) {
|
|
18619
|
+
if (extractMothershipEvents(text4).length > 0) return true;
|
|
18620
|
+
const trimmed = text4.trim();
|
|
18612
18621
|
if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) return false;
|
|
18613
18622
|
return safeJsonParse(trimmed, void 0) !== void 0;
|
|
18614
18623
|
}
|
|
@@ -18638,17 +18647,17 @@ function compactChatHistoryEvent(event, record) {
|
|
|
18638
18647
|
...payload,
|
|
18639
18648
|
message: {
|
|
18640
18649
|
...payload.message,
|
|
18641
|
-
content: payload.message.content.map((
|
|
18642
|
-
if (!isRecord(
|
|
18643
|
-
if (
|
|
18644
|
-
if (
|
|
18645
|
-
const
|
|
18646
|
-
if (isStructuredToolOutput(
|
|
18647
|
-
const replicasOmitted = omit(
|
|
18648
|
-
if (replicasOmitted) return { ...
|
|
18649
|
-
if (!Array.isArray(
|
|
18650
|
+
content: payload.message.content.map((block2) => {
|
|
18651
|
+
if (!isRecord(block2)) return block2;
|
|
18652
|
+
if (block2.type === "image") return compactImage(block2);
|
|
18653
|
+
if (block2.type !== "tool_result") return block2;
|
|
18654
|
+
const text4 = extractToolResultText(block2.content);
|
|
18655
|
+
if (isStructuredToolOutput(text4)) return block2;
|
|
18656
|
+
const replicasOmitted = omit(text4);
|
|
18657
|
+
if (replicasOmitted) return { ...block2, content: text4.slice(0, COMPACT_PREVIEW_CHARS), replicasOmitted };
|
|
18658
|
+
if (!Array.isArray(block2.content) || !block2.content.some((part) => isRecord(part) && part.type === "image") || sizeOf(block2.content) <= COMPACT_BODY_MAX_BYTES) return block2;
|
|
18650
18659
|
compacted = true;
|
|
18651
|
-
return { ...
|
|
18660
|
+
return { ...block2, content: text4 };
|
|
18652
18661
|
})
|
|
18653
18662
|
}
|
|
18654
18663
|
};
|
|
@@ -18725,11 +18734,11 @@ function createSubagentHistoryFilter() {
|
|
|
18725
18734
|
if (coerceBackgroundTaskPayload(payload)) return true;
|
|
18726
18735
|
const blocks = normalizeContentBlocks(isRecord(payload.message) ? payload.message.content : void 0);
|
|
18727
18736
|
if (type === "claude-assistant") {
|
|
18728
|
-
const spawns = blocks.filter((
|
|
18729
|
-
for (const
|
|
18737
|
+
const spawns = blocks.filter((block2) => block2.type === "tool_use" && block2.id && CLAUDE_SUBAGENT_TOOL_NAMES.has(block2.name ?? ""));
|
|
18738
|
+
for (const block2 of spawns) if (block2.id) spawnIds.add(block2.id);
|
|
18730
18739
|
return spawns.length > 0;
|
|
18731
18740
|
}
|
|
18732
|
-
return type === "claude-user" && blocks.some((
|
|
18741
|
+
return type === "claude-user" && blocks.some((block2) => block2.type === "tool_result" && spawnIds.has(block2.tool_use_id ?? ""));
|
|
18733
18742
|
};
|
|
18734
18743
|
}
|
|
18735
18744
|
function readChatSubagentHistory({ size, compact, readRange }) {
|
|
@@ -18761,7 +18770,7 @@ var SECRET_PATTERNS = [
|
|
|
18761
18770
|
/\b[A-Z][A-Z0-9_]*(?:KEY|TOKEN|SECRET|PASSWORD)\s*=\s*[^\s]{12,}/g
|
|
18762
18771
|
];
|
|
18763
18772
|
function redactSecrets(value) {
|
|
18764
|
-
return SECRET_PATTERNS.reduce((
|
|
18773
|
+
return SECRET_PATTERNS.reduce((text4, pattern) => text4.replace(pattern, "[REDACTED]"), value);
|
|
18765
18774
|
}
|
|
18766
18775
|
|
|
18767
18776
|
// ../shared/src/transcript-canonicalize.ts
|
|
@@ -18773,15 +18782,15 @@ function canonicalizeChatTranscriptBlocks(content, provider2, senders, beforeMes
|
|
|
18773
18782
|
const end = beforeMessageId === void 0 ? messages.length : messages.findIndex(({ id }) => id === beforeMessageId);
|
|
18774
18783
|
if (end === -1) throw new Error("That message is no longer in the chat history");
|
|
18775
18784
|
return messages.slice(0, end).flatMap((message2) => {
|
|
18776
|
-
let
|
|
18785
|
+
let block2 = null;
|
|
18777
18786
|
if (message2.type === "user") {
|
|
18778
|
-
|
|
18787
|
+
block2 = `## User${message2.senderEmail ? ` (${message2.senderEmail})` : ""}
|
|
18779
18788
|
${message2.content}`;
|
|
18780
18789
|
} else if (message2.type === "agent") {
|
|
18781
|
-
|
|
18790
|
+
block2 = `## Agent
|
|
18782
18791
|
${message2.content}`;
|
|
18783
18792
|
} else if (message2.type === "reasoning") {
|
|
18784
|
-
|
|
18793
|
+
block2 = `## Agent reasoning (unverified)
|
|
18785
18794
|
Timestamp: ${message2.sourceTimestamp ?? message2.timestamp}
|
|
18786
18795
|
${message2.content}`;
|
|
18787
18796
|
} else {
|
|
@@ -18796,19 +18805,19 @@ ${activity.items.map((item) => `- [${item.status}] ${item.text}`).join("\n")}`);
|
|
|
18796
18805
|
if (activity.content) details.push(`Details:
|
|
18797
18806
|
${activity.content}`);
|
|
18798
18807
|
if (message2.type === "command" && message2.exitCode != null) details.push(`Exit: ${message2.exitCode}`);
|
|
18799
|
-
|
|
18808
|
+
block2 = `## Activity
|
|
18800
18809
|
${activity.title}${details.length > 0 ? `
|
|
18801
18810
|
${details.join("\n")}` : ""}`;
|
|
18802
18811
|
}
|
|
18803
18812
|
}
|
|
18804
|
-
if (!
|
|
18805
|
-
return [redactSecrets(
|
|
18813
|
+
if (!block2) return [];
|
|
18814
|
+
return [redactSecrets(block2)];
|
|
18806
18815
|
});
|
|
18807
18816
|
}
|
|
18808
18817
|
function lastUserBlockText(blocks) {
|
|
18809
|
-
const
|
|
18810
|
-
if (!
|
|
18811
|
-
const body =
|
|
18818
|
+
const block2 = blocks.findLast((entry) => entry.startsWith("## User"));
|
|
18819
|
+
if (!block2) return null;
|
|
18820
|
+
const body = block2.slice(block2.indexOf("\n") + 1).trim();
|
|
18812
18821
|
return body || null;
|
|
18813
18822
|
}
|
|
18814
18823
|
|
|
@@ -19216,24 +19225,24 @@ function clampWarmHookTimeoutMs(timeoutMs) {
|
|
|
19216
19225
|
}
|
|
19217
19226
|
return Math.min(timeoutMs, MAX_WARM_HOOK_TIMEOUT_MS);
|
|
19218
19227
|
}
|
|
19219
|
-
function buildOutputPreview(
|
|
19228
|
+
function buildOutputPreview(text4, {
|
|
19220
19229
|
maxChars = DEFAULT_HOOK_OUTPUT_PREVIEW_CHARS,
|
|
19221
19230
|
truncateFrom = "head",
|
|
19222
19231
|
marker = "\n...[truncated \u2014 download the full log to see the rest]"
|
|
19223
19232
|
} = {}) {
|
|
19224
|
-
if (
|
|
19225
|
-
return { output:
|
|
19233
|
+
if (text4.length <= maxChars) {
|
|
19234
|
+
return { output: text4, outputTruncated: false, outputTotalChars: text4.length };
|
|
19226
19235
|
}
|
|
19227
19236
|
const previewChars = Math.max(0, maxChars - marker.length);
|
|
19228
|
-
const output = previewChars === 0 ? marker.slice(0, maxChars) : truncateFrom === "tail" ? `${marker}${
|
|
19237
|
+
const output = previewChars === 0 ? marker.slice(0, maxChars) : truncateFrom === "tail" ? `${marker}${text4.slice(-previewChars)}` : `${text4.slice(0, previewChars)}${marker}`;
|
|
19229
19238
|
return {
|
|
19230
19239
|
output,
|
|
19231
19240
|
outputTruncated: true,
|
|
19232
|
-
outputTotalChars:
|
|
19241
|
+
outputTotalChars: text4.length
|
|
19233
19242
|
};
|
|
19234
19243
|
}
|
|
19235
|
-
function buildHookOutputPreview(
|
|
19236
|
-
return buildOutputPreview(
|
|
19244
|
+
function buildHookOutputPreview(text4, maxChars = DEFAULT_HOOK_OUTPUT_PREVIEW_CHARS) {
|
|
19245
|
+
return buildOutputPreview(text4, { maxChars });
|
|
19237
19246
|
}
|
|
19238
19247
|
function parseWarmHookConfig(value, filename = "replicas.json") {
|
|
19239
19248
|
if (typeof value === "string") {
|
|
@@ -19340,14 +19349,14 @@ var AUTHENTICATION_ERROR_PATTERNS = [
|
|
|
19340
19349
|
/authentication error/,
|
|
19341
19350
|
/invalid api key/
|
|
19342
19351
|
];
|
|
19343
|
-
function isAuthenticationErrorText(
|
|
19344
|
-
const normalized =
|
|
19352
|
+
function isAuthenticationErrorText(text4, extraPatterns = []) {
|
|
19353
|
+
const normalized = text4.toLowerCase();
|
|
19345
19354
|
return AUTHENTICATION_ERROR_PATTERNS.some((pattern) => pattern.test(normalized)) || extraPatterns.some((pattern) => pattern.test(normalized));
|
|
19346
19355
|
}
|
|
19347
19356
|
|
|
19348
19357
|
// ../shared/src/claude-auth.ts
|
|
19349
|
-
function isClaudeAuthErrorText(
|
|
19350
|
-
const lower =
|
|
19358
|
+
function isClaudeAuthErrorText(text4) {
|
|
19359
|
+
const lower = text4.toLowerCase();
|
|
19351
19360
|
return lower.includes("failed to authenticate") || lower.includes("authentication_error") || lower.includes("authentication_failed") || lower.includes("authentication failed") || lower.includes("invalid authentication credentials") || lower.includes("not logged in") || lower.includes("please run /login") || lower.includes("401") && lower.includes("authentic");
|
|
19352
19361
|
}
|
|
19353
19362
|
|
|
@@ -19577,10 +19586,10 @@ function parseCommitArgs(args) {
|
|
|
19577
19586
|
const arg = args[index];
|
|
19578
19587
|
const long = /^--([\w-]+)(?:=([\s\S]*))?$/.exec(arg);
|
|
19579
19588
|
if (long) {
|
|
19580
|
-
const [, name,
|
|
19589
|
+
const [, name, inline2] = long;
|
|
19581
19590
|
if (name === "amend") amend = true;
|
|
19582
19591
|
if (!COMMIT_VALUE_OPTIONS.has(name)) continue;
|
|
19583
|
-
const value =
|
|
19592
|
+
const value = inline2 ?? args[++index] ?? "";
|
|
19584
19593
|
if (name === "message") messages.push(value);
|
|
19585
19594
|
else if (name === "file") file = value;
|
|
19586
19595
|
else if (name === "trailer") trailers.push(value);
|
|
@@ -19613,12 +19622,12 @@ function parsePushArgs(args) {
|
|
|
19613
19622
|
positionals.push(...args.slice(index + 1));
|
|
19614
19623
|
break;
|
|
19615
19624
|
} else if (long) {
|
|
19616
|
-
const [, name,
|
|
19625
|
+
const [, name, inline2] = long;
|
|
19617
19626
|
all ||= ["all", "mirror", "branches"].includes(name);
|
|
19618
19627
|
tags ||= name === "tags";
|
|
19619
19628
|
repo ||= name === "repo";
|
|
19620
19629
|
if (["repo", "push-option", "receive-pack", "exec"].includes(name)) {
|
|
19621
|
-
const value =
|
|
19630
|
+
const value = inline2 ?? args[++index] ?? "";
|
|
19622
19631
|
if (name === "push-option") options.push(value);
|
|
19623
19632
|
}
|
|
19624
19633
|
} else if (/^-[^-]/.test(arg)) {
|
|
@@ -19673,8 +19682,8 @@ function stringifyCommandProtectionInput(value) {
|
|
|
19673
19682
|
return String(value);
|
|
19674
19683
|
}
|
|
19675
19684
|
}
|
|
19676
|
-
function normalizeCommandProtectionText(
|
|
19677
|
-
return
|
|
19685
|
+
function normalizeCommandProtectionText(text4) {
|
|
19686
|
+
return text4.replace(/\\\n/g, " ").replace(/\s+/g, " ").trim().toLowerCase();
|
|
19678
19687
|
}
|
|
19679
19688
|
function extractCommandProtectionCommandText(request, options = {}) {
|
|
19680
19689
|
if (request.command && request.command.trim()) return request.command;
|
|
@@ -19798,7 +19807,7 @@ function isPrMergeCommand(argv) {
|
|
|
19798
19807
|
if (words[0] === (name === "gh" ? "pr" : "mr") && words[1] === "merge") return true;
|
|
19799
19808
|
return words[0] === "api" && apiMethod(args) === "PUT" && words.some((word) => /\/(?:pulls|merge_requests)\/[^/]+\/merge$/.test(word));
|
|
19800
19809
|
}
|
|
19801
|
-
var matchingChecks = (checks,
|
|
19810
|
+
var matchingChecks = (checks, text4) => checks.flatMap(([name, pattern]) => pattern.test(text4) ? [name] : []);
|
|
19802
19811
|
function executedText(commands, keepWord = () => true) {
|
|
19803
19812
|
return commands.filter(({ argv, wrapper, truncated }) => (!wrapper || truncated) && argv[0].split("/").pop() !== "git").map(({ argv, stdin }) => normalizeCommandProtectionText([...argv.filter(keepWord), stdin ?? ""].join(" ").replaceAll(SHELL_OPAQUE, " "))).join("\n");
|
|
19804
19813
|
}
|
|
@@ -20709,6 +20718,116 @@ var respondVariableRequestSchema = z33.discriminatedUnion("action", [
|
|
|
20709
20718
|
z33.object({ action: z33.literal("skip") })
|
|
20710
20719
|
]);
|
|
20711
20720
|
|
|
20721
|
+
// ../shared/src/mothership-board.ts
|
|
20722
|
+
import { z as z34 } from "zod";
|
|
20723
|
+
var MOTHERSHIP_BOARD_TONES = ["neutral", "needs_you", "warning", "success", "danger"];
|
|
20724
|
+
var label = (max) => z34.string().trim().min(1).max(max);
|
|
20725
|
+
var tone = z34.enum(MOTHERSHIP_BOARD_TONES);
|
|
20726
|
+
var blockId = z34.string().regex(/^[\w.:-]{1,64}$/, "Use 1-64 letters, digits, _, -, . or :");
|
|
20727
|
+
var httpsUrl = z34.url({ protocol: /^https$/, error: "Must be an https URL" });
|
|
20728
|
+
var prUrl = httpsUrl.refine((url) => parseCodeHostPrUrl(url) !== null, "Must be a GitHub pull request or GitLab merge request URL");
|
|
20729
|
+
var linearIdentifier = z34.string().regex(/^[A-Za-z][A-Za-z0-9]{0,9}-\d{1,7}$/, "Use a Linear identifier such as REP-123");
|
|
20730
|
+
var action = z34.discriminatedUnion("type", [
|
|
20731
|
+
z34.object({ type: z34.literal("open_ship"), workspace_id: z34.uuid() }),
|
|
20732
|
+
z34.object({ type: z34.literal("message_ship"), workspace_id: z34.uuid(), message: label(4e3) }),
|
|
20733
|
+
z34.object({ type: z34.literal("open_pr"), url: prUrl }),
|
|
20734
|
+
z34.object({ type: z34.literal("merge_pr"), url: prUrl }),
|
|
20735
|
+
z34.object({ type: z34.literal("message_mothership"), message: label(4e3) }),
|
|
20736
|
+
z34.object({ type: z34.literal("open_link"), url: httpsUrl })
|
|
20737
|
+
]);
|
|
20738
|
+
var text3 = z34.object({ type: z34.literal("text"), id: blockId.optional(), text: label(2e3) });
|
|
20739
|
+
var badge = z34.object({ type: z34.literal("badge"), id: blockId.optional(), label: label(40), tone: tone.optional() });
|
|
20740
|
+
var pr = z34.object({ type: z34.literal("pr"), id: blockId.optional(), url: prUrl });
|
|
20741
|
+
var ship = z34.object({ type: z34.literal("ship"), id: blockId.optional(), workspace_id: z34.uuid() });
|
|
20742
|
+
var linear = z34.object({ type: z34.literal("linear"), id: blockId.optional(), identifier: linearIdentifier });
|
|
20743
|
+
var button = z34.object({ type: z34.literal("button"), id: blockId.optional(), label: label(60), action, variant: z34.enum(["primary", "outline", "warning", "destructive"]).optional() });
|
|
20744
|
+
var steps = z34.object({
|
|
20745
|
+
type: z34.literal("steps"),
|
|
20746
|
+
id: blockId.optional(),
|
|
20747
|
+
steps: z34.array(z34.object({ label: label(30), state: z34.enum(["done", "current", "pending", "failed"]) })).min(1).max(8)
|
|
20748
|
+
});
|
|
20749
|
+
var inline = z34.discriminatedUnion("type", [text3, badge, pr, ship, linear, button, steps]);
|
|
20750
|
+
var row = z34.object({ type: z34.literal("row"), id: blockId.optional(), cells: z34.array(z34.union([label(500), inline])).min(1).max(6) });
|
|
20751
|
+
var blockTypes = {
|
|
20752
|
+
text: text3,
|
|
20753
|
+
badge,
|
|
20754
|
+
pr,
|
|
20755
|
+
ship,
|
|
20756
|
+
linear,
|
|
20757
|
+
button,
|
|
20758
|
+
steps,
|
|
20759
|
+
stat: z34.object({ type: z34.literal("stat"), id: blockId.optional(), label: label(40), value: label(40), tone: tone.optional() }),
|
|
20760
|
+
divider: z34.object({ type: z34.literal("divider"), id: blockId.optional() }),
|
|
20761
|
+
updated_at: z34.object({ type: z34.literal("updated_at"), id: blockId.optional() }),
|
|
20762
|
+
choice: z34.object({
|
|
20763
|
+
type: z34.literal("choice"),
|
|
20764
|
+
id: blockId.optional(),
|
|
20765
|
+
question: label(500),
|
|
20766
|
+
options: z34.array(z34.object({ label: label(60), message: label(2e3).optional() })).min(2).max(6)
|
|
20767
|
+
}),
|
|
20768
|
+
button_group: z34.object({ type: z34.literal("button_group"), id: blockId.optional(), children: z34.array(button).min(1).max(8) }),
|
|
20769
|
+
table: z34.object({ type: z34.literal("table"), id: blockId.optional(), columns: z34.array(label(40)).min(1).max(6), children: z34.array(row).max(100) }),
|
|
20770
|
+
callout: z34.object({
|
|
20771
|
+
type: z34.literal("callout"),
|
|
20772
|
+
id: blockId.optional(),
|
|
20773
|
+
tone,
|
|
20774
|
+
title: label(120).optional(),
|
|
20775
|
+
get children() {
|
|
20776
|
+
return z34.array(block).max(20).optional();
|
|
20777
|
+
}
|
|
20778
|
+
}),
|
|
20779
|
+
list: z34.object({
|
|
20780
|
+
type: z34.literal("list"),
|
|
20781
|
+
id: blockId.optional(),
|
|
20782
|
+
ordered: z34.boolean().optional(),
|
|
20783
|
+
get children() {
|
|
20784
|
+
return z34.array(block).max(100);
|
|
20785
|
+
}
|
|
20786
|
+
}),
|
|
20787
|
+
section: z34.object({
|
|
20788
|
+
type: z34.literal("section"),
|
|
20789
|
+
id: blockId.optional(),
|
|
20790
|
+
title: label(120),
|
|
20791
|
+
collapsed: z34.boolean().optional(),
|
|
20792
|
+
get children() {
|
|
20793
|
+
return z34.array(block).max(100);
|
|
20794
|
+
}
|
|
20795
|
+
})
|
|
20796
|
+
};
|
|
20797
|
+
var blockSchemas = [text3, ...Object.values(blockTypes).filter((schema) => schema !== text3)];
|
|
20798
|
+
var block = z34.discriminatedUnion("type", blockSchemas);
|
|
20799
|
+
var MOTHERSHIP_BOARD_CONTAINER_TYPES = Object.entries(blockTypes).filter(([, schema]) => "children" in schema.shape).map(([type]) => type);
|
|
20800
|
+
var mothershipBoardBlocksSchema = z34.array(block).max(100).superRefine((blocks, ctx) => {
|
|
20801
|
+
const seen = /* @__PURE__ */ new Set();
|
|
20802
|
+
const visit = (node, path) => {
|
|
20803
|
+
if (typeof node === "string") return;
|
|
20804
|
+
if (node.id) {
|
|
20805
|
+
if (seen.has(node.id)) ctx.addIssue({ code: "custom", path: [...path, "id"], message: `Duplicate block id "${node.id}"` });
|
|
20806
|
+
seen.add(node.id);
|
|
20807
|
+
}
|
|
20808
|
+
if (node.type === "table") {
|
|
20809
|
+
node.children.forEach((child, index) => {
|
|
20810
|
+
if (child.cells.length > node.columns.length) ctx.addIssue({ code: "custom", path: [...path, "children", index, "cells"], message: `Row has ${child.cells.length} cells but the table has ${node.columns.length} columns` });
|
|
20811
|
+
});
|
|
20812
|
+
}
|
|
20813
|
+
if (node.type === "row") node.cells.forEach((cell, index) => visit(cell, [...path, "cells", index]));
|
|
20814
|
+
else if ("children" in node) node.children?.forEach((child, index) => visit(child, [...path, "children", index]));
|
|
20815
|
+
};
|
|
20816
|
+
blocks.forEach((node, index) => visit(node, [index]));
|
|
20817
|
+
});
|
|
20818
|
+
var mothershipBoardOperationsSchema = z34.array(z34.discriminatedUnion("op", [
|
|
20819
|
+
z34.object({ op: z34.literal("replace"), blocks: z34.array(block) }),
|
|
20820
|
+
z34.object({
|
|
20821
|
+
op: z34.literal("upsert"),
|
|
20822
|
+
block: z34.discriminatedUnion("type", [row, ...blockSchemas]).refine((value) => Boolean(value.id), { message: "Give the block an id", path: ["id"] }),
|
|
20823
|
+
parent_id: blockId.optional(),
|
|
20824
|
+
position: z34.number().int().min(0).optional()
|
|
20825
|
+
}),
|
|
20826
|
+
z34.object({ op: z34.literal("remove"), id: blockId })
|
|
20827
|
+
])).min(1).max(50);
|
|
20828
|
+
var LINEAR_ISSUE_SUMMARIES_MAX = 50;
|
|
20829
|
+
var linearIssueSummariesRequestSchema = z34.object({ identifiers: z34.array(linearIdentifier).min(1).max(LINEAR_ISSUE_SUMMARIES_MAX) });
|
|
20830
|
+
|
|
20712
20831
|
export {
|
|
20713
20832
|
ENGINE_SEND_MESSAGE_FAILED_ERROR,
|
|
20714
20833
|
isRecord,
|