@kitman-sh/software-engineering 0.11.3 → 0.11.5

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
@@ -19504,7 +19504,9 @@ var TranscriptPoint = Struct({
19504
19504
  });
19505
19505
  var TranscriptsRequest = Struct({
19506
19506
  days: Int.check(isGreaterThanOrEqualTo2(1), isLessThanOrEqualTo3(31)),
19507
- teamId: optionalKey2(String5)
19507
+ teamId: optionalKey2(String5),
19508
+ projectId: optionalKey2(String5),
19509
+ fileIntoProjectId: optionalKey2(String5)
19508
19510
  });
19509
19511
  var TranscriptsResult = Struct({
19510
19512
  runs: ArraySchema(Struct({
@@ -19539,6 +19541,7 @@ var ProposeRequest = Union2([
19539
19541
  title: String5,
19540
19542
  description: String5,
19541
19543
  teamId: optional2(String5),
19544
+ projectId: optionalKey2(String5),
19542
19545
  key: optionalKey2(String5.check(isPattern2(/^[a-z0-9]+(?:-[a-z0-9]+)*$/), isMaxLength(80))),
19543
19546
  citations: Citations
19544
19547
  })
@@ -24629,6 +24632,8 @@ var research_default = defineLoop({
24629
24632
  var Input10 = Struct({
24630
24633
  days: optional2(Int.check(isGreaterThanOrEqualTo2(1), isLessThanOrEqualTo3(31))),
24631
24634
  teamId: optional2(String5),
24635
+ projectId: optional2(String5),
24636
+ fileIntoProjectId: optional2(String5),
24632
24637
  improvements: optional2(Int.check(isGreaterThanOrEqualTo2(0), isLessThanOrEqualTo3(5)))
24633
24638
  });
24634
24639
  var categories = [
@@ -24712,7 +24717,7 @@ var shared = (cited, field) => {
24712
24717
  const [only] = values;
24713
24718
  return values.size === 1 ? only : undefined;
24714
24719
  };
24715
- var proposal = (finding, runs, teamId) => {
24720
+ var proposal = (finding, runs, teamId, projectId) => {
24716
24721
  const evidence = new Set(runs.flatMap((run) => run.entries.flatMap((entry) => entry.kind === "message" ? [] : [point({ runId: run.runId, stepAttemptId: entry.stepAttemptId, sequence: entry.sequence })])));
24717
24722
  const roots = new Map(runs.map((run) => [run.runId, rootOf(run)]));
24718
24723
  const citations = [
@@ -24738,6 +24743,7 @@ var proposal = (finding, runs, teamId) => {
24738
24743
  title: finding.lesson,
24739
24744
  description: finding.detail ?? finding.lesson,
24740
24745
  ...team === undefined ? undefined : { teamId: team },
24746
+ ...projectId === undefined ? undefined : { projectId },
24741
24747
  key: finding.key,
24742
24748
  citations: [first, ...rest]
24743
24749
  },
@@ -24747,7 +24753,7 @@ var proposal = (finding, runs, teamId) => {
24747
24753
  var notStartedReason = (finding, wanted) => finding.kind === "memory" ? "It became Memory, which has no Task to start on" : finding.task === undefined ? "Its Task waits for a person to accept the proposal" : finding.task.active ? "A Run is already working on its Task" : `Only ${wanted} ${wanted === 1 ? "improvement was" : "improvements were"} asked for, and findings that recurred in more top-level Runs went first`;
24748
24754
  var hindsight_default = defineLoop({
24749
24755
  id: "hindsight",
24750
- version: "1.1.0",
24756
+ version: "1.2.0",
24751
24757
  title: "Hindsight",
24752
24758
  input: Input10,
24753
24759
  output: Output11,
@@ -24761,7 +24767,9 @@ var hindsight_default = defineLoop({
24761
24767
  const days = input.days ?? 7;
24762
24768
  const read = yield* transcripts("read", {
24763
24769
  days,
24764
- ...input.teamId === undefined ? undefined : { teamId: input.teamId }
24770
+ ...input.teamId === undefined ? undefined : { teamId: input.teamId },
24771
+ ...input.projectId === undefined ? undefined : { projectId: input.projectId },
24772
+ ...input.fileIntoProjectId === undefined ? undefined : { fileIntoProjectId: input.fileIntoProjectId }
24765
24773
  });
24766
24774
  const runs = read.runs;
24767
24775
  const pieces = new Set(runs.map(rootOf)).size;
@@ -24778,7 +24786,11 @@ var hindsight_default = defineLoop({
24778
24786
  prompt: prompt4(read, days),
24779
24787
  output: Findings
24780
24788
  });
24781
- const judged = findings.map((finding) => ({ finding, judged: proposal(finding, runs, input.teamId) }));
24789
+ const fileInto = input.fileIntoProjectId ?? input.projectId;
24790
+ const judged = findings.map((finding) => ({
24791
+ finding,
24792
+ judged: proposal(finding, runs, input.teamId, fileInto)
24793
+ }));
24782
24794
  const leftOut = judged.flatMap(({ finding, judged }) => judged.request === undefined ? [{ key: finding.key, reason: judged.reason }] : []);
24783
24795
  const kept = judged.flatMap(({ finding, judged }) => judged.request === undefined ? [] : [{ finding, request: judged.request, recurrence: judged.recurrence }]);
24784
24796
  const made = yield* forEach2(kept, (kept) => map8(propose(`propose:${kept.finding.key}`, kept.request), (made) => ({ ...kept, made })));
@@ -28095,7 +28107,14 @@ class RunnerCapabilityRpcs extends make30(make29("PutQuestion", {
28095
28107
  }),
28096
28108
  error: RunnerRpcError
28097
28109
  }), make29("ReadTranscripts", {
28098
- payload: { lease: ProgramLease, step: String5, days: Int, teamId: optionalKey2(String5) },
28110
+ payload: {
28111
+ lease: ProgramLease,
28112
+ step: String5,
28113
+ days: Int,
28114
+ teamId: optionalKey2(String5),
28115
+ projectId: optionalKey2(String5),
28116
+ fileIntoProjectId: optionalKey2(String5)
28117
+ },
28099
28118
  success: Struct({
28100
28119
  runs: ArraySchema(Struct({
28101
28120
  runId: String5,
@@ -28214,6 +28233,7 @@ class RunnerCapabilityRpcs extends make30(make29("PutQuestion", {
28214
28233
  title: String5,
28215
28234
  description: String5,
28216
28235
  teamId: optionalKey2(String5),
28236
+ projectId: optionalKey2(String5),
28217
28237
  key: optionalKey2(String5),
28218
28238
  citations: NonEmptyArray(Struct({ runId: String5, stepAttemptId: String5, sequence: Int }))
28219
28239
  })
@@ -28791,6 +28811,7 @@ var rpcProgramPorts = (rpc, work) => {
28791
28811
  title: proposal.title,
28792
28812
  description: proposal.description,
28793
28813
  ...proposal.teamId === undefined ? undefined : { teamId: proposal.teamId },
28814
+ ...proposal.projectId === undefined ? undefined : { projectId: proposal.projectId },
28794
28815
  ...proposal.key === undefined ? undefined : { key: proposal.key },
28795
28816
  citations: [...proposal.citations]
28796
28817
  }
@@ -31046,4 +31067,4 @@ var runKit = (config, identity, packages) => {
31046
31067
  runMain2(program.pipe(flatMap3((code) => sync2(() => process.exit(code)))));
31047
31068
  };
31048
31069
  // .kitman-build-entry.ts
31049
- runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.11.3" }, []);
31070
+ runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.11.5" }, []);
@@ -2570,7 +2570,7 @@
2570
2570
  {
2571
2571
  "id": "hindsight",
2572
2572
  "title": "Hindsight",
2573
- "version": "1.1.0",
2573
+ "version": "1.2.0",
2574
2574
  "input": {
2575
2575
  "type": "object",
2576
2576
  "properties": {
@@ -2596,6 +2596,26 @@
2596
2596
  }
2597
2597
  ]
2598
2598
  },
2599
+ "projectId": {
2600
+ "anyOf": [
2601
+ {
2602
+ "type": "string"
2603
+ },
2604
+ {
2605
+ "type": "null"
2606
+ }
2607
+ ]
2608
+ },
2609
+ "fileIntoProjectId": {
2610
+ "anyOf": [
2611
+ {
2612
+ "type": "string"
2613
+ },
2614
+ {
2615
+ "type": "null"
2616
+ }
2617
+ ]
2618
+ },
2599
2619
  "improvements": {
2600
2620
  "anyOf": [
2601
2621
  {
@@ -5088,7 +5108,7 @@
5088
5108
  "carried": [
5089
5109
  {
5090
5110
  "name": "@kitman-sh/software-engineering",
5091
- "version": "0.11.3",
5111
+ "version": "0.11.5",
5092
5112
  "setup": "2a237548a69b0cd53ec3be7f687cfa8c2128335b3a655d34e185f2abce6a3c37",
5093
5113
  "loops": [
5094
5114
  "build",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitman-sh/software-engineering",
3
- "version": "0.11.3",
3
+ "version": "0.11.5",
4
4
  "description": "Everything for building software: Loops, their Agents, the skills they use and the Ponytail plugin.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -17,12 +17,12 @@
17
17
  "tsconfig.json"
18
18
  ],
19
19
  "dependencies": {
20
- "@kitman-sh/sdk": "0.11.3",
20
+ "@kitman-sh/sdk": "0.11.5",
21
21
  "effect": "^4.1.2"
22
22
  },
23
23
  "kitman": {
24
24
  "bundle": "dist/bundle.js",
25
- "digest": "3462642351c70c3159eb3a9413014d15224da18df52217b040c85014cc28f019",
25
+ "digest": "52d476db0ecdaba5575d5c0ba2b502ab14531a88d4085c66daaceeb5e0451427",
26
26
  "protocolVersion": 5,
27
27
  "declarations": "dist/declarations.json",
28
28
  "setup": {
package/src/hindsight.ts CHANGED
@@ -19,6 +19,10 @@ const Input = Schema.Struct({
19
19
  days: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(31))),
20
20
  /** Reads one Team's Runs; every Team's the Run may read when left out. */
21
21
  teamId: Schema.optional(Schema.String),
22
+ /** Reads only the Runs of one Project's Tasks; every Project's when left out. */
23
+ projectId: Schema.optional(Schema.String),
24
+ /** The Project its Tasks are filed into once accepted; the Project read, else none, when left out. */
25
+ fileIntoProjectId: Schema.optional(Schema.String),
22
26
  /** How many findings to start fixing as Errands or Builds; none when left out. */
23
27
  improvements: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(5)))
24
28
  })
@@ -151,9 +155,14 @@ type Judged =
151
155
  /**
152
156
  * What a finding proposes, citing only evidence that was read (not an agent's own messages), or why it is left out
153
157
  * when that evidence falls in fewer than two top-level Runs. A Task goes to the cited Runs' shared Team, else the Team
154
- * read; Kitman gives one with neither the Run's own.
158
+ * read; Kitman gives one with neither the Run's own. A Task is filed into `projectId` when given.
155
159
  */
156
- const proposal = (finding: Finding, runs: readonly ReadRun[], teamId: string | undefined): Judged => {
160
+ const proposal = (
161
+ finding: Finding,
162
+ runs: readonly ReadRun[],
163
+ teamId: string | undefined,
164
+ projectId: string | undefined
165
+ ): Judged => {
157
166
  const evidence = new Set(
158
167
  runs.flatMap(run =>
159
168
  run.entries.flatMap(entry =>
@@ -200,6 +209,7 @@ const proposal = (finding: Finding, runs: readonly ReadRun[], teamId: string | u
200
209
  title: finding.lesson,
201
210
  description: finding.detail ?? finding.lesson,
202
211
  ...(team === undefined ? undefined : { teamId: team }),
212
+ ...(projectId === undefined ? undefined : { projectId }),
203
213
  key: finding.key,
204
214
  citations: [first, ...rest]
205
215
  },
@@ -221,16 +231,18 @@ const notStartedReason = (
221
231
  : `Only ${wanted} ${wanted === 1 ? 'improvement was' : 'improvements were'} asked for, and findings that recurred in more top-level Runs went first`
222
232
 
223
233
  /**
224
- * Reads every Run that settled in the last week (or `days`), of one Team or every Team the person it acts for may read,
225
- * completed ones too, as a bounded digest, and proposes Memory and Tasks for what went wrong in at least two top-level
226
- * Runs, each with a category and a stable key; the investigator sees earlier open findings' keys to reuse. A key that
227
- * matches an open Task or a waiting proposal adds the new Runs there instead of a duplicate. With `improvements`, that
228
- * many findings that matched an open Task no Run works on are started on it as Errands or Builds, those that recurred
229
- * in the most top-level Runs first. Memory belongs to one Team, so a lesson from Runs in several becomes a Task.
234
+ * Reads every Run that settled in the last week (or `days`), of one Team or every Team the person it acts for may
235
+ * read, and of one Project's Tasks when given, completed ones too, as a bounded digest, and proposes Memory and
236
+ * Tasks for what went wrong in at least two top-level Runs, each with a category and a stable key; the investigator
237
+ * sees earlier open findings' keys to reuse. A key that matches an open Task or a waiting proposal adds the new Runs
238
+ * there instead of a duplicate. With `improvements`, that many findings that matched an open Task no Run works on
239
+ * are started on it as Errands or Builds, those that recurred in the most top-level Runs first. Memory belongs to
240
+ * one Team, so a lesson from Runs in several becomes a Task. A Project to read or file into that the person cannot
241
+ * read fails the Run before anything is read.
230
242
  */
231
243
  export default defineLoop({
232
244
  id: 'hindsight',
233
- version: '1.1.0',
245
+ version: '1.2.0',
234
246
  title: 'Hindsight',
235
247
  input: Input,
236
248
  output: Output,
@@ -246,7 +258,9 @@ export default defineLoop({
246
258
 
247
259
  const read = yield* transcripts('read', {
248
260
  days,
249
- ...(input.teamId === undefined ? undefined : { teamId: input.teamId })
261
+ ...(input.teamId === undefined ? undefined : { teamId: input.teamId }),
262
+ ...(input.projectId === undefined ? undefined : { projectId: input.projectId }),
263
+ ...(input.fileIntoProjectId === undefined ? undefined : { fileIntoProjectId: input.fileIntoProjectId })
250
264
  })
251
265
 
252
266
  const runs = read.runs
@@ -267,7 +281,12 @@ export default defineLoop({
267
281
  output: Findings
268
282
  })
269
283
 
270
- const judged = findings.map(finding => ({ finding, judged: proposal(finding, runs, input.teamId) }))
284
+ const fileInto = input.fileIntoProjectId ?? input.projectId
285
+
286
+ const judged = findings.map(finding => ({
287
+ finding,
288
+ judged: proposal(finding, runs, input.teamId, fileInto)
289
+ }))
271
290
 
272
291
  const leftOut = judged.flatMap(({ finding, judged }) =>
273
292
  judged.request === undefined ? [{ key: finding.key, reason: judged.reason }] : []