@kitman-sh/software-engineering 0.52.0 → 0.54.0

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/bundle.js CHANGED
@@ -15141,6 +15141,15 @@ var QuestionAnswer = Struct({
15141
15141
  answeredAt: Timestamp,
15142
15142
  idempotencyKey: String5.check(isMinLength(1), isMaxLength(240))
15143
15143
  });
15144
+ var QuestionSplitEntry = Struct({
15145
+ title: String5.check(isMinLength(1), isMaxLength(240)),
15146
+ promise: QuestionText,
15147
+ criteria: ArraySchema(QuestionText).check(isMinLength(1))
15148
+ });
15149
+ var QuestionSplit = Struct({
15150
+ taskId: Id,
15151
+ entries: ArraySchema(QuestionSplitEntry).check(isMinLength(1))
15152
+ });
15144
15153
  var Question = Struct({
15145
15154
  id: Id,
15146
15155
  workspaceId: Id,
@@ -15158,6 +15167,7 @@ var Question = Struct({
15158
15167
  recommended: optionalKey2(QuestionText),
15159
15168
  recommendationReason: optionalKey2(QuestionText),
15160
15169
  informationOnly: optionalKey2(Boolean3),
15170
+ split: optionalKey2(QuestionSplit),
15161
15171
  default: optionalKey2(LoopSafeText),
15162
15172
  defaultAt: optionalKey2(Timestamp),
15163
15173
  responderPolicy: QuestionResponderPolicy,
@@ -15584,6 +15594,13 @@ var resolvedLocalDateTimes = new Map;
15584
15594
  var eventWhenClauseName = (event) => event.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
15585
15595
 
15586
15596
  // ../../packages/core/src/kit-declarations.ts
15597
+ var LoopIntent = Union2([
15598
+ Literal2("task"),
15599
+ Struct({
15600
+ goal: String5.check(makeFilter2((goal) => goal.trim() !== "" || "a non-blank goal")),
15601
+ doneWhen: ArraySchema(String5)
15602
+ })
15603
+ ]);
15587
15604
  var LoopCapabilities = [
15588
15605
  "agent_work",
15589
15606
  "ask",
@@ -15643,6 +15660,7 @@ var LoopManifest = Struct({
15643
15660
  secrets: optionalKey2(ArraySchema(SecretName2)),
15644
15661
  network: optionalKey2(AgentSandboxNetwork),
15645
15662
  schedule: optionalKey2(Struct({ rule: ScheduleRule, timezone: String5 })),
15663
+ intent: optionalKey2(LoopIntent),
15646
15664
  outline: optionalKey2(LoopOutline)
15647
15665
  });
15648
15666
  var ProgramLoopListing = Struct({ ...ProgramLoop.fields, schedule: LoopManifest.fields.schedule });
@@ -16004,6 +16022,21 @@ var carriesRole = (loop, role, declared) => gen2(function* () {
16004
16022
  });
16005
16023
  }
16006
16024
  });
16025
+ var IntentDeclaration = Union2([
16026
+ Literal2("task"),
16027
+ Struct({ goal: String5, doneWhen: optionalKey2(ArraySchema(String5)) })
16028
+ ]);
16029
+ var declaredIntent = (definition) => gen2(function* () {
16030
+ if (definition.intent === undefined)
16031
+ return { goal: `Run the ${definition.id} Loop`, doneWhen: [] };
16032
+ const invalid = (reason) => new ManifestInvalid({ loop: definition.id, message: `Loop "${definition.id}": ${reason}` });
16033
+ const declared = yield* decodeEffect2(IntentDeclaration)(definition.intent).pipe(mapError3((error) => invalid(`intent must be 'task' or a goal with a list of strings: ${error.message}`)));
16034
+ if (declared === "task")
16035
+ return declared;
16036
+ if (declared.goal.trim() === "")
16037
+ return yield* invalid("intent goal must not be blank");
16038
+ return { goal: declared.goal.trim(), doneWhen: [...declared.doneWhen ?? []] };
16039
+ });
16007
16040
  var loopManifest = (definition) => gen2(function* () {
16008
16041
  yield* declarationsAreData(definition);
16009
16042
  if (definition.version !== undefined && !is2(LoopVersion)(definition.version))
@@ -16016,6 +16049,7 @@ var loopManifest = (definition) => gen2(function* () {
16016
16049
  loop: definition.id,
16017
16050
  message: "description must be one line of 1 to 160 characters"
16018
16051
  });
16052
+ const intent = yield* declaredIntent(definition);
16019
16053
  const input = yield* jsonSchemaOf(definition.id, definition.input);
16020
16054
  const output = yield* jsonSchemaOf(definition.id, definition.output);
16021
16055
  if (definition.role !== undefined)
@@ -16029,6 +16063,7 @@ var loopManifest = (definition) => gen2(function* () {
16029
16063
  output,
16030
16064
  ...definition.outcome === undefined ? undefined : { outcome: definition.outcome },
16031
16065
  ...definition.role === undefined ? undefined : { role: definition.role },
16066
+ intent,
16032
16067
  agents: definition.agents,
16033
16068
  checkout: definition.checkout,
16034
16069
  when: yield* namedWhenClauses(definition.id, definition.when ?? []),
@@ -23492,7 +23527,9 @@ var scriptedHost = (script, engine, agentLaunches, childLaunches, waits, verifyL
23492
23527
  return andThen2(sync2(() => questions.push({
23493
23528
  step: launch.step,
23494
23529
  prompt: launch.prompt,
23495
- ...launch.answerSchema === undefined ? undefined : { answerSchema: launch.answerSchema }
23530
+ ...launch.answerSchema === undefined ? undefined : { answerSchema: launch.answerSchema },
23531
+ ...launch.default === undefined ? undefined : { default: launch.default },
23532
+ ...launch.unattendedAuto === undefined ? undefined : { unattendedAuto: launch.unattendedAuto }
23496
23533
  })), answer === undefined ? resolve(answerDeferred(launch.step), launch.token, fail5(new StepFailed({ step: launch.step, reason: "no answer was scripted" }))) : launch.answerSchema === undefined ? resolve(answerDeferred(launch.step), launch.token, succeed4(answer)) : resolve(structuredAnswerDeferred(launch.step), launch.token, succeed4({
23497
23534
  answer,
23498
23535
  by: scripted !== undefined ? "person" : auto !== undefined ? "auto" : "default"
@@ -29370,6 +29407,7 @@ var build2 = defineLoop({
29370
29407
  id: "build",
29371
29408
  version: "4.0.0",
29372
29409
  title: "Build",
29410
+ intent: "task",
29373
29411
  description: "Implements a Task or words, reviews and fixes the change, and opens a ChangeRequest with its evidence.",
29374
29412
  input: BuildInput,
29375
29413
  output: BuildOutput,
@@ -30829,11 +30867,13 @@ var ScopedTickets = planTicketsOf(Struct({
30829
30867
  promise: String5.check(isPattern2(/\S/)),
30830
30868
  outOfScope: ArraySchema(String5)
30831
30869
  }));
30870
+ var criterion = optional2(String5);
30832
30871
  var Concern = Struct({
30833
30872
  ticket: optional2(String5),
30834
- concern: Reason
30873
+ concern: Reason,
30874
+ criterion
30835
30875
  });
30836
- var TicketConcern = Struct({ ticket: String5, concern: Reason });
30876
+ var TicketConcern = Struct({ ticket: String5, concern: Reason, criterion });
30837
30877
  var Check = Struct({ concerns: ArraySchema(Concern) });
30838
30878
  var Recheck = Struct({
30839
30879
  concerns: ArraySchema(Struct({
@@ -30858,7 +30898,7 @@ var ticketText = (ticket) => [
30858
30898
  var checks = [
30859
30899
  "Load skills({ name: 'scope-tasks' }) from the Kitman MCP, read the code the plan is about, and check every ticket for each of these:",
30860
30900
  [
30861
- "- One Promise: the ticket promises one thing, and its Out of scope list names the cases it does not handle. An open-ended Promise is a concern.",
30901
+ "- One Promise: the ticket promises one thing, and its Out of scope list names the cases it does not handle. An open-ended Promise is a concern. Every acceptance criterion serves the ticket's Promise: a criterion that serves another outcome, one that could land as its own change, is a concern that names the criterion and the ticket it belongs in, with the criterion in its words in the concern's criterion. Set criterion on such a concern and on no other.",
30862
30902
  "- Size: estimate the context one agent session needs from reading the code to a verified change. 200k tokens or more is a concern; give your estimate.",
30863
30903
  "- Decisions: no design decision is left to the implementer.",
30864
30904
  "- Blockers: it is blocked by each ticket whose code it needs, and by no other."
@@ -30939,8 +30979,9 @@ var reviewTickets = (step, tickets) => planReviewer(step, {
30939
30979
  var oneLine = (text) => text.replace(/\s+/gu, " ").trim();
30940
30980
  var disputedText = (disputed) => disputed.length === 0 ? [] : [
30941
30981
  "## Still disputed",
30942
- disputed.flatMap(({ ticket, concern, declined }) => [
30982
+ disputed.flatMap(({ ticket, concern, criterion, declined }) => [
30943
30983
  `- ${ticket === undefined ? "" : `${ticket}: `}${oneLine(concern)}`,
30984
+ ...criterion === undefined ? [] : [` - Criterion of another promise: ${oneLine(criterion)}`],
30944
30985
  ...declined === undefined ? [] : [` - The planner did not act on it: ${oneLine(declined)}`]
30945
30986
  ]).join(`
30946
30987
  `)
@@ -30968,7 +31009,7 @@ var Output5 = Struct({
30968
31009
  });
30969
31010
  var file_tasks_default = defineLoop({
30970
31011
  id: "file-tasks",
30971
- version: "2.2.0",
31012
+ version: "2.2.1",
30972
31013
  title: "File Tasks",
30973
31014
  description: "Files reviewed tickets as Tasks, with their blockers as dependencies.",
30974
31015
  input: FileTasksInput,
@@ -31479,6 +31520,7 @@ var hillclimb_default = defineLoop({
31479
31520
  id: "hillclimb",
31480
31521
  version: "2.0.0",
31481
31522
  title: "Hillclimb",
31523
+ intent: "task",
31482
31524
  description: "Improves a measured number one verified step at a time, keeping only the steps that prove a gain.",
31483
31525
  outcome: "performance",
31484
31526
  input: Input6,
@@ -31855,6 +31897,7 @@ var ReworkedAnswer = Struct({
31855
31897
  var Disputed = Struct({
31856
31898
  ticket: optional2(String5),
31857
31899
  concern: String5,
31900
+ criterion: optional2(String5),
31858
31901
  declined: optional2(String5)
31859
31902
  });
31860
31903
  var CriteriaCheck = Struct({
@@ -31910,7 +31953,7 @@ var menuDescriptions = {
31910
31953
  var onFailure = ["Retry with a steer", "Skip it and its dependents", "Stop here"];
31911
31954
  var ticketRules = [
31912
31955
  "Each ticket is one Build: a vertical slice an agent can implement, review and deliver as one ChangeRequest. Give it a short unique key, and list in blockedBy the keys of the tickets whose code it needs; tickets never block each other in a cycle. Set repoBindingId only when it changes another repository than the plan, keep one repository per ticket, and no cycle across repositories. Set outcome to the kind of change: feature, bug, refactor, docs, migration, investigation or performance.",
31913
- "Give each ticket its promise: one sentence that says what is true once it is done. List in its outOfScope the cases it does not handle. Two promises are two tickets.",
31956
+ "Give each ticket its promise: one sentence that says what is true once it is done. List in its outOfScope the cases it does not handle. Two promises are two tickets. Each acceptance criterion serves its ticket's promise; a criterion for another outcome goes in another ticket.",
31914
31957
  "Each acceptance criterion is something a Build can show before its ChangeRequest: a behaviour a test or a check proves. A text search is never a criterion, nor is something the code already does. Outcomes only visible after merge go under afterMerge, not under a ticket's criteria."
31915
31958
  ].join(`
31916
31959
 
@@ -32125,18 +32168,24 @@ var planReviewed = step2("planReviewed", {
32125
32168
  success: Union2([PlanApproved, Drafted2]),
32126
32169
  key: ({ draft }) => String(draft.revision),
32127
32170
  run: ({ draft: { plan, revision, disputed, asked }, implement }) => gen2(function* () {
32171
+ const otherPromises = new Set(disputed.flatMap((entry) => entry.criterion === undefined ? [] : [entry.ticket ?? ""])).size;
32128
32172
  const { answer: decision, by } = yield* ask("review", {
32129
32173
  prompt: [
32130
32174
  `Review revision ${revision} of the plan "${plan.title}": approve it, or request changes by commenting on what should change.`,
32131
32175
  ...disputed.length === 0 ? [] : [
32132
32176
  `The plan reviewer still disputes ${disputed.length} point${disputed.length === 1 ? "" : "s"}, listed at the end of the plan.`
32177
+ ],
32178
+ ...otherPromises === 0 ? [] : [
32179
+ `The plan reviewer holds that ${otherPromises} ticket(s) have an acceptance criterion of another promise, so nobody's silence approves this revision.`
32133
32180
  ]
32134
32181
  ].join(" "),
32135
32182
  answer: planReviewDecision(revision),
32136
32183
  recommended: PlanApproval,
32137
32184
  recommendationReason: "Approve it once the plan reads right; until then the Run waits for you.",
32138
- ...implement ? { default: PlanApproval, timeout: "1 hour" } : { default: null },
32139
- unattendedAuto: PlanApproval
32185
+ ...otherPromises > 0 ? { default: null } : {
32186
+ ...implement ? { default: PlanApproval, timeout: "1 hour" } : { default: null },
32187
+ unattendedAuto: PlanApproval
32188
+ }
32140
32189
  });
32141
32190
  if ("approve" in decision)
32142
32191
  return new PlanApproved({ revision, reviewed: disputed.length === 0 || by === "person" });
@@ -32643,7 +32692,7 @@ var outputOfPlan = ({ plan, rejected }, docs, asTasks) => ({
32643
32692
  });
32644
32693
  var plan_default = defineLoop({
32645
32694
  id: "plan",
32646
- version: "5.0.0",
32695
+ version: "5.1.0",
32647
32696
  title: "Plan",
32648
32697
  description: "Plans a goal into reviewed tickets and a spec, then builds them or files them as Tasks.",
32649
32698
  input: Input8,
@@ -40288,4 +40337,4 @@ var runKit = (config, identity, packages) => {
40288
40337
  runMain2(program.pipe(flatMap3((code) => sync2(() => process.exit(code)))));
40289
40338
  };
40290
40339
  // .kitman-build-entry.ts
40291
- runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.52.0" }, []);
40340
+ runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.54.0" }, []);