@kitman-sh/sdk 0.6.0 → 0.7.1

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.
@@ -43,7 +43,53 @@ export declare const WorkspaceList: Schema.Struct<{
43
43
  readonly updatedAt: Schema.String;
44
44
  }>>;
45
45
  }>;
46
+ /** What a Workspace has set up, each part read from the rows that exist; nothing about onboarding is stored. */
47
+ export declare const WorkspaceSetup: Schema.Struct<{
48
+ readonly codeHostConnected: Schema.Boolean;
49
+ /** The first repository bound in the Workspace; a first Research Run reads it. */
50
+ readonly firstRepoBinding: Schema.NullOr<Schema.Struct<{
51
+ readonly id: Schema.String;
52
+ readonly projectId: Schema.String;
53
+ readonly owner: Schema.String;
54
+ readonly name: Schema.String;
55
+ }>>;
56
+ readonly verificationsApproved: Schema.Boolean;
57
+ /** The caller's own Runner heartbeating now, the Harnesses it offers, and what each other Harness lacks. */
58
+ readonly machine: Schema.Struct<{
59
+ readonly ready: Schema.Boolean;
60
+ readonly harnesses: Schema.$Array<Schema.String>;
61
+ readonly missing: Schema.$Array<Schema.String>;
62
+ }>;
63
+ readonly teammatesInvited: Schema.Boolean;
64
+ readonly firstRun: Schema.Boolean;
65
+ /** The code hosts this deployment connects in one click. */
66
+ readonly oneClickConnect: Schema.Struct<{
67
+ readonly github: Schema.Boolean;
68
+ readonly gitlab: Schema.Boolean;
69
+ }>;
70
+ }>;
71
+ /** A minted Pairing Code and the one command that pairs a machine with it. */
72
+ export declare const PairingCode: Schema.Struct<{
73
+ readonly code: Schema.String;
74
+ readonly expiresAt: Schema.String;
75
+ readonly command: Schema.String;
76
+ }>;
77
+ export declare const PairingRedeem: Schema.Struct<{
78
+ readonly code: Schema.String;
79
+ }>;
80
+ /** The credentials `kitman login` stores, for the person and Workspace the code was minted for. */
81
+ export declare const PairingCredentials: Schema.Struct<{
82
+ readonly accessToken: Schema.String;
83
+ readonly refreshToken: Schema.optional<Schema.String>;
84
+ readonly expiresIn: Schema.optional<Schema.Finite>;
85
+ readonly workspaceId: Schema.String;
86
+ readonly userId: Schema.String;
87
+ }>;
46
88
  export type Workspace = (typeof Workspace)['Type'];
89
+ export type PairingCode = (typeof PairingCode)['Type'];
90
+ export type PairingRedeem = (typeof PairingRedeem)['Type'];
91
+ export type PairingCredentials = (typeof PairingCredentials)['Type'];
92
+ export type WorkspaceSetup = (typeof WorkspaceSetup)['Type'];
47
93
  export type WorkspaceNotificationPreferences = (typeof WorkspaceNotificationPreferences)['Type'];
48
94
  export type WorkspaceCreate = (typeof WorkspaceCreate)['Type'];
49
95
  export type WorkspaceUpdate = (typeof WorkspaceUpdate)['Type'];
@@ -2,7 +2,10 @@ import * as Effect from 'effect/Effect';
2
2
  import * as Layer from 'effect/Layer';
3
3
  import { RpcClient } from 'effect/rpc';
4
4
  import { type RunnerSignal } from './runner-group';
5
- export declare const runnerWebSocketProtocol: (url: string) => Layer.Layer<RpcClient.Protocol>;
5
+ /** The Runner RPC over a WebSocket; `proxy` is the HTTP proxy it connects through, as a sandbox's egress proxy. */
6
+ export declare const runnerWebSocketProtocol: (url: string, options?: {
7
+ readonly proxy?: string;
8
+ }) => Layer.Layer<RpcClient.Protocol>;
6
9
  export declare function runnerRpcUrl(apiUrl: string): string;
