@kitman-sh/loops 0.0.0-stage → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1066 -0
- package/package.json +19 -4
- package/types/packages/core/src/agent-environment.d.ts +2429 -0
- package/types/packages/core/src/agent-sandbox-policy.d.ts +31 -0
- package/types/packages/core/src/common.d.ts +6 -0
- package/types/packages/core/src/context-pack.d.ts +182 -0
- package/types/packages/core/src/extension.d.ts +35 -0
- package/types/packages/core/src/kit.d.ts +1489 -0
- package/types/packages/core/src/loop-layers.d.ts +59 -0
- package/types/packages/core/src/loop-version.d.ts +59 -0
- package/types/packages/core/src/loop.d.ts +3076 -0
- package/types/packages/core/src/package-declarations.d.ts +427 -0
- package/types/packages/core/src/proposal.d.ts +292 -0
- package/types/packages/core/src/redaction.d.ts +73 -0
- package/types/packages/core/src/run.d.ts +566 -0
- package/types/packages/core/src/runtime-type.d.ts +36 -0
- package/types/packages/core/src/schedule.d.ts +136 -0
- package/types/packages/core/src/schema.d.ts +89 -0
- package/types/packages/core/src/trigger-dispatch.d.ts +421 -0
- package/types/packages/loops/src/build.d.ts +33 -0
- package/types/packages/loops/src/change-request-body.d.ts +14 -0
- package/types/packages/loops/src/code-quality-pass.d.ts +50 -0
- package/types/packages/loops/src/code-quality.d.ts +26 -0
- package/types/packages/loops/src/hello.d.ts +9 -0
- package/types/packages/loops/src/incident.d.ts +13 -0
- package/types/packages/loops/src/index.d.ts +172 -0
- package/types/packages/loops/src/plan.d.ts +37 -0
- package/types/packages/loops/src/release.d.ts +21 -0
- package/types/packages/loops/src/research.d.ts +8 -0
- package/types/packages/loops/src/review.d.ts +38 -0
- package/types/packages/sdk/src/loop/activities.d.ts +187 -0
- package/types/packages/sdk/src/loop/check.d.ts +39 -0
- package/types/packages/sdk/src/loop/config.d.ts +68 -0
- package/types/packages/sdk/src/loop/define.d.ts +69 -0
- package/types/packages/sdk/src/loop/evidence.d.ts +66 -0
- package/types/packages/sdk/src/loop/index.d.ts +9 -0
- package/types/packages/sdk/src/loop/plan.d.ts +43 -0
- package/types/packages/sdk/src/loop/review.d.ts +86 -0
- package/types/packages/sdk/src/loop/steps.d.ts +224 -0
- package/types/packages/sdk/src/loop/test-loop.d.ts +112 -0
- package/README.md +0 -3
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import * as Effect from 'effect/Effect';
|
|
2
|
+
import * as Exit from 'effect/Exit';
|
|
3
|
+
import * as Schema from 'effect/Schema';
|
|
4
|
+
import { Workflow, WorkflowEngine } from 'effect/workflow';
|
|
5
|
+
import { ArtifactActivity, ChangeRequestActivity, CommentActivity, CreateTasksActivity, IntegrationBranchActivity, MergeChangeRequestActivity, NoteActivity, ReleaseActivity, WriteBackActivity } from './activities';
|
|
6
|
+
import type { LoopCapability, LoopDefinition } from './define';
|
|
7
|
+
import type { VerifyResult } from './evidence';
|
|
8
|
+
import { InputInvalid, LoopHost, LoopRun, type LoopEvent, type StepRecord } from './steps';
|
|
9
|
+
/** Activity and deferred results, encoded as JSON; replaying from it runs no Activity again. */
|
|
10
|
+
export declare const LoopJournal: Schema.Struct<{
|
|
11
|
+
readonly activities: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
12
|
+
readonly deferreds: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
13
|
+
}>;
|
|
14
|
+
export type LoopJournal = typeof LoopJournal.Type;
|
|
15
|
+
declare const ScriptedFailure_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => Readonly<A> & {
|
|
16
|
+
readonly _tag: "ScriptedFailure";
|
|
17
|
+
} & import("effect/Pipeable").Pipeable;
|
|
18
|
+
export declare class ScriptedFailure extends ScriptedFailure_base<{
|
|
19
|
+
readonly reason: string;
|
|
20
|
+
}> {
|
|
21
|
+
}
|
|
22
|
+
/** Scripts a failed agent Step or Child Run. */
|
|
23
|
+
export declare const scriptedFailure: (reason: string) => ScriptedFailure;
|
|
24
|
+
type Scripted = Schema.Json | ScriptedFailure;
|
|
25
|
+
export type HostActivities = {
|
|
26
|
+
readonly changeRequest: ChangeRequestActivity['Service'];
|
|
27
|
+
readonly writeBack: WriteBackActivity['Service'];
|
|
28
|
+
readonly artifact: ArtifactActivity['Service'];
|
|
29
|
+
readonly note: NoteActivity['Service'];
|
|
30
|
+
readonly comment: CommentActivity['Service'];
|
|
31
|
+
readonly createTasks: CreateTasksActivity['Service'];
|
|
32
|
+
readonly integrationBranch: IntegrationBranchActivity['Service'];
|
|
33
|
+
readonly mergeChangeRequest: MergeChangeRequestActivity['Service'];
|
|
34
|
+
readonly release: ReleaseActivity['Service'];
|
|
35
|
+
};
|
|
36
|
+
export type TestLoopScript = {
|
|
37
|
+
/** The Loop Input as JSON, as a Run receives it. */
|
|
38
|
+
readonly input: Schema.Json;
|
|
39
|
+
/** Outputs by Step name; a Step left out fails. */
|
|
40
|
+
readonly outputs?: {
|
|
41
|
+
readonly [step: string]: Scripted;
|
|
42
|
+
};
|
|
43
|
+
readonly answers?: {
|
|
44
|
+
readonly [step: string]: string;
|
|
45
|
+
};
|
|
46
|
+
readonly children?: {
|
|
47
|
+
readonly [step: string]: Scripted;
|
|
48
|
+
};
|
|
49
|
+
/** Events by Step name; a waitFor left out times out. */
|
|
50
|
+
readonly events?: {
|
|
51
|
+
readonly [step: string]: LoopEvent;
|
|
52
|
+
};
|
|
53
|
+
/** Verification results by Step name; a verify left out passes with no checks. */
|
|
54
|
+
readonly verifications?: {
|
|
55
|
+
readonly [step: string]: VerifyResult | ScriptedFailure;
|
|
56
|
+
};
|
|
57
|
+
/** What the control plane grants; the declared capabilities by default. */
|
|
58
|
+
readonly grant?: readonly LoopCapability[];
|
|
59
|
+
readonly activities?: Partial<HostActivities>;
|
|
60
|
+
readonly journal?: LoopJournal;
|
|
61
|
+
/** Secret values the program reads with `Config`; none by default. */
|
|
62
|
+
readonly secrets?: {
|
|
63
|
+
readonly [name: string]: string;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
/** A check run twice, once from the journal: a Loop's `checks`, or a stored Loop module's `checks` export. */
|
|
67
|
+
export type LoopCheck = {
|
|
68
|
+
readonly name: string;
|
|
69
|
+
readonly script: TestLoopScript;
|
|
70
|
+
};
|
|
71
|
+
export type TestLoopResult<Out, E> = {
|
|
72
|
+
readonly result: Exit.Exit<Out, E | InputInvalid>;
|
|
73
|
+
readonly steps: readonly StepRecord[];
|
|
74
|
+
readonly journal: LoopJournal;
|
|
75
|
+
/** Activities that ran rather than replayed from the journal. */
|
|
76
|
+
readonly activities: readonly string[];
|
|
77
|
+
readonly agentLaunches: readonly AgentLaunchRecord[];
|
|
78
|
+
/** Child Runs admitted, with their Input as JSON, in admission order. */
|
|
79
|
+
readonly childLaunches: readonly ChildLaunchRecord[];
|
|
80
|
+
};
|
|
81
|
+
type AgentLaunchRecord = {
|
|
82
|
+
readonly step: string;
|
|
83
|
+
readonly agent: string;
|
|
84
|
+
readonly prompt: string;
|
|
85
|
+
readonly secrets?: readonly string[];
|
|
86
|
+
};
|
|
87
|
+
type ChildLaunchRecord = {
|
|
88
|
+
readonly step: string;
|
|
89
|
+
readonly loop: string;
|
|
90
|
+
readonly input: Schema.Json;
|
|
91
|
+
};
|
|
92
|
+
/** The workflow a Loop's program runs as; a Run is one execution of it. */
|
|
93
|
+
export declare const loopWorkflow: <In, Out, E>(loop: LoopDefinition<In, Out, E>) => Workflow.Workflow<`kitman-loop/${string}`, Schema.Struct<{
|
|
94
|
+
input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
95
|
+
}>, import("./define").LoopSchema<Out>, Schema.declare<E | InputInvalid, E | InputInvalid>>;
|
|
96
|
+
export type LoopRuntime = {
|
|
97
|
+
readonly host: LoopHost['Service'];
|
|
98
|
+
readonly activities: HostActivities;
|
|
99
|
+
/** The declared capabilities the control plane granted. */
|
|
100
|
+
readonly granted: ReadonlySet<LoopCapability>;
|
|
101
|
+
readonly onRun?: (run: LoopRun['Service']) => void;
|
|
102
|
+
};
|
|
103
|
+
/** Decodes the Loop Input and runs the program with what Kitman lends it; the engine comes from the caller. */
|
|
104
|
+
export declare const executeLoop: <In, Out, E>(loop: LoopDefinition<In, Out, E>, runtime: LoopRuntime) => ({ input }: {
|
|
105
|
+
readonly input: Schema.Json;
|
|
106
|
+
}) => Effect.Effect<Out, E | InputInvalid, WorkflowEngine.WorkflowEngine | WorkflowEngine.WorkflowInstance>;
|
|
107
|
+
/**
|
|
108
|
+
* Runs a Loop on Effect's in-memory workflow engine with scripted Outputs, answers, child results and Events.
|
|
109
|
+
* Given a `journal`, it replays from it.
|
|
110
|
+
*/
|
|
111
|
+
export declare const testLoop: <In, Out, E>(loop: LoopDefinition<In, Out, E>, script: TestLoopScript) => Effect.Effect<TestLoopResult<Out, E>>;
|
|
112
|
+
export {};
|
package/README.md
DELETED