@kitman-sh/sdk 0.9.0 → 0.10.53

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 (63) hide show
  1. package/dist/build/index.js +531 -116
  2. package/dist/{chunk-36jhc745.js → chunk-tcbgb4wm.js} +1841 -1574
  3. package/dist/{chunk-e1tqypyy.js → chunk-zvzw3zs4.js} +824 -419
  4. package/dist/loop/index.js +117 -3
  5. package/dist/program/index.js +8 -4
  6. package/package.json +6 -6
  7. package/types/packages/core/src/agent-capabilities.d.ts +6 -0
  8. package/types/packages/core/src/agent-environment.d.ts +32 -216
  9. package/types/packages/core/src/agent-sandbox-policy.d.ts +17 -3
  10. package/types/packages/core/src/change-request-review.d.ts +20 -5
  11. package/types/packages/core/src/change-request.d.ts +33 -208
  12. package/types/packages/core/src/crypto.d.ts +2 -0
  13. package/types/packages/core/src/index.d.ts +8 -4
  14. package/types/packages/core/src/{package-declarations.d.ts → kit-declarations.d.ts} +84 -180
  15. package/types/packages/core/src/kit-install.d.ts +130 -0
  16. package/types/packages/core/src/kit-setup.d.ts +316 -0
  17. package/types/packages/core/src/kit.d.ts +302 -1444
  18. package/types/packages/core/src/loop-layers.d.ts +33 -4
  19. package/types/packages/core/src/loop.d.ts +325 -55
  20. package/types/packages/core/src/marketplace.d.ts +51 -10
  21. package/types/packages/core/src/my-teams.d.ts +135 -20
  22. package/types/packages/core/src/network-host.d.ts +41 -0
  23. package/types/packages/core/src/notification.d.ts +8 -0
  24. package/types/packages/core/src/npm-registry.d.ts +65 -0
  25. package/types/packages/core/src/proposal.d.ts +0 -76
  26. package/types/packages/core/src/push.d.ts +68 -0
  27. package/types/packages/core/src/question-recommendation.d.ts +28 -0
  28. package/types/packages/core/src/redaction.d.ts +15 -3
  29. package/types/packages/core/src/resource-claim.d.ts +79 -0
  30. package/types/packages/core/src/run-display.d.ts +7 -1
  31. package/types/packages/core/src/run-graph.d.ts +1 -1
  32. package/types/packages/core/src/run-launch.d.ts +15 -2
  33. package/types/packages/core/src/run-queue.d.ts +28 -0
  34. package/types/packages/core/src/runner-eligibility.d.ts +21 -2
  35. package/types/packages/core/src/runner.d.ts +46 -15
  36. package/types/packages/core/src/secret.d.ts +18 -1
  37. package/types/packages/core/src/step-brief.d.ts +21 -7
  38. package/types/packages/core/src/sync-kit.d.ts +8 -0
  39. package/types/packages/core/src/task-detail.d.ts +15 -2
  40. package/types/packages/core/src/task.d.ts +9 -0
  41. package/types/packages/core/src/transcript.d.ts +24 -4
  42. package/types/packages/core/src/trust-panel.d.ts +1 -1
  43. package/types/packages/core/src/waiting-on.d.ts +14 -0
  44. package/types/packages/core/src/work-unit.d.ts +339 -8
  45. package/types/packages/live/src/rpc/runner-client.d.ts +505 -10
  46. package/types/packages/live/src/rpc/runner-group.d.ts +958 -28
  47. package/types/packages/sdk/src/build/index.d.ts +45 -9
  48. package/types/packages/sdk/src/loop/activities.d.ts +382 -2
  49. package/types/packages/sdk/src/loop/claims.d.ts +57 -0
  50. package/types/packages/sdk/src/loop/config.d.ts +38 -31
  51. package/types/packages/sdk/src/loop/continuing.d.ts +22 -0
  52. package/types/packages/sdk/src/loop/define.d.ts +30 -5
  53. package/types/packages/sdk/src/loop/evidence.d.ts +18 -3
  54. package/types/packages/sdk/src/loop/index.d.ts +4 -0
  55. package/types/packages/sdk/src/loop/measure.d.ts +132 -0
  56. package/types/packages/sdk/src/loop/plan.d.ts +2 -2
  57. package/types/packages/sdk/src/loop/steps.d.ts +127 -17
  58. package/types/packages/sdk/src/loop/sync.d.ts +53 -0
  59. package/types/packages/sdk/src/loop/test-loop.d.ts +25 -5
  60. package/types/packages/sdk/src/program/engine.d.ts +95 -3
  61. package/types/packages/sdk/src/program/host.d.ts +198 -36
  62. package/types/packages/core/src/engineering-resources.d.ts +0 -24
  63. package/types/packages/core/src/package.d.ts +0 -369
