@kitman-sh/sdk 0.0.0-stage → 0.7.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.
Files changed (102) hide show
  1. package/dist/build/index.js +215 -0
  2. package/dist/chunk-7hwhxthh.js +1055 -0
  3. package/dist/chunk-zp7s46pz.js +3966 -0
  4. package/dist/loop/index.js +193 -0
  5. package/dist/program/index.js +30 -0
  6. package/package.json +29 -4
  7. package/types/packages/core/src/a2a.d.ts +577 -0
  8. package/types/packages/core/src/agent-capabilities.d.ts +1434 -0
  9. package/types/packages/core/src/agent-environment.d.ts +2429 -0
  10. package/types/packages/core/src/agent-launch-snapshot.d.ts +44 -0
  11. package/types/packages/core/src/agent-sandbox-policy.d.ts +33 -0
  12. package/types/packages/core/src/approval-queue.d.ts +126 -0
  13. package/types/packages/core/src/audit.d.ts +52 -0
  14. package/types/packages/core/src/change-delivery.d.ts +39 -0
  15. package/types/packages/core/src/change-request-review.d.ts +146 -0
  16. package/types/packages/core/src/change-request.d.ts +432 -0
  17. package/types/packages/core/src/common.d.ts +6 -0
  18. package/types/packages/core/src/connection.d.ts +33 -0
  19. package/types/packages/core/src/context-feedback.d.ts +89 -0
  20. package/types/packages/core/src/context-pack.d.ts +182 -0
  21. package/types/packages/core/src/crypto.d.ts +11 -0
  22. package/types/packages/core/src/data-lifecycle.d.ts +195 -0
  23. package/types/packages/core/src/decision.d.ts +48 -0
  24. package/types/packages/core/src/delivery-operation.d.ts +125 -0
  25. package/types/packages/core/src/delivery-policy.d.ts +174 -0
  26. package/types/packages/core/src/engineering-resources.d.ts +26 -0
  27. package/types/packages/core/src/enterprise-code-host.d.ts +18 -0
  28. package/types/packages/core/src/epic-delivery.d.ts +38 -0
  29. package/types/packages/core/src/extension.d.ts +35 -0
  30. package/types/packages/core/src/external-effect.d.ts +313 -0
  31. package/types/packages/core/src/fix-flow.d.ts +149 -0
  32. package/types/packages/core/src/following.d.ts +59 -0
  33. package/types/packages/core/src/github-delivery-fixtures.d.ts +28 -0
  34. package/types/packages/core/src/github-delivery.d.ts +78 -0
  35. package/types/packages/core/src/gitlab-delivery-fixtures.d.ts +26 -0
  36. package/types/packages/core/src/gitlab-delivery.d.ts +76 -0
  37. package/types/packages/core/src/global-search.d.ts +42 -0
  38. package/types/packages/core/src/id.d.ts +1 -0
  39. package/types/packages/core/src/index.d.ts +74 -0
  40. package/types/packages/core/src/integration.d.ts +255 -0
  41. package/types/packages/core/src/intent.d.ts +260 -0
  42. package/types/packages/core/src/json.d.ts +10 -0
  43. package/types/packages/core/src/kit-taxonomy.d.ts +21 -0
  44. package/types/packages/core/src/kit.d.ts +1489 -0
  45. package/types/packages/core/src/live.d.ts +8309 -0
  46. package/types/packages/core/src/loop-layers.d.ts +59 -0
  47. package/types/packages/core/src/loop-version.d.ts +59 -0
  48. package/types/packages/core/src/loop.d.ts +3076 -0
  49. package/types/packages/core/src/me.d.ts +31 -0
  50. package/types/packages/core/src/memory.d.ts +88 -0
  51. package/types/packages/core/src/my-teams.d.ts +1230 -0
  52. package/types/packages/core/src/notification.d.ts +181 -0
  53. package/types/packages/core/src/observability.d.ts +175 -0
  54. package/types/packages/core/src/package-declarations.d.ts +435 -0
  55. package/types/packages/core/src/package.d.ts +369 -0
  56. package/types/packages/core/src/personal-development-profile.d.ts +11 -0
  57. package/types/packages/core/src/platform-release.d.ts +60 -0
  58. package/types/packages/core/src/program-credential.d.ts +10 -0
  59. package/types/packages/core/src/project.d.ts +66 -0
  60. package/types/packages/core/src/proposal.d.ts +292 -0
  61. package/types/packages/core/src/provider-safe-text.d.ts +2 -0
  62. package/types/packages/core/src/redaction.d.ts +73 -0
  63. package/types/packages/core/src/repo-binding.d.ts +131 -0
  64. package/types/packages/core/src/run-journal.d.ts +28 -0
  65. package/types/packages/core/src/run-launch.d.ts +67 -0
  66. package/types/packages/core/src/run.d.ts +566 -0
  67. package/types/packages/core/src/runner-eligibility.d.ts +43 -0
  68. package/types/packages/core/src/runner-routing.d.ts +11 -0
  69. package/types/packages/core/src/runner-trust.d.ts +67 -0
  70. package/types/packages/core/src/runner.d.ts +3750 -0
  71. package/types/packages/core/src/runtime-type.d.ts +36 -0
  72. package/types/packages/core/src/schedule.d.ts +136 -0
  73. package/types/packages/core/src/schema.d.ts +89 -0
  74. package/types/packages/core/src/scope-directory.d.ts +100 -0
  75. package/types/packages/core/src/secret.d.ts +37 -0
  76. package/types/packages/core/src/session.d.ts +90 -0
  77. package/types/packages/core/src/step-brief.d.ts +50 -0
  78. package/types/packages/core/src/sync-kit.d.ts +587 -0
  79. package/types/packages/core/src/task-detail.d.ts +491 -0
  80. package/types/packages/core/src/task-execution-record.d.ts +620 -0
  81. package/types/packages/core/src/task-key.d.ts +9 -0
  82. package/types/packages/core/src/task.d.ts +543 -0
  83. package/types/packages/core/src/trigger-dispatch.d.ts +421 -0
  84. package/types/packages/core/src/work-unit.d.ts +740 -0
  85. package/types/packages/core/src/workspace.d.ts +96 -0
  86. package/types/packages/live/src/rpc/runner-client.d.ts +947 -0
  87. package/types/packages/live/src/rpc/runner-group.d.ts +733 -0
  88. package/types/packages/sdk/src/build/index.d.ts +45 -0
  89. package/types/packages/sdk/src/loop/activities.d.ts +187 -0
  90. package/types/packages/sdk/src/loop/check.d.ts +39 -0
  91. package/types/packages/sdk/src/loop/config.d.ts +68 -0
  92. package/types/packages/sdk/src/loop/define.d.ts +76 -0
  93. package/types/packages/sdk/src/loop/evidence.d.ts +66 -0
  94. package/types/packages/sdk/src/loop/index.d.ts +9 -0
  95. package/types/packages/sdk/src/loop/plan.d.ts +43 -0
  96. package/types/packages/sdk/src/loop/review.d.ts +86 -0
  97. package/types/packages/sdk/src/loop/steps.d.ts +224 -0
  98. package/types/packages/sdk/src/loop/test-loop.d.ts +112 -0
  99. package/types/packages/sdk/src/program/engine.d.ts +144 -0
  100. package/types/packages/sdk/src/program/host.d.ts +70 -0
  101. package/types/packages/sdk/src/program/index.d.ts +2 -0
  102. package/README.md +0 -3
