@kitman-sh/software-engineering 0.52.0 → 0.53.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
@@ -15584,6 +15584,13 @@ var resolvedLocalDateTimes = new Map;
15584
15584
  var eventWhenClauseName = (event) => event.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
15585
15585
 
15586
15586
  // ../../packages/core/src/kit-declarations.ts
15587
+ var LoopIntent = Union2([
15588
+ Literal2("task"),
15589
+ Struct({
15590
+ goal: String5.check(makeFilter2((goal) => goal.trim() !== "" || "a non-blank goal")),
15591
+ doneWhen: ArraySchema(String5)
15592
+ })
15593
+ ]);
15587
15594
  var LoopCapabilities = [
15588
15595
  "agent_work",
15589
15596
  "ask",
@@ -15643,6 +15650,7 @@ var LoopManifest = Struct({
15643
15650
  secrets: optionalKey2(ArraySchema(SecretName2)),
15644
15651
  network: optionalKey2(AgentSandboxNetwork),
15645
15652
  schedule: optionalKey2(Struct({ rule: ScheduleRule, timezone: String5 })),
15653
+ intent: optionalKey2(LoopIntent),
15646
15654
  outline: optionalKey2(LoopOutline)
15647
15655
  });
15648
15656
  var ProgramLoopListing = Struct({ ...ProgramLoop.fields, schedule: LoopManifest.fields.schedule });
@@ -16004,6 +16012,21 @@ var carriesRole = (loop, role, declared) => gen2(function* () {
16004
16012
  });
16005
16013
  }
16006
16014
  });