@@ -18,6 +18,8 @@ export declare const NotificationPayload: Schema.Struct<{
18
18
  readonly changeRequestUrl: Schema.optionalKey<Schema.String>;
19
19
  /** What a Run needs that Kitman could not choose, such as its Loop or repository. */
20
20
  readonly missing: Schema.optionalKey<Schema.$Array<Schema.String>>;
21
+ /** The ChangeRequests a person can choose between for a missing `changeRequestId`, as links. */
22
+ readonly choices: Schema.optionalKey<Schema.$Array<Schema.String>>;
21
23
  readonly projectId: Schema.optionalKey<Schema.String>;
22
24
  readonly projectName: Schema.optionalKey<Schema.String>;
23
25
  /** What a drafted Project Update was written from, since the Update before it. */
@@ -63,6 +65,8 @@ export declare const Notification: Schema.Struct<{
63
65
  readonly changeRequestUrl: Schema.optionalKey<Schema.String>;
64
66
  /** What a Run needs that Kitman could not choose, such as its Loop or repository. */
65
67
  readonly missing: Schema.optionalKey<Schema.$Array<Schema.String>>;
68
+ /** The ChangeRequests a person can choose between for a missing `changeRequestId`, as links. */
69
+ readonly choices: Schema.optionalKey<Schema.$Array<Schema.String>>;
66
70
  readonly projectId: Schema.optionalKey<Schema.String>;
67
71
  readonly projectName: Schema.optionalKey<Schema.String>;
68
72
  /** What a drafted Project Update was written from, since the Update before it. */
@@ -125,6 +129,8 @@ export declare const InboxItem: Schema.Struct<{
125
129
  readonly changeRequestUrl: Schema.optionalKey<Schema.String>;
126
130
  /** What a Run needs that Kitman could not choose, such as its Loop or repository. */
127
131
  readonly missing: Schema.optionalKey<Schema.$Array<Schema.String>>;
132
+ /** The ChangeRequests a person can choose between for a missing `changeRequestId`, as links. */
133
+ readonly choices: Schema.optionalKey<Schema.$Array<Schema.String>>;
128
134
  readonly projectId: Schema.optionalKey<Schema.String>;
129
135
  readonly projectName: Schema.optionalKey<Schema.String>;
130
136
  /** What a drafted Project Update was written from, since the Update before it. */
@@ -185,6 +191,8 @@ export declare const InboxList: Schema.Struct<{
185
191
  readonly changeRequestUrl: Schema.optionalKey<Schema.String>;
186
192
  /** What a Run needs that Kitman could not choose, such as its Loop or repository. */
187
193
  readonly missing: Schema.optionalKey<Schema.$Array<Schema.String>>;
194
+ /** The ChangeRequests a person can choose between for a missing `changeRequestId`, as links. */
195
+ readonly choices: Schema.optionalKey<Schema.$Array<Schema.String>>;
188
196
  readonly projectId: Schema.optionalKey<Schema.String>;
189
197
  readonly projectName: Schema.optionalKey<Schema.String>;
190
198
  /** What a drafted Project Update was written from, since the Update before it. */
@@ -0,0 +1,65 @@
1
+ import * as Config from 'effect/Config';
2
+ import * as Context from 'effect/Context';
3
+ import * as Effect from 'effect/Effect';
4
+ import * as Schema from 'effect/Schema';
5
+ /** The `kitman` field `kitman kit build` writes into a Kit's `package.json`: its built files, by path in the package. */
6
+ export declare const KitManifest: Schema.Struct<{
7
+ readonly bundle: Schema.String;
8
+ readonly digest: Schema.String;
9
+ readonly protocolVersion: Schema.Int;
10
+ readonly declarations: Schema.String;
11
+ readonly setup: Schema.$Record<Schema.String, Schema.String>;
12
+ }>;
13
+ export type KitManifest = typeof KitManifest.Type;
14
+ /** A Kit as one npm version publishes it, its tarball checked against npm's integrity. */
15
+ export type PublishedKit = {
16
+ readonly name: string;
17
+ readonly version: string;
18
+ readonly integrity: string;
19
+ readonly bundle: Uint8Array;
20
+ readonly digest: string;
21
+ readonly protocolVersion: number;
22
+ readonly declarations: unknown;
23
+ readonly setupArchives: readonly {
24
+ readonly digest: string;
25
+ readonly archive: Uint8Array;
26
+ }[];
27
+ };
28
+ declare const NpmRegistryError_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]; }>) => import("effect/Cause").YieldableError & {
29
+ readonly _tag: "NpmRegistryError";
30
+ } & Readonly<A>;
31
+ /** `unreachable` may succeed when tried again; the others name a version that never will. */
32
+ export declare class NpmRegistryError extends NpmRegistryError_base<{
33
+ readonly kind: 'unreachable' | 'not_found' | 'integrity' | 'not_a_kit';
34
+ readonly message: string;
35
+ }> {
36
+ }
37
+ type NpmRegistryService = {
38
+ /** The version npm's `latest` dist-tag names. */
39
+ readonly latest: (name: string) => Effect.Effect<string, NpmRegistryError>;
40
+ /** The built Kit `version` (a version or dist-tag) of `name` carries. */
41
+ readonly kit: (name: string, version: string) => Effect.Effect<PublishedKit, NpmRegistryError>;
42
+ };
43
+ declare const Dist: Schema.Struct<{
44
+ readonly tarball: Schema.String;
45
+ readonly integrity: Schema.optionalKey<Schema.String>;
46
+ readonly shasum: Schema.optionalKey<Schema.String>;
47
+ }>;
48
+ /** An npm package's metadata; old versions may carry only a `shasum`. */
49
+ export declare const Packument: Schema.Struct<{
50
+ readonly 'dist-tags': Schema.$Record<Schema.String, Schema.String>;
51
+ readonly versions: Schema.$Record<Schema.String, Schema.Struct<{
52
+ readonly dist: Schema.Struct<{
53
+ readonly tarball: Schema.String;
54
+ readonly integrity: Schema.optionalKey<Schema.String>;
55
+ readonly shasum: Schema.optionalKey<Schema.String>;
56
+ }>;
57
+ }>>;
58
+ }>;
59
+ /** Whether `tarball` matches its `dist`: the strongest algorithm its integrity names, else its sha1 `shasum`. */
60
+ export declare const tarballMatches: (tarball: Uint8Array, dist: typeof Dist.Type) => boolean;
61
+ /** The registry at `url`, or at `NPM_CONFIG_REGISTRY` read on each call. */
62
+ export declare const npmRegistryAt: (url?: string | Config.Config<string>) => NpmRegistryService;
63
+ /** npm, as Kitman reads Kits and latest versions from it; tests point it at a local fake. */
64
+ export declare const NpmRegistry: Context.Reference<NpmRegistryService>;
65
+ export {};
@@ -1,7 +1,6 @@
1
1
  import * as Schema from 'effect/Schema';
2
2
  export declare const ProposalStatuses: readonly ['proposed', 'in_review', 'approved', 'rejected', 'applied', 'reverted', 'superseded', 'canceled'];
3
3
  export declare const KitMarketplaceProposalTargetTypes: readonly ['kit_source', 'kit_version', 'kit_installation', 'kit_activation', 'kit_trust_policy'];
4
- export declare const KitMarketplaceProposalActions: readonly ['source_publish', 'version_publish', 'source_update', 'trust_change', 'visibility_change', 'broad_activation', 'risky_agent_environment_effect', 'rollback'];
5
4
  export declare const ProposalTargetTypes: readonly ["memory", "kit", "agent_environment_policy", "decision", "task", "team_context", "context_relevance", "kit_source", "kit_version", "kit_installation", "kit_activation", "kit_trust_policy"];
6
5
  export declare const ProposalRiskLevels: readonly ['low', 'medium', 'high'];
7
6
  export declare const ProposalApprovalPolicyModes: readonly ['auto_approve_low_risk', 'require_other_team_member', 'require_workspace_owner_or_admin'];
@@ -76,71 +75,6 @@ export declare const ProposalRiskSummary: Schema.Struct<{
76
75
  readonly summary: Schema.String;
77
76
  readonly reasons: Schema.$Array<Schema.String>;
78
77
  }>;
79
- export declare const KitMarketplaceProposalReview: Schema.Struct<{
80
- readonly action: Schema.Literals<readonly ["source_publish", "version_publish", "source_update", "trust_change", "visibility_change", "broad_activation", "risky_agent_environment_effect", "rollback"]>;
81
- readonly target: Schema.Struct<{
82
- readonly type: Schema.Literals<readonly ["memory", "kit", "agent_environment_policy", "decision", "task", "team_context", "context_relevance", "kit_source", "kit_version", "kit_installation", "kit_activation", "kit_trust_policy"]>;
83
- readonly id: Schema.optionalKey<Schema.String>;
84
- readonly scopeType: Schema.optionalKey<Schema.Union<readonly [Schema.Literal<"workspace">, Schema.Literal<"team">, Schema.Literal<"task">, Schema.Literal<"kit">]>>;
85
- readonly scopeId: Schema.optionalKey<Schema.String>;
86
- }>;
87
- readonly payload: Schema.Struct<{
88
- readonly memory: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>>]>>>;
89
- readonly kit: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>>]>>>;
90
- readonly kit_source: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>>]>>>;
91
- readonly kit_version: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>>]>>>;
92
- readonly kit_installation: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>>]>>>;
93
- readonly kit_activation: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>>]>>>;
94
- readonly kit_trust_policy: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>>]>>>;
95
- readonly agent_environment_policy: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>>]>>>;
96
- readonly decision: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>>]>>>;
97
- readonly task: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>>]>>>;
98
- readonly team_context: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>>]>>>;
99
- readonly context_relevance: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>>]>>>;
100
- }>;
101
- readonly renderedDiff: Schema.Struct<{
102
- readonly format: Schema.Literals<readonly ["summary", "field_diff", "markdown"]>;
103
- readonly title: Schema.String;
104
- readonly summary: Schema.String;
105
- readonly sections: Schema.$Array<Schema.Struct<{
106
- readonly title: Schema.String;
107
- readonly beforeSummary: Schema.optionalKey<Schema.String>;
108
- readonly afterSummary: Schema.optionalKey<Schema.String>;
109
- readonly risk: Schema.Literals<readonly ["low", "medium", "high"]>;
110
- }>>;
111
- readonly refs: Schema.$Array<Schema.Struct<{
112
- readonly kind: Schema.Literals<readonly ["memory", "kit", "loop", "agent", "agent_environment_policy", "decision", "task", "team_context", "context_relevance", "kit_source", "kit_version", "kit_installation", "kit_activation", "kit_trust_policy", "session", "step_attempt", "change_request"]>;
113
- readonly id: Schema.optionalKey<Schema.String>;
114
- readonly externalId: Schema.optionalKey<Schema.String>;
115
- readonly url: Schema.optionalKey<Schema.String>;
116
- readonly title: Schema.optionalKey<Schema.String>;
117
- }>>;
118
- }>;
119
- readonly riskSummary: Schema.Struct<{
120
- readonly level: Schema.Literals<readonly ["low", "medium", "high"]>;
121
- readonly summary: Schema.String;
122
- readonly reasons: Schema.$Array<Schema.String>;
123
- }>;
124
- readonly validationFindings: Schema.$Array<Schema.Struct<{
125
- readonly code: Schema.Literals<readonly ["autonomous_self_approval", "self_capability_escalation", "missing_required_approval", "unsafe_payload", "target_conflict"]>;
126
- readonly severity: Schema.Literals<readonly ["warning", "blocking"]>;
127
- readonly message: Schema.String;
128
- readonly actorId: Schema.optionalKey<Schema.String>;
129
- readonly target: Schema.optionalKey<Schema.Struct<{
130
- readonly type: Schema.Literals<readonly ["memory", "kit", "agent_environment_policy", "decision", "task", "team_context", "context_relevance", "kit_source", "kit_version", "kit_installation", "kit_activation", "kit_trust_policy"]>;
131
- readonly id: Schema.optionalKey<Schema.String>;
132
- readonly scopeType: Schema.optionalKey<Schema.Union<readonly [Schema.Literal<"workspace">, Schema.Literal<"team">, Schema.Literal<"task">, Schema.Literal<"kit">]>>;
133
- readonly scopeId: Schema.optionalKey<Schema.String>;
134
- }>>;
135
- readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>>]>>>;
136
- }>>;
137
- readonly approvalPolicy: Schema.Struct<{
138
- readonly mode: Schema.Literals<readonly ["auto_approve_low_risk", "require_other_team_member", "require_workspace_owner_or_admin"]>;
139
- readonly requireDifferentApprover: Schema.optionalKey<Schema.Boolean>;
140
- readonly autonomousAgentApprovalAllowed: Schema.Literal<false>;
141
- readonly deniedViolationCodes: Schema.$Array<Schema.Literals<readonly ["autonomous_self_approval", "self_capability_escalation", "missing_required_approval", "unsafe_payload", "target_conflict"]>>;
142
- }>;
143
- }>;
144
78
  export declare const Proposal: Schema.Struct<{
145
79
  readonly id: Schema.String;
146
80
  readonly workspaceId: Schema.String;
@@ -261,15 +195,6 @@ export declare const ProposalApplication: Schema.Struct<{
261
195
  }>;
262
196
  export declare function findForbiddenProposalPayloadPath<ValueType>(value: ValueType, path?: readonly string[]): readonly string[] | undefined;
263
197
  export declare function isKitMarketplaceProposalTargetType(value: ProposalTargetType): value is (typeof KitMarketplaceProposalTargetTypes)[number];
264
- export declare function validateKitMarketplaceProposalReview(input: {
265
- readonly action: (typeof KitMarketplaceProposalActions)[number];
266
- readonly target: ProposalTargetRef;
267
- readonly payload: ProposalPayload;
268
- readonly renderedDiff: ProposalRenderedDiff;
269
- readonly riskSummary: ProposalRiskSummary;
270
- readonly proposedByActorId?: string;
271
- readonly approvingActorId?: string;
272
- }): ProposalPolicyViolation[];
273
198
  export type ProposalStatus = (typeof ProposalStatus)['Type'];
274
199
  export type ProposalTargetType = (typeof ProposalTargetType)['Type'];
275
200
  export type ProposalRiskLevel = (typeof ProposalRiskLevel)['Type'];
@@ -283,7 +208,6 @@ export type ProposalApprovalPolicy = (typeof ProposalApprovalPolicy)['Type'];
283
208
  export type ProposalPolicyViolation = (typeof ProposalPolicyViolation)['Type'];
284
209
  export type ProposalRenderedDiff = (typeof ProposalRenderedDiff)['Type'];
285
210
  export type ProposalRiskSummary = (typeof ProposalRiskSummary)['Type'];
286
- export type KitMarketplaceProposalReview = (typeof KitMarketplaceProposalReview)['Type'];
287
211
  export type Proposal = (typeof Proposal)['Type'];
288
212
  export type ProposalRevision = (typeof ProposalRevision)['Type'];
289
213
  export type ProposalCommentAnchor = (typeof ProposalCommentAnchor)['Type'];
@@ -0,0 +1,68 @@
1
+ import * as Schema from 'effect/Schema';
2
+ import type { NotificationKind } from './notification';
3
+ /** What a device can be pushed about; a Question is on by default, the others are opt-in. */
4
+ export declare const PushEvents: readonly ['question_asked', 'run_failed', 'run_done'];
5
+ export type PushEvent = (typeof PushEvents)[number];
6
+ export declare const defaultPushEvents: readonly PushEvent[];
7
+ export declare const pushEventOf: (kind: NotificationKind) => PushEvent | undefined;
8
+ /** A browser's PushSubscription as `toJSON()` gives it, with what the person chose for that device. */
9
+ export declare const PushDeviceInput: Schema.Struct<{
10
+ readonly endpoint: Schema.String;
11
+ readonly keys: Schema.Struct<{
12
+ readonly p256dh: Schema.String;
13
+ readonly auth: Schema.String;
14
+ }>;
15
+ /** How the person tells their devices apart, such as the browser and platform. */
16
+ readonly label: Schema.optionalKey<Schema.String>;
17
+ readonly events: Schema.optionalKey<Schema.$Array<Schema.Literals<readonly ["question_asked", "run_failed", "run_done"]>>>;
18
+ }>;
19
+ export type PushDeviceInput = (typeof PushDeviceInput)['Type'];
20
+ export declare const PushDeviceChange: Schema.Struct<{
21
+ readonly enabled: Schema.optionalKey<Schema.Boolean>;
22
+ readonly events: Schema.optionalKey<Schema.$Array<Schema.Literals<readonly ["question_asked", "run_failed", "run_done"]>>>;
23
+ }>;
24
+ export type PushDeviceChange = (typeof PushDeviceChange)['Type'];
25
+ /** One of a person's devices; its endpoint and keys stay on the server. */
26
+ export declare const PushDevice: Schema.Struct<{
27
+ readonly id: Schema.String;
28
+ readonly label: Schema.String;
29
+ readonly enabled: Schema.Boolean;
30
+ readonly events: Schema.$Array<Schema.Literals<readonly ["question_asked", "run_failed", "run_done"]>>;
31
+ /** Lets a browser find its own device among the person's. */
32
+ readonly endpointHash: Schema.String;
33
+ readonly createdAt: Schema.String;
34
+ readonly lastPushedAt: Schema.optionalKey<Schema.String>;
35
+ }>;
36
+ export type PushDevice = (typeof PushDevice)['Type'];
37
+ export declare const PushSettings: Schema.Struct<{
38
+ /** The VAPID public key a browser subscribes with; absent when this Kitman cannot send pushes. */
39
+ readonly publicKey: Schema.optionalKey<Schema.String>;
40
+ readonly devices: Schema.$Array<Schema.Struct<{
41
+ readonly id: Schema.String;
42
+ readonly label: Schema.String;
43
+ readonly enabled: Schema.Boolean;
44
+ readonly events: Schema.$Array<Schema.Literals<readonly ["question_asked", "run_failed", "run_done"]>>;
45
+ /** Lets a browser find its own device among the person's. */
46
+ readonly endpointHash: Schema.String;
47
+ readonly createdAt: Schema.String;
48
+ readonly lastPushedAt: Schema.optionalKey<Schema.String>;
49
+ }>>;
50
+ }>;
51
+ export type PushSettings = (typeof PushSettings)['Type'];
52
+ /** What a push carries to the service worker: a short summary and a link, never source, Outputs or secrets. */
53
+ export type PushMessage = {
54
+ readonly title: string;
55
+ readonly body: string;
56
+ /** Same tag, same notification: a later push about the Run replaces the earlier one on the device. */
57
+ readonly tag: string;
58
+ /** The page that tapping opens, relative to the web app. */
59
+ readonly url: string;
60
+ /** Replaces the device's notification without alerting again: one within the minute already did. */
61
+ readonly quiet?: true;
62
+ /** Offered as "Accept recommendation" where the platform shows notification actions. */
63
+ readonly accept?: {
64
+ readonly runId: string;
65
+ readonly questionId: string;
66
+ readonly value: string;
67
+ };
68
+ };
@@ -0,0 +1,28 @@
1
+ /** An answer to choose from, with the trade-off beside it. */
2
+ export type QuestionOption = string | {
3
+ readonly value: string;
4
+ readonly description?: string;
5
+ };
6
+ export declare const optionValue: (option: QuestionOption) => string;
7
+ /** The option values, and each option's description by value; none when no option has one. */
8
+ export declare const splitQuestionOptions: (options: readonly QuestionOption[]) => {
9
+ options: string[];
10
+ optionDescriptions?: {
11
+ [k: string]: string;
12
+ };
13
+ };
14
+ /** A Question's recommendation as its asker gives it; `Question` in loop.ts says what each field means. */
15
+ export type QuestionRecommendation = {
16
+ readonly options?: readonly QuestionOption[];
17
+ readonly recommended?: string;
18
+ readonly recommendationReason?: string;
19
+ readonly informationOnly?: boolean;
20
+ };
21
+ /** Why a Question cannot be put as it is, written for the agent or author who asked it; undefined when it can. */
22
+ export declare const recommendationProblem: (question: QuestionRecommendation) => string | undefined;
23
+ /** What a Question carries beside its prompt and options to help a person answer. */
24
+ export type QuestionAdvice = Omit<QuestionRecommendation, 'options'> & {
25
+ readonly optionDescriptions?: Readonly<Record<string, string>>;
26
+ };
27
+ /** The advice fields that are set, so they can be spread into a record that leaves unset keys out. */
28
+ export declare const questionAdvice: (question: { readonly [Field in keyof QuestionAdvice]?: QuestionAdvice[Field] | undefined; }) => QuestionAdvice;
@@ -58,16 +58,28 @@ export declare class DurableSurfaceScanError extends DurableSurfaceScanError_bas
58
58
  }> {
59
59
  constructor(findings: readonly RedactionFinding[]);
60
60
  }
