@kitman-sh/sdk 0.6.0 → 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.
@@ -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 {};