@ghx-dev/core 0.1.2 → 0.2.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.
Files changed (181) hide show
  1. package/.claude-plugin/plugin.json +21 -0
  2. package/README.md +12 -15
  3. package/dist/cards/issue.assignees.add.yaml +50 -0
  4. package/dist/cards/issue.assignees.remove.yaml +50 -0
  5. package/dist/cards/issue.assignees.set.yaml +47 -0
  6. package/dist/cards/issue.close.yaml +16 -2
  7. package/dist/cards/issue.comments.create.yaml +16 -2
  8. package/dist/cards/issue.create.yaml +11 -0
  9. package/dist/cards/issue.delete.yaml +16 -2
  10. package/dist/cards/issue.labels.add.yaml +48 -0
  11. package/dist/cards/issue.labels.remove.yaml +50 -0
  12. package/dist/cards/issue.labels.set.yaml +47 -0
  13. package/dist/cards/issue.milestone.clear.yaml +40 -0
  14. package/dist/cards/issue.milestone.set.yaml +23 -4
  15. package/dist/{core/registry/cards/issue.blocked_by.add.yaml → cards/issue.relations.blocked_by.add.yaml} +3 -2
  16. package/dist/cards/{issue.blocked_by.remove.yaml → issue.relations.blocked_by.remove.yaml} +1 -1
  17. package/dist/cards/{issue.parent.remove.yaml → issue.relations.parent.remove.yaml} +11 -1
  18. package/dist/{core/registry/cards/issue.parent.set.yaml → cards/issue.relations.parent.set.yaml} +3 -2
  19. package/dist/{core/registry/cards/issue.linked_prs.list.yaml → cards/issue.relations.prs.list.yaml} +1 -1
  20. package/dist/cards/{issue.relations.get.yaml → issue.relations.view.yaml} +1 -1
  21. package/dist/cards/issue.reopen.yaml +16 -2
  22. package/dist/cards/issue.update.yaml +16 -2
  23. package/dist/cards/issue.view.yaml +7 -5
  24. package/dist/cards/{pr.review.submit_approve.yaml → pr.assignees.add.yaml} +12 -9
  25. package/dist/cards/pr.assignees.remove.yaml +29 -0
  26. package/dist/{core/registry/cards/pr.status.checks.yaml → cards/pr.checks.list.yaml} +15 -2
  27. package/dist/{core/registry/cards/pr.checks.rerun_all.yaml → cards/pr.checks.rerun.all.yaml} +2 -4
  28. package/dist/{core/registry/cards/pr.checks.rerun_failed.yaml → cards/pr.checks.rerun.failed.yaml} +3 -5
  29. package/dist/cards/pr.create.yaml +30 -0
  30. package/dist/cards/{pr.diff.list_files.yaml → pr.diff.files.yaml} +1 -1
  31. package/dist/cards/{pr.ready_for_review.set.yaml → pr.diff.view.yaml} +6 -8
  32. package/dist/{core/registry/cards/pr.mergeability.view.yaml → cards/pr.merge.status.yaml} +6 -3
  33. package/dist/{core/registry/cards/pr.merge.execute.yaml → cards/pr.merge.yaml} +1 -1
  34. package/dist/cards/pr.reviews.list.yaml +1 -1
  35. package/dist/cards/{pr.reviewers.request.yaml → pr.reviews.request.yaml} +1 -1
  36. package/dist/cards/pr.reviews.submit.yaml +67 -0
  37. package/dist/cards/{pr.comments.list.yaml → pr.threads.list.yaml} +2 -2
  38. package/dist/cards/{pr.comment.reply.yaml → pr.threads.reply.yaml} +4 -2
  39. package/dist/cards/{pr.comment.resolve.yaml → pr.threads.resolve.yaml} +1 -1
  40. package/dist/cards/{pr.comment.unresolve.yaml → pr.threads.unresolve.yaml} +1 -1
  41. package/dist/cards/pr.update.yaml +29 -0
  42. package/dist/cards/pr.view.yaml +7 -5
  43. package/dist/{core/registry/cards/project_v2.item.field.update.yaml → cards/project_v2.items.field.update.yaml} +1 -1
  44. package/dist/{core/registry/cards/project_v2.item.add_issue.yaml → cards/project_v2.items.issue.add.yaml} +1 -1
  45. package/dist/cards/project_v2.items.issue.remove.yaml +23 -0
  46. package/dist/{core/registry/cards/project_v2.org.get.yaml → cards/project_v2.org.view.yaml} +1 -1
  47. package/dist/cards/{project_v2.user.get.yaml → project_v2.user.view.yaml} +1 -1
  48. package/dist/{core/registry/cards/release.create_draft.yaml → cards/release.create.yaml} +1 -1
  49. package/dist/cards/{release.publish_draft.yaml → release.publish.yaml} +1 -1
  50. package/dist/{core/registry/cards/release.get.yaml → cards/release.view.yaml} +1 -1
  51. package/dist/cards/repo.view.yaml +2 -4
  52. package/dist/cards/{workflow_dispatch.run.yaml → workflow.dispatch.yaml} +1 -1
  53. package/dist/cards/{workflow_job.logs.get.yaml → workflow.job.logs.raw.yaml} +2 -2
  54. package/dist/{core/registry/cards/workflow_job.logs.analyze.yaml → cards/workflow.job.logs.view.yaml} +1 -1
  55. package/dist/{core/registry/cards/workflow_run.artifacts.list.yaml → cards/workflow.run.artifacts.list.yaml} +1 -1
  56. package/dist/cards/{workflow_run.cancel.yaml → workflow.run.cancel.yaml} +1 -1
  57. package/dist/cards/{workflow_run.rerun_all.yaml → workflow.run.rerun.all.yaml} +3 -3
  58. package/dist/{core/registry/cards/workflow_run.rerun_failed.yaml → cards/workflow.run.rerun.failed.yaml} +3 -3
  59. package/dist/{core/registry/cards/workflow_run.get.yaml → cards/workflow.run.view.yaml} +19 -4
  60. package/dist/cards/{workflow_runs.list.yaml → workflow.runs.list.yaml} +1 -1
  61. package/dist/cards/{workflow.get.yaml → workflow.view.yaml} +2 -2
  62. package/dist/chunk-3DU2WHXF.js +15 -0
  63. package/dist/chunk-3DU2WHXF.js.map +1 -0
  64. package/dist/chunk-3P3KHWFU.js +5779 -0
  65. package/dist/chunk-3P3KHWFU.js.map +1 -0
  66. package/dist/chunk-BIWBJA2F.js +228 -0
  67. package/dist/chunk-BIWBJA2F.js.map +1 -0
  68. package/dist/chunk-HEHONZTO.js +121 -0
  69. package/dist/chunk-HEHONZTO.js.map +1 -0
  70. package/dist/chunk-Q7RCIK2C.js +773 -0
  71. package/dist/chunk-Q7RCIK2C.js.map +1 -0
  72. package/dist/chunk-R3CBGJZX.js +12 -0
  73. package/dist/chunk-R3CBGJZX.js.map +1 -0
  74. package/dist/chunk-TDABI6C7.js +167 -0
  75. package/dist/chunk-TDABI6C7.js.map +1 -0
  76. package/dist/chunk-TPQYVCAS.js +15 -0
  77. package/dist/chunk-TPQYVCAS.js.map +1 -0
  78. package/dist/cli/index.js +202 -21
  79. package/dist/cli/index.js.map +1 -1
  80. package/dist/core/registry/cards/issue.assignees.add.yaml +50 -0
  81. package/dist/core/registry/cards/issue.assignees.remove.yaml +50 -0
  82. package/dist/core/registry/cards/issue.assignees.set.yaml +47 -0
  83. package/dist/core/registry/cards/issue.close.yaml +16 -2
  84. package/dist/core/registry/cards/issue.comments.create.yaml +16 -2
  85. package/dist/core/registry/cards/issue.create.yaml +11 -0
  86. package/dist/core/registry/cards/issue.delete.yaml +16 -2
  87. package/dist/core/registry/cards/issue.labels.add.yaml +48 -0
  88. package/dist/core/registry/cards/issue.labels.remove.yaml +50 -0
  89. package/dist/core/registry/cards/issue.labels.set.yaml +47 -0
  90. package/dist/core/registry/cards/issue.milestone.clear.yaml +40 -0
  91. package/dist/core/registry/cards/issue.milestone.set.yaml +23 -4
  92. package/dist/{cards/issue.blocked_by.add.yaml → core/registry/cards/issue.relations.blocked_by.add.yaml} +3 -2
  93. package/dist/core/registry/cards/{issue.blocked_by.remove.yaml → issue.relations.blocked_by.remove.yaml} +1 -1
  94. package/dist/core/registry/cards/{issue.parent.remove.yaml → issue.relations.parent.remove.yaml} +11 -1
  95. package/dist/{cards/issue.parent.set.yaml → core/registry/cards/issue.relations.parent.set.yaml} +3 -2
  96. package/dist/{cards/issue.linked_prs.list.yaml → core/registry/cards/issue.relations.prs.list.yaml} +1 -1
  97. package/dist/core/registry/cards/{issue.relations.get.yaml → issue.relations.view.yaml} +1 -1
  98. package/dist/core/registry/cards/issue.reopen.yaml +16 -2
  99. package/dist/core/registry/cards/issue.update.yaml +16 -2
  100. package/dist/core/registry/cards/issue.view.yaml +7 -5
  101. package/dist/core/registry/cards/pr.assignees.add.yaml +29 -0
  102. package/dist/core/registry/cards/pr.assignees.remove.yaml +29 -0
  103. package/dist/{cards/pr.status.checks.yaml → core/registry/cards/pr.checks.list.yaml} +15 -2
  104. package/dist/{cards/pr.checks.rerun_all.yaml → core/registry/cards/pr.checks.rerun.all.yaml} +2 -4
  105. package/dist/{cards/pr.checks.rerun_failed.yaml → core/registry/cards/pr.checks.rerun.failed.yaml} +3 -5
  106. package/dist/core/registry/cards/pr.create.yaml +30 -0
  107. package/dist/core/registry/cards/{pr.diff.list_files.yaml → pr.diff.files.yaml} +1 -1
  108. package/dist/core/registry/cards/{pr.ready_for_review.set.yaml → pr.diff.view.yaml} +6 -8
  109. package/dist/{cards/pr.mergeability.view.yaml → core/registry/cards/pr.merge.status.yaml} +6 -3
  110. package/dist/{cards/pr.merge.execute.yaml → core/registry/cards/pr.merge.yaml} +1 -1
  111. package/dist/core/registry/cards/pr.reviews.list.yaml +1 -1
  112. package/dist/core/registry/cards/{pr.reviewers.request.yaml → pr.reviews.request.yaml} +1 -1
  113. package/dist/core/registry/cards/pr.reviews.submit.yaml +67 -0
  114. package/dist/core/registry/cards/{pr.comments.list.yaml → pr.threads.list.yaml} +2 -2
  115. package/dist/core/registry/cards/{pr.comment.reply.yaml → pr.threads.reply.yaml} +4 -2
  116. package/dist/core/registry/cards/{pr.comment.resolve.yaml → pr.threads.resolve.yaml} +1 -1
  117. package/dist/core/registry/cards/{pr.comment.unresolve.yaml → pr.threads.unresolve.yaml} +1 -1
  118. package/dist/core/registry/cards/pr.update.yaml +29 -0
  119. package/dist/core/registry/cards/pr.view.yaml +7 -5
  120. package/dist/{cards/project_v2.item.field.update.yaml → core/registry/cards/project_v2.items.field.update.yaml} +1 -1
  121. package/dist/{cards/project_v2.item.add_issue.yaml → core/registry/cards/project_v2.items.issue.add.yaml} +1 -1
  122. package/dist/core/registry/cards/project_v2.items.issue.remove.yaml +23 -0
  123. package/dist/{cards/project_v2.org.get.yaml → core/registry/cards/project_v2.org.view.yaml} +1 -1
  124. package/dist/core/registry/cards/{project_v2.user.get.yaml → project_v2.user.view.yaml} +1 -1
  125. package/dist/{cards/release.create_draft.yaml → core/registry/cards/release.create.yaml} +1 -1
  126. package/dist/core/registry/cards/{release.publish_draft.yaml → release.publish.yaml} +1 -1
  127. package/dist/{cards/release.get.yaml → core/registry/cards/release.view.yaml} +1 -1
  128. package/dist/core/registry/cards/repo.view.yaml +2 -4
  129. package/dist/core/registry/cards/{workflow_dispatch.run.yaml → workflow.dispatch.yaml} +1 -1
  130. package/dist/core/registry/cards/{workflow_job.logs.get.yaml → workflow.job.logs.raw.yaml} +2 -2
  131. package/dist/{cards/workflow_job.logs.analyze.yaml → core/registry/cards/workflow.job.logs.view.yaml} +1 -1
  132. package/dist/{cards/workflow_run.artifacts.list.yaml → core/registry/cards/workflow.run.artifacts.list.yaml} +1 -1
  133. package/dist/core/registry/cards/{workflow_run.cancel.yaml → workflow.run.cancel.yaml} +1 -1
  134. package/dist/core/registry/cards/{workflow_run.rerun_all.yaml → workflow.run.rerun.all.yaml} +3 -3
  135. package/dist/{cards/workflow_run.rerun_failed.yaml → core/registry/cards/workflow.run.rerun.failed.yaml} +3 -3
  136. package/dist/{cards/workflow_run.get.yaml → core/registry/cards/workflow.run.view.yaml} +19 -4
  137. package/dist/core/registry/cards/{workflow_runs.list.yaml → workflow.runs.list.yaml} +1 -1
  138. package/dist/core/registry/cards/{workflow.get.yaml → workflow.view.yaml} +2 -2
  139. package/dist/index.d.ts +374 -35
  140. package/dist/index.js +33 -5
  141. package/dist/index.js.map +1 -1
  142. package/dist/issue-mutations-FJNZW7L5.js +668 -0
  143. package/dist/issue-mutations-FJNZW7L5.js.map +1 -0
  144. package/dist/issue-queries-GRA4MKPD.js +208 -0
  145. package/dist/issue-queries-GRA4MKPD.js.map +1 -0
  146. package/dist/pr-mutations-UG67YOF5.js +344 -0
  147. package/dist/pr-mutations-UG67YOF5.js.map +1 -0
  148. package/dist/pr-queries-UOEOXIJQ.js +331 -0
  149. package/dist/pr-queries-UOEOXIJQ.js.map +1 -0
  150. package/dist/repo-JDUHFPZF.js +66 -0
  151. package/dist/repo-JDUHFPZF.js.map +1 -0
  152. package/package.json +16 -13
  153. package/skills/using-ghx/SKILL.md +61 -0
  154. package/dist/agent.d.ts +0 -32
  155. package/dist/agent.js +0 -36
  156. package/dist/agent.js.map +0 -1
  157. package/dist/cards/check_run.annotations.list.yaml +0 -35
  158. package/dist/cards/issue.assignees.update.yaml +0 -27
  159. package/dist/cards/issue.labels.update.yaml +0 -27
  160. package/dist/cards/pr.assignees.update.yaml +0 -38
  161. package/dist/cards/pr.checks.get_failed.yaml +0 -42
  162. package/dist/cards/pr.review.submit_comment.yaml +0 -26
  163. package/dist/cards/pr.review.submit_request_changes.yaml +0 -26
  164. package/dist/cards/workflow_run.jobs.list.yaml +0 -35
  165. package/dist/chunk-2FCPR3XZ.js +0 -54
  166. package/dist/chunk-2FCPR3XZ.js.map +0 -1
  167. package/dist/chunk-RDUPMVHG.js +0 -4139
  168. package/dist/chunk-RDUPMVHG.js.map +0 -1
  169. package/dist/chunk-UN5YHUNK.js +0 -245
  170. package/dist/chunk-UN5YHUNK.js.map +0 -1
  171. package/dist/cli/assets/skills/ghx/SKILL.md +0 -57
  172. package/dist/core/registry/cards/check_run.annotations.list.yaml +0 -35
  173. package/dist/core/registry/cards/issue.assignees.update.yaml +0 -27
  174. package/dist/core/registry/cards/issue.labels.update.yaml +0 -27
  175. package/dist/core/registry/cards/pr.assignees.update.yaml +0 -38
  176. package/dist/core/registry/cards/pr.checks.get_failed.yaml +0 -42
  177. package/dist/core/registry/cards/pr.review.submit_approve.yaml +0 -26
  178. package/dist/core/registry/cards/pr.review.submit_comment.yaml +0 -26
  179. package/dist/core/registry/cards/pr.review.submit_request_changes.yaml +0 -26
  180. package/dist/core/registry/cards/workflow_run.jobs.list.yaml +0 -35
  181. package/dist/envelope-BpF6MNCv.d.ts +0 -55