@@ -0,0 +1,45 @@
1
+ import { PackageDeclarations } from '../../../core/src/package-declarations';
2
+ import * as Effect from 'effect/Effect';
3
+ import * as FileSystem from 'effect/FileSystem';
4
+ import * as Path from 'effect/Path';
5
+ import * as Schema from 'effect/Schema';
6
+ import { ChildProcessSpawner } from 'effect/process';
7
+ import type { LoopCheckError } from '../loop/check';
8
+ import type { ManifestInvalid } from '../loop/define';
9
+ declare const DependencyInstallFailed_base: Schema.Class<DependencyInstallFailed, Schema.TaggedStruct<"DependencyInstallFailed", {
10
+ readonly reason: Schema.String;
11
+ }>, import("effect/Cause").YieldableError>;
12
+ export declare class DependencyInstallFailed extends DependencyInstallFailed_base {
13
+ get message(): string;
14
+ }
15
+ declare const BundleFailed_base: Schema.Class<BundleFailed, Schema.TaggedStruct<"BundleFailed", {
16
+ readonly reason: Schema.String;
17
+ }>, import("effect/Cause").YieldableError>;
18
+ export declare class BundleFailed extends BundleFailed_base {
19
+ get message(): string;
20
+ }
21
+ declare const DeclarationsInvalid_base: Schema.Class<DeclarationsInvalid, Schema.TaggedStruct<"DeclarationsInvalid", {
22
+ readonly reason: Schema.String;
23
+ }>, import("effect/Cause").YieldableError>;
24
+ export declare class DeclarationsInvalid extends DeclarationsInvalid_base {
25
+ get message(): string;
26
+ }
27
+ export type PackageBuildError = DependencyInstallFailed | BundleFailed | DeclarationsInvalid | ManifestInvalid | LoopCheckError;
28
+ export type PackageProvenance = {
29
+ readonly repository?: string;
30
+ readonly commit?: string;
31
+ readonly clean: boolean;
32
+ };
33
+ export type PackageBuild = {
34
+ /** From `package.json`. */
35
+ readonly name: string;
36
+ /** One module that runs with nothing but `bun`: the program host, the config, the SDK, Effect and every dependency. */
37
+ readonly bundle: Uint8Array;
38
+ readonly digest: string;
39
+ readonly declarations: PackageDeclarations;
40
+ readonly protocolVersion: number;
41
+ readonly provenance: PackageProvenance;
42
+ };
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>;
45
+ export {};
@@ -0,0 +1,187 @@
1
+ import * as Context from 'effect/Context';
2
+ import * as Effect from 'effect/Effect';
3
+ import * as Schema from 'effect/Schema';
4
+ import { StepFailed } from './steps';
5
+ /** The Run's ChangeRequest, from its branch to its base branch. */
6
+ export declare const ChangeRequestRequest: Schema.Struct<{
7
+ readonly title: Schema.String;
8
+ readonly body: Schema.String;
9
+ /** A RepoBinding: opens from the Run's integration branch on it, into its base branch, instead. */
10
+ readonly integration: Schema.optional<Schema.String>;
11
+ }>;
12
+ export declare const ChangeRequestResult: Schema.Struct<{
13
+ readonly id: Schema.String;
14
+ readonly number: Schema.String;
15
+ readonly url: Schema.String;
16
+ }>;
17
+ export type ChangeRequestResult = typeof ChangeRequestResult.Type;
18
+ export declare const WriteBackMilestones: readonly ['started', 'change_request_opened', 'merged', 'failed'];
19
+ /** A Run milestone for the Run's Task, which moves it to the state its Team maps the milestone to. */
20
+ export declare const WriteBackRequest: Schema.Struct<{
21
+ readonly milestone: Schema.optional<Schema.Literals<readonly ["started", "change_request_opened", "merged", "failed"]>>;
22
+ readonly changeRequestUrl: Schema.optional<Schema.String>;
23
+ }>;
24
+ /** A document stored in Kitman with the Run, such as a plan, findings or a conclusion; later Runs retrieve it. */
25
+ export declare const ArtifactRequest: Schema.Struct<{
26
+ readonly kind: Schema.String;
27
+ readonly title: Schema.String;
28
+ readonly text: Schema.String;
29
+ readonly data: Schema.optional<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
30
+ }>;
31
+ export declare const ArtifactResult: Schema.Struct<{
32
+ readonly artifactId: Schema.String;
33
+ }>;
34
+ /** A thread entry on the Run's Task; given an artifact, it links to it. */
35
+ export declare const NoteRequest: Schema.Struct<{
36
+ readonly text: Schema.String;
37
+ readonly artifactId: Schema.optional<Schema.String>;
38
+ }>;
39
+ export declare const CreateTasksRequest: Schema.Struct<{
40
+ readonly tickets: Schema.$Array<Schema.Struct<{
41
+ readonly key: Schema.String;
42
+ readonly title: Schema.String;
43
+ readonly body: Schema.String;
44
+ readonly acceptanceCriteria: Schema.$Array<Schema.String>;
45
+ readonly repoBindingId: Schema.optional<Schema.String>;
46
+ readonly blockedBy: Schema.$Array<Schema.String>;
47
+ readonly outcome: Schema.optional<Schema.Literals<readonly ["feature", "bug", "refactor", "investigation", "docs", "migration"]>>;
48
+ }>>;
49
+ }>;
50
+ /** The Task made for each ticket, by ticket key. */
51
+ export declare const CreateTasksResult: Schema.Struct<{
52
+ readonly tasks: Schema.$Array<Schema.Struct<{
53
+ readonly key: Schema.String;
54
+ readonly taskId: Schema.String;
55
+ }>>;
56
+ }>;
57
+ /** The Project's default RepoBinding when left out. */
58
+ export declare const IntegrationBranchRequest: Schema.Struct<{
59
+ readonly repoBindingId: Schema.optional<Schema.String>;
60
+ }>;
61
+ export declare const IntegrationBranch: Schema.Struct<{
62
+ readonly repoBindingId: Schema.String;
63
+ readonly branch: Schema.String;
64
+ /** The branch head now. */
65
+ readonly revision: Schema.String;
66
+ }>;
67
+ export type IntegrationBranch = typeof IntegrationBranch.Type;
68
+ export declare const MergeChangeRequestRequest: Schema.Struct<{
69
+ readonly changeRequestId: Schema.String;
70
+ }>;
71
+ export declare const MergeResult: Schema.Union<readonly [Schema.Struct<{
72
+ readonly status: Schema.Literal<"merged">;
73
+ readonly revision: Schema.String;
74
+ }>, Schema.Struct<{
75
+ readonly status: Schema.Literal<"conflict">;
76
+ }>]>;
77
+ export type MergeResult = typeof MergeResult.Type;
78
+ /** A comment on a ChangeRequest, which need not be the Run's own. */
79
+ export declare const CommentRequest: Schema.Struct<{
80
+ readonly changeRequestId: Schema.String;
81
+ readonly body: Schema.String;
82
+ }>;
83
+ /** Tags `revision`, the Run's base branch head when left out, and publishes the release with its notes. */
84
+ export declare const ReleaseRequest: Schema.Struct<{
85
+ readonly tag: Schema.String;
86
+ readonly revision: Schema.optional<Schema.String>;
87
+ readonly title: Schema.String;
88
+ readonly notes: Schema.String;
89
+ }>;
90
+ export declare const ReleaseResult: Schema.Struct<{
91
+ readonly tag: Schema.String;
92
+ readonly revision: Schema.String;
93
+ readonly url: Schema.String;
94
+ }>;
95
+ export type ReleaseResult = typeof ReleaseResult.Type;
96
+ declare const ChangeRequestActivity_base: Context.ServiceClass<ChangeRequestActivity, "@kitman-sh/sdk/loop/ChangeRequestActivity", {
97
+ /** A Run has one ChangeRequest: it opens once, and a later Step updates it. */
98
+ readonly run: (request: typeof ChangeRequestRequest.Type, step: string) => Effect.Effect<ChangeRequestResult, StepFailed>;
99
+ }>;
100
+ /** Opens or updates the Run's ChangeRequest. */
101
+ export declare class ChangeRequestActivity extends ChangeRequestActivity_base {
102
+ }
103
+ declare const WriteBackActivity_base: Context.ServiceClass<WriteBackActivity, "@kitman-sh/sdk/loop/WriteBackActivity", {
104
+ readonly run: (request: typeof WriteBackRequest.Type, step: string) => Effect.Effect<void, StepFailed>;
105
+ }>;
106
+ /** Gives the Run's Task a milestone of the Run's. */
107
+ export declare class WriteBackActivity extends WriteBackActivity_base {
108
+ }
109
+ declare const ArtifactActivity_base: Context.ServiceClass<ArtifactActivity, "@kitman-sh/sdk/loop/ArtifactActivity", {
110
+ /** `step` names the Step storing it; a Step stores one artifact, however often it runs. */
111
+ readonly run: (request: typeof ArtifactRequest.Type, step: string) => Effect.Effect<typeof ArtifactResult.Type, StepFailed>;
112
+ }>;
113
+ /** Stores a Run artifact in Kitman, indexed for later Runs' ContextPacks and search. */
114
+ export declare class ArtifactActivity extends ArtifactActivity_base {
115
+ }
116
+ declare const NoteActivity_base: Context.ServiceClass<NoteActivity, "@kitman-sh/sdk/loop/NoteActivity", {
117
+ readonly run: (request: typeof NoteRequest.Type, step: string) => Effect.Effect<void, StepFailed>;
118
+ }>;
119
+ /** Adds an entry to the thread of the Run's Task. */
120
+ export declare class NoteActivity extends NoteActivity_base {
121
+ }
122
+ declare const CommentActivity_base: Context.ServiceClass<CommentActivity, "@kitman-sh/sdk/loop/CommentActivity", {
123
+ readonly run: (request: typeof CommentRequest.Type, step: string) => Effect.Effect<void, StepFailed>;
124
+ }>;
125
+ /** Posts a comment on a ChangeRequest through Kitman's external-effect ledger; a Step posts once. */
126
+ export declare class CommentActivity extends CommentActivity_base {
127
+ }
128
+ declare const CreateTasksActivity_base: Context.ServiceClass<CreateTasksActivity, "@kitman-sh/sdk/loop/CreateTasksActivity", {
129
+ /** A Step makes each ticket's Task once. */
130
+ readonly run: (request: typeof CreateTasksRequest.Type, step: string) => Effect.Effect<typeof CreateTasksResult.Type, StepFailed>;
131
+ }>;
132
+ /** Makes a Task for each plan ticket, with the plan ticket as its origin and its blockers as TaskDependencies. */
133
+ export declare class CreateTasksActivity extends CreateTasksActivity_base {
134
+ }
135
+ declare const IntegrationBranchActivity_base: Context.ServiceClass<IntegrationBranchActivity, "@kitman-sh/sdk/loop/IntegrationBranchActivity", {
136
+ readonly run: (request: typeof IntegrationBranchRequest.Type, step: string) => Effect.Effect<IntegrationBranch, StepFailed>;
137
+ }>;
138
+ /** The Run's integration branch on a repository, made from its base branch the first time. */
139
+ export declare class IntegrationBranchActivity extends IntegrationBranchActivity_base {
140
+ }
141
+ declare const MergeChangeRequestActivity_base: Context.ServiceClass<MergeChangeRequestActivity, "@kitman-sh/sdk/loop/MergeChangeRequestActivity", {
142
+ readonly run: (request: typeof MergeChangeRequestRequest.Type, step: string) => Effect.Effect<MergeResult, StepFailed>;
143
+ }>;
144
+ /** Merges a ChangeRequest into its target branch through the external-effect ledger; a Step merges once. */
145
+ export declare class MergeChangeRequestActivity extends MergeChangeRequestActivity_base {
146
+ }
147
+ declare const ReleaseActivity_base: Context.ServiceClass<ReleaseActivity, "@kitman-sh/sdk/loop/ReleaseActivity", {
148
+ readonly run: (request: typeof ReleaseRequest.Type, step: string) => Effect.Effect<ReleaseResult, StepFailed>;
149
+ }>;
150
+ /** Tags and publishes a release on the Run's repository through the external-effect ledger; a Step releases once. */
151
+ export declare class ReleaseActivity extends ReleaseActivity_base {
152
+ }
153
+ export declare const changeRequest: (name: string, request: typeof ChangeRequestRequest.Type) => Effect.Effect<{
154
+ readonly id: string;
155
+ readonly number: string;
156
+ readonly url: string;
157
+ }, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, ChangeRequestActivity | import("./steps").LoopRun | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
158
+ export declare const writeBack: (name: string, request: typeof WriteBackRequest.Type) => Effect.Effect<void, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, import("./steps").LoopRun | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance | WriteBackActivity>;
159
+ export declare const artifact: (name: string, request: typeof ArtifactRequest.Type) => Effect.Effect<{
160
+ readonly artifactId: string;
161
+ }, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, ArtifactActivity | import("./steps").LoopRun | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
162
+ export declare const note: (name: string, request: typeof NoteRequest.Type) => Effect.Effect<void, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, import("./steps").LoopRun | NoteActivity | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
163
+ export declare const comment: (name: string, request: typeof CommentRequest.Type) => Effect.Effect<void, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, CommentActivity | import("./steps").LoopRun | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
164
+ export declare const createTasks: (name: string, request: typeof CreateTasksRequest.Type) => Effect.Effect<{
165
+ readonly tasks: readonly {
166
+ readonly key: string;
167
+ readonly taskId: string;
168
+ }[];
169
+ }, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, CreateTasksActivity | import("./steps").LoopRun | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
170
+ /** Its head is read when the Step runs, so a later Step with another name sees what was merged since. */
171
+ export declare const integrationBranch: (name: string, request: typeof IntegrationBranchRequest.Type) => Effect.Effect<{
172
+ readonly repoBindingId: string;
173
+ readonly branch: string;
174
+ readonly revision: string;
175
+ }, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, IntegrationBranchActivity | import("./steps").LoopRun | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
176
+ export declare const mergeChangeRequest: (name: string, request: typeof MergeChangeRequestRequest.Type) => Effect.Effect<{
177
+ readonly status: "merged";
178
+ readonly revision: string;
179
+ } | {
180
+ readonly status: "conflict";
181
+ }, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, import("./steps").LoopRun | MergeChangeRequestActivity | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
182
+ export declare const release: (name: string, request: typeof ReleaseRequest.Type) => Effect.Effect<{
183
+ readonly tag: string;
184
+ readonly revision: string;
185
+ readonly url: string;
186
+ }, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, import("./steps").LoopRun | ReleaseActivity | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
187
+ export {};
@@ -0,0 +1,39 @@
1
+ import * as Cause from 'effect/Cause';
2
+ import * as Effect from 'effect/Effect';
3
+ import * as Schema from 'effect/Schema';
4
+ import type { LoopDefinition } from './define';
5
+ import { type LoopCheck } from './test-loop';
6
+ declare const CheckFailed_base: Schema.Class<CheckFailed, Schema.TaggedStruct<"CheckFailed", {
7
+ readonly loop: Schema.String;
8
+ readonly check: Schema.String;
9
+ readonly reason: Schema.String;
10
+ }>, Cause.YieldableError>;
11
+ export declare class CheckFailed extends CheckFailed_base {
12
+ get detail(): string;
13
+ get message(): string;
14
+ }
15
+ declare const StepNamedTwice_base: Schema.Class<StepNamedTwice, Schema.TaggedStruct<"StepNamedTwice", {
16
+ readonly loop: Schema.String;
17
+ readonly check: Schema.String;
18
+ readonly step: Schema.String;
19
+ }>, Cause.YieldableError>;
20
+ export declare class StepNamedTwice extends StepNamedTwice_base {
21
+ get detail(): string;
22
+ get message(): string;
23
+ }
24
+ declare const ReplayDiverged_base: Schema.Class<ReplayDiverged, Schema.TaggedStruct<"ReplayDiverged", {
25
+ readonly loop: Schema.String;
26
+ readonly check: Schema.String;
27
+ readonly first: Schema.$Array<Schema.String>;
28
+ readonly replay: Schema.$Array<Schema.String>;
29
+ readonly rerun: Schema.$Array<Schema.String>;
30
+ }>, Cause.YieldableError>;
31
+ export declare class ReplayDiverged extends ReplayDiverged_base {
32
+ get detail(): string;
33
+ get message(): string;
34
+ }
35
+ export declare const LoopCheckError: Schema.Union<readonly [typeof CheckFailed, typeof StepNamedTwice, typeof ReplayDiverged]>;
36
+ export type LoopCheckError = typeof LoopCheckError.Type;
37
+ /** Runs a check twice, the second time from the first run's journal; the replay must take the same Steps and rerun no Activity. */
38
+ export declare const checkLoop: (loop: LoopDefinition<unknown, unknown, unknown>, check: LoopCheck) => Effect.Effect<void, LoopCheckError>;
39
+ export {};
@@ -0,0 +1,68 @@
1
+ import type { KitAssignmentDeclaration, KitInstallationDeclaration, ScheduleDeclaration } from '../../../core/src/package-declarations';
2
+ import type { LoopDefinition } from './define';
3
+ /** Agent instructions inline, or a Markdown file in the Package's repository, read at build. */
4
+ export type AgentInstructions = string | {
5
+ readonly file: string;
6
+ };
7
+ export type AgentConfig = {
8
+ /** The Agent this one extends. */
9
+ readonly extends?: string;
10
+ readonly instructions?: AgentInstructions;
11
+ readonly harness?: string;
12
+ readonly model?: string;
13
+ /** How hard its harness thinks; a harness without the control ignores it. */
14
+ readonly effort?: 'low' | 'medium' | 'high' | 'xhigh';
15
+ /** Kit references. */
16
+ readonly kits?: readonly string[];
17
+ /** Hosts its sandboxed Steps may reach beyond the defaults, or `open` for an Agent that browses. */
18
+ readonly network?: {
19
+ readonly hosts: readonly string[];
20
+ } | 'open';
21
+ /** Runs its Steps only on Runners that run agents in docker, for services or a project image. */
22
+ readonly sandbox?: 'docker';
23
+ };
24
+ /** A Kit written from the Package's files: its context, and skill directories each holding a `SKILL.md`. */
25
+ export type AuthoredKitConfig = {
26
+ readonly name: string;
27
+ readonly kind?: 'technology' | 'brand' | 'domain' | 'process' | 'other';
28
+ readonly description?: string;
29
+ readonly context: AgentInstructions;
30
+ /** Skill directories in the repository; each is named after its directory. */
31
+ readonly skills?: readonly string[];
32
+ };
33
+ /** An authored Kit, a Marketplace Kit to install, or where a Kit applies. */
34
+ export type KitConfig = AuthoredKitConfig | KitInstallationDeclaration | KitAssignmentDeclaration;
35
+ export type PackageLoop = LoopDefinition<unknown, unknown, unknown>;
36
+ /** A Package's `kitman.config.ts` default export. */
37
+ export type PackageConfig = {
38
+ readonly loops: readonly PackageLoop[];
39
+ readonly agents?: {
40
+ readonly [id: string]: AgentConfig;
41
+ };
42
+ readonly schedules?: {
43
+ readonly [key: string]: ScheduleDeclaration;
44
+ };
45
+ readonly kits?: {
46
+ readonly [key: string]: KitConfig;
47
+ };
48
+ };
49
+ /** Each element a Loop, whatever its Input, Output and error types. */
50
+ type Loops<L extends readonly unknown[]> = {
51
+ readonly [K in keyof L]: L[K] extends LoopDefinition<infer In, infer Out, infer E> ? LoopDefinition<In, Out, E> : never;
52
+ };
53
+ /** Declares a Package: its Loops, and its Agents keyed by id. */
54
+ export declare const defineConfig: <const L extends readonly unknown[]>(config: {
55
+ readonly loops: L & Loops<L>;
56
+ readonly agents?: {
57
+ readonly [id: string]: AgentConfig;
58
+ };
59
+ /** Recurring starts of a Loop, keyed; the Package owns each Schedule it declares. */
60
+ readonly schedules?: {
61
+ readonly [key: string]: ScheduleDeclaration;
62
+ };
63
+ /** Kits, keyed; only a Workspace Package may declare them. */
64
+ readonly kits?: {
65
+ readonly [key: string]: KitConfig;
66
+ };
67
+ }) => PackageConfig;
68
+ export {};
@@ -0,0 +1,76 @@
1
+ import { LoopCapabilities, type LoopManifest } from '../../../core/src/package-declarations';
2
+ import * as Effect from 'effect/Effect';
3
+ import * as Schema from 'effect/Schema';
4
+ import type { WorkflowEngine } from 'effect/workflow';
5
+ import type { LoopHost, LoopRun } from './steps';
6
+ import type { LoopCheck } from './test-loop';
7
+ import type { ArtifactActivity, ChangeRequestActivity, CommentActivity, CreateTasksActivity, IntegrationBranchActivity, MergeChangeRequestActivity, NoteActivity, ReleaseActivity, WriteBackActivity } from './activities';
8
+ export { LoopCapabilities, type LoopManifest };
9
+ /** What a Loop's program may ask Kitman for; the control plane checks each request against them. */
10
+ export type LoopCapability = (typeof LoopCapabilities)[number];
11
+ export declare const LoopOutcome: Schema.Literals<readonly ["feature", "bug", "refactor", "investigation", "docs", "migration"]>;
12
+ export type LoopOutcome = typeof LoopOutcome.Type;
13
+ export type LoopCheckout = 'none' | 'read' | 'write';
14
+ type EventFilterValue = string | number | boolean | null;
15
+ /** Matched by the control plane against Event payload paths: a value, or any of several. */
16
+ export type EventFilter = {
17
+ readonly [path: string]: EventFilterValue | readonly EventFilterValue[];
18
+ };
19
+ /** Starts a Run on a matching Event, binding Event payload paths into the Loop Input. */
20
+ export type WhenClause = {
21
+ readonly event: string;
22
+ readonly filter?: EventFilter;
23
+ readonly input: {
24
+ readonly [inputField: string]: string;
25
+ };
26
+ };
27
+ /** An action shown on a settled Run: start another Loop. */
28
+ export type LoopOffer = {
29
+ readonly id: string;
30
+ readonly title: string;
31
+ readonly loop: string;
32
+ };
33
+ /** The services a Loop's program runs with; a Runner or `testLoop` provides them. */
34
+ export type LoopServices = LoopRun | LoopHost | ChangeRequestActivity | WriteBackActivity | ArtifactActivity | NoteActivity | CommentActivity | CreateTasksActivity | IntegrationBranchActivity | MergeChangeRequestActivity | ReleaseActivity | WorkflowEngine.WorkflowEngine | WorkflowEngine.WorkflowInstance;
35
+ /** A schema a Loop can decode and encode with no services. */
36
+ export type LoopSchema<T> = Schema.Codec<T, unknown>;
37
+ export type LoopDefinition<In, Out, E> = {
38
+ readonly id: string;
39
+ readonly title: string;
40
+ readonly input: LoopSchema<In>;
41
+ readonly output: LoopSchema<Out>;
42
+ readonly outcome?: LoopOutcome;
43
+ /** Agent ids by role; `agentWork` names a role. */
44
+ readonly agents: {
45
+ readonly [role: string]: string;
46
+ };
47
+ readonly checkout: LoopCheckout;
48
+ readonly when?: readonly WhenClause[];
49
+ readonly offers?: readonly LoopOffer[];
50
+ readonly capabilities: readonly LoopCapability[];
51
+ /** The Secrets the program reads with `Config.Redacted`, and `agentWork` may put into a Step's sandbox. */
52
+ readonly secrets?: readonly string[];
53
+ /**
54
+ * The hosts the program calls besides Kitman, or `open` for any; a shared Runner refuses the rest. An `open` Loop
55
+ * runs only on a Runner with `docker`, or a personal Runner.
56
+ */
57
+ readonly network?: {
58
+ readonly hosts: readonly string[];
59
+ } | 'open';
60
+ readonly run: (input: In) => Effect.Effect<Out, E, LoopServices>;
61
+ /** Scripts a build runs twice, the second time from the journal; not part of the manifest. */
62
+ readonly checks?: readonly LoopCheck[];
63
+ };
64
+ /** A Loop module's default export. The definition keeps its shape, so a fork spreads it. */
65
+ export declare const defineLoop: <In, Out, E>(definition: LoopDefinition<In, Out, E>) => LoopDefinition<In, Out, E>;
66
+ declare const ManifestInvalid_base: Schema.Class<ManifestInvalid, Schema.TaggedStruct<"ManifestInvalid", {
67
+ readonly loop: Schema.String;
68
+ readonly message: Schema.String;
69
+ }>, import("effect/Cause").YieldableError>;
70
+ export declare class ManifestInvalid extends ManifestInvalid_base {
71
+ }
72
+ export declare const jsonSchemaOf: <T>(loop: string, schema: LoopSchema<T>) => Effect.Effect<{
73
+ readonly [x: string]: Schema.Json;
74
+ }, ManifestInvalid, never>;
75
+ /** The data the control plane reads from a Loop, made without calling `run`. */
76
+ export declare const loopManifest: <In, Out, E>(definition: LoopDefinition<In, Out, E>) => Effect.Effect<LoopManifest, ManifestInvalid>;
@@ -0,0 +1,66 @@
1
+ import * as Schema from 'effect/Schema';
2
+ import type { LoopOutcome } from './define';
3
+ import type { ScopeJudgement } from './review';
4
+ /** One approved verification's result at a tree, as a Runner recorded it. */
5
+ export declare const EvidenceCheck: Schema.Struct<{
6
+ readonly name: Schema.String;
7
+ readonly command: Schema.String;
8
+ readonly status: Schema.Literals<readonly ["passed", "failed"]>;
9
+ /** It also fails on the default branch's head, so the Run did not cause it. */
10
+ readonly preExisting: Schema.Boolean;
11
+ readonly durationMs: Schema.Finite;
12
+ readonly evidenceId: Schema.String;
13
+ }>;
14
+ export type EvidenceCheck = typeof EvidenceCheck.Type;
15
+ /** Evidence for a revision; `tree` is its git tree id, and the evidence holds for any revision with that tree. */
16
+ export declare const VerifyResult: Schema.Struct<{
17
+ readonly revision: Schema.String;
18
+ readonly tree: Schema.String;
19
+ /** Every check passed or already failed on the default branch. */
20
+ readonly passed: Schema.Boolean;
21
+ readonly checks: Schema.$Array<Schema.Struct<{
22
+ readonly name: Schema.String;
23
+ readonly command: Schema.String;
24
+ readonly status: Schema.Literals<readonly ["passed", "failed"]>;
25
+ /** It also fails on the default branch's head, so the Run did not cause it. */
26
+ readonly preExisting: Schema.Boolean;
27
+ readonly durationMs: Schema.Finite;
28
+ readonly evidenceId: Schema.String;
29
+ }>>;
30
+ }>;
31
+ export type VerifyResult = typeof VerifyResult.Type;
32
+ /** What closes a Run, by its Outcome; `none` is a Run with no Outcome. */
33
+ export declare const OutcomeTable: {
34
+ readonly feature: 'Approved verifications pass on the head tree, and review says the scope was met';
35
+ readonly bug: 'A reproducing check fails on the base and passes on the head';
36
+ readonly refactor: 'Approved verifications pass on both base and head';
37
+ readonly investigation: 'A conclusion Output with its sources; no patch needed';
38
+ readonly docs: 'The documented commands run';
39
+ readonly migration: 'A rollback check passes';
40
+ readonly none: 'Only the approved verifications';
41
+ };
42
+ export type EvidenceGateInput = {
43
+ readonly outcome?: LoopOutcome;
44
+ readonly head?: VerifyResult;
45
+ readonly base?: VerifyResult;
46
+ /** The reviewer's scope judgement; absent when no reviewer judged it, which never reads as met. */
47
+ readonly review?: ScopeJudgement;
48
+ /** The check that reproduces a bug. */
49
+ readonly reproducing?: string;
50
+ readonly conclusion?: {
51
+ readonly text: string;
52
+ readonly sources: readonly string[];
53
+ };
54
+ /** The checks that run the documented commands. */
55
+ readonly documented?: readonly string[];
56
+ /** The check that rolls a migration back. */
57
+ readonly rollback?: string;
58
+ };
59
+ export type EvidenceVerdict = {
60
+ readonly settled: true;
61
+ } | {
62
+ readonly settled: false;
63
+ readonly reasons: readonly string[];
64
+ };
65
+ /** Whether the Run's evidence closes its Outcome, per `OutcomeTable`; claims in Outputs never count. */
66
+ export declare const evidenceGate: (input: EvidenceGateInput) => EvidenceVerdict;
@@ -0,0 +1,9 @@
1
+ export * from './define';
2
+ export * from './steps';
3
+ export * from './activities';
4
+ export * from './test-loop';
5
+ export * from './evidence';
6
+ export * from './review';
7
+ export * from './plan';
8
+ export * from './check';
9
+ export * from './config';
@@ -0,0 +1,43 @@
1
+ import * as Effect from 'effect/Effect';
2
+ import * as Schema from 'effect/Schema';
3
+ /** One unit of a plan, which Implement now turns into a Task and builds. */
4
+ export declare const PlanTicket: Schema.Struct<{
5
+ /** Short and unique within the plan; blockers name it. */
6
+ readonly key: Schema.String;
7
+ readonly title: Schema.String;
8
+ readonly body: Schema.String;
9
+ readonly acceptanceCriteria: Schema.$Array<Schema.String>;
10
+ /** The repository it changes; the Project's default when left out. */
11
+ readonly repoBindingId: Schema.optional<Schema.String>;
12
+ /** Keys of the tickets that must be built first. */
13
+ readonly blockedBy: Schema.$Array<Schema.String>;
14
+ /** The kind of change; its Task gets the first Task Type with this Outcome. */
15
+ readonly outcome: Schema.optional<Schema.Literals<readonly ["feature", "bug", "refactor", "investigation", "docs", "migration"]>>;
16
+ }>;
17
+ export type PlanTicket = typeof PlanTicket.Type;
18
+ /** A plan's tickets; a blocker must name another ticket, and no tickets may block each other in a cycle. */
19
+ export declare const PlanTickets: Schema.$Array<Schema.Struct<{
20
+ /** Short and unique within the plan; blockers name it. */
21
+ readonly key: Schema.String;
22
+ readonly title: Schema.String;
23
+ readonly body: Schema.String;
24
+ readonly acceptanceCriteria: Schema.$Array<Schema.String>;
25
+ /** The repository it changes; the Project's default when left out. */
26
+ readonly repoBindingId: Schema.optional<Schema.String>;
27
+ /** Keys of the tickets that must be built first. */
28
+ readonly blockedBy: Schema.$Array<Schema.String>;
29
+ /** The kind of change; its Task gets the first Task Type with this Outcome. */
30
+ readonly outcome: Schema.optional<Schema.Literals<readonly ["feature", "bug", "refactor", "investigation", "docs", "migration"]>>;
31
+ }>>;
32
+ declare const BlockingCycle_base: Schema.Class<BlockingCycle, Schema.TaggedStruct<"BlockingCycle", {
33
+ readonly tickets: Schema.$Array<Schema.String>;
34
+ }>, import("effect/Cause").YieldableError>;
35
+ export declare class BlockingCycle extends BlockingCycle_base {
36
+ get message(): string;
37
+ }
38
+ /**
39
+ * Orders tickets into waves: a ticket is in the wave after its last blocker's, and each wave is grouped by
40
+ * RepoBinding. Every ticket in a wave can be built at once.
41
+ */
42
+ export declare const planWaves: (tickets: readonly PlanTicket[]) => Effect.Effect<readonly PlanTicket[][], BlockingCycle>;
43
+ export {};
@@ -0,0 +1,86 @@
1
+ import * as Schema from 'effect/Schema';
2
+ export declare const Severity: Schema.Literals<readonly ["blocker", "major", "minor"]>;
3
+ export type Severity = typeof Severity.Type;
4
+ /** What one reviewer seat found. */
5
+ export declare const Finding: Schema.Struct<{
6
+ readonly severity: Schema.Literals<readonly ["blocker", "major", "minor"]>;
7
+ readonly file: Schema.String;
8
+ readonly line: Schema.Int;
9
+ readonly detail: Schema.String;
10
+ }>;
11
+ export type Finding = typeof Finding.Type;
12
+ /** A finding after the panel's findings are merged; `id` is its file and line. */
13
+ export declare const MergedFinding: Schema.Struct<{
14
+ readonly severity: Schema.Literals<readonly ["blocker", "major", "minor"]>;
15
+ readonly file: Schema.String;
16
+ readonly line: Schema.Int;
17
+ readonly detail: Schema.String;
18
+ readonly id: Schema.String;
19
+ readonly seats: Schema.$Array<Schema.String>;
20
+ }>;
21
+ export type MergedFinding = typeof MergedFinding.Type;
22
+ export declare const Rebuttal: Schema.Struct<{
23
+ readonly findingId: Schema.String;
24
+ readonly reason: Schema.String;
25
+ }>;
26
+ export type Rebuttal = typeof Rebuttal.Type;
27
+ export declare const RebuttalVerdict: Schema.Struct<{
28
+ readonly findingId: Schema.String;
29
+ readonly accepted: Schema.Boolean;
30
+ }>;
31
+ export type RebuttalVerdict = typeof RebuttalVerdict.Type;
32
+ /** Whether a change does what its Task asks; `unmet` names each criterion or part of the description not done. */
33
+ export declare const ScopeJudgement: Schema.Struct<{
34
+ readonly met: Schema.Boolean;
35
+ readonly unmet: Schema.$Array<Schema.String>;
36
+ }>;
37
+ export type ScopeJudgement = typeof ScopeJudgement.Type;
38
+ export type Disputed = {
39
+ readonly finding: MergedFinding;
40
+ readonly rebuttal: Rebuttal;
41
+ };
42
+ export declare const isBlocking: (finding: Pick<Finding, 'severity'>) => boolean;
43
+ /** One finding per file and line; the worst severity's detail wins, and every seat that raised it is kept. */
44
+ export declare const mergeFindings: (bySeat: {
45
+ readonly [seat: string]: readonly Finding[];
46
+ }) => readonly MergedFinding[];
47
+ export declare const splitDisputed: (findings: readonly MergedFinding[], rebuttals: readonly Rebuttal[]) => {
48
+ disputed: Disputed[];
49
+ undisputed: {
50
+ readonly severity: "blocker" | "major" | "minor";
51
+ readonly file: string;
52
+ readonly line: number;
53
+ readonly detail: string;
54
+ readonly id: string;
55
+ readonly seats: readonly string[];
56
+ }[];
57
+ };
58
+ export type SettledRound = {
59
+ /** Findings still to fix. */
60
+ readonly open: readonly MergedFinding[];
61
+ /** Rebutted, and the reviewers accepted the rebuttal. */
62
+ readonly withdrawn: readonly Disputed[];
63
+ /** Rebutted, and the reviewers did not accept the rebuttal. */
64
+ readonly standing: readonly Disputed[];
65
+ };
66
+ /** A rebutted finding is withdrawn only when every verdict on it accepts the rebuttal. */
67
+ export declare const settleRound: (round: {
68
+ readonly findings: readonly MergedFinding[];
69
+ readonly rebuttals: readonly Rebuttal[];
70
+ readonly verdicts: readonly RebuttalVerdict[];
71
+ }) => SettledRound;
72
+ export type RallyStopReason = 'settled' | 'dispute_stands' | 'findings_returned' | 'round_cap';
73
+ export type RallyDecision = {
74
+ readonly stop: false;
75
+ } | {
76
+ readonly stop: true;
77
+ readonly reason: RallyStopReason;
78
+ readonly unsettled: readonly string[];
79
+ };
80
+ /** Whether the rally ends after this round; `previous` is the last round's blocking finding ids. */
81
+ export declare const rallyStop: (input: {
82
+ readonly round: number;
83
+ readonly maxRounds: number;
84
+ readonly settled: SettledRound;
85
+ readonly previous?: readonly string[];
86
+ }) => RallyDecision;