@chernabog/sdk 0.1.0 → 0.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chernabog/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "license": "MIT",
5
5
  "description": "Services and helpers for writing Chernabog flows and steps",
6
6
  "repository": {
@@ -12,7 +12,9 @@
12
12
  "exports": {
13
13
  ".": "./src/index.ts"
14
14
  },
15
- "files": ["src"],
15
+ "files": [
16
+ "src"
17
+ ],
16
18
  "peerDependencies": {
17
19
  "effect": "4.0.5"
18
20
  },
package/src/implement.ts CHANGED
@@ -32,6 +32,7 @@ export const issueItem = (issue: Issue): WorkItem => ({
32
32
  title: issue.title,
33
33
  url: issue.url,
34
34
  data: { issue: issue.number },
35
+ assignees: issue.assignees,
35
36
  });
36
37
 
37
38
  // The issue number a work item from `trigger` carries.
@@ -50,7 +51,7 @@ export const sessionIdFor = (runId: string, purpose: string) => {
50
51
  return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-4${hex.slice(13, 16)}-${variant}${hex.slice(17, 20)}-${hex.slice(20, 32)}`;
51
52
  };
52
53
 
53
- // Issues labelled eligible, oldest first.
54
+ // Issues labelled eligible, oldest first, each with its assignees.
54
55
  export const trigger = GitHub.use((github) => github.queuedIssues).pipe(Effect.map((issues) => issues.map(issueItem)));
55
56
 
56
57
  // The account is the one machine config expects, and it has room for a task.
package/src/review.ts CHANGED
@@ -44,6 +44,8 @@ const reviewItem = (pull: PullRequest): WorkItem => ({
44
44
  title: pull.title,
45
45
  url: pull.url,
46
46
  data: { pullRequest: pull.number, headRef: pull.headRef, agentWritten: isAgentBranch(pull.headRef) },
47
+ assignees: pull.assignees,
48
+ reviewers: pull.requestedReviewers,
47
49
  });
48
50
 
49
51
  // The head the latest review saw.
package/src/services.ts CHANGED
@@ -38,7 +38,20 @@ export const Board = Schema.Struct({ projectNumber: Schema.Finite, readyStatus:
38
38
  export type Board = typeof Board.Type;
39
39
 
40
40
  // configDir none is the agent's default home (~/.claude, ~/.codex).
41
- export const Account = Schema.Struct({ name: Schema.String, configDir: Schema.Option(Schema.String), expectedEmail: Schema.Option(Schema.String) });
41
+ // oauthTokenEnv names the environment variable holding a Claude login token
42
+ // (from `claude setup-token`), for a host with no login of its own, such as CI.
43
+ // usageGate none launches without reading usage, which such a token cannot.
44
+ export const UsageGateMode = Schema.Literals(['usage', 'none']);
45
+
46
+ export type UsageGateMode = typeof UsageGateMode.Type;
47
+
48
+ export const Account = Schema.Struct({
49
+ name: Schema.String,
50
+ configDir: Schema.Option(Schema.String),
51
+ expectedEmail: Schema.Option(Schema.String),
52
+ oauthTokenEnv: Schema.Option(Schema.String),
53
+ usageGate: UsageGateMode,
54
+ });
42
55
 
43
56
  export type Account = typeof Account.Type;
44
57
 
@@ -117,6 +130,10 @@ export const WorkItem = Schema.Struct({
117
130
  signals: Schema.optionalKey(Schema.Array(Schema.String)),
118
131
  // Only wakes a run already waiting on it; never starts one.
119
132
  wakeOnly: Schema.optionalKey(Schema.Boolean),
133
+ // GitHub logins assigned to the item, and asked to review it, which
134
+ // flows.<flow>.assignee and reviewRequested match to choose the machines it starts on.
135
+ assignees: Schema.optionalKey(Schema.Array(Schema.String)),
136
+ reviewers: Schema.optionalKey(Schema.Array(Schema.String)),
120
137
  });
121
138
 
122
139
  export type WorkItem = typeof WorkItem.Type;
@@ -134,6 +151,7 @@ export type Issue = {
134
151
  readonly url: string;
135
152
  readonly createdAt: string;
136
153
  readonly labels: ReadonlyArray<string>;
154
+ readonly assignees: ReadonlyArray<string>;
137
155
  };
138
156
 
139
157
  export type Comment = { readonly id: number; readonly author: string; readonly body: string; readonly createdAt: string; readonly trusted: boolean };
@@ -152,6 +170,9 @@ export type PullRequest = {
152
170
  readonly baseRef: string;
153
171
  readonly labels: ReadonlyArray<string>;
154
172
  readonly author: string;
173
+ readonly assignees: ReadonlyArray<string>;
174
+ // Users asked to review it who haven't yet; GitHub drops one once they review.
175
+ readonly requestedReviewers: ReadonlyArray<string>;
155
176
  };
156
177
 
157
178
  export type ReviewComment = { readonly path: string; readonly line: number; readonly body: string };