7
10
  /**
8
11
  * A Runner's control connection, open for the caller's scope. `bearer` mints the AgentCredential token sent with
@@ -50,6 +53,9 @@ export declare const makeRunnerRpcClient: (options: {
50
53
  readonly [x: string]: unknown;
51
54
  };
52
55
  };
56
+ readonly network?: "open" | {
57
+ readonly hosts: readonly string[];
58
+ };
53
59
  readonly program: {
54
60
  readonly loopId: string;
55
61
  readonly credential: string;
@@ -179,6 +185,9 @@ export declare const makeRunnerRpcClient: (options: {
179
185
  readonly [x: string]: unknown;
180
186
  };
181
187
  };
188
+ readonly network?: "open" | {
189
+ readonly hosts: readonly string[];
190
+ };
182
191
  readonly program: {
183
192
  readonly loopId: string;
184
193
  readonly credential: string;
@@ -106,23 +106,7 @@ export declare const ProgramOutcome: Schema.Union<readonly [Schema.Struct<{
106
106
  readonly status: Schema.Literal<"failed">;
107
107
  readonly failureSummary: Schema.String;
108
108
  }>]>;
109
- declare const RunnerRpcs_base: RpcGroup.RpcGroup<Rpc.Rpc<"Signals", Schema.Struct<{
110
- runnerReplicaId: Schema.String;
111
- }>, import("effect/rpc/RpcSchema").Stream<Schema.Union<readonly [Schema.TaggedStruct<"WorkAvailable", {}>, Schema.TaggedStruct<"LeaseRevoked", {
112
- readonly workUnitId: Schema.String;
113
- }>, Schema.TaggedStruct<"Settled", {
114
- readonly workUnitId: Schema.String;
115
- }>, Schema.TaggedStruct<"Canceled", {
116
- readonly workUnitId: Schema.String;
117
- }>, Schema.TaggedStruct<"RunSettled", {
118
- readonly runId: Schema.String;
119
- }>, Schema.TaggedStruct<"Steer", {
120
- readonly workUnitId: Schema.String;
121
- readonly messageId: Schema.String;
122
- readonly text: Schema.String;
123
- }>, Schema.TaggedStruct<"SessionUpdated", {
124
- readonly workUnitId: Schema.String;
125
- }>]>, typeof RunnerRpcError>, Schema.Never, typeof RunnerAuthentication, never> | Rpc.Rpc<"AdmitChild", Schema.Struct<{
109
+ declare const RunnerRpcs_base: RpcGroup.RpcGroup<Rpc.Rpc<"AdmitChild", Schema.Struct<{
126
110
  lease: Schema.Struct<{
127
111
  readonly workUnitId: Schema.String;
128
112
  readonly leaseOwnerId: Schema.String;
@@ -187,6 +171,9 @@ declare const RunnerRpcs_base: RpcGroup.RpcGroup<Rpc.Rpc<"Signals", Schema.Struc
187
171
  readonly activities: Schema.$Record<Schema.String, Schema.Unknown>;
188
172
  readonly deferreds: Schema.$Record<Schema.String, Schema.Unknown>;
189
173
  }>;
174
+ readonly network: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
175
+ readonly hosts: Schema.$Array<Schema.String>;
176
+ }>, Schema.Literal<"open">]>>;
190
177
  readonly program: Schema.Struct<{
191
178
  readonly loopId: Schema.String;
192
179
  readonly credential: Schema.String;
@@ -660,7 +647,23 @@ declare const RunnerRpcs_base: RpcGroup.RpcGroup<Rpc.Rpc<"Signals", Schema.Struc
660
647
  }>>;
661
648
  }>>, typeof RunnerRpcError, typeof RunnerAuthentication, never> | Rpc.Rpc<"SettledRuns", Schema.Struct<{
662
649
  runIds: Schema.$Array<Schema.String>;
663
- }>, Schema.$Array<Schema.String>, typeof RunnerRpcError, typeof RunnerAuthentication, never> | Rpc.Rpc<"StartAgentStep", Schema.Struct<{
650
+ }>, Schema.$Array<Schema.String>, typeof RunnerRpcError, typeof RunnerAuthentication, never> | Rpc.Rpc<"Signals", Schema.Struct<{
651
+ runnerReplicaId: Schema.String;
652
+ }>, import("effect/rpc/RpcSchema").Stream<Schema.Union<readonly [Schema.TaggedStruct<"WorkAvailable", {}>, Schema.TaggedStruct<"LeaseRevoked", {
653
+ readonly workUnitId: Schema.String;
654
+ }>, Schema.TaggedStruct<"Settled", {
655
+ readonly workUnitId: Schema.String;
656
+ }>, Schema.TaggedStruct<"Canceled", {
657
+ readonly workUnitId: Schema.String;
658
+ }>, Schema.TaggedStruct<"RunSettled", {
659
+ readonly runId: Schema.String;
660
+ }>, Schema.TaggedStruct<"Steer", {
661
+ readonly workUnitId: Schema.String;
662
+ readonly messageId: Schema.String;
663
+ readonly text: Schema.String;
664
+ }>, Schema.TaggedStruct<"SessionUpdated", {
665
+ readonly workUnitId: Schema.String;
666
+ }>]>, typeof RunnerRpcError>, Schema.Never, typeof RunnerAuthentication, never> | Rpc.Rpc<"StartAgentStep", Schema.Struct<{
664
667
  lease: Schema.Struct<{
665
668
  readonly workUnitId: Schema.String;
666
669
  readonly leaseOwnerId: Schema.String;
@@ -50,6 +50,13 @@ export type LoopDefinition<In, Out, E> = {
50
50
  readonly capabilities: readonly LoopCapability[];
51
51
  /** The Secrets the program reads with `Config.Redacted`, and `agentWork` may put into a Step's sandbox. */
