halfcycle 0.12.0 → 0.13.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -982,13 +982,39 @@ var leftForOwnerSchema = z6.object({
982
982
  }).strict().refine((v) => v.tasks.length + v.waiting.length > 0, {
983
983
  message: "is sent only when some work was left for the owner"
984
984
  });
985
+ var TASKS_FILE_PATH = "docs/tasks.md";
986
+ function isTicket(ref, url) {
987
+ const issue = /^#([1-9][0-9]{0,9})$/.exec(ref);
988
+ if (issue === null)
989
+ return ref === TASKS_FILE_PATH && (url === void 0 || url === null);
990
+ if (url === void 0 || url === null)
991
+ return true;
992
+ const address = /^(.*)\/issues\/([1-9][0-9]{0,9})$/.exec(url);
993
+ return address !== null && address[2] === issue[1] && GITHUB_REPOSITORY_ADDRESS.test(address[1]) && !looksLikeSecret(url);
994
+ }
995
+ var TICKET_MESSAGE = `must be #<number> or ${TASKS_FILE_PATH}, with a link only beside #<number>: https://github.com/<owner>/<repo>/issues/<number>`;
996
+ var ticketSchema = z6.object({
997
+ ref: z6.string(),
998
+ url: z6.string().optional()
999
+ }).strict().refine((t) => isTicket(t.ref, t.url), { message: TICKET_MESSAGE });
1000
+ var TICKET_TITLE_MAX = 240;
1001
+ var TICKETS_MAX = 500;
1002
+ var ticketEntrySchema = z6.object({
1003
+ title: plainText(TICKET_TITLE_MAX),
1004
+ ref: z6.string(),
1005
+ url: z6.string().nullable()
1006
+ }).strict().refine((t) => isTicket(t.ref, t.url), { message: TICKET_MESSAGE });
1007
+ var ticketsSchema = z6.object({
1008
+ entries: z6.array(ticketEntrySchema).min(1).max(TICKETS_MAX)
1009
+ }).strict();
985
1010
  var observedCloseSchema = z6.object({
986
1011
  sequence: z6.number().int().min(1),
987
1012
  closedAt: utcIso8601,
988
1013
  closedBy: closedBySchema,
989
1014
  crossed: crossedSchema,
990
1015
  seatCoverage: seatCoverageSchema.nullable(),
991
- leftForOwner: leftForOwnerSchema.optional()
1016
+ leftForOwner: leftForOwnerSchema.optional(),
1017
+ tickets: ticketsSchema.optional()
992
1018
  }).strict();