package/dist/index.d.ts CHANGED
@@ -1,19 +1,188 @@
1
- import { a as RouteSource, b as RouteReasonCode, R as ResultEnvelope } from './envelope-BpF6MNCv.js';
2
- export { A as AttemptMeta, c as ResultError, d as ResultMeta } from './envelope-BpF6MNCv.js';
3
1
  import { DocumentNode } from 'graphql';
4
2
 
3
+ declare const errorCodes: {
4
+ readonly Auth: "AUTH";
5
+ readonly NotFound: "NOT_FOUND";
6
+ readonly Validation: "VALIDATION";
7
+ readonly RateLimit: "RATE_LIMIT";
8
+ readonly Network: "NETWORK";
9
+ readonly Server: "SERVER";
10
+ readonly AdapterUnsupported: "ADAPTER_UNSUPPORTED";
11
+ readonly Unknown: "UNKNOWN";
12
+ };
13
+ type ErrorCode = (typeof errorCodes)[keyof typeof errorCodes];
14
+
15
+ declare const routeReasonCodes: readonly ["INPUT_VALIDATION", "OUTPUT_VALIDATION", "CARD_PREFERRED", "CARD_FALLBACK", "PREFLIGHT_FAILED", "ENV_CONSTRAINT", "CAPABILITY_LIMIT", "DEFAULT_POLICY"];
16
+ type RouteReasonCode = (typeof routeReasonCodes)[number];
17
+
18
+ type RouteSource = "cli" | "rest" | "graphql";
19
+ interface ResultError {
20
+ code: ErrorCode;
21
+ message: string;
22
+ retryable: boolean;
23
+ details?: Record<string, unknown>;
24
+ }
25
+ interface AttemptMeta {
26
+ route: RouteSource;
27
+ status: "success" | "error" | "skipped";
28
+ error_code?: ErrorCode;
29
+ duration_ms?: number;
30
+ }
31
+ interface ResultMeta {
32
+ capability_id: string;
33
+ route_used?: RouteSource;
34
+ reason?: RouteReasonCode;
35
+ attempts?: AttemptMeta[];
36
+ pagination?: {
37
+ has_next_page?: boolean;
38
+ end_cursor?: string;
39
+ next?: unknown;
40
+ };
41
+ timings?: {
42
+ total_ms?: number;
43
+ adapter_ms?: number;
44
+ };
45
+ cost?: {
46
+ tokens_in?: number;
47
+ tokens_out?: number;
48
+ };
49
+ }
50
+ interface ResultEnvelope<TData = unknown> {
51
+ ok: boolean;
52
+ data?: TData;
53
+ error?: ResultError;
54
+ meta: ResultMeta;
55
+ }
56
+ type ChainStatus = "success" | "partial" | "failed";
57
+ interface ChainStepResult {
58
+ task: string;
59
+ ok: boolean;
60
+ data?: unknown;
61
+ error?: ResultError;
62
+ }
63
+ interface ChainResultEnvelope {
64
+ status: ChainStatus;
65
+ results: ChainStepResult[];
66
+ meta: {
67
+ route_used: RouteSource;
68
+ total: number;
69
+ succeeded: number;
70
+ failed: number;
71
+ };
72
+ }
73
+
5
74
  type TaskId = string;