16015
+ var IntentDeclaration = Union2([
16016
+ Literal2("task"),
16017
+ Struct({ goal: String5, doneWhen: optionalKey2(ArraySchema(String5)) })
16018
+ ]);
16019
+ var declaredIntent = (definition) => gen2(function* () {
16020
+ if (definition.intent === undefined)
16021
+ return { goal: `Run the ${definition.id} Loop`, doneWhen: [] };
16022
+ const invalid = (reason) => new ManifestInvalid({ loop: definition.id, message: `Loop "${definition.id}": ${reason}` });
16023
+ 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}`)));
16024
+ if (declared === "task")
16025
+ return declared;
16026
+ if (declared.goal.trim() === "")
16027
+ return yield* invalid("intent goal must not be blank");
16028
+ return { goal: declared.goal.trim(), doneWhen: [...declared.doneWhen ?? []] };
16029
+ });
16007
16030
  var loopManifest = (definition) => gen2(function* () {
16008
16031
  yield* declarationsAreData(definition);
16009
16032
  if (definition.version !== undefined && !is2(LoopVersion)(definition.version))
@@ -16016,6 +16039,7 @@ var loopManifest = (definition) => gen2(function* () {
16016
16039
  loop: definition.id,
16017
16040
  message: "description must be one line of 1 to 160 characters"
16018
16041
  });
16042
+ const intent = yield* declaredIntent(definition);
16019
16043
  const input = yield* jsonSchemaOf(definition.id, definition.input);
16020
16044
  const output = yield* jsonSchemaOf(definition.id, definition.output);
16021
16045
  if (definition.role !== undefined)
@@ -16029,6 +16053,7 @@ var loopManifest = (definition) => gen2(function* () {
16029
16053
  output,
16030
16054
  ...definition.outcome === undefined ? undefined : { outcome: definition.outcome },
16031
16055
  ...definition.role === undefined ? undefined : { role: definition.role },
16056
+ intent,
16032
16057
  agents: definition.agents,
16033
16058
  checkout: definition.checkout,
16034
16059
  when: yield* namedWhenClauses(definition.id, definition.when ?? []),
@@ -23492,7 +23517,9 @@ var scriptedHost = (script, engine, agentLaunches, childLaunches, waits, verifyL
23492
23517
  return andThen2(sync2(() => questions.push({
23493
23518
  step: launch.step,
23494
23519
  prompt: launch.prompt,
23495
- ...launch.answerSchema === undefined ? undefined : { answerSchema: launch.answerSchema }
23520
+ ...launch.answerSchema === undefined ? undefined : { answerSchema: launch.answerSchema },
23521
+ ...launch.default === undefined ? undefined : { default: launch.default },
23522
+ ...launch.unattendedAuto === undefined ? undefined : { unattendedAuto: launch.unattendedAuto }
23496
23523
  })), 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
23524
  answer,
23498
23525
  by: scripted !== undefined ? "person" : auto !== undefined ? "auto" : "default"
@@ -29370,6 +29397,7 @@ var build2 = defineLoop({
29370
29397
  id: "build",
29371
29398
  version: "4.0.0",
29372
29399
  title: "Build",
29400
+ intent: "task",
29373
29401
  description: "Implements a Task or words, reviews and fixes the change, and opens a ChangeRequest with its evidence.",
29374
29402
  input: BuildInput,
29375
29403
  output: BuildOutput,
@@ -30829,11 +30857,13 @@ var ScopedTickets = planTicketsOf(Struct({
30829
30857
  promise: String5.check(isPattern2(/\S/)),
30830
30858
  outOfScope: ArraySchema(String5)
30831
30859
  }));
30860
+ var criterion = optional2(String5);
30832
30861
  var Concern = Struct({
30833
30862
  ticket: optional2(String5),
30834
- concern: Reason
30863
+ concern: Reason,
30864
+ criterion
30835
30865
  });
30836
- var TicketConcern = Struct({ ticket: String5, concern: Reason });
30866
+ var TicketConcern = Struct({ ticket: String5, concern: Reason, criterion });
30837
30867
  var Check = Struct({ concerns: ArraySchema(Concern) });
30838
30868
  var Recheck = Struct({
30839
30869
  concerns: ArraySchema(Struct({
@@ -30858,7 +30888,7 @@ var ticketText = (ticket) => [
30858
30888
  var checks = [
30859
30889
  "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
30890
  [
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.",
30891
+ "- 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
30892
  "- 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
30893
  "- Decisions: no design decision is left to the implementer.",
30864
30894
  "- Blockers: it is blocked by each ticket whose code it needs, and by no other."
@@ -30939,8 +30969,9 @@ var reviewTickets = (step, tickets) => planReviewer(step, {
30939
30969
  var oneLine = (text) => text.replace(/\s+/gu, " ").trim();
30940
30970
  var disputedText = (disputed) => disputed.length === 0 ? [] : [
30941
30971
  "## Still disputed",
30942
- disputed.flatMap(({ ticket, concern, declined }) => [
30972
+ disputed.flatMap(({ ticket, concern, criterion, declined }) => [
30943
30973
  `- ${ticket === undefined ? "" : `${ticket}: `}${oneLine(concern)}`,
30974
+ ...criterion === undefined ? [] : [` - Criterion of another promise: ${oneLine(criterion)}`],
30944
30975
  ...declined === undefined ? [] : [` - The planner did not act on it: ${oneLine(declined)}`]
30945
30976
  ]).join(`
30946
30977
  `)
@@ -30968,7 +30999,7 @@ var Output5 = Struct({
30968
30999
  });
30969
31000
  var file_tasks_default = defineLoop({
30970
31001
  id: "file-tasks",
30971
- version: "2.2.0",
31002
+ version: "2.2.1",
30972
31003
  title: "File Tasks",
30973
31004
  description: "Files reviewed tickets as Tasks, with their blockers as dependencies.",
30974
31005
  input: FileTasksInput,
@@ -31479,6 +31510,7 @@ var hillclimb_default = defineLoop({
31479
31510
  id: "hillclimb",
31480
31511
  version: "2.0.0",
31481
31512
  title: "Hillclimb",
31513
+ intent: "task",
31482
31514
  description: "Improves a measured number one verified step at a time, keeping only the steps that prove a gain.",
31483
31515
  outcome: "performance",
31484
31516
  input: Input6,
@@ -31855,6 +31887,7 @@ var ReworkedAnswer = Struct({
31855
31887
  var Disputed = Struct({
31856
31888
  ticket: optional2(String5),
31857
31889
  concern: String5,
31890
+ criterion: optional2(String5),
31858
31891
  declined: optional2(String5)
31859
31892
  });
31860
31893
  var CriteriaCheck = Struct({
@@ -31910,7 +31943,7 @@ var menuDescriptions = {
31910
31943
  var onFailure = ["Retry with a steer", "Skip it and its dependents", "Stop here"];
31911
31944
  var ticketRules = [
31912
31945
  "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.",
31946
+ "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
31947
  "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
31948
  ].join(`
31916
31949
 
@@ -32125,18 +32158,24 @@ var planReviewed = step2("planReviewed", {
32125
32158
  success: Union2([PlanApproved, Drafted2]),
32126
32159
  key: ({ draft }) => String(draft.revision),
32127
32160
  run: ({ draft: { plan, revision, disputed, asked }, implement }) => gen2(function* () {
32161
+ const otherPromises = new Set(disputed.flatMap((entry) => entry.criterion === undefined ? [] : [entry.ticket ?? ""])).size;
32128
32162
  const { answer: decision, by } = yield* ask("review", {
32129
32163
  prompt: [
32130
32164
  `Review revision ${revision} of the plan "${plan.title}": approve it, or request changes by commenting on what should change.`,
32131
32165
  ...disputed.length === 0 ? [] : [
32132
32166
  `The plan reviewer still disputes ${disputed.length} point${disputed.length === 1 ? "" : "s"}, listed at the end of the plan.`
32167
+ ],
32168
+ ...otherPromises === 0 ? [] : [
32169
+ `The plan reviewer holds that ${otherPromises} ticket(s) have an acceptance criterion of another promise, so nobody's silence approves this revision.`
32133
32170
  ]
32134
32171
  ].join(" "),
32135
32172
  answer: planReviewDecision(revision),
32136
32173
  recommended: PlanApproval,
32137
32174
  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
32175
+ ...otherPromises > 0 ? { default: null } : {
32176
+ ...implement ? { default: PlanApproval, timeout: "1 hour" } : { default: null },
32177
+ unattendedAuto: PlanApproval
32178
+ }
32140
32179
  });
32141
32180
  if ("approve" in decision)
32142
32181
  return new PlanApproved({ revision, reviewed: disputed.length === 0 || by === "person" });
@@ -32643,7 +32682,7 @@ var outputOfPlan = ({ plan, rejected }, docs, asTasks) => ({
32643
32682
  });
32644
32683
  var plan_default = defineLoop({
32645
32684
  id: "plan",
32646
- version: "5.0.0",
32685
+ version: "5.1.0",
32647
32686
  title: "Plan",
32648
32687
  description: "Plans a goal into reviewed tickets and a spec, then builds them or files them as Tasks.",
32649
32688
  input: Input8,
@@ -40288,4 +40327,4 @@ var runKit = (config, identity, packages) => {
40288
40327
  runMain2(program.pipe(flatMap3((code) => sync2(() => process.exit(code)))));
40289
40328
  };
40290
40329
  // .kitman-build-entry.ts
40291
- runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.52.0" }, []);
40330
+ runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.53.0" }, []);