52
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';
53
60
  readonly run: (input: In) => Effect.Effect<Out, E, LoopServices>;
54
61
  /** Scripts a build runs twice, the second time from the journal; not part of the manifest. */
55
62
  readonly checks?: readonly LoopCheck[];
@@ -5,6 +5,7 @@ import * as Option from 'effect/Option';
5
5
  import * as Schema from 'effect/Schema';
6
6
  import type { PackageConfig } from '../loop/config';
7
7
  import { ManifestInvalid } from '../loop/define';
8
+ import { type ProgramJournal } from './engine';
8
9
  /** Asks a bundle for its declarations and check results instead of running a program. */
9
10
  export declare const describeFlag = "--kitman-describe";
10
11
  export declare const Described: Schema.Union<readonly [Schema.TaggedStruct<"Described", {
@@ -28,6 +29,9 @@ export declare const Described: Schema.Union<readonly [Schema.TaggedStruct<"Desc
28
29
  }>>;
29
30
  readonly capabilities: Schema.$Array<Schema.Literals<readonly ["agent_work", "ask", "call", "verify", "change_request", "write_back", "post_comment", "create_tasks", "merge_change_request", "publish_release"]>>;
30
31
  readonly secrets: Schema.optionalKey<Schema.$Array<Schema.String>>;
32
+ readonly network: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
33
+ readonly hosts: Schema.$Array<Schema.String>;
34
+ }>, Schema.Literal<"open">]>>;
31
35
  }>>;
32
36
  readonly agents: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
33
37
  readonly schedules: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
@@ -43,6 +47,24 @@ type SecretsRpc = Pick<Effect.Success<ReturnType<typeof makeRunnerRpcClient>>, '
43
47
  export declare const programSecrets: (rpc: SecretsRpc, lease: ProgramLease) => Effect.Effect<Option.Option<never> | Option.Option<{
44
48
  readonly [x: string]: string;
45
49
  }>, Error | import("effect/rpc/RpcClientError").RpcClientError | import("../../../live/src/rpc/runner-group").RunnerRpcError, never>;
50
+ /** Kitman's API host and the Loop's declared hosts, comma-separated, as the Runner passes them; unset for `open`. */
51
+ export declare const programHostsEnv = "KITMAN_PROGRAM_HOSTS";
52
+ /** `fail` where the Runner sandboxes the program, `warn` where it runs on its owner's host. */
53
+ export declare const undeclaredHostsEnv = "KITMAN_UNDECLARED_HOSTS";
54
+ type Fetch = (resource: string | URL | Request, init?: RequestInit) => Promise<Response>;
55
+ /**
56
+ * `fetch` limited to `hosts`, redirect hops included. An undeclared host is refused, and fails the Run with its name
57
+ * whatever the program then reports; under `warn` it is let through, with one warning per host.
58
+ */
59
+ export declare const networkGuard: (input: {
60
+ readonly hosts: readonly string[];
61
+ readonly undeclared: 'fail' | 'warn';
62
+ readonly fetch: Fetch;
63
+ readonly warn: (line: string) => void;
64
+ }) => {
65
+ fetch: Fetch;
66
+ journal: <Journal extends Pick<ProgramJournal, 'suspend' | 'finish'>>(journal: Journal) => Journal;
67
+ };
46
68
  /** The entry of every Package bundle. */
47
69
  export declare const runPackage: (config: PackageConfig) => void;
48
70
  export {};