6
75
  interface TaskRequest<TInput = Record<string, unknown>> {
7
76
  task: TaskId;
8
77
  input: TInput;
9
78
  }
10
79
 
80
+ type ExecuteTaskFn = (request: {
81
+ task: string;
82
+ input: Record<string, unknown>;
83
+ options?: Record<string, unknown>;
84
+ }) => Promise<ResultEnvelope>;
85
+ declare function createExecuteTool(deps: {
86
+ executeTask: ExecuteTaskFn;
87
+ }): {
88
+ execute(capabilityId: string, params: Record<string, unknown>, options?: Record<string, unknown>): Promise<ResultEnvelope>;
89
+ };
90
+
11
91
  type JsonSchema = Record<string, unknown>;
12
92
  interface SuitabilityRule {
13
93
  when: "always" | "env" | "params";
14
94
  predicate: string;
15
95
  reason: string;
16
96
  }
97
+ /**
98
+ * Extracts a single value from a Phase 1 lookup result using a dot-notation path.
99
+ *
100
+ * Use when the mutation needs one node ID that can be resolved via a lookup query.
101
+ *
102
+ * @example
103
+ * ```yaml
104
+ * inject:
105
+ * - target: pullRequestId
106
+ * source: scalar
107
+ * path: repository.pullRequest.id
108
+ * ```
109
+ */
110
+ interface ScalarInject {
111
+ target: string;
112
+ source: "scalar";
113
+ path: string;
114
+ }
115
+ /**
116
+ * Resolves a list of human-readable names to node IDs using a Phase 1 lookup result.
117
+ *
118
+ * Matching is case-insensitive. Use when the mutation needs an array of IDs
119
+ * (e.g. label IDs, assignee IDs) that must be looked up by name.
120
+ *
121
+ * @example
122
+ * ```yaml
123
+ * inject:
124
+ * - target: labelIds
125
+ * source: map_array
126
+ * from_input: labels # input field containing list of names
127
+ * nodes_path: repository.labels.nodes
128
+ * match_field: name # field on each node to match against input names
129
+ * extract_field: id # field on each node to extract as the resolved value
130
+ * ```
131
+ */
132
+ interface MapArrayInject {
133
+ target: string;
134
+ source: "map_array";
135
+ from_input: string;
136
+ nodes_path: string;
137
+ match_field: string;
138
+ extract_field: string;
139
+ }
140
+ /**
141
+ * Passes a value directly from the step's `input` into a mutation variable.
142
+ *
143
+ * No Phase 1 lookup is required. Use when the caller already has the required node ID
144
+ * (e.g. the agent passes `issueId` directly), avoiding an unnecessary resolution round-trip.
145
+ *
146
+ * @example
147
+ * ```yaml
148
+ * inject:
149
+ * - target: labelableId
150
+ * source: input
151
+ * from_input: issueId # the input field whose value is passed through
152
+ * ```
153
+ */
154
+ interface InputPassthroughInject {
155
+ target: string;
156
+ source: "input";
157
+ from_input: string;
158
+ }
159
+ /**
160
+ * Injects an explicit `null` value into a mutation variable.
161
+ *
162
+ * Use when a mutation variable must be explicitly set to `null` to clear a field
163
+ * (e.g. clearing a milestone from an issue by passing `milestoneId: null`).
164
+ *
165
+ * @example
166
+ * ```yaml
167
+ * inject:
168
+ * - target: milestoneId
169
+ * source: "null_literal"
170
+ * ```
171
+ */
172
+ interface NullLiteralInject {
173
+ target: string;
174
+ source: "null_literal";
175
+ }
176
+ type InjectSpec = ScalarInject | MapArrayInject | InputPassthroughInject | NullLiteralInject;
177
+ interface LookupSpec {
178
+ operationName: string;
179
+ documentPath: string;
180
+ vars: Record<string, string>;
181
+ }
182
+ interface ResolutionConfig {
183
+ lookup: LookupSpec;
184
+ inject: InjectSpec[];
185
+ }
17
186
  interface OperationCard<Input = Record<string, unknown>> {
18
187
  capability_id: string;
19
188
  version: string;
@@ -33,6 +202,7 @@ interface OperationCard<Input = Record<string, unknown>> {
33
202
  limits?: {
34
203
  maxPageSize?: number;
35
204
  };
205
+ resolution?: ResolutionConfig;
36
206
  };
37
207
  cli?: {
38
208
  command: string;
@@ -54,12 +224,13 @@ interface OperationCard<Input = Record<string, unknown>> {
54
224
  }>;
55
225
  }
56
226
 
227
+ type CliRunResult = {
228
+ stdout: string;
229
+ stderr: string;
230
+ exitCode: number;
231
+ };
57
232
  type CliCommandRunner = {
58
- run(command: string, args: string[], timeoutMs: number): Promise<{
59
- stdout: string;
60
- stderr: string;
61
- exitCode: number;
62
- }>;
233
+ run(command: string, args: string[], timeoutMs: number): Promise<CliRunResult>;
63
234
  };
64
235
 
65
236
  type SafeRunnerOptions = {
@@ -67,9 +238,54 @@ type SafeRunnerOptions = {
67
238
  };
68
239
  declare function createSafeCliCommandRunner(options?: SafeRunnerOptions): CliCommandRunner;
69
240
 
241
+ type CapabilityExplanation = {
242
+ capability_id: string;
243
+ purpose: string;
244
+ required_inputs: string[];
245
+ optional_inputs: Record<string, unknown>;
246
+ preferred_route: "cli" | "graphql" | "rest";
247
+ fallback_routes: Array<"cli" | "graphql" | "rest">;
248
+ output_fields: string[];
249
+ };
250
+ declare function explainCapability(capabilityId: string): CapabilityExplanation;
251
+
70
252
  declare function listOperationCards(): OperationCard[];
71
253
  declare function getOperationCard(capabilityId: string): OperationCard | undefined;
72
254
 
255
+ type CapabilityListItem = {
256
+ capability_id: string;
257
+ description: string;
258
+ required_inputs: string[];
259
+ optional_inputs: string[];
260
+ optional_inputs_detail: Record<string, unknown>;
261
+ };
262
+ declare function listCapabilities(domain?: string): CapabilityListItem[];
263
+
264
+ type GraphqlVariables = Record<string, unknown>;
265
+ type GraphqlError = {
266
+ message: string;
267
+ path?: ReadonlyArray<string | number>;
268
+ extensions?: Record<string, unknown>;
269
+ };
270
+ type GraphqlRawResult<TData> = {
271
+ data: TData | undefined;
272
+ errors: GraphqlError[] | undefined;
273
+ };
274
+ type GraphqlDocument = string | DocumentNode;
275
+ interface GraphqlTransport {
276
+ execute<TData>(query: string, variables?: GraphqlVariables): Promise<TData>;
277
+ executeRaw?<TData>(query: string, variables?: GraphqlVariables): Promise<GraphqlRawResult<TData>>;
278
+ }
279
+ interface GraphqlClient {
280
+ query<TData, TVariables extends GraphqlVariables = GraphqlVariables>(query: GraphqlDocument, variables?: TVariables): Promise<TData>;
281
+ queryRaw<TData, TVariables extends GraphqlVariables = GraphqlVariables>(query: GraphqlDocument, variables?: TVariables): Promise<GraphqlRawResult<TData>>;
282
+ }
283
+ type TokenClientOptions = {
284
+ token: string;
285
+ graphqlUrl?: string;
286
+ };
287
+ declare function createGraphqlClient(transport: GraphqlTransport): GraphqlClient;
288
+
73
289
  type Maybe<T> = T | null;
74
290
  type InputMaybe<T> = Maybe<T>;
75
291
  type Exact<T extends {
@@ -99,6 +315,16 @@ type Scalars = {
99
315
  output: unknown;
100
316
  };
101
317
  };
318
+ type DiffSide = string;
319
+ type PullRequestReviewEvent = string;
320
+ type DraftPullRequestReviewThread = {
321
+ body: Scalars["String"]["input"];
322
+ line?: InputMaybe<Scalars["Int"]["input"]>;
323
+ path?: InputMaybe<Scalars["String"]["input"]>;
324
+ side?: InputMaybe<DiffSide>;
325
+ startLine?: InputMaybe<Scalars["Int"]["input"]>;
326
+ startSide?: InputMaybe<DiffSide>;
327
+ };
102
328
 
103
329
  type IssueCommentsListQueryVariables = Exact<{
104
330
  owner: Scalars["String"]["input"];
@@ -136,6 +362,13 @@ type PrListQueryVariables = Exact<{
136
362
  after?: InputMaybe<Scalars["String"]["input"]>;
137
363
  }>;
138
364
 
365
+ type PrReviewSubmitMutationVariables = Exact<{
366
+ pullRequestId: Scalars["ID"]["input"];
367
+ event: PullRequestReviewEvent;
368
+ body?: InputMaybe<Scalars["String"]["input"]>;
369
+ threads?: InputMaybe<Array<DraftPullRequestReviewThread> | DraftPullRequestReviewThread>;
370
+ }>;
371
+
139
372
  type PrReviewsListQueryVariables = Exact<{
140
373
  owner: Scalars["String"]["input"];
141
374
  name: Scalars["String"]["input"];
@@ -155,14 +388,6 @@ type RepoViewQueryVariables = Exact<{
155
388
  name: Scalars["String"]["input"];
156
389
  }>;
157
390
 
158
- type GraphqlVariables = Record<string, unknown>;
159
- type GraphqlDocument = string | DocumentNode;
160
- interface GraphqlTransport {
161
- execute<TData>(query: string, variables?: GraphqlVariables): Promise<TData>;
162
- }
163
- interface GraphqlClient {
164
- query<TData, TVariables extends GraphqlVariables = GraphqlVariables>(query: GraphqlDocument, variables?: TVariables): Promise<TData>;
165
- }
166
391
  type RepoViewInput = RepoViewQueryVariables;
167
392
  type IssueCommentsListInput = IssueCommentsListQueryVariables;
168
393
  type IssueListInput = IssueListQueryVariables;
@@ -187,27 +412,57 @@ type IssueCreateInput = {
187
412
  body?: string;
188
413
  };
189
414
  type IssueUpdateInput = {
190
- issueId: string;
415
+ owner: string;
416
+ name: string;
417
+ issueNumber: number;
191
418
  title?: string;
192
419
  body?: string;
193
420
  };
194
421
  type IssueMutationInput = {
195
- issueId: string;
422
+ owner: string;
423
+ name: string;
424
+ issueNumber: number;
196
425
  };
197
426
  type IssueLabelsUpdateInput = {
198
- issueId: string;
427
+ owner: string;
428
+ name: string;
429
+ issueNumber: number;
430
+ labels: string[];
431
+ };
432
+ type IssueLabelsAddInput = {
433
+ owner: string;
434
+ name: string;
435
+ issueNumber: number;
199
436
  labels: string[];
200
437
  };
201
438
  type IssueAssigneesUpdateInput = {
202
- issueId: string;
439
+ owner: string;
440
+ name: string;
441
+ issueNumber: number;
442
+ assignees: string[];
443
+ };
444
+ type IssueAssigneesAddInput = {
445
+ owner: string;
446
+ name: string;
447
+ issueNumber: number;
448
+ assignees: string[];
449
+ };
450
+ type IssueAssigneesRemoveInput = {
451
+ owner: string;
452
+ name: string;
453
+ issueNumber: number;
203
454
  assignees: string[];
204
455
  };
205
456
  type IssueMilestoneSetInput = {
206
- issueId: string;
207
- milestoneNumber: number | null;
457
+ owner: string;
458
+ name: string;
459
+ issueNumber: number;
460
+ milestoneNumber: number;
208
461
  };
209
462
  type IssueCommentCreateInput = {
210
- issueId: string;
463
+ owner: string;
464
+ name: string;
465
+ issueNumber: number;
211
466
  body: string;
212
467
  };
213
468
  type IssueLinkedPrsListInput = {
@@ -243,9 +498,18 @@ type IssueViewData = {
243
498
  title: string;
244
499
  state: string;
245
500
  url: string;
501
+ body: string;
502
+ labels: string[];
503
+ };
504
+ type IssueListItemData = {
505
+ id: string;
506
+ number: number;
507
+ title: string;
508
+ state: string;
509
+ url: string;
246
510
  };
247
511
  type IssueListData = {
248
- items: Array<IssueViewData>;
512
+ items: Array<IssueListItemData>;
249
513
  pageInfo: {
250
514
  endCursor: string | null;
251
515
  hasNextPage: boolean;
@@ -279,10 +543,22 @@ type IssueLabelsUpdateData = {
279
543
  id: string;
280
544
  labels: string[];
281
545
  };
546
+ type IssueLabelsAddData = {
547
+ id: string;
548
+ labels: string[];
549
+ };
282
550
  type IssueAssigneesUpdateData = {
283
551
  id: string;
284
552
  assignees: string[];
285
553
  };
554
+ type IssueAssigneesAddData = {
555
+ id: string;
556
+ assignees: string[];
557
+ };
558
+ type IssueAssigneesRemoveData = {
559
+ id: string;
560
+ assignees: string[];
561
+ };
286
562
  type IssueMilestoneSetData = {
287
563
  id: string;
288
564
  milestoneNumber: number | null;
@@ -315,6 +591,7 @@ type IssueRelationsGetData = {
315
591
  type IssueParentSetData = {
316
592
  issueId: string;
317
593
  parentIssueId: string;
594
+ updated: boolean;
318
595
  };
319
596
  type IssueParentRemoveData = {
320
597
  issueId: string;
@@ -323,6 +600,7 @@ type IssueParentRemoveData = {
323
600
  type IssueBlockedByData = {
324
601
  issueId: string;
325
602
  blockedByIssueId: string;
603
+ added?: boolean;
326
604
  removed?: boolean;
327
605
  };
328
606
  type PrViewData = {
@@ -331,9 +609,18 @@ type PrViewData = {
331
609
  title: string;
332
610
  state: string;
333
611
  url: string;
612
+ body: string;
613
+ labels: string[];
614
+ };
615
+ type PrListItemData = {
616
+ id: string;
617
+ number: number;
618
+ title: string;
619
+ state: string;
620
+ url: string;
334
621
  };
335
622
  type PrListData = {
336
- items: Array<PrViewData>;
623
+ items: Array<PrListItemData>;
337
624
  pageInfo: {
338
625
  endCursor: string | null;
339
626
  hasNextPage: boolean;
@@ -405,6 +692,18 @@ type PrDiffListFilesData = {
405
692
  hasNextPage: boolean;
406
693
  };
407
694
  };
695
+ type PrMergeStatusInput = {
696
+ owner: string;
697
+ name: string;
698
+ prNumber: number;
699
+ };
700
+ type PrMergeStatusData = {
701
+ mergeable: string | null;
702
+ mergeStateStatus: string | null;
703
+ reviewDecision: string | null;
704
+ isDraft: boolean;
705
+ state: string;
706
+ };
408
707
  type ReviewThreadMutationInput = {
409
708
  threadId: string;
410
709
  };
@@ -415,6 +714,29 @@ type ReviewThreadMutationData = {
415
714
  id: string;
416
715
  isResolved: boolean;
417
716
  };
717
+ type DraftComment = {
718
+ path: string;
719
+ body: string;
720
+ line: number;
721
+ side?: "LEFT" | "RIGHT";
722
+ startLine?: number;
723
+ startSide?: "LEFT" | "RIGHT";
724
+ };
725
+ type PrReviewSubmitInput = {
726
+ owner: string;
727
+ name: string;
728
+ prNumber: number;
729
+ event: PrReviewSubmitMutationVariables["event"];
730
+ body?: string;
731
+ comments?: DraftComment[];
732
+ };
733
+ type PrReviewSubmitData = {
734
+ id: string;
735
+ state: string;
736
+ url: string;
737
+ body: string | null;
738
+ };
739
+
418
740
  interface GithubClient extends GraphqlClient {
419
741
  fetchRepoView(input: RepoViewInput): Promise<RepoViewData>;
420
742
  fetchIssueCommentsList(input: IssueCommentsListInput): Promise<IssueCommentsListData>;
@@ -424,7 +746,10 @@ interface GithubClient extends GraphqlClient {
424
746
  reopenIssue(input: IssueMutationInput): Promise<IssueMutationData>;
425
747
  deleteIssue(input: IssueMutationInput): Promise<IssueMutationData>;
426
748
  updateIssueLabels(input: IssueLabelsUpdateInput): Promise<IssueLabelsUpdateData>;
749
+ addIssueLabels(input: IssueLabelsAddInput): Promise<IssueLabelsAddData>;
427
750
  updateIssueAssignees(input: IssueAssigneesUpdateInput): Promise<IssueAssigneesUpdateData>;
751
+ addIssueAssignees(input: IssueAssigneesAddInput): Promise<IssueAssigneesAddData>;
752
+ removeIssueAssignees(input: IssueAssigneesRemoveInput): Promise<IssueAssigneesRemoveData>;
428
753
  setIssueMilestone(input: IssueMilestoneSetInput): Promise<IssueMilestoneSetData>;
429
754
  createIssueComment(input: IssueCommentCreateInput): Promise<IssueCommentCreateData>;
430
755
  fetchIssueLinkedPrs(input: IssueLinkedPrsListInput): Promise<IssueLinkedPrsListData>;
@@ -440,31 +765,45 @@ interface GithubClient extends GraphqlClient {
440
765
  fetchPrCommentsList(input: PrCommentsListInput): Promise<PrCommentsListData>;
441
766
  fetchPrReviewsList(input: PrReviewsListInput): Promise<PrReviewsListData>;
442
767
  fetchPrDiffListFiles(input: PrDiffListFilesInput): Promise<PrDiffListFilesData>;
768
+ fetchPrMergeStatus(input: PrMergeStatusInput): Promise<PrMergeStatusData>;
443
769
  replyToReviewThread(input: ReplyToReviewThreadInput): Promise<ReviewThreadMutationData>;
444
770
  resolveReviewThread(input: ReviewThreadMutationInput): Promise<ReviewThreadMutationData>;
445
771
  unresolveReviewThread(input: ReviewThreadMutationInput): Promise<ReviewThreadMutationData>;
772
+ submitPrReview(input: PrReviewSubmitInput): Promise<PrReviewSubmitData>;
446
773
  }
447
- declare function createGraphqlClient(transport: GraphqlTransport): GraphqlClient;
448
- type TokenClientOptions = {
449
- token: string;
450
- graphqlUrl?: string;
451
- };
452
- /**
453
- * Create a GithubClient from a token string or options object.
454
- * Reads GITHUB_GRAPHQL_URL and GH_HOST from env for enterprise support.
455
- */
456
774
  declare function createGithubClientFromToken(tokenOrOptions: string | TokenClientOptions): GithubClient;
457
775
  declare function createGithubClient(transport: GraphqlTransport): GithubClient;
458
776
 
777
+ interface ResolutionCache {
778
+ get(key: string): unknown | undefined;
779
+ set(key: string, value: unknown): void;
780
+ clear(): void;
781
+ /** Current store size; may include expired entries due to lazy eviction. */
782
+ readonly size: number;
783
+ }
784
+ interface ResolutionCacheOptions {
785
+ /** Time-to-live in milliseconds. Default: 60 000 (1 min). */
786
+ ttlMs?: number;
787
+ /** Maximum number of cached entries. Default: 200. */
788
+ maxEntries?: number;
789
+ }
790
+ declare function createResolutionCache(opts?: ResolutionCacheOptions): ResolutionCache;
791
+ declare function buildCacheKey(operationName: string, variables: Record<string, unknown>): string;
792
+
459
793
  type ExecutionDeps = {
460
- githubClient: Pick<GithubClient, "fetchRepoView" | "fetchIssueCommentsList" | "fetchIssueList" | "fetchIssueView" | "fetchPrList" | "fetchPrView" | "fetchPrCommentsList" | "fetchPrReviewsList" | "fetchPrDiffListFiles" | "replyToReviewThread" | "resolveReviewThread" | "unresolveReviewThread">;
794
+ githubClient: GithubClient;
461
795
  githubToken?: string | null;
462
796
  cliRunner?: CliCommandRunner;
463
797
  ghCliAvailable?: boolean;
464
798
  ghAuthenticated?: boolean;
465
799
  skipGhPreflight?: boolean;
466
800
  reason?: RouteReasonCode;
801
+ resolutionCache?: ResolutionCache;
467
802
  };
468
803
  declare function executeTask(request: TaskRequest, deps: ExecutionDeps): Promise<ResultEnvelope>;
804
+ declare function executeTasks(requests: Array<{
805
+ task: string;
806
+ input: Record<string, unknown>;
807
+ }>, deps: ExecutionDeps): Promise<ChainResultEnvelope>;
469
808
 
470
- export { type CliCommandRunner, type GithubClient, type GraphqlClient, type GraphqlTransport, type OperationCard, ResultEnvelope, RouteReasonCode, RouteSource, type TaskRequest, type TokenClientOptions, createGithubClient, createGithubClientFromToken, createGraphqlClient, createSafeCliCommandRunner, executeTask, getOperationCard, listOperationCards };
809
+ export { type AttemptMeta, type CapabilityExplanation, type CapabilityListItem, type ChainResultEnvelope, type ChainStatus, type ChainStepResult, type CliCommandRunner, type GithubClient, type GraphqlClient, type GraphqlError, type GraphqlRawResult, type GraphqlTransport, type OperationCard, type ResolutionCache, type ResolutionCacheOptions, type ResultEnvelope, type ResultError, type ResultMeta, type RouteReasonCode, type RouteSource, type TaskRequest, type TokenClientOptions, buildCacheKey, createExecuteTool, createGithubClient, createGithubClientFromToken, createGraphqlClient, createResolutionCache, createSafeCliCommandRunner, executeTask, executeTasks, explainCapability, getOperationCard, listCapabilities, listOperationCards };
package/dist/index.js CHANGED
@@ -1,21 +1,49 @@
1
1
  import {
2
+ buildCacheKey,
2
3
  createGithubClient,
3
4
  createGithubClientFromToken,
4
- createGraphqlClient,
5
+ createResolutionCache,
5
6
  createSafeCliCommandRunner,
6
- executeTask
7
- } from "./chunk-RDUPMVHG.js";
8
- import {
7
+ executeTask,
8
+ executeTasks,
9
+ explainCapability,
9
10
  getOperationCard,
11
+ listCapabilities,
10
12
  listOperationCards
11
- } from "./chunk-UN5YHUNK.js";
13
+ } from "./chunk-3P3KHWFU.js";
14
+ import "./chunk-Q7RCIK2C.js";
15
+ import "./chunk-3DU2WHXF.js";
16
+ import "./chunk-TDABI6C7.js";
17
+ import {
18
+ createGraphqlClient
19
+ } from "./chunk-HEHONZTO.js";
20
+
21
+ // src/core/execute/execute-tool.ts
22
+ function createExecuteTool(deps) {
23
+ return {
24
+ execute(capabilityId, params, options) {
25
+ const request = {
26
+ task: capabilityId,
27
+ input: params,
28
+ ...options ? { options } : {}
29
+ };
30
+ return deps.executeTask(request);
31
+ }
32
+ };
33
+ }
12
34
  export {
35
+ buildCacheKey,
36
+ createExecuteTool,
13
37
  createGithubClient,
14
38
  createGithubClientFromToken,
15
39
  createGraphqlClient,
40
+ createResolutionCache,
16
41
  createSafeCliCommandRunner,
17
42
  executeTask,
43
+ executeTasks,
44
+ explainCapability,
18
45
  getOperationCard,
46
+ listCapabilities,
19
47
  listOperationCards
20
48
  };
21
49
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":["../src/core/execute/execute-tool.ts"],"sourcesContent":["import type { ResultEnvelope } from \"../contracts/envelope.js\"\n\ntype ExecuteTaskFn = (request: {\n task: string\n input: Record<string, unknown>\n options?: Record<string, unknown>\n}) => Promise<ResultEnvelope>\n\nexport function createExecuteTool(deps: { executeTask: ExecuteTaskFn }) {\n return {\n execute(\n capabilityId: string,\n params: Record<string, unknown>,\n options?: Record<string, unknown>,\n ): Promise<ResultEnvelope> {\n const request = {\n task: capabilityId,\n input: params,\n ...(options ? { options } : {}),\n }\n\n return deps.executeTask(request)\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAQO,SAAS,kBAAkB,MAAsC;AACtE,SAAO;AAAA,IACL,QACE,cACA,QACA,SACyB;AACzB,YAAM,UAAU;AAAA,QACd,MAAM;AAAA,QACN,OAAO;AAAA,QACP,GAAI,UAAU,EAAE,QAAQ,IAAI,CAAC;AAAA,MAC/B;AAEA,aAAO,KAAK,YAAY,OAAO;AAAA,IACjC;AAAA,EACF;AACF;","names":[]}