61
+ /**
62
+ * What Kitman may not keep at all, or may not send out. Kitman keeps what its own readers may read, so only secrets,
63
+ * credentials and values it cannot read are classified; `leavesKitman` adds everything else a third party should not get.
64
+ */
61
65
  export declare function classifyDurableSurfaceValue<ValueType>(key: string, value: ValueType, options?: DurableSurfaceScanOptions): RedactionClassification | undefined;
62
66
  export type DurableSurfaceScanOptions = {
63
67
  readonly allowCanonicalIds?: boolean;
64
- /** Lets text cite plain https links, as an agent's Output does. */
65
- readonly allowPlainUrls?: boolean;
68
+ /** Also classifies personal data, links, paths and pasted content, for what a third party receives. */
69
+ readonly leavesKitman?: boolean;
70
+ /** The longest text kept unread as unknown (default 1024); a surface bounded elsewhere passes its own bound. */
71
+ readonly maxTextLength?: number;
66
72
  };
67
73
  export declare function scanDurableSurface<ValueType>(value: ValueType, path?: string, options?: DurableSurfaceScanOptions): DurableSurfaceScan;
68
74
  export declare function assertDurableSurfaceClean<ValueType>(value: ValueType, path?: string): void;
69
- export declare function redactDurableSurface<ValueType>(value: ValueType, path?: string): RedactedDurableSurface;
75
+ export declare function redactDurableSurface<ValueType>(value: ValueType, path?: string, options?: DurableSurfaceScanOptions): RedactedDurableSurface;
70
76
  export declare function sha256Hex(input: string): string;
