@kitman-sh/sdk 0.9.0 → 0.10.53

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.
Files changed (63) hide show
  1. package/dist/build/index.js +531 -116
  2. package/dist/{chunk-36jhc745.js → chunk-tcbgb4wm.js} +1841 -1574
  3. package/dist/{chunk-e1tqypyy.js → chunk-zvzw3zs4.js} +824 -419
  4. package/dist/loop/index.js +117 -3
  5. package/dist/program/index.js +8 -4
  6. package/package.json +6 -6
  7. package/types/packages/core/src/agent-capabilities.d.ts +6 -0
  8. package/types/packages/core/src/agent-environment.d.ts +32 -216
  9. package/types/packages/core/src/agent-sandbox-policy.d.ts +17 -3
  10. package/types/packages/core/src/change-request-review.d.ts +20 -5
  11. package/types/packages/core/src/change-request.d.ts +33 -208
  12. package/types/packages/core/src/crypto.d.ts +2 -0
  13. package/types/packages/core/src/index.d.ts +8 -4
  14. package/types/packages/core/src/{package-declarations.d.ts → kit-declarations.d.ts} +84 -180
  15. package/types/packages/core/src/kit-install.d.ts +130 -0
  16. package/types/packages/core/src/kit-setup.d.ts +316 -0
  17. package/types/packages/core/src/kit.d.ts +302 -1444
  18. package/types/packages/core/src/loop-layers.d.ts +33 -4
  19. package/types/packages/core/src/loop.d.ts +325 -55
  20. package/types/packages/core/src/marketplace.d.ts +51 -10
  21. package/types/packages/core/src/my-teams.d.ts +135 -20
  22. package/types/packages/core/src/network-host.d.ts +41 -0
  23. package/types/packages/core/src/notification.d.ts +8 -0
  24. package/types/packages/core/src/npm-registry.d.ts +65 -0
  25. package/types/packages/core/src/proposal.d.ts +0 -76
  26. package/types/packages/core/src/push.d.ts +68 -0
  27. package/types/packages/core/src/question-recommendation.d.ts +28 -0
  28. package/types/packages/core/src/redaction.d.ts +15 -3
  29. package/types/packages/core/src/resource-claim.d.ts +79 -0
  30. package/types/packages/core/src/run-display.d.ts +7 -1
  31. package/types/packages/core/src/run-graph.d.ts +1 -1
  32. package/types/packages/core/src/run-launch.d.ts +15 -2
  33. package/types/packages/core/src/run-queue.d.ts +28 -0
  34. package/types/packages/core/src/runner-eligibility.d.ts +21 -2
  35. package/types/packages/core/src/runner.d.ts +46 -15
  36. package/types/packages/core/src/secret.d.ts +18 -1
  37. package/types/packages/core/src/step-brief.d.ts +21 -7
  38. package/types/packages/core/src/sync-kit.d.ts +8 -0
  39. package/types/packages/core/src/task-detail.d.ts +15 -2
  40. package/types/packages/core/src/task.d.ts +9 -0
  41. package/types/packages/core/src/transcript.d.ts +24 -4
  42. package/types/packages/core/src/trust-panel.d.ts +1 -1
  43. package/types/packages/core/src/waiting-on.d.ts +14 -0
  44. package/types/packages/core/src/work-unit.d.ts +339 -8
  45. package/types/packages/live/src/rpc/runner-client.d.ts +505 -10
  46. package/types/packages/live/src/rpc/runner-group.d.ts +958 -28
  47. package/types/packages/sdk/src/build/index.d.ts +45 -9
  48. package/types/packages/sdk/src/loop/activities.d.ts +382 -2
  49. package/types/packages/sdk/src/loop/claims.d.ts +57 -0
  50. package/types/packages/sdk/src/loop/config.d.ts +38 -31
  51. package/types/packages/sdk/src/loop/continuing.d.ts +22 -0
  52. package/types/packages/sdk/src/loop/define.d.ts +30 -5
  53. package/types/packages/sdk/src/loop/evidence.d.ts +18 -3
  54. package/types/packages/sdk/src/loop/index.d.ts +4 -0
  55. package/types/packages/sdk/src/loop/measure.d.ts +132 -0
  56. package/types/packages/sdk/src/loop/plan.d.ts +2 -2
  57. package/types/packages/sdk/src/loop/steps.d.ts +127 -17
  58. package/types/packages/sdk/src/loop/sync.d.ts +53 -0
  59. package/types/packages/sdk/src/loop/test-loop.d.ts +25 -5
  60. package/types/packages/sdk/src/program/engine.d.ts +95 -3
  61. package/types/packages/sdk/src/program/host.d.ts +198 -36
  62. package/types/packages/core/src/engineering-resources.d.ts +0 -24
  63. package/types/packages/core/src/package.d.ts +0 -369
@@ -1,4 +1,5 @@
1
- import { PackageDeclarations } from '../../../core/src/package-declarations';
1
+ import { KitDeclarations } from '../../../core/src/kit-declarations';
2
+ import * as Context from 'effect/Context';
2
3
  import * as Effect from 'effect/Effect';
3
4
  import * as FileSystem from 'effect/FileSystem';
4
5
  import * as Path from 'effect/Path';
@@ -24,22 +25,57 @@ declare const DeclarationsInvalid_base: Schema.Class<DeclarationsInvalid, Schema
24
25
  export declare class DeclarationsInvalid extends DeclarationsInvalid_base {
25
26
  get message(): string;
26
27
  }