993
1019
  var couldNotRunCheckSchema = z6.object({
994
1020
  check: plainText(),
@@ -1334,7 +1360,8 @@ var buildTaskSchema = z8.object({
1334
1360
  ships: buildTaskShipsSchema.optional(),
1335
1361
  // The commit or version the task reported when it shipped, exactly as reported, as
1336
1362
  // one word with no spaces. Absent until it has shipped, or when it reported none.
1337
- shipped: z8.string().min(1).max(BUILD_TASK_SHIPPED_MAX).regex(/^[^\s\x00-\x1f\x7f-\x9f]*$/, { message: "must be one word, with no spaces or control characters" }).optional()
1363
+ shipped: z8.string().min(1).max(BUILD_TASK_SHIPPED_MAX).regex(/^[^\s\x00-\x1f\x7f-\x9f]*$/, { message: "must be one word, with no spaces or control characters" }).optional(),
1364
+ ticket: ticketSchema.optional()
1338
1365
  }).strict().superRefine((task, ctx) => {
1339
1366
  if (task.reviews !== void 0 && task.reviews === task.id) {
1340
1367
  ctx.addIssue({
@@ -3351,6 +3378,8 @@ var ownerWaitAddResultSchema = z24.discriminatedUnion("outcome", [
3351
3378
  z24.object({ outcome: z24.literal("refused"), reason: z24.literal("too-many") }).strict()
3352
3379
  ]);
3353
3380
  var ownerWaitUndoableSchema = z24.enum(["yes", "no"]);
3381
+ var OWNER_WAIT_STEP_MAX = 64;
3382
+ var ownerWaitStepSchema = z24.string().max(OWNER_WAIT_STEP_MAX).refine((v) => stepIdSchema.safeParse(v).success, { message: "must be the id of a step, as the method names it" });
3354
3383
  var ownerWaitDeclareRequestSchema = z24.object({
3355
3384
  engagementId: z24.string().min(1),
3356
3385
  item: ownerWaitItemRefSchema,
@@ -3359,7 +3388,8 @@ var ownerWaitDeclareRequestSchema = z24.object({
3359
3388
  task: buildTaskIdSchema.optional(),
3360
3389
  by: agentNameSchema.optional(),
3361
3390
  undoable: ownerWaitUndoableSchema.optional(),
3362
- how: statementText(STATEMENT_MAX).optional()
3391
+ how: statementText(STATEMENT_MAX).optional(),
3392
+ step: ownerWaitStepSchema.optional()
3363
3393
  }).strict().refine((r) => r.undoable === "yes" === (r.how !== void 0), {
3364
3394
  message: "says how to undo it exactly when it can be undone",
3365
3395
  path: ["how"]
@@ -6262,7 +6292,11 @@ HC_LEAD="$HC_LEAD|"$'\\xc2\\xa0|\\xe1\\x9a\\x80|\\xe2\\x80[\\x80-\\x8a\\xa8\\xa9
6262
6292
  # reading is the same set or narrower): a number of agents, the most, faster, a
6263
6293
  # vague amount it answers with an ask for a number, or a free share.
6264
6294
  HC_PACE='((run|use|start|go)( +with| +at)? +)?(up +to +|the +)?(faster|more +agents|(-?[0-9]+(\\.[0-9]+)?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty) +agents?|(max|maximum|full|top) +(pace|speed)|(max|maximum)( +possible)?( +number +of)? +agents|as +many +agents +as +(possible|you +can)|(lots +of|a +lot +of|loads +of|plenty +of|many|some|several|a +few|a +bunch +of) +agents)( +(at +once|at +a +time|in +parallel|concurrently|simultaneously|together))?|keep +[0-9]{1,3}% +free|use +up +to +[0-9]{1,3}%'
6265
- if ! printf '%s' "$HC_INPUT" | LC_ALL=C grep -Eiq "\\"prompt\\"[[:space:]]*:[[:space:]]*\\"($HC_LEAD)*((approve|send back|accept|question|carry|drop|reject|autonomy|decline) |allow( +[0-9]{1,4})?($HC_LEAD)*\\"|(keep going|stop|stop here|limit it to [0-9]{1,9}(\\.[0-9]{1,2})? (times|million|billion|million tokens|billion tokens)|limit it to [0-9]{1,3}% of the week)($HC_LEAD)*\\"|(please,? +)?($HC_PACE)(,? +please)?[.!]*($HC_LEAD)*\\")"; then
6295
+ # A pace intent anywhere in a short prompt (a short one-line prompt is read from what the
6296
+ # person means; the runner decides the count of words and the line, this only lets a
6297
+ # candidate through, so it is the same set or wider).
6298
+ HC_INTENT='(max|maximum|full|top|fastest)( +[a-z]+){0,2} +(pace|speed)|as +many +agents +as +possible|faster|speed +up|(increase|raise|up)( +the)? +(pace|speed)|more +agents|slower|slow +down|(decrease|lower|reduce)( +the)? +(pace|speed)|fewer +agents|(-?[0-9]+(\\.[0-9]+)?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty) +agents?'
6299
+ if ! printf '%s' "$HC_INPUT" | LC_ALL=C grep -Eiq "\\"prompt\\"[[:space:]]*:[[:space:]]*\\"($HC_LEAD)*((approve|send back|accept|question|carry|drop|reject|autonomy|decline) |allow( +[0-9]{1,4})?\\.?($HC_LEAD)*\\"|[^\\"]{0,200}($HC_INTENT)[^\\"]{0,200}\\"|(keep going|stop|stop here|limit it to [0-9]{1,9}(\\.[0-9]{1,2})? (times|million|billion|million tokens|billion tokens)|limit it to [0-9]{1,3}% of the week)($HC_LEAD)*\\"|(please,? +)?($HC_PACE)(,? +please)?[.!]*($HC_LEAD)*\\")"; then
6266
6300
  exit 0
6267
6301
  fi
6268
6302
 
@@ -8431,6 +8465,20 @@ function leftForYouLines(left, p) {
8431
8465
  }
8432
8466
  return lines;
8433
8467
  }
8468
+ var TASKS_FILE_LINK = "../tasks.md";
8469
+ function ticketLines(tickets, p) {
8470
+ if (tickets === void 0)
8471
+ return [];
8472
+ const lines = ["- Tickets:"];
8473
+ for (const entry of tickets.entries) {
8474
+ lines.push(` - ${entry.ref} ${p.text(entry.title)}`);
8475
+ if (entry.url !== null)
8476
+ lines.push(` - Link: [${entry.ref}](${entry.url})`);
8477
+ else if (entry.ref === TASKS_FILE_PATH)
8478
+ lines.push(` - Link: [${entry.ref}](${TASKS_FILE_LINK})`);
8479
+ }
8480
+ return lines;
8481
+ }
8434
8482
  function shownBy(steps) {
8435
8483
  const named2 = steps.filter((s) => s.name !== void 0).length;
8436
8484
  if (named2 === 0)
@@ -8504,6 +8552,7 @@ function renderClose(heading, observed, attested, checks, p, closingRound = fals
8504
8552
  `- Signed in as: ${signedInAs(observed.closedBy, p)}`,
8505
8553
  ...outstanding(observed.crossed, p),
8506
8554
  ...leftForYouLines(observed.leftForOwner, p),
8555
+ ...ticketLines(observed.tickets, p),
8507
8556
  machines(observed.seatCoverage, checks)
8508
8557
  ].join("\n"),
8509
8558
  STATED_LABEL,