77
+ /**
78
+ * A response to a caller already authorized to read it, such as a Code Mode result: every secret and credential
79
+ * is replaced where it stands, by its key or by its text, and everything else stays readable. A failure that names
80
+ * a path, a host or `git@…` is the caller's to read; what is stored durably goes through `redactDurableSurface`.
81
+ */
82
+ export declare function redactResponseSurface<ValueType>(value: ValueType): JsonValue;
71
83
  /** Command output with secrets and credentials replaced; other content stays readable. */
72
84
  export declare function redactCredentials(output: string): string;
73
85
  export declare function redactedOutputTail(output: string, maxChars?: number): string;
@@ -0,0 +1,79 @@
1
+ import * as Schema from 'effect/Schema';
2
+ /** A shared resource's name in its Workspace, such as `stage` or `deploy:production`. */
3
+ export declare const ResourceName: Schema.String;
4
+ /**
5
+ * The Run that kept a resource after it settled without completing, and why. A Run of a private Team the asking Run is
6
+ * not in is `private`, with nothing else about it.
7
+ */
8
+ export declare const ClaimHolder: Schema.Struct<{
9
+ readonly runId: Schema.optionalKey<Schema.String>;
10
+ readonly loopId: Schema.optionalKey<Schema.String>;
11
+ readonly status: Schema.optionalKey<Schema.Literals<readonly ["pending", "running", "blocked", "completed", "failed", "canceled", "expired"]>>;
12
+ readonly reason: Schema.optionalKey<Schema.String>;
13
+ readonly private: Schema.optionalKey<Schema.Literal<true>>;
14
+ /** The same Loop on the same repository as the Run asking, which makes a takeover the default. */
15
+ readonly sameLoop: Schema.Boolean;
16
+ }>;
17
+ export type ClaimHolder = typeof ClaimHolder.Type;
18
+ /**
19
+ * What a claim came to: `granted`, possibly after waiting or by taking it over from a kept holder; or `kept`, held by
20
+ * a settled Run the claimant may take over.
21
+ */
22
+ export declare const ClaimResult: Schema.Union<readonly [Schema.Struct<{
23
+ readonly status: Schema.Literal<"granted">;
24
+ readonly resource: Schema.String;
25
+ readonly takenOverFrom: Schema.optionalKey<Schema.Struct<{
26
+ readonly runId: Schema.optionalKey<Schema.String>;
27
+ readonly loopId: Schema.optionalKey<Schema.String>;
28
+ readonly status: Schema.optionalKey<Schema.Literals<readonly ["pending", "running", "blocked", "completed", "failed", "canceled", "expired"]>>;
29
+ readonly reason: Schema.optionalKey<Schema.String>;
30
+ readonly private: Schema.optionalKey<Schema.Literal<true>>;
31
+ /** The same Loop on the same repository as the Run asking, which makes a takeover the default. */
32
+ readonly sameLoop: Schema.Boolean;
33
+ }>>;
34
+ }>, Schema.Struct<{
35
+ readonly status: Schema.Literal<"kept">;
36
+ readonly resource: Schema.String;
37
+ readonly holder: Schema.Struct<{
38
+ readonly runId: Schema.optionalKey<Schema.String>;
39
+ readonly loopId: Schema.optionalKey<Schema.String>;
40
+ readonly status: Schema.optionalKey<Schema.Literals<readonly ["pending", "running", "blocked", "completed", "failed", "canceled", "expired"]>>;
41
+ readonly reason: Schema.optionalKey<Schema.String>;
42
+ readonly private: Schema.optionalKey<Schema.Literal<true>>;
43
+ /** The same Loop on the same repository as the Run asking, which makes a takeover the default. */
44
+ readonly sameLoop: Schema.Boolean;
45
+ }>;
46
+ }>]>;
47
+ export type ClaimResult = typeof ClaimResult.Type;
48
+ /** A held resource as a person sees it. */
49
+ export declare const ResourceClaim: Schema.Struct<{
50
+ readonly resource: Schema.String;
51
+ readonly runId: Schema.String;
52
+ readonly loopId: Schema.String;
53
+ readonly runStatus: Schema.Literals<readonly ["pending", "running", "blocked", "completed", "failed", "canceled", "expired"]>;
54
+ readonly claimedAt: Schema.String;
55
+ readonly keptAt: Schema.optionalKey<Schema.String>;
56
+ readonly keptReason: Schema.optionalKey<Schema.String>;
57
+ /** Runs waiting for it, oldest first. */
58
+ readonly waiting: Schema.$Array<Schema.String>;
59
+ }>;
60
+ export type ResourceClaim = typeof ResourceClaim.Type;
61
+ export declare const ResourceClaimList: Schema.Struct<{
62
+ readonly items: Schema.$Array<Schema.Struct<{
63
+ readonly resource: Schema.String;
64
+ readonly runId: Schema.String;
65
+ readonly loopId: Schema.String;
66
+ readonly runStatus: Schema.Literals<readonly ["pending", "running", "blocked", "completed", "failed", "canceled", "expired"]>;
67
+ readonly claimedAt: Schema.String;
68
+ readonly keptAt: Schema.optionalKey<Schema.String>;
69
+ readonly keptReason: Schema.optionalKey<Schema.String>;
70
+ /** Runs waiting for it, oldest first. */
71
+ readonly waiting: Schema.$Array<Schema.String>;
72
+ }>>;
73
+ }>;
74
+ export type ResourceClaimList = typeof ResourceClaimList.Type;
75
+ /** A person letting a resource go, with why; the oldest waiting Run gets it. */
76
+ export declare const ClaimRelease: Schema.Struct<{
77
+ readonly reason: Schema.String;
78
+ }>;
79
+ export type ClaimRelease = typeof ClaimRelease.Type;
@@ -1,4 +1,4 @@
1
- import type { RunDisplay, RunDisplayState, RunShow } from './loop';
1
+ import type { Run, RunDisplay, RunDisplayState, RunShow } from './loop';
2
2
  export type RunDisplayInput = Pick<RunShow, 'run' | 'steps' | 'questions' | 'children' | 'waiting'> & {
3
3
  /** A Runner has leased one of the Run's orchestration Work Units. */
4
4
  readonly claimed: boolean;
@@ -8,5 +8,11 @@ export type RunDisplayInput = Pick<RunShow, 'run' | 'steps' | 'questions' | 'chi
8
8
  readonly failedChecks: readonly string[];
9
9
  };
