@kitman-sh/sdk 0.9.0 → 0.10.52
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/build/index.js +531 -116
- package/dist/{chunk-36jhc745.js → chunk-tcbgb4wm.js} +1841 -1574
- package/dist/{chunk-e1tqypyy.js → chunk-zvzw3zs4.js} +824 -419
- package/dist/loop/index.js +117 -3
- package/dist/program/index.js +8 -4
- package/package.json +6 -6
- package/types/packages/core/src/agent-capabilities.d.ts +6 -0
- package/types/packages/core/src/agent-environment.d.ts +32 -216
- package/types/packages/core/src/agent-sandbox-policy.d.ts +17 -3
- package/types/packages/core/src/change-request-review.d.ts +20 -5
- package/types/packages/core/src/change-request.d.ts +33 -208
- package/types/packages/core/src/crypto.d.ts +2 -0
- package/types/packages/core/src/index.d.ts +8 -4
- package/types/packages/core/src/{package-declarations.d.ts → kit-declarations.d.ts} +84 -180
- package/types/packages/core/src/kit-install.d.ts +130 -0
- package/types/packages/core/src/kit-setup.d.ts +316 -0
- package/types/packages/core/src/kit.d.ts +302 -1444
- package/types/packages/core/src/loop-layers.d.ts +33 -4
- package/types/packages/core/src/loop.d.ts +325 -55
- package/types/packages/core/src/marketplace.d.ts +51 -10
- package/types/packages/core/src/my-teams.d.ts +135 -20
- package/types/packages/core/src/network-host.d.ts +41 -0
- package/types/packages/core/src/notification.d.ts +8 -0
- package/types/packages/core/src/npm-registry.d.ts +65 -0
- package/types/packages/core/src/proposal.d.ts +0 -76
- package/types/packages/core/src/push.d.ts +68 -0
- package/types/packages/core/src/question-recommendation.d.ts +28 -0
- package/types/packages/core/src/redaction.d.ts +15 -3
- package/types/packages/core/src/resource-claim.d.ts +79 -0
- package/types/packages/core/src/run-display.d.ts +7 -1
- package/types/packages/core/src/run-graph.d.ts +1 -1
- package/types/packages/core/src/run-launch.d.ts +15 -2
- package/types/packages/core/src/run-queue.d.ts +28 -0
- package/types/packages/core/src/runner-eligibility.d.ts +21 -2
- package/types/packages/core/src/runner.d.ts +46 -15
- package/types/packages/core/src/secret.d.ts +18 -1
- package/types/packages/core/src/step-brief.d.ts +21 -7
- package/types/packages/core/src/sync-kit.d.ts +8 -0
- package/types/packages/core/src/task-detail.d.ts +15 -2
- package/types/packages/core/src/task.d.ts +9 -0
- package/types/packages/core/src/transcript.d.ts +24 -4
- package/types/packages/core/src/trust-panel.d.ts +1 -1
- package/types/packages/core/src/waiting-on.d.ts +14 -0
- package/types/packages/core/src/work-unit.d.ts +339 -8
- package/types/packages/live/src/rpc/runner-client.d.ts +505 -10
- package/types/packages/live/src/rpc/runner-group.d.ts +958 -28
- package/types/packages/sdk/src/build/index.d.ts +45 -9
- package/types/packages/sdk/src/loop/activities.d.ts +382 -2
- package/types/packages/sdk/src/loop/claims.d.ts +57 -0
- package/types/packages/sdk/src/loop/config.d.ts +38 -31
- package/types/packages/sdk/src/loop/continuing.d.ts +22 -0
- package/types/packages/sdk/src/loop/define.d.ts +30 -5
- package/types/packages/sdk/src/loop/evidence.d.ts +18 -3
- package/types/packages/sdk/src/loop/index.d.ts +4 -0
- package/types/packages/sdk/src/loop/measure.d.ts +132 -0
- package/types/packages/sdk/src/loop/plan.d.ts +2 -2
- package/types/packages/sdk/src/loop/steps.d.ts +127 -17
- package/types/packages/sdk/src/loop/sync.d.ts +53 -0
- package/types/packages/sdk/src/loop/test-loop.d.ts +25 -5
- package/types/packages/sdk/src/program/engine.d.ts +95 -3
- package/types/packages/sdk/src/program/host.d.ts +198 -36
- package/types/packages/core/src/engineering-resources.d.ts +0 -24
- package/types/packages/core/src/package.d.ts +0 -369
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ScheduleDeclaration } from '../../../core/src/kit-declarations';
|
|
2
|
+
import type { KitSetup } from '../../../core/src/kit-setup';
|
|
2
3
|
import type { LoopDefinition } from './define';
|
|
3
|
-
/** Agent instructions inline, or a Markdown file in the
|
|
4
|
+
/** Agent instructions inline, or a Markdown file in the Kit's repository, read at build. */
|
|
4
5
|
export type AgentInstructions = string | {
|
|
5
6
|
readonly file: string;
|
|
6
7
|
};
|
|
@@ -12,8 +13,19 @@ export type AgentConfig = {
|
|
|
12
13
|
readonly model?: string;
|
|
13
14
|
/** How hard its harness thinks; a harness without the control ignores it. */
|
|
14
15
|
readonly effort?: 'low' | 'medium' | 'high' | 'xhigh';
|
|
15
|
-
/**
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Harnesses to launch on, in order, when a Runner does not offer this one. A fallback with no effort uses this
|
|
18
|
+
* Agent's; one with no model uses the Harness's own, not this Agent's.
|
|
19
|
+
*/
|
|
20
|
+
readonly fallbacks?: readonly {
|
|
21
|
+
readonly harness: string;
|
|
22
|
+
readonly model?: string;
|
|
23
|
+
readonly effort?: 'low' | 'medium' | 'high' | 'xhigh';
|
|
24
|
+
}[];
|
|
25
|
+
/** Tools its Steps get beyond the base ones; a list replaces an inherited one and `[]` clears it. */
|
|
26
|
+
readonly tools?: readonly ('web' | 'subagents' | 'artifacts' | 'browser')[];
|
|
27
|
+
/** The skills its Steps list; the Run's other Kit skills are loaded by name. A list replaces, `[]` clears. */
|
|
28
|
+
readonly skills?: readonly string[];
|
|
17
29
|
/** Hosts its sandboxed Steps may reach beyond the defaults, or `open` for an Agent that browses. */
|
|
18
30
|
readonly network?: {
|
|
19
31
|
readonly hosts: readonly string[];
|
|
@@ -21,48 +33,43 @@ export type AgentConfig = {
|
|
|
21
33
|
/** Runs its Steps only on Runners that run agents in docker, for services or a team image. */
|
|
22
34
|
readonly sandbox?: 'docker';
|
|
23
35
|
};
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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[];
|
|
36
|
+
/**
|
|
37
|
+
* What the Kit's agents get. Each skill and plugin comes from a local path in the Kit, a git repository or an npm
|
|
38
|
+
* package, and `instructions` is a Markdown file in the Kit; the build copies them all in.
|
|
39
|
+
*/
|
|
40
|
+
export type KitSetupConfig = KitSetup;
|
|
41
|
+
export type KitLoop = LoopDefinition<unknown, unknown, unknown>;
|
|
42
|
+
/** A Kit's `kitman.config.ts` default export. */
|
|
43
|
+
export type KitConfig = {
|
|
44
|
+
readonly loops: readonly KitLoop[];
|
|
39
45
|
readonly agents?: {
|
|
40
46
|
readonly [id: string]: AgentConfig;
|
|
41
47
|
};
|
|
42
48
|
readonly schedules?: {
|
|
43
49
|
readonly [key: string]: ScheduleDeclaration;
|
|
44
50
|
};
|
|
45
|
-
readonly
|
|
46
|
-
|
|
47
|
-
};
|
|
51
|
+
readonly setup?: KitSetupConfig;
|
|
52
|
+
readonly extends?: readonly KitConfig[];
|
|
48
53
|
};
|
|
49
54
|
/** Each element a Loop, whatever its Input, Output and error types. */
|
|
50
55
|
type Loops<L extends readonly unknown[]> = {
|
|
51
56
|
readonly [K in keyof L]: L[K] extends LoopDefinition<infer In, infer Out, infer E> ? LoopDefinition<In, Out, E> : never;
|
|
52
57
|
};
|
|
53
|
-
/** Declares a
|
|
54
|
-
export declare const
|
|
55
|
-
readonly loops
|
|
58
|
+
/** Declares a Kit: its Loops, its Agents keyed by id, the setup its agents get, and the Kits it extends. */
|
|
59
|
+
export declare const defineKit: <const L extends readonly unknown[] = []>(config: {
|
|
60
|
+
readonly loops?: L & Loops<L>;
|
|
56
61
|
readonly agents?: {
|
|
57
62
|
readonly [id: string]: AgentConfig;
|
|
58
63
|
};
|
|
59
|
-
/** Recurring starts of a Loop, keyed; the
|
|
64
|
+
/** Recurring starts of a Loop, keyed; only the Kit a repository deploys may declare them. */
|
|
60
65
|
readonly schedules?: {
|
|
61
66
|
readonly [key: string]: ScheduleDeclaration;
|
|
62
67
|
};
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
readonly setup?: KitSetupConfig;
|
|
69
|
+
/**
|
|
70
|
+
* Imported Kits this one builds in, like Nuxt layers: this Kit's entries replace theirs by name, and an earlier
|
|
71
|
+
* entry's replace a later one's.
|
|
72
|
+
*/
|
|
73
|
+
readonly extends?: readonly KitConfig[];
|
|
74
|
+
}) => KitConfig;
|
|
68
75
|
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as Schema from 'effect/Schema';
|
|
2
|
+
/**
|
|
3
|
+
* What an earlier Run left on a Task: its open ChangeRequest and branch, which a new write Run on the Task continues.
|
|
4
|
+
* Kitman adds it to the Input of a Loop that declares `continuing: Schema.optional(Continuing)`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const Continuing: Schema.Struct<{
|
|
7
|
+
readonly changeRequestId: Schema.String;
|
|
8
|
+
/** The forge's number for the ChangeRequest. */
|
|
9
|
+
readonly number: Schema.String;
|
|
10
|
+
readonly url: Schema.String;
|
|
11
|
+
readonly branch: Schema.String;
|
|
12
|
+
/** The branch the ChangeRequest merges into. */
|
|
13
|
+
readonly targetBranch: Schema.String;
|
|
14
|
+
/** The branch head the earlier Run last pushed; the forge's may be newer if someone pushed since. */
|
|
15
|
+
readonly revision: Schema.optional<Schema.String>;
|
|
16
|
+
readonly lastRunId: Schema.optional<Schema.String>;
|
|
17
|
+
readonly lastRunStatus: Schema.optional<Schema.String>;
|
|
18
|
+
readonly lastRunSummary: Schema.optional<Schema.String>;
|
|
19
|
+
}>;
|
|
20
|
+
export type Continuing = typeof Continuing.Type;
|
|
21
|
+
/** Tells an agent what is already on the branch it starts from, and where to find what was left unsettled. */
|
|
22
|
+
export declare const continuingBrief: (continuing: Continuing) => string;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { LoopCapabilities, type LoopManifest } from '../../../core/src/
|
|
1
|
+
import { LoopCapabilities, type LoopManifest } from '../../../core/src/kit-declarations';
|
|
2
2
|
import type { ScheduleRule } from '../../../core/src/schedule';
|
|
3
3
|
import * as Effect from 'effect/Effect';
|
|
4
4
|
import * as Schema from 'effect/Schema';
|
|
5
5
|
import type { WorkflowEngine } from 'effect/workflow';
|
|
6
6
|
import type { LoopHost, LoopRun } from './steps';
|
|
7
7
|
import type { LoopCheck } from './test-loop';
|
|
8
|
-
import type { ArtifactActivity, ChangeRequestActivity, CommentActivity, CreateTasksActivity, FileActivity, IntegrationBranchActivity, MergeChangeRequestActivity, NoteActivity, ProjectActivityActivity, DraftUpdateActivity, ProposeActivity, ReleaseActivity, TranscriptsActivity, WriteBackActivity } from './activities';
|
|
8
|
+
import type { ArtifactActivity, ChangeRequestActivity, CommentActivity, AlertTaskActivity, CreateTasksActivity, FileActivity, IntegrationBranchActivity, MergeChangeRequestActivity, NoteActivity, ProjectActivityActivity, DraftUpdateActivity, ProposeActivity, ReleaseActivity, TranscriptsActivity, ChangeRequestReadActivity, WriteBackActivity } from './activities';
|
|
9
9
|
export { LoopCapabilities, type LoopManifest };
|
|
10
10
|
/** What a Loop's program may ask Kitman for; the control plane checks each request against them. */
|
|
11
11
|
export type LoopCapability = (typeof LoopCapabilities)[number];
|
|
12
|
-
export declare const LoopOutcome: Schema.Literals<readonly ["feature", "bug", "refactor", "investigation", "docs", "migration"]>;
|
|
12
|
+
export declare const LoopOutcome: Schema.Literals<readonly ["feature", "bug", "refactor", "investigation", "docs", "migration", "performance"]>;
|
|
13
13
|
export type LoopOutcome = typeof LoopOutcome.Type;
|
|
14
14
|
export type LoopCheckout = 'none' | 'read' | 'write';
|
|
15
15
|
type EventFilterValue = string | number | boolean | null;
|
|
@@ -17,27 +17,40 @@ type EventFilterValue = string | number | boolean | null;
|
|
|
17
17
|
export type EventFilter = {
|
|
18
18
|
readonly [path: string]: EventFilterValue | readonly EventFilterValue[];
|
|
19
19
|
};
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Starts a Run on a matching Event, binding Event payload paths into the Loop Input. `values` are Input fields every
|
|
22
|
+
* such Run gets, so the Kit that declares the Loop for a Team sets them for that Team.
|
|
23
|
+
*/
|
|
21
24
|
export type WhenClause = {
|
|
22
25
|
readonly event: string;
|
|
23
26
|
readonly filter?: EventFilter;
|
|
24
27
|
readonly input: {
|
|
25
28
|
readonly [inputField: string]: string;
|
|
26
29
|
};
|
|
30
|
+
readonly values?: {
|
|
31
|
+
readonly [inputField: string]: Schema.Json;
|
|
32
|
+
};
|
|
27
33
|
};
|
|
28
34
|
/** An action shown on a settled Run: start another Loop. */
|
|
35
|
+
/**
|
|
36
|
+
* A Loop the settled Run offers to start, with the Run's Input fields it declares. With `from`, the offer is built from
|
|
37
|
+
* the Output: it shows only when the Output has that field, an object whose fields are given to the offered Loop too.
|
|
38
|
+
*/
|
|
29
39
|
export type LoopOffer = {
|
|
30
40
|
readonly id: string;
|
|
31
41
|
readonly title: string;
|
|
32
42
|
readonly loop: string;
|
|
43
|
+
readonly from?: string;
|
|
33
44
|
};
|
|
34
45
|
/** The services a Loop's program runs with; a Runner or `testLoop` provides them. */
|
|
35
|
-
export type LoopServices = LoopRun | LoopHost | ChangeRequestActivity | WriteBackActivity | ArtifactActivity | FileActivity | NoteActivity | CommentActivity | CreateTasksActivity | IntegrationBranchActivity | MergeChangeRequestActivity | ReleaseActivity | TranscriptsActivity | ProposeActivity | ProjectActivityActivity | DraftUpdateActivity | WorkflowEngine.WorkflowEngine | WorkflowEngine.WorkflowInstance;
|
|
46
|
+
export type LoopServices = LoopRun | LoopHost | ChangeRequestActivity | WriteBackActivity | ArtifactActivity | FileActivity | NoteActivity | CommentActivity | CreateTasksActivity | AlertTaskActivity | IntegrationBranchActivity | MergeChangeRequestActivity | ReleaseActivity | TranscriptsActivity | ChangeRequestReadActivity | ProposeActivity | ProjectActivityActivity | DraftUpdateActivity | WorkflowEngine.WorkflowEngine | WorkflowEngine.WorkflowInstance;
|
|
36
47
|
/** A schema a Loop can decode and encode with no services. */
|
|
37
48
|
export type LoopSchema<T> = Schema.Codec<T, unknown>;
|
|
38
49
|
export type LoopDefinition<In, Out, E> = {
|
|
39
50
|
readonly id: string;
|
|
40
51
|
readonly title: string;
|
|
52
|
+
/** Semver, shown under the title: bump major for a changed input, output or behaviour people rely on. */
|
|
53
|
+
readonly version?: string;
|
|
41
54
|
readonly input: LoopSchema<In>;
|
|
42
55
|
readonly output: LoopSchema<Out>;
|
|
43
56
|
readonly outcome?: LoopOutcome;
|
|
@@ -49,6 +62,11 @@ export type LoopDefinition<In, Out, E> = {
|
|
|
49
62
|
readonly when?: readonly WhenClause[];
|
|
50
63
|
readonly offers?: readonly LoopOffer[];
|
|
51
64
|
readonly capabilities: readonly LoopCapability[];
|
|
65
|
+
/**
|
|
66
|
+
* The Loops it runs as Child Runs with `call`. A Child Run is granted no more than its parent, so the manifest
|
|
67
|
+
* declares their capabilities, and `call`, besides the Loop's own.
|
|
68
|
+
*/
|
|
69
|
+
readonly calls?: () => readonly CalledLoop[];
|
|
52
70
|
/** The Secrets the program reads with `Config.Redacted`, and `agentWork` may put into a Step's sandbox. */
|
|
53
71
|
readonly secrets?: readonly string[];
|
|
54
72
|
/**
|
|
@@ -67,6 +85,13 @@ export type LoopDefinition<In, Out, E> = {
|
|
|
67
85
|
/** Scripts a build runs twice, the second time from the journal; not part of the manifest. */
|
|
68
86
|
readonly checks?: readonly LoopCheck[];
|
|
69
87
|
};
|
|
88
|
+
/** What a parent needs of a Loop it calls. A function, so Loops that call each other can name each other. */
|
|
89
|
+
export type CalledLoop = {
|
|
90
|
+
readonly capabilities: readonly LoopCapability[];
|
|
91
|
+
readonly calls?: () => readonly CalledLoop[];
|
|
92
|
+
};
|
|
93
|
+
/** A Loop's own capabilities, and those of every Loop it calls, however deep. */
|
|
94
|
+
export declare const capabilitiesOf: (loop: CalledLoop) => readonly LoopCapability[];
|
|
70
95
|
/** A Loop module's default export. The definition keeps its shape, so a fork spreads it. */
|
|
71
96
|
export declare const defineLoop: <In, Out, E>(definition: LoopDefinition<In, Out, E>) => LoopDefinition<In, Out, E>;
|
|
72
97
|
declare const ManifestInvalid_base: Schema.Class<ManifestInvalid, Schema.TaggedStruct<"ManifestInvalid", {
|
|
@@ -1,31 +1,42 @@
|
|
|
1
1
|
import * as Schema from 'effect/Schema';
|
|
2
2
|
import type { LoopOutcome } from './define';
|
|
3
|
+
import type { Measurement } from './measure';
|
|
3
4
|
import type { ScopeJudgement } from './review';
|
|
4
5
|
/** One approved verification's result at a tree, as a Runner recorded it. */
|
|
5
6
|
export declare const EvidenceCheck: Schema.Struct<{
|
|
6
7
|
readonly name: Schema.String;
|
|
7
8
|
readonly command: Schema.String;
|
|
8
9
|
readonly status: Schema.Literals<readonly ["passed", "failed"]>;
|
|
9
|
-
/** It also fails on the
|
|
10
|
+
/** It also fails on the head of the baseline, so the Run did not cause it. */
|
|
10
11
|
readonly preExisting: Schema.Boolean;
|
|
11
12
|
readonly durationMs: Schema.Finite;
|
|
12
13
|
readonly evidenceId: Schema.String;
|
|
14
|
+
/** The end of what a failed check printed. */
|
|
15
|
+
readonly outputTail: Schema.optionalKey<Schema.String>;
|
|
16
|
+
/** An agent suggested it because the repository has none approved; a person should check it. */
|
|
17
|
+
readonly suggested: Schema.optionalKey<Schema.Boolean>;
|
|
13
18
|
}>;
|
|
14
19
|
export type EvidenceCheck = typeof EvidenceCheck.Type;
|
|
15
20
|
/** Evidence for a revision; `tree` is its git tree id, and the evidence holds for any revision with that tree. */
|
|
16
21
|
export declare const VerifyResult: Schema.Struct<{
|
|
17
22
|
readonly revision: Schema.String;
|
|
18
23
|
readonly tree: Schema.String;
|
|
19
|
-
/** Every check passed or already failed on the
|
|
24
|
+
/** Every check passed or already failed on the baseline. */
|
|
20
25
|
readonly passed: Schema.Boolean;
|
|
26
|
+
/** The tree is the baseline's, so no baseline ran: a failure here is the baseline's, though not `preExisting`. */
|
|
27
|
+
readonly unchanged: Schema.optionalKey<Schema.Boolean>;
|
|
21
28
|
readonly checks: Schema.$Array<Schema.Struct<{
|
|
22
29
|
readonly name: Schema.String;
|
|
23
30
|
readonly command: Schema.String;
|
|
24
31
|
readonly status: Schema.Literals<readonly ["passed", "failed"]>;
|
|
25
|
-
/** It also fails on the
|
|
32
|
+
/** It also fails on the head of the baseline, so the Run did not cause it. */
|
|
26
33
|
readonly preExisting: Schema.Boolean;
|
|
27
34
|
readonly durationMs: Schema.Finite;
|
|
28
35
|
readonly evidenceId: Schema.String;
|
|
36
|
+
/** The end of what a failed check printed. */
|
|
37
|
+
readonly outputTail: Schema.optionalKey<Schema.String>;
|
|
38
|
+
/** An agent suggested it because the repository has none approved; a person should check it. */
|
|
39
|
+
readonly suggested: Schema.optionalKey<Schema.Boolean>;
|
|
29
40
|
}>>;
|
|
30
41
|
}>;
|
|
31
42
|
export type VerifyResult = typeof VerifyResult.Type;
|
|
@@ -37,6 +48,7 @@ export declare const OutcomeTable: {
|
|
|
37
48
|
readonly investigation: 'A conclusion Output with its sources; no patch needed';
|
|
38
49
|
readonly docs: 'The documented commands run';
|
|
39
50
|
readonly migration: 'A rollback check passes';
|
|
51
|
+
readonly performance: 'A kept final measurement against the merge base shows a gain, and approved verifications pass on the head';
|
|
40
52
|
readonly none: 'Only the approved verifications';
|
|
41
53
|
};
|
|
42
54
|
export type EvidenceGateInput = {
|
|
@@ -55,6 +67,8 @@ export type EvidenceGateInput = {
|
|
|
55
67
|
readonly documented?: readonly string[];
|
|
56
68
|
/** The check that rolls a migration back. */
|
|
57
69
|
readonly rollback?: string;
|
|
70
|
+
/** The final measurement of the head against its merge base, which the Run kept. */
|
|
71
|
+
readonly measurement?: Measurement;
|
|
58
72
|
};
|
|
59
73
|
export type EvidenceVerdict = {
|
|
60
74
|
readonly settled: true;
|
|
@@ -62,5 +76,6 @@ export type EvidenceVerdict = {
|
|
|
62
76
|
readonly settled: false;
|
|
63
77
|
readonly reasons: readonly string[];
|
|
64
78
|
};
|
|
79
|
+
export declare const failsOn: (side: 'base' | 'head', name: string, tree: string | undefined) => string;
|
|
65
80
|
/** Whether the Run's evidence closes its Outcome, per `OutcomeTable`; claims in Outputs never count. */
|
|
66
81
|
export declare const evidenceGate: (input: EvidenceGateInput) => EvidenceVerdict;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { MeasureEvidence, MeasurePlan } from '../../../core/src/work-unit';
|
|
2
|
+
import * as Effect from 'effect/Effect';
|
|
3
|
+
import * as Schema from 'effect/Schema';
|
|
4
|
+
import { DurableDeferred } from 'effect/workflow';
|
|
5
|
+
import { LoopRun, StepFailed } from './steps';
|
|
6
|
+
export { MeasurePlan };
|
|
7
|
+
export declare const MetricStats: Schema.Struct<{
|
|
8
|
+
readonly samples: Schema.Finite;
|
|
9
|
+
readonly median: Schema.Finite;
|
|
10
|
+
readonly mean: Schema.Finite;
|
|
11
|
+
readonly min: Schema.Finite;
|
|
12
|
+
readonly max: Schema.Finite;
|
|
13
|
+
readonly stdev: Schema.Finite;
|
|
14
|
+
}>;
|
|
15
|
+
export type MetricStats = typeof MetricStats.Type;
|
|
16
|
+
export declare const MeasureVerdict: Schema.Literals<readonly ["gain", "no_gain", "guardrail_regressed", "too_noisy"]>;
|
|
17
|
+
export type MeasureVerdict = typeof MeasureVerdict.Type;
|
|
18
|
+
/**
|
|
19
|
+
* What the host measured, and its verdict. `change` is the head's improvement over the base as a fraction of the
|
|
20
|
+
* base's median, positive when better in the metric's direction; `noise` is the base measured against itself.
|
|
21
|
+
*/
|
|
22
|
+
export declare const Measurement: Schema.Struct<{
|
|
23
|
+
readonly verdict: Schema.Literals<readonly ["gain", "no_gain", "guardrail_regressed", "too_noisy"]>;
|
|
24
|
+
/** Why the verdict, in a line a ChangeRequest body can carry. */
|
|
25
|
+
readonly reason: Schema.String;
|
|
26
|
+
readonly metrics: Schema.$Array<Schema.Struct<{
|
|
27
|
+
readonly name: Schema.String;
|
|
28
|
+
readonly role: Schema.Literals<readonly ["primary", "guardrail"]>;
|
|
29
|
+
readonly direction: Schema.Literals<readonly ["lower", "higher"]>;
|
|
30
|
+
readonly base: Schema.Struct<{
|
|
31
|
+
readonly samples: Schema.Finite;
|
|
32
|
+
readonly median: Schema.Finite;
|
|
33
|
+
readonly mean: Schema.Finite;
|
|
34
|
+
readonly min: Schema.Finite;
|
|
35
|
+
readonly max: Schema.Finite;
|
|
36
|
+
readonly stdev: Schema.Finite;
|
|
37
|
+
}>;
|
|
38
|
+
readonly head: Schema.Struct<{
|
|
39
|
+
readonly samples: Schema.Finite;
|
|
40
|
+
readonly median: Schema.Finite;
|
|
41
|
+
readonly mean: Schema.Finite;
|
|
42
|
+
readonly min: Schema.Finite;
|
|
43
|
+
readonly max: Schema.Finite;
|
|
44
|
+
readonly stdev: Schema.Finite;
|
|
45
|
+
}>;
|
|
46
|
+
readonly change: Schema.Finite;
|
|
47
|
+
readonly noise: Schema.Finite;
|
|
48
|
+
}>>;
|
|
49
|
+
/** On `too_noisy`, what to judge on instead. */
|
|
50
|
+
readonly suggestion: Schema.optional<Schema.String>;
|
|
51
|
+
readonly evidence: Schema.Struct<{
|
|
52
|
+
readonly base: Schema.$Array<Schema.$Record<Schema.String, Schema.Finite>>;
|
|
53
|
+
readonly head: Schema.$Array<Schema.$Record<Schema.String, Schema.Finite>>;
|
|
54
|
+
readonly baseAgain: Schema.optionalKey<Schema.$Array<Schema.$Record<Schema.String, Schema.Finite>>>;
|
|
55
|
+
}>;
|
|
56
|
+
}>;
|
|
57
|
+
export type Measurement = typeof Measurement.Type;
|
|
58
|
+
/** The noise floor by metric, from the Run's first measurement. */
|
|
59
|
+
export type NoiseFloor = {
|
|
60
|
+
readonly [metric: string]: number;
|
|
61
|
+
};
|
|
62
|
+
export declare const measureDeferred: (step: string) => DurableDeferred.DurableDeferred<Schema.Struct<{
|
|
63
|
+
readonly base: Schema.$Array<Schema.$Record<Schema.String, Schema.Finite>>;
|
|
64
|
+
readonly head: Schema.$Array<Schema.$Record<Schema.String, Schema.Finite>>;
|
|
65
|
+
readonly baseAgain: Schema.optionalKey<Schema.$Array<Schema.$Record<Schema.String, Schema.Finite>>>;
|
|
66
|
+
}>, typeof StepFailed>;
|
|
67
|
+
/**
|
|
68
|
+
* The noise floor of each metric: how far the base strays from itself, as the larger of its spread and the gap
|
|
69
|
+
* between its two medians.
|
|
70
|
+
*/
|
|
71
|
+
export declare const noiseFloor: (plan: MeasurePlan, evidence: MeasureEvidence) => NoiseFloor;
|
|
72
|
+
/**
|
|
73
|
+
* Judges a measurement: `too_noisy` when the primary metric's noise floor exceeds `threshold`; else
|
|
74
|
+
* `guardrail_regressed` when a guardrail got worse by more than `tolerance` beyond its noise, whatever the primary
|
|
75
|
+
* did; else `gain` when the primary improved by more than `threshold` beyond its noise; else `no_gain`.
|
|
76
|
+
*/
|
|
77
|
+
export declare const judgeMeasurement: (plan: MeasurePlan, evidence: MeasureEvidence, noise: NoiseFloor, limits: {
|
|
78
|
+
readonly threshold: number;
|
|
79
|
+
readonly tolerance: number;
|
|
80
|
+
}) => Measurement;
|
|
81
|
+
/**
|
|
82
|
+
* Benchmarks `head` (the Run's head when left out) against `base` (its base branch's head when left out) on a Runner,
|
|
83
|
+
* with no agent: `samples` of each, interleaved, after the plan's warmup. The Run's first measurement also measures
|
|
84
|
+
* the base against itself, and every verdict allows for that noise floor. `threshold` is the smallest gain that
|
|
85
|
+
* counts and `tolerance` how much worse a guardrail may get, both fractions of the base.
|
|
86
|
+
*/
|
|
87
|
+
export declare const measure: (name: string, request: {
|
|
88
|
+
readonly plan: MeasurePlan;
|
|
89
|
+
readonly base?: string;
|
|
90
|
+
readonly head?: string;
|
|
91
|
+
readonly samples?: number;
|
|
92
|
+
readonly threshold?: number;
|
|
93
|
+
readonly tolerance?: number;
|
|
94
|
+
}) => Effect.Effect<{
|
|
95
|
+
readonly verdict: "gain" | "guardrail_regressed" | "no_gain" | "too_noisy";
|
|
96
|
+
readonly reason: string;
|
|
97
|
+
readonly metrics: readonly {
|
|
98
|
+
readonly name: string;
|
|
99
|
+
readonly role: "guardrail" | "primary";
|
|
100
|
+
readonly direction: "higher" | "lower";
|
|
101
|
+
readonly base: {
|
|
102
|
+
readonly samples: number;
|
|
103
|
+
readonly median: number;
|
|
104
|
+
readonly mean: number;
|
|
105
|
+
readonly min: number;
|
|
106
|
+
readonly max: number;
|
|
107
|
+
readonly stdev: number;
|
|
108
|
+
};
|
|
109
|
+
readonly head: {
|
|
110
|
+
readonly samples: number;
|
|
111
|
+
readonly median: number;
|
|
112
|
+
readonly mean: number;
|
|
113
|
+
readonly min: number;
|
|
114
|
+
readonly max: number;
|
|
115
|
+
readonly stdev: number;
|
|
116
|
+
};
|
|
117
|
+
readonly change: number;
|
|
118
|
+
readonly noise: number;
|
|
119
|
+
}[];
|
|
120
|
+
readonly suggestion?: string | undefined;
|
|
121
|
+
readonly evidence: {
|
|
122
|
+
readonly base: readonly {
|
|
123
|
+
readonly [x: string]: number;
|
|
124
|
+
}[];
|
|
125
|
+
readonly head: readonly {
|
|
126
|
+
readonly [x: string]: number;
|
|
127
|
+
}[];
|
|
128
|
+
readonly baseAgain?: readonly {
|
|
129
|
+
readonly [x: string]: number;
|
|
130
|
+
}[];
|
|
131
|
+
};
|
|
132
|
+
}, import("./steps").CapabilityDenied | import("./steps").DuplicateStep | StepFailed, import("./steps").LoopHost | LoopRun | import("effect/workflow/WorkflowEngine").WorkflowEngine | import("effect/workflow/WorkflowEngine").WorkflowInstance>;
|
|
@@ -12,7 +12,7 @@ export declare const PlanTicket: Schema.Struct<{
|
|
|
12
12
|
/** Keys of the tickets that must be built first. */
|
|
13
13
|
readonly blockedBy: Schema.$Array<Schema.String>;
|
|
14
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"]>>;
|
|
15
|
+
readonly outcome: Schema.optional<Schema.Literals<readonly ["feature", "bug", "refactor", "investigation", "docs", "migration", "performance"]>>;
|
|
16
16
|
}>;
|
|
17
17
|
export type PlanTicket = typeof PlanTicket.Type;
|
|
18
18
|
/** A plan's tickets; a blocker must name another ticket, and no tickets may block each other in a cycle. */
|
|
@@ -27,7 +27,7 @@ export declare const PlanTickets: Schema.$Array<Schema.Struct<{
|
|
|
27
27
|
/** Keys of the tickets that must be built first. */
|
|
28
28
|
readonly blockedBy: Schema.$Array<Schema.String>;
|
|
29
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"]>>;
|
|
30
|
+
readonly outcome: Schema.optional<Schema.Literals<readonly ["feature", "bug", "refactor", "investigation", "docs", "migration", "performance"]>>;
|
|
31
31
|
}>>;
|
|
32
32
|
declare const BlockingCycle_base: Schema.Class<BlockingCycle, Schema.TaggedStruct<"BlockingCycle", {
|
|
33
33
|
readonly tickets: Schema.$Array<Schema.String>;
|