27
- export type PackageBuildError = DependencyInstallFailed | BundleFailed | DeclarationsInvalid | ManifestInvalid | LoopCheckError;
28
- export type PackageProvenance = {
28
+ declare const SourceFetchFailed_base: Schema.Class<SourceFetchFailed, Schema.TaggedStruct<"SourceFetchFailed", {
29
+ readonly reason: Schema.String;
30
+ }>, import("effect/Cause").YieldableError>;
31
+ export declare class SourceFetchFailed extends SourceFetchFailed_base {
32
+ get message(): string;
33
+ }
34
+ export type KitBuildError = DependencyInstallFailed | BundleFailed | DeclarationsInvalid | SourceFetchFailed | ManifestInvalid | LoopCheckError;
35
+ export type KitProvenance = {
29
36
  readonly repository?: string;
30
37
  readonly commit?: string;
31
38
  readonly clean: boolean;
32
39
  };
33
- export type PackageBuild = {
40
+ export type KitBuild = {
34
41
  /** From `package.json`. */
35
42
  readonly name: string;
36
- /** One module that runs with nothing but `bun`: the program host, the config, the SDK, Effect and every dependency. */
43
+ readonly version: string;
44
+ /** One module that runs with nothing but `bun`: the program host, every carried Kit's config, the SDK and Effect. */
37
45
  readonly bundle: Uint8Array;
38
46
  readonly digest: string;
39
- readonly declarations: PackageDeclarations;
47
+ readonly declarations: KitDeclarations;
48
+ /** One per carried Kit, as `declarations.carried` names them. */
49
+ readonly setupArchives: readonly {
50
+ readonly digest: string;
51
+ readonly archive: Uint8Array;
52
+ }[];
40
53
  readonly protocolVersion: number;
41
- readonly provenance: PackageProvenance;
54
+ readonly provenance: KitProvenance;
55
+ /** Each named entry a higher-priority Kit replaced, in priority order. */
56
+ readonly overrides: readonly KitOverride[];
57
+ };
58
+ export type KitOverride = {
59
+ readonly what: 'Loop' | 'Agent' | 'skill' | 'plugin' | 'MCP server';
60
+ readonly name: string;
61
+ readonly winner: string;
62
+ readonly replaced: string;
63
+ };
64
+ type GitLocation = {
65
+ readonly url: string;
66
+ readonly ref: string | undefined;
42
67
  };
43
- /** Builds the Package in `directory` into one bundle and its declarations; dependencies install with lifecycle scripts off. */
44
- export declare const buildPackage: (directory: string) => Effect.Effect<PackageBuild, PackageBuildError, FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner>;
68
+ /** Where a build fetches a git source; a test replaces it to stay off the network. */
69
+ export declare const GitSourceLocation: Context.Reference<(declared: GitLocation) => GitLocation>;
70
+ /**
71
+ * Builds the Kit in `directory` into one bundle carrying it and every Kit it extends, one setup archive per carried
72
+ * Kit in priority order, and the declarations of the winning Loops and Agents; dependencies install with lifecycle
73
+ * scripts off.
74
+ */
75
+ export declare const buildKit: (directory: string, options?: {
76
+ /** The version the Kit is published at, in place of its `package.json` one. */
77
+ readonly version?: string;
78
+ }) => Effect.Effect<KitBuild, KitBuildError, FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner>;
79
+ /** Writes a built Kit into `out` and names its files in `directory`'s package.json `kitman` field, for `npm publish`. */
80
+ export declare const writeKit: (directory: string, built: KitBuild, out: string) => Effect.Effect<void, import("effect/PlatformError").PlatformError | Schema.SchemaError, FileSystem.FileSystem | Path.Path>;
45
81
  export {};
@@ -1,6 +1,7 @@
1
1
  import * as Context from 'effect/Context';
2
2
  import * as Effect from 'effect/Effect';
3
3
  import * as Schema from 'effect/Schema';
4
+ import type * as Duration from 'effect/Duration';
4
5
  import { StepFailed } from './steps';
5
6
  /** The Run's ChangeRequest, from its branch to its base branch. */
6
7
  export declare const ChangeRequestRequest: Schema.Struct<{
@@ -62,8 +63,10 @@ export declare const CreateTasksRequest: Schema.Struct<{
62
63
  readonly acceptanceCriteria: Schema.$Array<Schema.String>;
63
64
  readonly repoBindingId: Schema.optional<Schema.String>;
64
65
  readonly blockedBy: Schema.$Array<Schema.String>;
65
- readonly outcome: Schema.optional<Schema.Literals<readonly ["feature", "bug", "refactor", "investigation", "docs", "migration"]>>;
66
+ readonly outcome: Schema.optional<Schema.Literals<readonly ["feature", "bug", "refactor", "investigation", "docs", "migration", "performance"]>>;
66
67
  }>>;
68
+ /** The Project the Tasks land in. */
69
+ readonly projectId: Schema.optionalKey<Schema.String>;
67
70
  }>;
68
71
  /** The Task made for each ticket, by ticket key. */
69
72
  export declare const CreateTasksResult: Schema.Struct<{
@@ -72,6 +75,33 @@ export declare const CreateTasksResult: Schema.Struct<{
72
75
  readonly taskId: Schema.String;
73
76
  }>>;
74
77
  }>;
78
+ /** An alert's Bug Task, found by fingerprint or made. */
79
+ export declare const AlertTaskRequest: Schema.Struct<{
80
+ /** Names the alert across repeats: its fingerprint, else its title. */
81
+ readonly fingerprint: Schema.String;
82
+ readonly title: Schema.String;
83
+ /** How long a conclusion counts as recent: a repeat within it joins instead of investigating again. */
84
+ readonly windowHours: Schema.Int;
85
+ /** The alert reports it resolved: it is folded in as such, lowers its Task to low, and makes no Task when there is none. */
86
+ readonly resolved: Schema.optionalKey<Schema.Boolean>;
87
+ /** The alert's priority: its Task takes it when made and when the alert fires again. */
88
+ readonly priority: Schema.optionalKey<Schema.Literals<readonly ["urgent", "high", "medium", "low"]>>;
89
+ }>;
90
+ /**
91
+ * The Bug Task the Run now works on; none for a resolve with no Task. `joined` names the open Run of the same alert,
92
+ * or the Run whose conclusion is recent, that this alert was folded into as another occurrence. `resolved` says a
93
+ * resolve of the alert was folded into the Run since it took the Task.
94
+ */
95
+ export declare const AlertTaskResult: Schema.Struct<{
96
+ readonly taskId: Schema.optionalKey<Schema.String>;
97
+ readonly created: Schema.Boolean;
98
+ readonly resolved: Schema.optionalKey<Schema.Boolean>;
99
+ readonly joined: Schema.optionalKey<Schema.Struct<{
100
+ readonly kind: Schema.Literals<readonly ["run", "recent"]>;
101
+ readonly runId: Schema.String;
102
+ }>>;
103
+ }>;
104
+ export type AlertTaskResult = typeof AlertTaskResult.Type;
75
105
  /** The Team's default RepoBinding when left out. */
76
106
  export declare const IntegrationBranchRequest: Schema.Struct<{
77
107
  readonly repoBindingId: Schema.optional<Schema.String>;
@@ -85,18 +115,104 @@ export declare const IntegrationBranch: Schema.Struct<{
85
115
  export type IntegrationBranch = typeof IntegrationBranch.Type;
86
116
  export declare const MergeChangeRequestRequest: Schema.Struct<{
87
117
  readonly changeRequestId: Schema.String;
118
+ /** The head that was checked; the merge is refused as `moved` when the ChangeRequest's head is another by then. */
119
+ readonly head: Schema.optionalKey<Schema.String>;
88
120
  }>;
89
121
  export declare const MergeResult: Schema.Union<readonly [Schema.Struct<{
90
122
  readonly status: Schema.Literal<"merged">;
91
123
  readonly revision: Schema.String;
92
124
  }>, Schema.Struct<{
93
125
  readonly status: Schema.Literal<"conflict">;
126
+ }>, Schema.Struct<{
127
+ readonly status: Schema.Literal<"moved">;
128
+ readonly head: Schema.String;
94
129
  }>]>;
95
130
  export type MergeResult = typeof MergeResult.Type;
131
+ export declare const ApproveChangeRequestRequest: Schema.Struct<{
132
+ readonly changeRequestId: Schema.String;
133
+ /** The full head revision that was reviewed; the approval approves only this commit. */
134
+ readonly head: Schema.String;
135
+ readonly summary: Schema.String;
136
+ /**
137
+ * The Step of a Review Child Run of this Run whose passing review of `head` is the approval, as Build's last round
138
+ * is; the Run approves as itself when left out.
139
+ */
140
+ readonly review: Schema.optionalKey<Schema.String>;
141
+ /**
142
+ * The Step of a base sync of this Run that merged with no conflict and left the branch's own diff as it was: the
143
+ * approval of the head it merged from is carried to `head`, the head it pushed. With a `review` of only the files
144
+ * that sync settled or rewrote, it is what covers the rest of `head`.
145
+ */
146
+ readonly carries: Schema.optionalKey<Schema.String>;
147
+ }>;
148
+ /** Refused, with the reason, when the approving Run opened the ChangeRequest or pushed to its branch. */
149
+ export declare const ApproveChangeRequestResult: Schema.Union<readonly [Schema.Struct<{
150
+ readonly approved: Schema.Literal<true>;
151
+ readonly reviewId: Schema.String;
152
+ }>, Schema.Struct<{
153
+ readonly approved: Schema.Literal<false>;
154
+ readonly reason: Schema.String;
155
+ }>]>;
156
+ /**
157
+ * Closes an open ChangeRequest on the Run's repository by its number, with one note saying why, while its head is still
158
+ * the `head` the Run checked.
159
+ */
160
+ export declare const CloseChangeRequestRequest: Schema.Struct<{
161
+ readonly number: Schema.String;
162
+ readonly head: Schema.String;
163
+ readonly note: Schema.String;
164
+ }>;
165
+ export declare const CloseChangeRequestResult: Schema.Struct<{
166
+ readonly closed: Schema.Boolean;
167
+ /** The head it has now, when it was left open because that is not the head asked for. */
168
+ readonly head: Schema.optionalKey<Schema.String>;
169
+ }>;
170
+ /**
171
+ * The pipeline of a ChangeRequest's head, or of a ref such as a release tag on the Run's repository. With `all`, the
172
+ * ref's newest pipeline runs again in full, as a rollback redeploys an earlier tag; otherwise only its failed jobs do.
173
+ */
174
+ export declare const RerunPipelineRequest: Schema.Union<readonly [Schema.Struct<{
175
+ readonly changeRequestId: Schema.String;
176
+ }>, Schema.Struct<{
177
+ readonly ref: Schema.String;
178
+ readonly all: Schema.optionalKey<Schema.Boolean>;
179
+ }>]>;
180
+ /** The head whose failed jobs were run again, and how many pipelines that was; none when nothing had failed. */
181
+ export declare const RerunPipelineResult: Schema.Struct<{
182
+ readonly head: Schema.String;
183
+ readonly pipelines: Schema.Int;
184
+ }>;
185
+ /** A ChangeRequest whose pipeline the Run's completed `verify` Step `verification` ran on a Runner. */
186
+ export declare const ReportPipelineRequest: Schema.Struct<{
187
+ readonly changeRequestId: Schema.String;
188
+ readonly verification: Schema.String;
189
+ }>;
190
+ /** The commit the verification checked, which the report is for, and the pipeline's result there. */
191
+ export declare const ReportPipelineResult: Schema.Struct<{
192
+ readonly head: Schema.String;
193
+ readonly status: Schema.Literals<readonly ["success", "failed"]>;
194
+ }>;
195
+ export type ReportPipelineResult = typeof ReportPipelineResult.Type;
96
196
  /** A comment on a ChangeRequest, which need not be the Run's own. */
97
197
  export declare const CommentRequest: Schema.Struct<{
98
198
  readonly changeRequestId: Schema.String;
99
199
  readonly body: Schema.String;
200
+ /** Replies on this open review thread instead of commenting on the ChangeRequest. */
201
+ readonly threadId: Schema.optionalKey<Schema.String>;
202
+ /**
203
+ * Keeps one comment per `summary` key on the ChangeRequest: a later post with the same key, from any Run, edits that
204
+ * comment instead of adding another.
205
+ */
206
+ readonly summary: Schema.optionalKey<Schema.String>;
207
+ /**
208
+ * Comments on these lines of the ChangeRequest's head instead, each on the new side of the diff, once per Step; `body`
209
+ * is not posted. A line outside the diff fails the Step.
210
+ */
211
+ readonly anchors: Schema.optionalKey<Schema.$Array<Schema.Struct<{
212
+ readonly file: Schema.String;
213
+ readonly line: Schema.Int;
214
+ readonly body: Schema.String;
215
+ }>>>;
100
216
  }>;
101
217
  /** Tags `revision`, the Run's base branch head when left out, and publishes the release with its notes. */
102
218
  export declare const ReleaseRequest: Schema.Struct<{
@@ -111,6 +227,118 @@ export declare const ReleaseResult: Schema.Struct<{
111
227
  readonly url: Schema.String;
112
228
  }>;
113
229
  export type ReleaseResult = typeof ReleaseResult.Type;
230
+ /** A ChangeRequest in the Run's Team, which need not be the Run's own. */
231
+ export declare const ChangeRequestReadRequest: Schema.Struct<{
232
+ readonly changeRequestId: Schema.String;
233
+ }>;
234
+ export declare const PipelineJob: Schema.Struct<{
235
+ readonly name: Schema.String;
236
+ readonly status: Schema.Literals<readonly ["running", "success", "failed", "skipped"]>;
237
+ readonly url: Schema.optional<Schema.String>;
238
+ /** The redacted end of a failed job's log, at most 4000 characters, where the forge serves job logs. */
239
+ readonly logTail: Schema.optional<Schema.String>;
240
+ }>;
241
+ /**
242
+ * The pipeline at the ChangeRequest's head: the forge's, or else the latest one reported through the API for a
243
+ * pipeline run elsewhere. `none` while neither has a result for the head.
244
+ */
245
+ export declare const PipelineStatus: Schema.Struct<{
246
+ readonly head: Schema.String;
247
+ readonly status: Schema.Literals<readonly ["none", "running", "success", "failed", "canceled"]>;
248
+ readonly source: Schema.Literals<readonly ["forge", "reported"]>;
249
+ readonly jobs: Schema.$Array<Schema.Struct<{
250
+ readonly name: Schema.String;
251
+ readonly status: Schema.Literals<readonly ["running", "success", "failed", "skipped"]>;
252
+ readonly url: Schema.optional<Schema.String>;
253
+ /** The redacted end of a failed job's log, at most 4000 characters, where the forge serves job logs. */
254
+ readonly logTail: Schema.optional<Schema.String>;
255
+ }>>;
256
+ /** When Kitman read it; a `waitFor` `since` this time ignores the state Events the read already superseded. */
257
+ readonly readAt: Schema.optionalKey<Schema.String>;
258
+ /**
259
+ * The checks approved as the repository's pipeline, where the forge runs none: while it is `none`, a Loop runs these
260
+ * with `verify` on the head and posts the result with `reportPipeline`, and may do so again for a failure it doubts.
261
+ */
262
+ readonly runnerChecks: Schema.optionalKey<Schema.$Array<Schema.String>>;
263
+ }>;
264
+ export type PipelineStatus = typeof PipelineStatus.Type;
265
+ /** A review conversation not yet resolved, with its comments oldest first. */
266
+ export declare const ReviewThread: Schema.Struct<{
267
+ readonly id: Schema.String;
268
+ readonly path: Schema.optional<Schema.String>;
269
+ readonly line: Schema.optional<Schema.Int>;
270
+ /** The code under it has changed since, where the forge says. */
271
+ readonly outdated: Schema.optional<Schema.Boolean>;
272
+ readonly comments: Schema.$Array<Schema.Struct<{
273
+ readonly author: Schema.optional<Schema.String>;
274
+ readonly body: Schema.String;
275
+ }>>;
276
+ }>;
277
+ export declare const ReviewThreads: Schema.Struct<{
278
+ readonly threads: Schema.$Array<Schema.Struct<{
279
+ readonly id: Schema.String;
280
+ readonly path: Schema.optional<Schema.String>;
281
+ readonly line: Schema.optional<Schema.Int>;
282
+ /** The code under it has changed since, where the forge says. */
283
+ readonly outdated: Schema.optional<Schema.Boolean>;
284
+ readonly comments: Schema.$Array<Schema.Struct<{
285
+ readonly author: Schema.optional<Schema.String>;
286
+ readonly body: Schema.String;
287
+ }>>;
288
+ }>>;
289
+ }>;
290
+ export type ReviewThreads = typeof ReviewThreads.Type;
291
+ /** The open ChangeRequests on the Run's repository that any of `authors` opened, such as a dependency bot's. */
292
+ export declare const OpenChangeRequestsRequest: Schema.Struct<{
293
+ readonly authors: Schema.NonEmptyArray<Schema.String>;
294
+ }>;
295
+ export declare const OpenChangeRequest: Schema.Struct<{
296
+ readonly number: Schema.String;
297
+ readonly title: Schema.String;
298
+ /** The description, at most 4000 characters. */
299
+ readonly body: Schema.String;
300
+ readonly url: Schema.String;
301
+ readonly author: Schema.String;
302
+ readonly sourceBranch: Schema.String;
303
+ /** The head revision when it was read; a bot can push again before the Run builds on it. */
304
+ readonly head: Schema.String;
305
+ }>;
306
+ export declare const OpenChangeRequests: Schema.Struct<{
307
+ readonly changeRequests: Schema.$Array<Schema.Struct<{
308
+ readonly number: Schema.String;
309
+ readonly title: Schema.String;
310
+ /** The description, at most 4000 characters. */
311
+ readonly body: Schema.String;
312
+ readonly url: Schema.String;
313
+ readonly author: Schema.String;
314
+ readonly sourceBranch: Schema.String;
315
+ /** The head revision when it was read; a bot can push again before the Run builds on it. */
316
+ readonly head: Schema.String;
317
+ }>>;
318
+ }>;
319
+ export type OpenChangeRequests = typeof OpenChangeRequests.Type;
320
+ /** An open ChangeRequest a Run of this Loop opened; `id` is Kitman's, for `call`ing a Loop on it. */
321
+ export declare const OwnChangeRequest: Schema.Struct<{
322
+ readonly id: Schema.String;
323
+ readonly number: Schema.String;
324
+ readonly url: Schema.String;
325
+ readonly title: Schema.String;
326
+ readonly sourceBranch: Schema.String;
327
+ /** Its description on the forge now, such as the list of what a batch supersedes. */
328
+ readonly body: Schema.String;
329
+ }>;
330
+ export declare const OwnChangeRequests: Schema.Struct<{
331
+ readonly changeRequests: Schema.$Array<Schema.Struct<{
332
+ readonly id: Schema.String;
333
+ readonly number: Schema.String;
334
+ readonly url: Schema.String;
335
+ readonly title: Schema.String;
336
+ readonly sourceBranch: Schema.String;
337
+ /** Its description on the forge now, such as the list of what a batch supersedes. */
338
+ readonly body: Schema.String;
339
+ }>>;
340
+ }>;
341
+ export type OwnChangeRequests = typeof OwnChangeRequests.Type;
114
342
  /** An entry of a Run's Transcript. */
115
343
  export declare const TranscriptPoint: Schema.Struct<{
116
344
  readonly runId: Schema.String;
@@ -121,13 +349,18 @@ export type TranscriptPoint = typeof TranscriptPoint.Type;
121
349
  export declare const TranscriptsRequest: Schema.Struct<{
122
350
  readonly days: Schema.Int;
123
351
  }>;
124
- /** The Workspace's failed Runs of the window that the person the Run acts for may read, with their Transcripts. */
352
+ /**
353
+ * The Workspace's Runs that settled in the window, which the person the Run acts for may read, with their Transcripts:
354
+ * each with its `status`, a failed one with its `failure`, and one with a retried Step marked `retried`.
355
+ */
125
356
  export declare const TranscriptsResult: Schema.Struct<{
126
357
  readonly runs: Schema.$Array<Schema.Struct<{
127
358
  readonly runId: Schema.String;
128
359
  readonly loopId: Schema.String;
360
+ readonly status: Schema.optional<Schema.Literals<readonly ["completed", "failed", "canceled", "expired"]>>;
129
361
  readonly teamId: Schema.optional<Schema.String>;
130
362
  readonly failure: Schema.optional<Schema.String>;
363
+ readonly retried: Schema.optional<Schema.Boolean>;
131
364
  readonly entries: Schema.$Array<Schema.Struct<{
132
365
  readonly stepAttemptId: Schema.String;
133
366
  readonly sequence: Schema.Int;
@@ -153,6 +386,11 @@ export declare const ProposeRequest: Schema.Union<readonly [Schema.Struct<{
153
386
  readonly description: Schema.String;
154
387
  /** The Team the approver is offered first. */
155
388
  readonly teamId: Schema.optional<Schema.String>;
389
+ /**
390
+ * A stable kebab-case name for what it is about. While a proposal with this key waits for a decision it is cited
391
+ * again instead, and while the Task it filed is open the new Runs are commented on that Task.
392
+ */
393
+ readonly key: Schema.optionalKey<Schema.String>;
156
394
  readonly citations: Schema.NonEmptyArray<Schema.Struct<{
157
395
  readonly runId: Schema.String;
158
396
  readonly stepAttemptId: Schema.String;
@@ -163,6 +401,8 @@ export type ProposeRequest = typeof ProposeRequest.Type;
163
401
  export declare const ProposeResult: Schema.Struct<{
164
402
  readonly kind: Schema.Literals<readonly ["memory", "task"]>;
165
403
  readonly id: Schema.String;
404
+ /** Its key matched an earlier proposal or open Task, which it added to instead. */
405
+ readonly matched: Schema.optionalKey<Schema.Boolean>;
166
406
  }>;
167
407
  export declare const ProjectActivityRequest: Schema.Struct<{
168
408
  readonly projectId: Schema.String;
@@ -262,6 +502,12 @@ declare const CreateTasksActivity_base: Context.ServiceClass<CreateTasksActivity
262
502
  /** Makes a Task for each plan ticket, with the plan ticket as its origin and its blockers as TaskDependencies. */
263
503
  export declare class CreateTasksActivity extends CreateTasksActivity_base {
264
504
  }
505
+ declare const AlertTaskActivity_base: Context.ServiceClass<AlertTaskActivity, "@kitman-sh/sdk/loop/AlertTaskActivity", {
506
+ readonly run: (request: typeof AlertTaskRequest.Type, step: string) => Effect.Effect<AlertTaskResult, StepFailed>;
507
+ }>;
508
+ /** Finds or makes an alert's Bug Task, puts the Run on it, and folds a repeat into earlier work. */
509
+ export declare class AlertTaskActivity extends AlertTaskActivity_base {
510
+ }
265
511
  declare const IntegrationBranchActivity_base: Context.ServiceClass<IntegrationBranchActivity, "@kitman-sh/sdk/loop/IntegrationBranchActivity", {
266
512
  readonly run: (request: typeof IntegrationBranchRequest.Type, step: string) => Effect.Effect<IntegrationBranch, StepFailed>;
267
513
  }>;
@@ -270,6 +516,10 @@ export declare class IntegrationBranchActivity extends IntegrationBranchActivity
270
516
  }
271
517
  declare const MergeChangeRequestActivity_base: Context.ServiceClass<MergeChangeRequestActivity, "@kitman-sh/sdk/loop/MergeChangeRequestActivity", {
272
518
  readonly run: (request: typeof MergeChangeRequestRequest.Type, step: string) => Effect.Effect<MergeResult, StepFailed>;
519
+ readonly close: (request: typeof CloseChangeRequestRequest.Type, step: string) => Effect.Effect<typeof CloseChangeRequestResult.Type, StepFailed>;
520
+ readonly rerun: (request: typeof RerunPipelineRequest.Type, step: string) => Effect.Effect<typeof RerunPipelineResult.Type, StepFailed>;
521
+ readonly report: (request: typeof ReportPipelineRequest.Type, step: string) => Effect.Effect<ReportPipelineResult, StepFailed>;
522
+ readonly approve: (request: typeof ApproveChangeRequestRequest.Type, step: string) => Effect.Effect<typeof ApproveChangeRequestResult.Type, StepFailed>;
273
523
  }>;
274
524
  /** Merges a ChangeRequest into its target branch through the external-effect ledger; a Step merges once. */
275
525
  export declare class MergeChangeRequestActivity extends MergeChangeRequestActivity_base {
@@ -304,6 +554,15 @@ declare const DraftUpdateActivity_base: Context.ServiceClass<DraftUpdateActivity
304
554
  /** Drafts a Project Update for the person the Run acts for; a Run drafts once. Nothing a Loop calls posts one. */
305
555
  export declare class DraftUpdateActivity extends DraftUpdateActivity_base {
306
556
  }
557
+ declare const ChangeRequestReadActivity_base: Context.ServiceClass<ChangeRequestReadActivity, "@kitman-sh/sdk/loop/ChangeRequestReadActivity", {
558
+ readonly pipeline: (request: typeof ChangeRequestReadRequest.Type, step: string) => Effect.Effect<PipelineStatus, StepFailed>;
559
+ readonly reviewThreads: (request: typeof ChangeRequestReadRequest.Type, step: string) => Effect.Effect<ReviewThreads, StepFailed>;
560
+ readonly opened: (request: typeof OpenChangeRequestsRequest.Type, step: string) => Effect.Effect<OpenChangeRequests, StepFailed>;
561
+ readonly own: (step: string) => Effect.Effect<OwnChangeRequests, StepFailed>;
562
+ }>;
563
+ /** Reads what a ChangeRequest's Events point at, from its forge. */
564
+ export declare class ChangeRequestReadActivity extends ChangeRequestReadActivity_base {
565
+ }
307
566
  export declare const changeRequest: (name: string, request: typeof ChangeRequestRequest.Type) => Effect.Effect<{
308
567
  readonly id: string;
309
568
  readonly number: string;
@@ -325,6 +584,19 @@ export declare const createTasks: (name: string, request: typeof CreateTasksRequ
325
584
  readonly taskId: string;
326
585
  }[];
327
586
  }, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, CreateTasksActivity | import("./steps").LoopRun | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
587
+ /**
588
+ * Puts the Run on the Bug Task of the alert's fingerprint, made the first time. A repeat while another Run of it is
589
+ * open, or within `windowHours` of its last conclusion, is recorded on the Task as another occurrence and `joined`.
590
+ */
591
+ export declare const alertTask: (name: string, request: typeof AlertTaskRequest.Type) => Effect.Effect<{
592
+ readonly taskId?: string;
593
+ readonly created: boolean;
594
+ readonly resolved?: boolean;
595
+ readonly joined?: {
596
+ readonly kind: "recent" | "run";
597
+ readonly runId: string;
598
+ };
599
+ }, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, AlertTaskActivity | import("./steps").LoopRun | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
328
600
  /** Its head is read when the Step runs, so a later Step with another name sees what was merged since. */
329
601
  export declare const integrationBranch: (name: string, request: typeof IntegrationBranchRequest.Type) => Effect.Effect<{
330
602
  readonly repoBindingId: string;
@@ -336,6 +608,55 @@ export declare const mergeChangeRequest: (name: string, request: typeof MergeCha
336
608
  readonly revision: string;
337
609
  } | {
338
610
  readonly status: "conflict";
611
+ } | {
612
+ readonly status: "moved";
613
+ readonly head: string;
614
+ }, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, import("./steps").LoopRun | MergeChangeRequestActivity | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
615
+ /**
616
+ * Records Kitman's approval of a ChangeRequest's head, as Shepherd and readiness wait for. A Run cannot approve work it
617
+ * wrote: that is refused, not failed.
618
+ */
619
+ export declare const approveChangeRequest: (name: string, request: typeof ApproveChangeRequestRequest.Type) => Effect.Effect<{
620
+ readonly approved: true;
621
+ readonly reviewId: string;
622
+ } | {
623
+ readonly approved: false;
624
+ readonly reason: string;
625
+ }, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, import("./steps").LoopRun | MergeChangeRequestActivity | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
626
+ /**
627
+ * Closes another's open ChangeRequest on the Run's repository, such as one a batch supersedes, after posting `note` on
628
+ * it once. Closing one already closed or merged succeeds with `closed: false`.
629
+ */
630
+ export declare const closeChangeRequest: (name: string, request: typeof CloseChangeRequestRequest.Type) => Effect.Effect<{
631
+ readonly closed: boolean;
632
+ readonly head?: string;
633
+ }, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, import("./steps").LoopRun | MergeChangeRequestActivity | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
634
+ /**
635
+ * Waits for the ChangeRequest's next pipeline Event after `read`, on any head: a push moves the head, and only the new
636
+ * head's pipeline reports. Events received before the read never settle it. A read with no `readAt` waits on its head.
637
+ */
638
+ export declare const pipelineMoved: (name: string, changeRequestId: string, read: PipelineStatus, timeout?: Duration.Input) => Effect.Effect<{
639
+ readonly type: string;
640
+ readonly payload: {
641
+ readonly [x: string]: Schema.Json;
642
+ };
643
+ }, import("./steps").CapabilityDenied | import("./steps").ChangeRequestClosed | import("./steps").DuplicateStep | StepFailed | import("./steps").WaitTimedOut, import("./steps").LoopHost | import("./steps").LoopRun | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
644
+ /**
645
+ * Runs the failed jobs of the ChangeRequest's head pipeline, or of the newest pipeline of `ref`, again on the forge, as
646
+ * a person would for a flaky job or a failed deploy; with `all`, that pipeline runs again in full. The journal keeps the result, so a replayed Step runs nothing again.
647
+ */
648
+ export declare const rerunPipeline: (name: string, request: typeof RerunPipelineRequest.Type) => Effect.Effect<{
649
+ readonly head: string;
650
+ readonly pipelines: number;
651
+ }, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, import("./steps").LoopRun | MergeChangeRequestActivity | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
652
+ /**
653
+ * Reports the Run's completed `verify` Step `verification` as the ChangeRequest's pipeline at the commit it checked:
654
+ * one job per check, a failed one with the end of its output as its log. `pipelineStatus` then reads it for that head,
655
+ * and `change_request.pipeline` fires as for a forge's pipeline.
656
+ */
657
+ export declare const reportPipeline: (name: string, request: typeof ReportPipelineRequest.Type) => Effect.Effect<{
658
+ readonly head: string;
659
+ readonly status: "failed" | "success";
339
660
  }, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, import("./steps").LoopRun | MergeChangeRequestActivity | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
340
661
  export declare const release: (name: string, request: typeof ReleaseRequest.Type) => Effect.Effect<{
341
662
  readonly tag: string;
@@ -346,8 +667,10 @@ export declare const transcripts: (name: string, request: typeof TranscriptsRequ
346
667
  readonly runs: readonly {
347
668
  readonly runId: string;
348
669
  readonly loopId: string;
670
+ readonly status?: "canceled" | "completed" | "expired" | "failed" | undefined;
349
671
  readonly teamId?: string | undefined;
350
672
  readonly failure?: string | undefined;
673
+ readonly retried?: boolean | undefined;
351
674
  readonly entries: readonly {
352
675
  readonly stepAttemptId: string;
353
676
  readonly sequence: number;
@@ -359,6 +682,7 @@ export declare const transcripts: (name: string, request: typeof TranscriptsRequ
359
682
  export declare const propose: (name: string, request: ProposeRequest) => Effect.Effect<{
360
683
  readonly kind: "memory" | "task";
361
684
  readonly id: string;
685
+ readonly matched?: boolean;
362
686
  }, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, import("./steps").LoopRun | ProposeActivity | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
363
687
  export declare const projectActivity: (name: string, request: typeof ProjectActivityRequest.Type) => Effect.Effect<{
364
688
  readonly project: {
@@ -388,6 +712,62 @@ export declare const projectActivity: (name: string, request: typeof ProjectActi
388
712
  readonly at: string;
389
713
  }[];
390
714
  }, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, import("./steps").LoopRun | ProjectActivityActivity | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
715
+ /**
716
+ * The pipeline at a ChangeRequest's head, with a log tail per failed job. It is read when the Step runs, so read again
717
+ * under another name after waiting for `change_request.pipeline`.
718
+ */
719
+ export declare const pipelineStatus: (name: string, request: typeof ChangeRequestReadRequest.Type) => Effect.Effect<{
720
+ readonly head: string;
721
+ readonly status: "canceled" | "failed" | "none" | "running" | "success";
722
+ readonly source: "forge" | "reported";
723
+ readonly jobs: readonly {
724
+ readonly name: string;
725
+ readonly status: "failed" | "running" | "skipped" | "success";
726
+ readonly url?: string | undefined;
727
+ readonly logTail?: string | undefined;
728
+ }[];
729
+ readonly readAt?: string;
730
+ readonly runnerChecks?: readonly string[];
731
+ }, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, ChangeRequestReadActivity | import("./steps").LoopRun | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
732
+ /** A ChangeRequest's unresolved review conversations, read when the Step runs. */
733
+ export declare const reviewThreads: (name: string, request: typeof ChangeRequestReadRequest.Type) => Effect.Effect<{
734
+ readonly threads: readonly {
735
+ readonly id: string;
736
+ readonly path?: string | undefined;
737
+ readonly line?: number | undefined;
738
+ readonly outdated?: boolean | undefined;
739
+ readonly comments: readonly {
740
+ readonly author?: string | undefined;
741
+ readonly body: string;
742
+ }[];
743
+ }[];
744
+ }, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, ChangeRequestReadActivity | import("./steps").LoopRun | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
745
+ /** The open ChangeRequests on the Run's repository by any of `authors`, read when the Step runs. */
746
+ export declare const openChangeRequests: (name: string, request: typeof OpenChangeRequestsRequest.Type) => Effect.Effect<{
747
+ readonly changeRequests: readonly {
748
+ readonly number: string;
749
+ readonly title: string;
750
+ readonly body: string;
751
+ readonly url: string;
752
+ readonly author: string;
753
+ readonly sourceBranch: string;
754
+ readonly head: string;
755
+ }[];
756
+ }, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, ChangeRequestReadActivity | import("./steps").LoopRun | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
757
+ /**
758
+ * The open ChangeRequests that Runs of this Loop in this Team opened on the Run's repository, newest first, read when
759
+ * the Step runs: a scheduled Loop finds the one its last Run left open.
760
+ */
761
+ export declare const ownChangeRequests: (name: string) => Effect.Effect<{
762
+ readonly changeRequests: readonly {
763
+ readonly id: string;
764
+ readonly number: string;
765
+ readonly url: string;
766
+ readonly title: string;
767
+ readonly sourceBranch: string;
768
+ readonly body: string;
769
+ }[];
770
+ }, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, ChangeRequestReadActivity | import("./steps").LoopRun | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
391
771
  export declare const draftUpdate: (name: string, request: DraftUpdateRequest) => Effect.Effect<{
392
772
  readonly id: string;
393
773
  }, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, DraftUpdateActivity | import("./steps").LoopRun | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
@@ -0,0 +1,57 @@
1
+ import { ClaimResult } from '../../../core/src/resource-claim';
2
+ import type * as Duration from 'effect/Duration';
3
+ import * as Effect from 'effect/Effect';
4
+ import * as Schema from 'effect/Schema';
5
+ import { DurableDeferred } from 'effect/workflow';
6
+ import { LoopRun, StepFailed } from './steps';
7
+ export { ClaimResult };
8
+ /** A resource the Run holds until it lets go or settles. */
9
+ export type Claim = Extract<ClaimResult, {
10
+ readonly status: 'granted';
11
+ }>;
12
+ export declare const claimDeferred: (step: string) => DurableDeferred.DurableDeferred<Schema.Union<readonly [Schema.Struct<{
13
+ readonly status: Schema.Literal<"granted">;
14
+ readonly resource: Schema.String;
15
+ readonly takenOverFrom: Schema.optionalKey<Schema.Struct<{
16
+ readonly runId: Schema.optionalKey<Schema.String>;
17
+ readonly loopId: Schema.optionalKey<Schema.String>;
18
+ readonly status: Schema.optionalKey<Schema.Literals<readonly ["pending", "running", "blocked", "completed", "failed", "canceled", "expired"]>>;
19
+ readonly reason: Schema.optionalKey<Schema.String>;
20
+ readonly private: Schema.optionalKey<Schema.Literal<true>>;
21
+ readonly sameLoop: Schema.Boolean;
22
+ }>>;
23
+ }>, Schema.Struct<{
24
+ readonly status: Schema.Literal<"kept">;
25
+ readonly resource: Schema.String;
26
+ readonly holder: Schema.Struct<{
27
+ readonly runId: Schema.optionalKey<Schema.String>;
28
+ readonly loopId: Schema.optionalKey<Schema.String>;
29
+ readonly status: Schema.optionalKey<Schema.Literals<readonly ["pending", "running", "blocked", "completed", "failed", "canceled", "expired"]>>;
30
+ readonly reason: Schema.optionalKey<Schema.String>;
31
+ readonly private: Schema.optionalKey<Schema.Literal<true>>;
32
+ readonly sameLoop: Schema.Boolean;
33
+ }>;
34
+ }>]>, typeof StepFailed>;
35
+ export declare const letGoDeferred: (step: string) => DurableDeferred.DurableDeferred<Schema.Null, typeof StepFailed>;
36
+ /**
37
+ * Holds `resource`, such as a deploy target, for the Run, which lets go when it completes. A resource another Run
38
+ * holds is waited for with no Step running. One kept by a Run that settled without completing is offered as a
39
+ * takeover: asked when the Loop may ask, by default taken when the holder is the same Loop on the same repository.
40
+ */
41
+ export declare const claim: (name: string, request: {
42
+ readonly resource: string;
43
+ readonly timeout?: Duration.Input;
44
+ }) => Effect.Effect<{
45
+ readonly status: "granted";
46
+ readonly resource: string;
47
+ readonly takenOverFrom?: {
48
+ readonly runId?: string;
49
+ readonly loopId?: string;
50
+ readonly status?: "blocked" | "canceled" | "completed" | "expired" | "failed" | "pending" | "running";
51
+ readonly reason?: string;
52
+ readonly private?: true;
53
+ readonly sameLoop: boolean;
54
+ };
55
+ }, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | import("./steps").QuestionRefused | StepFailed, import("./steps").LoopHost | LoopRun | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
56
+ /** Lets go of a claim before the Run settles, so the oldest waiting Run gets it. */
57
+ export declare const letGo: (name: string, held: Claim) => Effect.Effect<void, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, import("./steps").LoopHost | LoopRun | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;