10
10
  export declare const runDisplayLabels: Record<RunDisplayState, string>;
11
+ /** What a Run's output says it left open: any Loop's `unsettled` list. `displayFacts` in run-list.ts reads the same. */
12
+ export declare const reportedUnsettled: (output: Run['output']) => readonly string[] | undefined;
13
+ /** What a Run and the Child Runs below it report left open. */
14
+ export declare const unsettledItems: ({ run, children }: Pick<RunDisplayInput, 'run' | 'children'>) => string[];
15
+ /** A display summary for a list row: one line, cut short. */
16
+ export declare const listedSummary: (summary: string) => string;
11
17
  /** The one display state every surface shows for a Run (ADR-0072). */
12
18
  export declare const runDisplay: (input: RunDisplayInput) => RunDisplay;
@@ -31,7 +31,7 @@ export type RunGraphStep = (Reached & {
31
31
  readonly leased: boolean;
32
32
  readonly failureSummary?: string;
33
33
  };
34
- /** Every check passed or already failed on the default branch. */
34
+ /** Every check passed or already failed on the baseline. */
35
35
  readonly passed?: boolean;
36
36
  }) | (Reached & {
37
37
  readonly kind: 'question';
@@ -1,5 +1,5 @@
1
1
  import type { JsonObject } from './runtime-type';
2
- export type LaunchOutcome = 'feature' | 'bug' | 'refactor' | 'investigation' | 'docs' | 'migration';
2
+ export type LaunchOutcome = 'feature' | 'bug' | 'refactor' | 'investigation' | 'docs' | 'migration' | 'performance';
3
3
  /** Where and how a developer launched: their checkout, and the words they typed. */
4
4
  export type LaunchContext = {
5
5
  /** The Team the request names; it wins over the repository's. */
@@ -27,6 +27,13 @@ export type LaunchCandidates = {
27
27
  readonly sourceBranch?: string;
28
28
  }[];
29
29
  };
30
+ /** A Task's open ChangeRequest, as a launch names it to a person. */
31
+ export type LaunchChangeRequest = {
32
+ readonly id: string;
33
+ readonly title: string;
34
+ readonly url: string;
35
+ readonly repoBindingId: string;
36
+ };
30
37
  export type LaunchTask = {
31
38
  readonly kind: 'tracker';
32
39
  readonly key: string;
@@ -39,6 +46,8 @@ export type InferredLaunch = {
39
46
  readonly repoBindingId?: string;
40
47
  readonly branch?: string;
41
48
  readonly changeRequestId?: string;
49
+ /** The Task's open ChangeRequests, when the Loop needs one and only a person can say which. */
50
+ readonly changeRequestChoices?: readonly LaunchChangeRequest[];
42
51
  readonly trackerKeys: readonly string[];
43
52
  readonly task?: LaunchTask;
44
53
  readonly outcome?: LaunchOutcome;
@@ -56,7 +65,9 @@ export declare const launchInputSchema: (schema: JsonObject) => {
56
65
  };
57
66
  /**
58
67
  * What a launch means: the Team, repository, branch, open ChangeRequest, Task and Outcome its context points at,
59
- * and the Loop Input they fill. The words fill a `words` field, or else the one required text field left.
68
+ * and the Loop Input they fill. The words fill a `words` field, or else the one required text field left other than
69
+ * `taskId` and `changeRequestId`. A Loop that requires a ChangeRequest the launch does not point at takes the Task's
70
+ * only open one.
60
71
  */
61
72
  export declare const inferLaunch: (launch: {
62
73
  readonly context: LaunchContext;
@@ -65,5 +76,7 @@ export declare const inferLaunch: (launch: {
65
76
  readonly outcome?: LaunchOutcome;
66
77
  };
67
78
  readonly candidates: LaunchCandidates;
79
+ /** The open ChangeRequests of the Task the launch is for. */
80
+ readonly taskChangeRequests?: readonly LaunchChangeRequest[];
68
81
  readonly given?: JsonObject;
69
82
  }) => InferredLaunch;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * What a Runner claims first: work of a Run already in progress, then a Run that finishes a ChangeRequest, then a new
3
+ * Run. A rank's index is the `claim_rank` a Work Unit stores.
4
+ */
5
+ export declare const ClaimRanks: readonly ['in_progress', 'finishing', 'new'];
6
+ export type ClaimRank = (typeof ClaimRanks)[number];
7
+ /** What orders a Work Unit waiting for a Runner. */
8
+ export interface ClaimOrdered {
9
+ readonly id: string;
10
+ readonly rank: ClaimRank;
11
+ /** The Run's Task priority: 1 urgent to 4 low, and 5 for none or no Task. */
12
+ readonly urgency: number;
13
+ readonly rootRunCreatedAt: Date;
14
+ readonly createdAt: Date;
15
+ }
16
+ export interface QueuedWork extends ClaimOrdered {
17
+ readonly runId: string;
18
+ }
19
+ export declare const compareClaimOrder: (a: ClaimOrdered, b: ClaimOrdered) => number;
20
+ export interface QueuePlace {
21
+ /** 1 plus the other Runs with work ahead of it. */
22
+ readonly position: number;
23
+ /** Why it waits, as a clause: the other Runs ahead of it. */
24
+ readonly reason: string;
25
+ }
26
+ /** Each queued Work Unit's place in the claim order, and which other Runs have work ahead of it. */
27
+ export declare const queuePlaces: (queue: readonly QueuedWork[]) => ReadonlyMap<string, QueuePlace>;
28
+ export declare const queueWords: (place: QueuePlace) => string;
@@ -1,3 +1,5 @@
1
+ import type { HarnessHoldReason, SkippedChoice } from './loop';
2
+ import type { AgentChoice } from './loop-layers';
1
3
  import { type Runner, type RunnerCapabilities } from './runner';
2
4
  import type { RunnerExecutionRouting } from './runner-routing';
3
5
  export declare const RunnerEligibilityReasonCodes: readonly ['workspace_mismatch', 'team_access_denied', 'personal_owner_attribution_required', 'personal_owner_team_access_denied', 'agent_identity_authority_missing', 'foreground_target_required', 'foreground_target_mismatch', 'foreground_target_not_personal', 'runner_requirements_mismatch', 'runner_replica_unavailable'];
@@ -37,7 +39,24 @@ export interface RunnerEligibilityResult {
37
39
  * state before invoking this function.
38
40
  */
39
41
  export declare function evaluateRunnerEligibility(input: RunnerEligibilityInput): RunnerEligibilityResult;
42
+ /** A (harness, model) this Runner cannot run until `until`, or, with no `until`, that this Step passes over. */
43
+ export type RunnerHarnessHold = {
44
+ readonly harness: string;
45
+ readonly model: string;
46
+ readonly reason: HarnessHoldReason;
47
+ readonly until?: string;
48
+ };
40
49
  /** The owner's choice while the Runner offers it, else the first offered of Pi, Claude Code and Codex. */
41
50
  export declare function runnerDefaultHarness(harnesses: readonly string[], chosen: string | undefined): string | undefined;
42
- /** The Harness this Runner would launch an Agent on, or undefined when the Agent's Step is not this Runner's. */
43
- export declare function agentStepHarness(capabilities: Pick<RunnerCapabilities, 'harnesses' | 'defaultHarness'>, agentHarness: string | undefined): string | undefined;
51
+ /**
52
+ * The first choice this Runner offers, with its Harness resolved, and the choices before it as skipped; undefined when
53
+ * it offers none, so the Step is not this Runner's.
54
+ */
55
+ export declare function offeredChoice(capabilities: Pick<RunnerCapabilities, 'harnesses' | 'defaultHarness'>, choices: readonly AgentChoice[],
56
+ /** The Runner's live Harness Holds; a held choice is skipped. `model` is `''` for the Harness's own. */
57
+ holds?: readonly RunnerHarnessHold[]): {
58
+ readonly choice: AgentChoice & {
59
+ readonly harness: string;
60
+ };
61
+ readonly skipped: readonly SkippedChoice[];
62
+ } | undefined;