@ghx-dev/core 0.1.0 → 0.1.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.
- package/README.md +14 -2
- package/dist/agent.d.ts +32 -7
- package/dist/agent.js +29 -12
- package/dist/agent.js.map +1 -1
- package/dist/{chunk-JH6GM6XU.js → chunk-OL4ARD3R.js} +116 -7
- package/dist/chunk-OL4ARD3R.js.map +1 -0
- package/dist/chunk-PJ2JKKQE.js +4148 -0
- package/dist/chunk-PJ2JKKQE.js.map +1 -0
- package/dist/{chunk-4PLVKNCF.js → chunk-SCIJMW5P.js} +14 -4
- package/dist/chunk-SCIJMW5P.js.map +1 -0
- package/dist/cli/assets/skills/ghx/SKILL.md +57 -0
- package/dist/cli/index.js +373 -41
- package/dist/cli/index.js.map +1 -1
- package/dist/{core/contracts/envelope.d.ts → envelope-BpF6MNCv.d.ts} +15 -3
- package/dist/index.d.ts +470 -22
- package/dist/index.js +6 -30
- package/package.json +11 -9
- package/dist/agent-interface/prompt/main-skill.d.ts +0 -3
- package/dist/agent-interface/prompt/main-skill.js +0 -7
- package/dist/agent-interface/prompt/main-skill.js.map +0 -1
- package/dist/agent-interface/tools/execute-tool.d.ts +0 -16
- package/dist/agent-interface/tools/execute-tool.js +0 -7
- package/dist/agent-interface/tools/execute-tool.js.map +0 -1
- package/dist/agent-interface/tools/explain-tool.d.ts +0 -11
- package/dist/agent-interface/tools/explain-tool.js +0 -9
- package/dist/agent-interface/tools/explain-tool.js.map +0 -1
- package/dist/agent-interface/tools/list-capabilities-tool.d.ts +0 -7
- package/dist/agent-interface/tools/list-capabilities-tool.js +0 -9
- package/dist/agent-interface/tools/list-capabilities-tool.js.map +0 -1
- package/dist/chunk-22WWCK6A.js +0 -92
- package/dist/chunk-22WWCK6A.js.map +0 -1
- package/dist/chunk-2W4L5YCC.js +0 -116
- package/dist/chunk-2W4L5YCC.js.map +0 -1
- package/dist/chunk-3MRJX72M.js +0 -209
- package/dist/chunk-3MRJX72M.js.map +0 -1
- package/dist/chunk-4PLVKNCF.js.map +0 -1
- package/dist/chunk-573MDG3I.js +0 -18
- package/dist/chunk-573MDG3I.js.map +0 -1
- package/dist/chunk-5JRLVOF2.js +0 -50
- package/dist/chunk-5JRLVOF2.js.map +0 -1
- package/dist/chunk-B6RLMKS4.js +0 -41
- package/dist/chunk-B6RLMKS4.js.map +0 -1
- package/dist/chunk-D746VR3B.js +0 -38
- package/dist/chunk-D746VR3B.js.map +0 -1
- package/dist/chunk-DJIEG6K7.js +0 -20
- package/dist/chunk-DJIEG6K7.js.map +0 -1
- package/dist/chunk-DLKIQBK6.js +0 -106
- package/dist/chunk-DLKIQBK6.js.map +0 -1
- package/dist/chunk-EBRDO4Y6.js +0 -31
- package/dist/chunk-EBRDO4Y6.js.map +0 -1
- package/dist/chunk-FXN6IIT5.js +0 -14
- package/dist/chunk-FXN6IIT5.js.map +0 -1
- package/dist/chunk-GMTG7X2L.js +0 -16
- package/dist/chunk-GMTG7X2L.js.map +0 -1
- package/dist/chunk-HQ2VRCH7.js +0 -42
- package/dist/chunk-HQ2VRCH7.js.map +0 -1
- package/dist/chunk-JH6GM6XU.js.map +0 -1
- package/dist/chunk-JLDU462R.js +0 -1352
- package/dist/chunk-JLDU462R.js.map +0 -1
- package/dist/chunk-MGNGSGMF.js +0 -203
- package/dist/chunk-MGNGSGMF.js.map +0 -1
- package/dist/chunk-NFF5VF4U.js +0 -28
- package/dist/chunk-NFF5VF4U.js.map +0 -1
- package/dist/chunk-QEAMC4IJ.js +0 -34
- package/dist/chunk-QEAMC4IJ.js.map +0 -1
- package/dist/chunk-QZZC53HF.js +0 -38
- package/dist/chunk-QZZC53HF.js.map +0 -1
- package/dist/chunk-RUQXGZ35.js +0 -34
- package/dist/chunk-RUQXGZ35.js.map +0 -1
- package/dist/chunk-SA2D4A5U.js +0 -1496
- package/dist/chunk-SA2D4A5U.js.map +0 -1
- package/dist/chunk-SD7U4BNA.js +0 -174
- package/dist/chunk-SD7U4BNA.js.map +0 -1
- package/dist/chunk-SJR2SACI.js +0 -30
- package/dist/chunk-SJR2SACI.js.map +0 -1
- package/dist/chunk-TCLMLVUQ.js +0 -38
- package/dist/chunk-TCLMLVUQ.js.map +0 -1
- package/dist/chunk-TDTKOJKN.js +0 -52
- package/dist/chunk-TDTKOJKN.js.map +0 -1
- package/dist/chunk-UGWIZ3RI.js +0 -7
- package/dist/chunk-UGWIZ3RI.js.map +0 -1
- package/dist/chunk-UOJWOHRM.js +0 -16
- package/dist/chunk-UOJWOHRM.js.map +0 -1
- package/dist/chunk-VD5NXQP7.js +0 -42
- package/dist/chunk-VD5NXQP7.js.map +0 -1
- package/dist/chunk-W2TKG2UL.js +0 -37
- package/dist/chunk-W2TKG2UL.js.map +0 -1
- package/dist/chunk-W6ROKCY5.js +0 -28
- package/dist/chunk-W6ROKCY5.js.map +0 -1
- package/dist/chunk-XNMM64WU.js +0 -221
- package/dist/chunk-XNMM64WU.js.map +0 -1
- package/dist/cli/commands/capabilities-explain.d.ts +0 -3
- package/dist/cli/commands/capabilities-explain.js +0 -10
- package/dist/cli/commands/capabilities-explain.js.map +0 -1
- package/dist/cli/commands/capabilities-list.d.ts +0 -3
- package/dist/cli/commands/capabilities-list.js +0 -10
- package/dist/cli/commands/capabilities-list.js.map +0 -1
- package/dist/cli/commands/doctor.d.ts +0 -3
- package/dist/cli/commands/doctor.js +0 -7
- package/dist/cli/commands/doctor.js.map +0 -1
- package/dist/cli/commands/routes.d.ts +0 -3
- package/dist/cli/commands/routes.js +0 -7
- package/dist/cli/commands/routes.js.map +0 -1
- package/dist/cli/commands/run.d.ts +0 -3
- package/dist/cli/commands/run.js +0 -31
- package/dist/cli/commands/run.js.map +0 -1
- package/dist/cli/commands/setup.d.ts +0 -3
- package/dist/cli/commands/setup.js +0 -7
- package/dist/cli/commands/setup.js.map +0 -1
- package/dist/cli/formatters/json.d.ts +0 -3
- package/dist/cli/formatters/json.js +0 -8
- package/dist/cli/formatters/json.js.map +0 -1
- package/dist/cli/formatters/table.d.ts +0 -3
- package/dist/cli/formatters/table.js +0 -8
- package/dist/cli/formatters/table.js.map +0 -1
- package/dist/core/contracts/envelope.js +0 -1
- package/dist/core/contracts/envelope.js.map +0 -1
- package/dist/core/contracts/task.d.ts +0 -7
- package/dist/core/contracts/task.js +0 -1
- package/dist/core/contracts/task.js.map +0 -1
- package/dist/core/contracts/tasks/check_run.annotations.list.d.ts +0 -5
- package/dist/core/contracts/tasks/check_run.annotations.list.js +0 -8
- package/dist/core/contracts/tasks/check_run.annotations.list.js.map +0 -1
- package/dist/core/contracts/tasks/issue.assignees.update.d.ts +0 -5
- package/dist/core/contracts/tasks/issue.assignees.update.js +0 -8
- package/dist/core/contracts/tasks/issue.assignees.update.js.map +0 -1
- package/dist/core/contracts/tasks/issue.blocked_by.add.d.ts +0 -5
- package/dist/core/contracts/tasks/issue.blocked_by.add.js +0 -8
- package/dist/core/contracts/tasks/issue.blocked_by.add.js.map +0 -1
- package/dist/core/contracts/tasks/issue.blocked_by.remove.d.ts +0 -5
- package/dist/core/contracts/tasks/issue.blocked_by.remove.js +0 -8
- package/dist/core/contracts/tasks/issue.blocked_by.remove.js.map +0 -1
- package/dist/core/contracts/tasks/issue.close.d.ts +0 -5
- package/dist/core/contracts/tasks/issue.close.js +0 -8
- package/dist/core/contracts/tasks/issue.close.js.map +0 -1
- package/dist/core/contracts/tasks/issue.comments.create.d.ts +0 -5
- package/dist/core/contracts/tasks/issue.comments.create.js +0 -8
- package/dist/core/contracts/tasks/issue.comments.create.js.map +0 -1
- package/dist/core/contracts/tasks/issue.comments.list.d.ts +0 -5
- package/dist/core/contracts/tasks/issue.comments.list.js +0 -8
- package/dist/core/contracts/tasks/issue.comments.list.js.map +0 -1
- package/dist/core/contracts/tasks/issue.create.d.ts +0 -5
- package/dist/core/contracts/tasks/issue.create.js +0 -8
- package/dist/core/contracts/tasks/issue.create.js.map +0 -1
- package/dist/core/contracts/tasks/issue.delete.d.ts +0 -5
- package/dist/core/contracts/tasks/issue.delete.js +0 -8
- package/dist/core/contracts/tasks/issue.delete.js.map +0 -1
- package/dist/core/contracts/tasks/issue.labels.update.d.ts +0 -5
- package/dist/core/contracts/tasks/issue.labels.update.js +0 -8
- package/dist/core/contracts/tasks/issue.labels.update.js.map +0 -1
- package/dist/core/contracts/tasks/issue.linked_prs.list.d.ts +0 -5
- package/dist/core/contracts/tasks/issue.linked_prs.list.js +0 -8
- package/dist/core/contracts/tasks/issue.linked_prs.list.js.map +0 -1
- package/dist/core/contracts/tasks/issue.list.d.ts +0 -5
- package/dist/core/contracts/tasks/issue.list.js +0 -8
- package/dist/core/contracts/tasks/issue.list.js.map +0 -1
- package/dist/core/contracts/tasks/issue.milestone.set.d.ts +0 -5
- package/dist/core/contracts/tasks/issue.milestone.set.js +0 -8
- package/dist/core/contracts/tasks/issue.milestone.set.js.map +0 -1
- package/dist/core/contracts/tasks/issue.parent.remove.d.ts +0 -5
- package/dist/core/contracts/tasks/issue.parent.remove.js +0 -8
- package/dist/core/contracts/tasks/issue.parent.remove.js.map +0 -1
- package/dist/core/contracts/tasks/issue.parent.set.d.ts +0 -5
- package/dist/core/contracts/tasks/issue.parent.set.js +0 -8
- package/dist/core/contracts/tasks/issue.parent.set.js.map +0 -1
- package/dist/core/contracts/tasks/issue.relations.get.d.ts +0 -5
- package/dist/core/contracts/tasks/issue.relations.get.js +0 -8
- package/dist/core/contracts/tasks/issue.relations.get.js.map +0 -1
- package/dist/core/contracts/tasks/issue.reopen.d.ts +0 -5
- package/dist/core/contracts/tasks/issue.reopen.js +0 -8
- package/dist/core/contracts/tasks/issue.reopen.js.map +0 -1
- package/dist/core/contracts/tasks/issue.update.d.ts +0 -5
- package/dist/core/contracts/tasks/issue.update.js +0 -8
- package/dist/core/contracts/tasks/issue.update.js.map +0 -1
- package/dist/core/contracts/tasks/issue.view.d.ts +0 -5
- package/dist/core/contracts/tasks/issue.view.js +0 -8
- package/dist/core/contracts/tasks/issue.view.js.map +0 -1
- package/dist/core/contracts/tasks/pr.assignees.update.d.ts +0 -5
- package/dist/core/contracts/tasks/pr.assignees.update.js +0 -8
- package/dist/core/contracts/tasks/pr.assignees.update.js.map +0 -1
- package/dist/core/contracts/tasks/pr.branch.update.d.ts +0 -5
- package/dist/core/contracts/tasks/pr.branch.update.js +0 -8
- package/dist/core/contracts/tasks/pr.branch.update.js.map +0 -1
- package/dist/core/contracts/tasks/pr.checks.get_failed.d.ts +0 -5
- package/dist/core/contracts/tasks/pr.checks.get_failed.js +0 -8
- package/dist/core/contracts/tasks/pr.checks.get_failed.js.map +0 -1
- package/dist/core/contracts/tasks/pr.checks.rerun_all.d.ts +0 -5
- package/dist/core/contracts/tasks/pr.checks.rerun_all.js +0 -8
- package/dist/core/contracts/tasks/pr.checks.rerun_all.js.map +0 -1
- package/dist/core/contracts/tasks/pr.checks.rerun_failed.d.ts +0 -5
- package/dist/core/contracts/tasks/pr.checks.rerun_failed.js +0 -8
- package/dist/core/contracts/tasks/pr.checks.rerun_failed.js.map +0 -1
- package/dist/core/contracts/tasks/pr.comment.reply.d.ts +0 -5
- package/dist/core/contracts/tasks/pr.comment.reply.js +0 -8
- package/dist/core/contracts/tasks/pr.comment.reply.js.map +0 -1
- package/dist/core/contracts/tasks/pr.comment.resolve.d.ts +0 -5
- package/dist/core/contracts/tasks/pr.comment.resolve.js +0 -8
- package/dist/core/contracts/tasks/pr.comment.resolve.js.map +0 -1
- package/dist/core/contracts/tasks/pr.comment.unresolve.d.ts +0 -5
- package/dist/core/contracts/tasks/pr.comment.unresolve.js +0 -8
- package/dist/core/contracts/tasks/pr.comment.unresolve.js.map +0 -1
- package/dist/core/contracts/tasks/pr.comments.list.d.ts +0 -5
- package/dist/core/contracts/tasks/pr.comments.list.js +0 -8
- package/dist/core/contracts/tasks/pr.comments.list.js.map +0 -1
- package/dist/core/contracts/tasks/pr.diff.list_files.d.ts +0 -5
- package/dist/core/contracts/tasks/pr.diff.list_files.js +0 -8
- package/dist/core/contracts/tasks/pr.diff.list_files.js.map +0 -1
- package/dist/core/contracts/tasks/pr.list.d.ts +0 -5
- package/dist/core/contracts/tasks/pr.list.js +0 -8
- package/dist/core/contracts/tasks/pr.list.js.map +0 -1
- package/dist/core/contracts/tasks/pr.merge.execute.d.ts +0 -5
- package/dist/core/contracts/tasks/pr.merge.execute.js +0 -8
- package/dist/core/contracts/tasks/pr.merge.execute.js.map +0 -1
- package/dist/core/contracts/tasks/pr.mergeability.view.d.ts +0 -5
- package/dist/core/contracts/tasks/pr.mergeability.view.js +0 -8
- package/dist/core/contracts/tasks/pr.mergeability.view.js.map +0 -1
- package/dist/core/contracts/tasks/pr.ready_for_review.set.d.ts +0 -5
- package/dist/core/contracts/tasks/pr.ready_for_review.set.js +0 -8
- package/dist/core/contracts/tasks/pr.ready_for_review.set.js.map +0 -1
- package/dist/core/contracts/tasks/pr.review.submit_approve.d.ts +0 -5
- package/dist/core/contracts/tasks/pr.review.submit_approve.js +0 -8
- package/dist/core/contracts/tasks/pr.review.submit_approve.js.map +0 -1
- package/dist/core/contracts/tasks/pr.review.submit_comment.d.ts +0 -5
- package/dist/core/contracts/tasks/pr.review.submit_comment.js +0 -8
- package/dist/core/contracts/tasks/pr.review.submit_comment.js.map +0 -1
- package/dist/core/contracts/tasks/pr.review.submit_request_changes.d.ts +0 -5
- package/dist/core/contracts/tasks/pr.review.submit_request_changes.js +0 -8
- package/dist/core/contracts/tasks/pr.review.submit_request_changes.js.map +0 -1
- package/dist/core/contracts/tasks/pr.reviewers.request.d.ts +0 -5
- package/dist/core/contracts/tasks/pr.reviewers.request.js +0 -8
- package/dist/core/contracts/tasks/pr.reviewers.request.js.map +0 -1
- package/dist/core/contracts/tasks/pr.reviews.list.d.ts +0 -5
- package/dist/core/contracts/tasks/pr.reviews.list.js +0 -8
- package/dist/core/contracts/tasks/pr.reviews.list.js.map +0 -1
- package/dist/core/contracts/tasks/pr.status.checks.d.ts +0 -5
- package/dist/core/contracts/tasks/pr.status.checks.js +0 -8
- package/dist/core/contracts/tasks/pr.status.checks.js.map +0 -1
- package/dist/core/contracts/tasks/pr.view.d.ts +0 -5
- package/dist/core/contracts/tasks/pr.view.js +0 -8
- package/dist/core/contracts/tasks/pr.view.js.map +0 -1
- package/dist/core/contracts/tasks/project_v2.fields.list.d.ts +0 -5
- package/dist/core/contracts/tasks/project_v2.fields.list.js +0 -8
- package/dist/core/contracts/tasks/project_v2.fields.list.js.map +0 -1
- package/dist/core/contracts/tasks/project_v2.item.add_issue.d.ts +0 -5
- package/dist/core/contracts/tasks/project_v2.item.add_issue.js +0 -8
- package/dist/core/contracts/tasks/project_v2.item.add_issue.js.map +0 -1
- package/dist/core/contracts/tasks/project_v2.item.field.update.d.ts +0 -5
- package/dist/core/contracts/tasks/project_v2.item.field.update.js +0 -8
- package/dist/core/contracts/tasks/project_v2.item.field.update.js.map +0 -1
- package/dist/core/contracts/tasks/project_v2.items.list.d.ts +0 -5
- package/dist/core/contracts/tasks/project_v2.items.list.js +0 -8
- package/dist/core/contracts/tasks/project_v2.items.list.js.map +0 -1
- package/dist/core/contracts/tasks/project_v2.org.get.d.ts +0 -5
- package/dist/core/contracts/tasks/project_v2.org.get.js +0 -8
- package/dist/core/contracts/tasks/project_v2.org.get.js.map +0 -1
- package/dist/core/contracts/tasks/project_v2.user.get.d.ts +0 -5
- package/dist/core/contracts/tasks/project_v2.user.get.js +0 -8
- package/dist/core/contracts/tasks/project_v2.user.get.js.map +0 -1
- package/dist/core/contracts/tasks/release.create_draft.d.ts +0 -5
- package/dist/core/contracts/tasks/release.create_draft.js +0 -8
- package/dist/core/contracts/tasks/release.create_draft.js.map +0 -1
- package/dist/core/contracts/tasks/release.get.d.ts +0 -5
- package/dist/core/contracts/tasks/release.get.js +0 -8
- package/dist/core/contracts/tasks/release.get.js.map +0 -1
- package/dist/core/contracts/tasks/release.list.d.ts +0 -5
- package/dist/core/contracts/tasks/release.list.js +0 -8
- package/dist/core/contracts/tasks/release.list.js.map +0 -1
- package/dist/core/contracts/tasks/release.publish_draft.d.ts +0 -5
- package/dist/core/contracts/tasks/release.publish_draft.js +0 -8
- package/dist/core/contracts/tasks/release.publish_draft.js.map +0 -1
- package/dist/core/contracts/tasks/release.update.d.ts +0 -5
- package/dist/core/contracts/tasks/release.update.js +0 -8
- package/dist/core/contracts/tasks/release.update.js.map +0 -1
- package/dist/core/contracts/tasks/repo.issue_types.list.d.ts +0 -5
- package/dist/core/contracts/tasks/repo.issue_types.list.js +0 -8
- package/dist/core/contracts/tasks/repo.issue_types.list.js.map +0 -1
- package/dist/core/contracts/tasks/repo.labels.list.d.ts +0 -5
- package/dist/core/contracts/tasks/repo.labels.list.js +0 -8
- package/dist/core/contracts/tasks/repo.labels.list.js.map +0 -1
- package/dist/core/contracts/tasks/repo.view.d.ts +0 -5
- package/dist/core/contracts/tasks/repo.view.js +0 -8
- package/dist/core/contracts/tasks/repo.view.js.map +0 -1
- package/dist/core/contracts/tasks/workflow.get.d.ts +0 -5
- package/dist/core/contracts/tasks/workflow.get.js +0 -8
- package/dist/core/contracts/tasks/workflow.get.js.map +0 -1
- package/dist/core/contracts/tasks/workflow.list.d.ts +0 -5
- package/dist/core/contracts/tasks/workflow.list.js +0 -8
- package/dist/core/contracts/tasks/workflow.list.js.map +0 -1
- package/dist/core/contracts/tasks/workflow_dispatch.run.d.ts +0 -5
- package/dist/core/contracts/tasks/workflow_dispatch.run.js +0 -8
- package/dist/core/contracts/tasks/workflow_dispatch.run.js.map +0 -1
- package/dist/core/contracts/tasks/workflow_job.logs.analyze.d.ts +0 -5
- package/dist/core/contracts/tasks/workflow_job.logs.analyze.js +0 -8
- package/dist/core/contracts/tasks/workflow_job.logs.analyze.js.map +0 -1
- package/dist/core/contracts/tasks/workflow_job.logs.get.d.ts +0 -5
- package/dist/core/contracts/tasks/workflow_job.logs.get.js +0 -8
- package/dist/core/contracts/tasks/workflow_job.logs.get.js.map +0 -1
- package/dist/core/contracts/tasks/workflow_run.artifacts.list.d.ts +0 -5
- package/dist/core/contracts/tasks/workflow_run.artifacts.list.js +0 -8
- package/dist/core/contracts/tasks/workflow_run.artifacts.list.js.map +0 -1
- package/dist/core/contracts/tasks/workflow_run.cancel.d.ts +0 -5
- package/dist/core/contracts/tasks/workflow_run.cancel.js +0 -8
- package/dist/core/contracts/tasks/workflow_run.cancel.js.map +0 -1
- package/dist/core/contracts/tasks/workflow_run.get.d.ts +0 -5
- package/dist/core/contracts/tasks/workflow_run.get.js +0 -8
- package/dist/core/contracts/tasks/workflow_run.get.js.map +0 -1
- package/dist/core/contracts/tasks/workflow_run.jobs.list.d.ts +0 -5
- package/dist/core/contracts/tasks/workflow_run.jobs.list.js +0 -8
- package/dist/core/contracts/tasks/workflow_run.jobs.list.js.map +0 -1
- package/dist/core/contracts/tasks/workflow_run.rerun_all.d.ts +0 -5
- package/dist/core/contracts/tasks/workflow_run.rerun_all.js +0 -8
- package/dist/core/contracts/tasks/workflow_run.rerun_all.js.map +0 -1
- package/dist/core/contracts/tasks/workflow_run.rerun_failed.d.ts +0 -5
- package/dist/core/contracts/tasks/workflow_run.rerun_failed.js +0 -8
- package/dist/core/contracts/tasks/workflow_run.rerun_failed.js.map +0 -1
- package/dist/core/contracts/tasks/workflow_runs.list.d.ts +0 -5
- package/dist/core/contracts/tasks/workflow_runs.list.js +0 -8
- package/dist/core/contracts/tasks/workflow_runs.list.js.map +0 -1
- package/dist/core/errors/codes.d.ts +0 -13
- package/dist/core/errors/codes.js +0 -7
- package/dist/core/errors/codes.js.map +0 -1
- package/dist/core/errors/map-error.d.ts +0 -5
- package/dist/core/errors/map-error.js +0 -8
- package/dist/core/errors/map-error.js.map +0 -1
- package/dist/core/errors/retryability.d.ts +0 -3
- package/dist/core/errors/retryability.js +0 -8
- package/dist/core/errors/retryability.js.map +0 -1
- package/dist/core/execute/execute.d.ts +0 -28
- package/dist/core/execute/execute.js +0 -11
- package/dist/core/execute/execute.js.map +0 -1
- package/dist/core/execution/adapters/cli-adapter.d.ts +0 -22
- package/dist/core/execution/adapters/cli-adapter.js +0 -69
- package/dist/core/execution/adapters/cli-adapter.js.map +0 -1
- package/dist/core/execution/adapters/cli-capability-adapter.d.ts +0 -16
- package/dist/core/execution/adapters/cli-capability-adapter.js +0 -11
- package/dist/core/execution/adapters/cli-capability-adapter.js.map +0 -1
- package/dist/core/execution/adapters/graphql-adapter.d.ts +0 -25
- package/dist/core/execution/adapters/graphql-adapter.js +0 -44
- package/dist/core/execution/adapters/graphql-adapter.js.map +0 -1
- package/dist/core/execution/adapters/graphql-capability-adapter.d.ts +0 -20
- package/dist/core/execution/adapters/graphql-capability-adapter.js +0 -11
- package/dist/core/execution/adapters/graphql-capability-adapter.js.map +0 -1
- package/dist/core/execution/adapters/rest-adapter.d.ts +0 -3
- package/dist/core/execution/adapters/rest-adapter.js +0 -8
- package/dist/core/execution/adapters/rest-adapter.js.map +0 -1
- package/dist/core/execution/cli/safe-runner.d.ts +0 -12
- package/dist/core/execution/cli/safe-runner.js +0 -7
- package/dist/core/execution/cli/safe-runner.js.map +0 -1
- package/dist/core/execution/normalizer.d.ts +0 -13
- package/dist/core/execution/normalizer.js +0 -9
- package/dist/core/execution/normalizer.js.map +0 -1
- package/dist/core/execution/preflight.d.ts +0 -24
- package/dist/core/execution/preflight.js +0 -8
- package/dist/core/execution/preflight.js.map +0 -1
- package/dist/core/registry/index.d.ts +0 -15
- package/dist/core/registry/index.js +0 -12
- package/dist/core/registry/index.js.map +0 -1
- package/dist/core/registry/operation-card-schema.d.ts +0 -167
- package/dist/core/registry/operation-card-schema.js +0 -7
- package/dist/core/registry/operation-card-schema.js.map +0 -1
- package/dist/core/registry/schema-validator.d.ts +0 -16
- package/dist/core/registry/schema-validator.js +0 -9
- package/dist/core/registry/schema-validator.js.map +0 -1
- package/dist/core/registry/types.d.ts +0 -51
- package/dist/core/registry/types.js +0 -1
- package/dist/core/registry/types.js.map +0 -1
- package/dist/core/routing/capability-registry.d.ts +0 -8
- package/dist/core/routing/capability-registry.js +0 -15
- package/dist/core/routing/capability-registry.js.map +0 -1
- package/dist/core/routing/engine.d.ts +0 -32
- package/dist/core/routing/engine.js +0 -23
- package/dist/core/routing/engine.js.map +0 -1
- package/dist/core/routing/policy.d.ts +0 -3
- package/dist/core/routing/policy.js +0 -7
- package/dist/core/routing/policy.js.map +0 -1
- package/dist/core/routing/reason-codes.d.ts +0 -4
- package/dist/core/routing/reason-codes.js +0 -15
- package/dist/core/routing/reason-codes.js.map +0 -1
- package/dist/core/telemetry/logger.d.ts +0 -8
- package/dist/core/telemetry/logger.js +0 -9
- package/dist/core/telemetry/logger.js.map +0 -1
- package/dist/core/telemetry/metrics.d.ts +0 -7
- package/dist/core/telemetry/metrics.js +0 -1
- package/dist/core/telemetry/metrics.js.map +0 -1
- package/dist/gql/client.d.ts +0 -314
- package/dist/gql/client.js +0 -19
- package/dist/gql/client.js.map +0 -1
- package/dist/gql/generated/common-types.d.ts +0 -36
- package/dist/gql/generated/common-types.js +0 -1
- package/dist/gql/generated/common-types.js.map +0 -1
- package/dist/gql/operations/issue-assignees-update.generated.d.ts +0 -33
- package/dist/gql/operations/issue-assignees-update.generated.js +0 -28
- package/dist/gql/operations/issue-assignees-update.generated.js.map +0 -1
- package/dist/gql/operations/issue-blocked-by-add.generated.d.ts +0 -30
- package/dist/gql/operations/issue-blocked-by-add.generated.js +0 -26
- package/dist/gql/operations/issue-blocked-by-add.generated.js.map +0 -1
- package/dist/gql/operations/issue-blocked-by-remove.generated.d.ts +0 -30
- package/dist/gql/operations/issue-blocked-by-remove.generated.js +0 -26
- package/dist/gql/operations/issue-blocked-by-remove.generated.js.map +0 -1
- package/dist/gql/operations/issue-close.generated.d.ts +0 -27
- package/dist/gql/operations/issue-close.generated.js +0 -25
- package/dist/gql/operations/issue-close.generated.js.map +0 -1
- package/dist/gql/operations/issue-comment-create.generated.d.ts +0 -31
- package/dist/gql/operations/issue-comment-create.generated.js +0 -27
- package/dist/gql/operations/issue-comment-create.generated.js.map +0 -1
- package/dist/gql/operations/issue-comments-list.generated.d.ts +0 -59
- package/dist/gql/operations/issue-comments-list.generated.js +0 -9
- package/dist/gql/operations/issue-comments-list.generated.js.map +0 -1
- package/dist/gql/operations/issue-create.generated.d.ts +0 -31
- package/dist/gql/operations/issue-create.generated.js +0 -27
- package/dist/gql/operations/issue-create.generated.js.map +0 -1
- package/dist/gql/operations/issue-delete.generated.d.ts +0 -22
- package/dist/gql/operations/issue-delete.generated.js +0 -21
- package/dist/gql/operations/issue-delete.generated.js.map +0 -1
- package/dist/gql/operations/issue-labels-update.generated.d.ts +0 -33
- package/dist/gql/operations/issue-labels-update.generated.js +0 -28
- package/dist/gql/operations/issue-labels-update.generated.js.map +0 -1
- package/dist/gql/operations/issue-linked-prs-list.generated.d.ts +0 -132
- package/dist/gql/operations/issue-linked-prs-list.generated.js +0 -39
- package/dist/gql/operations/issue-linked-prs-list.generated.js.map +0 -1
- package/dist/gql/operations/issue-list.generated.d.ts +0 -40
- package/dist/gql/operations/issue-list.generated.js +0 -9
- package/dist/gql/operations/issue-list.generated.js.map +0 -1
- package/dist/gql/operations/issue-milestone-set.generated.d.ts +0 -30
- package/dist/gql/operations/issue-milestone-set.generated.js +0 -26
- package/dist/gql/operations/issue-milestone-set.generated.js.map +0 -1
- package/dist/gql/operations/issue-parent-remove.generated.d.ts +0 -30
- package/dist/gql/operations/issue-parent-remove.generated.js +0 -26
- package/dist/gql/operations/issue-parent-remove.generated.js.map +0 -1
- package/dist/gql/operations/issue-parent-set.generated.d.ts +0 -30
- package/dist/gql/operations/issue-parent-set.generated.js +0 -26
- package/dist/gql/operations/issue-parent-set.generated.js.map +0 -1
- package/dist/gql/operations/issue-relations-get.generated.d.ts +0 -49
- package/dist/gql/operations/issue-relations-get.generated.js +0 -40
- package/dist/gql/operations/issue-relations-get.generated.js.map +0 -1
- package/dist/gql/operations/issue-reopen.generated.d.ts +0 -27
- package/dist/gql/operations/issue-reopen.generated.js +0 -25
- package/dist/gql/operations/issue-reopen.generated.js.map +0 -1
- package/dist/gql/operations/issue-update.generated.d.ts +0 -31
- package/dist/gql/operations/issue-update.generated.js +0 -27
- package/dist/gql/operations/issue-update.generated.js.map +0 -1
- package/dist/gql/operations/issue-view.generated.d.ts +0 -31
- package/dist/gql/operations/issue-view.generated.js +0 -9
- package/dist/gql/operations/issue-view.generated.js.map +0 -1
- package/dist/gql/operations/pr-comment-reply.generated.d.ts +0 -26
- package/dist/gql/operations/pr-comment-reply.generated.js +0 -25
- package/dist/gql/operations/pr-comment-reply.generated.js.map +0 -1
- package/dist/gql/operations/pr-comment-resolve.generated.d.ts +0 -26
- package/dist/gql/operations/pr-comment-resolve.generated.js +0 -24
- package/dist/gql/operations/pr-comment-resolve.generated.js.map +0 -1
- package/dist/gql/operations/pr-comment-unresolve.generated.d.ts +0 -26
- package/dist/gql/operations/pr-comment-unresolve.generated.js +0 -24
- package/dist/gql/operations/pr-comment-unresolve.generated.js.map +0 -1
- package/dist/gql/operations/pr-comments-list.generated.d.ts +0 -84
- package/dist/gql/operations/pr-comments-list.generated.js +0 -58
- package/dist/gql/operations/pr-comments-list.generated.js.map +0 -1
- package/dist/gql/operations/pr-diff-list-files.generated.d.ts +0 -42
- package/dist/gql/operations/pr-diff-list-files.generated.js +0 -9
- package/dist/gql/operations/pr-diff-list-files.generated.js.map +0 -1
- package/dist/gql/operations/pr-list.generated.d.ts +0 -40
- package/dist/gql/operations/pr-list.generated.js +0 -9
- package/dist/gql/operations/pr-list.generated.js.map +0 -1
- package/dist/gql/operations/pr-reviews-list.generated.d.ts +0 -64
- package/dist/gql/operations/pr-reviews-list.generated.js +0 -9
- package/dist/gql/operations/pr-reviews-list.generated.js.map +0 -1
- package/dist/gql/operations/pr-view.generated.d.ts +0 -31
- package/dist/gql/operations/pr-view.generated.js +0 -9
- package/dist/gql/operations/pr-view.generated.js.map +0 -1
- package/dist/gql/operations/repo-view.generated.d.ts +0 -33
- package/dist/gql/operations/repo-view.generated.js +0 -9
- package/dist/gql/operations/repo-view.generated.js.map +0 -1
- package/dist/shared/constants.d.ts +0 -3
- package/dist/shared/constants.js +0 -6
- package/dist/shared/constants.js.map +0 -1
- package/dist/shared/types.d.ts +0 -3
- package/dist/shared/types.js +0 -1
- package/dist/shared/types.js.map +0 -1
- package/dist/shared/utils.d.ts +0 -3
- package/dist/shared/utils.js +0 -8
- package/dist/shared/utils.js.map +0 -1
package/dist/chunk-22WWCK6A.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
executeTask
|
|
3
|
-
} from "./chunk-SD7U4BNA.js";
|
|
4
|
-
import {
|
|
5
|
-
createGithubClient
|
|
6
|
-
} from "./chunk-JLDU462R.js";
|
|
7
|
-
|
|
8
|
-
// src/cli/commands/run.ts
|
|
9
|
-
var GITHUB_GRAPHQL_ENDPOINT = "https://api.github.com/graphql";
|
|
10
|
-
function parseRunArgs(argv) {
|
|
11
|
-
const [task, ...rest] = argv;
|
|
12
|
-
if (!task || task.trim().length === 0) {
|
|
13
|
-
throw new Error("Usage: ghx run <task> --input '<json>'");
|
|
14
|
-
}
|
|
15
|
-
const inputIndex = rest.findIndex((arg) => arg === "--input");
|
|
16
|
-
const inlineInput = rest.find((arg) => arg.startsWith("--input="));
|
|
17
|
-
const inputRaw = inputIndex >= 0 ? rest[inputIndex + 1] : inlineInput ? inlineInput.slice("--input=".length) : void 0;
|
|
18
|
-
if (!inputRaw) {
|
|
19
|
-
throw new Error("Missing --input JSON");
|
|
20
|
-
}
|
|
21
|
-
let parsed;
|
|
22
|
-
try {
|
|
23
|
-
parsed = JSON.parse(inputRaw);
|
|
24
|
-
} catch {
|
|
25
|
-
throw new Error("Invalid JSON for --input");
|
|
26
|
-
}
|
|
27
|
-
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
28
|
-
throw new Error("--input must be a JSON object");
|
|
29
|
-
}
|
|
30
|
-
return { task, input: parsed };
|
|
31
|
-
}
|
|
32
|
-
function resolveGithubToken() {
|
|
33
|
-
const token = process.env.GITHUB_TOKEN ?? process.env.GH_TOKEN;
|
|
34
|
-
if (!token || token.trim().length === 0) {
|
|
35
|
-
throw new Error("Missing GITHUB_TOKEN or GH_TOKEN for GraphQL transport");
|
|
36
|
-
}
|
|
37
|
-
return token;
|
|
38
|
-
}
|
|
39
|
-
async function executeGraphqlRequest(token, query, variables) {
|
|
40
|
-
const response = await fetch(GITHUB_GRAPHQL_ENDPOINT, {
|
|
41
|
-
method: "POST",
|
|
42
|
-
headers: {
|
|
43
|
-
"content-type": "application/json",
|
|
44
|
-
accept: "application/json",
|
|
45
|
-
authorization: `Bearer ${token}`,
|
|
46
|
-
"user-agent": "ghx"
|
|
47
|
-
},
|
|
48
|
-
body: JSON.stringify({ query, variables: variables ?? {} })
|
|
49
|
-
});
|
|
50
|
-
const payload = await response.json();
|
|
51
|
-
if (!response.ok) {
|
|
52
|
-
const message = payload.message ?? `GitHub GraphQL request failed with status ${response.status}`;
|
|
53
|
-
throw new Error(message);
|
|
54
|
-
}
|
|
55
|
-
if (Array.isArray(payload.errors) && payload.errors.length > 0) {
|
|
56
|
-
const message = payload.errors[0]?.message ?? "GitHub GraphQL returned errors";
|
|
57
|
-
throw new Error(message);
|
|
58
|
-
}
|
|
59
|
-
if (payload.data === void 0) {
|
|
60
|
-
throw new Error("GitHub GraphQL response missing data");
|
|
61
|
-
}
|
|
62
|
-
return payload.data;
|
|
63
|
-
}
|
|
64
|
-
async function runCommand(argv = []) {
|
|
65
|
-
if (argv.length === 0) {
|
|
66
|
-
process.stdout.write("Usage: ghx run <task> --input '<json>'\n");
|
|
67
|
-
return 1;
|
|
68
|
-
}
|
|
69
|
-
const { task, input } = parseRunArgs(argv);
|
|
70
|
-
const githubToken = resolveGithubToken();
|
|
71
|
-
const githubClient = createGithubClient({
|
|
72
|
-
async execute(query, variables) {
|
|
73
|
-
return executeGraphqlRequest(githubToken, query, variables);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
const request = {
|
|
77
|
-
task,
|
|
78
|
-
input
|
|
79
|
-
};
|
|
80
|
-
const result = await executeTask(request, {
|
|
81
|
-
githubClient,
|
|
82
|
-
githubToken
|
|
83
|
-
});
|
|
84
|
-
process.stdout.write(`${JSON.stringify(result)}
|
|
85
|
-
`);
|
|
86
|
-
return 0;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export {
|
|
90
|
-
runCommand
|
|
91
|
-
};
|
|
92
|
-
//# sourceMappingURL=chunk-22WWCK6A.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/commands/run.ts"],"sourcesContent":["import { createGithubClient } from \"../../gql/client.js\"\nimport { executeTask } from \"../../core/routing/engine.js\"\nimport type { TaskRequest } from \"../../core/contracts/task.js\"\n\nconst GITHUB_GRAPHQL_ENDPOINT = \"https://api.github.com/graphql\"\n\nfunction parseRunArgs(argv: string[]): { task: string; input: Record<string, unknown> } {\n const [task, ...rest] = argv\n if (!task || task.trim().length === 0) {\n throw new Error(\"Usage: ghx run <task> --input '<json>'\")\n }\n\n const inputIndex = rest.findIndex((arg) => arg === \"--input\")\n const inlineInput = rest.find((arg) => arg.startsWith(\"--input=\"))\n const inputRaw =\n inputIndex >= 0\n ? rest[inputIndex + 1]\n : inlineInput\n ? inlineInput.slice(\"--input=\".length)\n : undefined\n\n if (!inputRaw) {\n throw new Error(\"Missing --input JSON\")\n }\n\n let parsed: unknown\n try {\n parsed = JSON.parse(inputRaw)\n } catch {\n throw new Error(\"Invalid JSON for --input\")\n }\n\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n throw new Error(\"--input must be a JSON object\")\n }\n\n return { task, input: parsed as Record<string, unknown> }\n}\n\nfunction resolveGithubToken(): string {\n const token = process.env.GITHUB_TOKEN ?? process.env.GH_TOKEN\n if (!token || token.trim().length === 0) {\n throw new Error(\"Missing GITHUB_TOKEN or GH_TOKEN for GraphQL transport\")\n }\n\n return token\n}\n\nasync function executeGraphqlRequest<TData>(\n token: string,\n query: string,\n variables?: Record<string, unknown>\n): Promise<TData> {\n const response = await fetch(GITHUB_GRAPHQL_ENDPOINT, {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n accept: \"application/json\",\n authorization: `Bearer ${token}`,\n \"user-agent\": \"ghx\"\n },\n body: JSON.stringify({ query, variables: variables ?? {} })\n })\n\n const payload = (await response.json()) as {\n data?: TData\n errors?: Array<{ message?: string }>\n message?: string\n }\n\n if (!response.ok) {\n const message = payload.message ?? `GitHub GraphQL request failed with status ${response.status}`\n throw new Error(message)\n }\n\n if (Array.isArray(payload.errors) && payload.errors.length > 0) {\n const message = payload.errors[0]?.message ?? \"GitHub GraphQL returned errors\"\n throw new Error(message)\n }\n\n if (payload.data === undefined) {\n throw new Error(\"GitHub GraphQL response missing data\")\n }\n\n return payload.data\n}\n\nexport async function runCommand(argv: string[] = []): Promise<number> {\n if (argv.length === 0) {\n process.stdout.write(\"Usage: ghx run <task> --input '<json>'\\n\")\n return 1\n }\n\n const { task, input } = parseRunArgs(argv)\n const githubToken = resolveGithubToken()\n\n const githubClient = createGithubClient({\n async execute<TData>(query: string, variables?: Record<string, unknown>): Promise<TData> {\n return executeGraphqlRequest<TData>(githubToken, query, variables)\n }\n })\n\n const request: TaskRequest = {\n task,\n input\n }\n\n const result = await executeTask(request, {\n githubClient,\n githubToken\n })\n\n process.stdout.write(`${JSON.stringify(result)}\\n`)\n return 0\n}\n"],"mappings":";;;;;;;;AAIA,IAAM,0BAA0B;AAEhC,SAAS,aAAa,MAAkE;AACtF,QAAM,CAAC,MAAM,GAAG,IAAI,IAAI;AACxB,MAAI,CAAC,QAAQ,KAAK,KAAK,EAAE,WAAW,GAAG;AACrC,UAAM,IAAI,MAAM,wCAAwC;AAAA,EAC1D;AAEA,QAAM,aAAa,KAAK,UAAU,CAAC,QAAQ,QAAQ,SAAS;AAC5D,QAAM,cAAc,KAAK,KAAK,CAAC,QAAQ,IAAI,WAAW,UAAU,CAAC;AACjE,QAAM,WACJ,cAAc,IACV,KAAK,aAAa,CAAC,IACnB,cACE,YAA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I,MAAM,sCAAsC;AAAA,EACxD;AAEA,SAAO,QAAQ;AACjB;AAEA,eAAsB,WAAW,OAAiB,CAAC,GAAoB;AACrE,MAAI,KAAK,WAAW,GAAG;AACrB,YAAQ,OAAO,MAAM,0CAA0C;AAC/D,WAAO;AAAA,EACT;AAEA,QAAM,EAAE,MAAM,MAAM,IAAI,aAAa,IAAI;AACzC,QAAM,cAAc,mBAAmB;AAEvC,QAAM,eAAe,mBAAmB;AAAA,IACtC,MAAM,QAAe,OAAe,WAAqD;AACvF,aAAO,sBAA6B,aAAa,OAAO,SAAS;AAAA,IACnE;AAAA,EACF,CAAC;AAED,QAAM,UAAuB;AAAA,IAC3B;AAAA,IACA;AAAA,EACF;AAEA,QAAM,SAAS,MAAM,YAAY,SAAS;AAAA,IACxC;AAAA,IACA;AAAA,EACF,CAAC;AAED,UAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,MAAM,CAAC;AAAA,CAAI;AAClD,SAAO;AACT;","names":[]}
|
package/dist/chunk-2W4L5YCC.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
// src/core/registry/operation-card-schema.ts
|
|
2
|
-
var operationCardSchema = {
|
|
3
|
-
$id: "https://ghx.local/schemas/operation-card.json",
|
|
4
|
-
type: "object",
|
|
5
|
-
required: ["capability_id", "version", "description", "input_schema", "output_schema", "routing"],
|
|
6
|
-
properties: {
|
|
7
|
-
capability_id: { type: "string", minLength: 1 },
|
|
8
|
-
version: { type: "string", minLength: 1 },
|
|
9
|
-
description: { type: "string", minLength: 1 },
|
|
10
|
-
input_schema: { type: "object" },
|
|
11
|
-
output_schema: { type: "object" },
|
|
12
|
-
routing: {
|
|
13
|
-
type: "object",
|
|
14
|
-
required: ["preferred", "fallbacks"],
|
|
15
|
-
properties: {
|
|
16
|
-
preferred: { enum: ["cli", "graphql", "rest"] },
|
|
17
|
-
fallbacks: {
|
|
18
|
-
type: "array",
|
|
19
|
-
items: { enum: ["cli", "graphql", "rest"] }
|
|
20
|
-
},
|
|
21
|
-
suitability: {
|
|
22
|
-
type: "array",
|
|
23
|
-
items: {
|
|
24
|
-
type: "object",
|
|
25
|
-
required: ["when", "predicate", "reason"],
|
|
26
|
-
properties: {
|
|
27
|
-
when: { enum: ["always", "env", "params"] },
|
|
28
|
-
predicate: { type: "string", minLength: 1 },
|
|
29
|
-
reason: { type: "string", minLength: 1 }
|
|
30
|
-
},
|
|
31
|
-
additionalProperties: false
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
notes: {
|
|
35
|
-
type: "array",
|
|
36
|
-
items: { type: "string" }
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
additionalProperties: false
|
|
40
|
-
},
|
|
41
|
-
graphql: {
|
|
42
|
-
type: "object",
|
|
43
|
-
required: ["operationName", "documentPath"],
|
|
44
|
-
properties: {
|
|
45
|
-
operationName: { type: "string", minLength: 1 },
|
|
46
|
-
documentPath: { type: "string", minLength: 1 },
|
|
47
|
-
variables: { type: "object" },
|
|
48
|
-
limits: {
|
|
49
|
-
type: "object",
|
|
50
|
-
properties: {
|
|
51
|
-
maxPageSize: { type: "number" }
|
|
52
|
-
},
|
|
53
|
-
additionalProperties: false
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
additionalProperties: false
|
|
57
|
-
},
|
|
58
|
-
cli: {
|
|
59
|
-
type: "object",
|
|
60
|
-
required: ["command"],
|
|
61
|
-
properties: {
|
|
62
|
-
command: { type: "string", minLength: 1 },
|
|
63
|
-
jsonFields: {
|
|
64
|
-
type: "array",
|
|
65
|
-
items: { type: "string", minLength: 1 }
|
|
66
|
-
},
|
|
67
|
-
jq: { type: "string" },
|
|
68
|
-
limits: {
|
|
69
|
-
type: "object",
|
|
70
|
-
properties: {
|
|
71
|
-
maxItemsPerCall: { type: "number" }
|
|
72
|
-
},
|
|
73
|
-
additionalProperties: false
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
additionalProperties: false
|
|
77
|
-
},
|
|
78
|
-
rest: {
|
|
79
|
-
type: "object",
|
|
80
|
-
required: ["endpoints"],
|
|
81
|
-
properties: {
|
|
82
|
-
endpoints: {
|
|
83
|
-
type: "array",
|
|
84
|
-
items: {
|
|
85
|
-
type: "object",
|
|
86
|
-
required: ["method", "path"],
|
|
87
|
-
properties: {
|
|
88
|
-
method: { type: "string" },
|
|
89
|
-
path: { type: "string" }
|
|
90
|
-
},
|
|
91
|
-
additionalProperties: false
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
additionalProperties: false
|
|
96
|
-
},
|
|
97
|
-
examples: {
|
|
98
|
-
type: "array",
|
|
99
|
-
items: {
|
|
100
|
-
type: "object",
|
|
101
|
-
required: ["title", "input"],
|
|
102
|
-
properties: {
|
|
103
|
-
title: { type: "string" },
|
|
104
|
-
input: { type: "object" }
|
|
105
|
-
},
|
|
106
|
-
additionalProperties: false
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
additionalProperties: false
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
export {
|
|
114
|
-
operationCardSchema
|
|
115
|
-
};
|
|
116
|
-
//# sourceMappingURL=chunk-2W4L5YCC.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/registry/operation-card-schema.ts"],"sourcesContent":["export const operationCardSchema = {\n $id: \"https://ghx.local/schemas/operation-card.json\",\n type: \"object\",\n required: [\"capability_id\", \"version\", \"description\", \"input_schema\", \"output_schema\", \"routing\"],\n properties: {\n capability_id: { type: \"string\", minLength: 1 },\n version: { type: \"string\", minLength: 1 },\n description: { type: \"string\", minLength: 1 },\n input_schema: { type: \"object\" },\n output_schema: { type: \"object\" },\n routing: {\n type: \"object\",\n required: [\"preferred\", \"fallbacks\"],\n properties: {\n preferred: { enum: [\"cli\", \"graphql\", \"rest\"] },\n fallbacks: {\n type: \"array\",\n items: { enum: [\"cli\", \"graphql\", \"rest\"] }\n },\n suitability: {\n type: \"array\",\n items: {\n type: \"object\",\n required: [\"when\", \"predicate\", \"reason\"],\n properties: {\n when: { enum: [\"always\", \"env\", \"params\"] },\n predicate: { type: \"string\", minLength: 1 },\n reason: { type: \"string\", minLength: 1 }\n },\n additionalProperties: false\n }\n },\n notes: {\n type: \"array\",\n items: { type: \"string\" }\n }\n },\n additionalProperties: false\n },\n graphql: {\n type: \"object\",\n required: [\"operationName\", \"documentPath\"],\n properties: {\n operationName: { type: \"string\", minLength: 1 },\n documentPath: { type: \"string\", minLength: 1 },\n variables: { type: \"object\" },\n limits: {\n type: \"object\",\n properties: {\n maxPageSize: { type: \"number\" }\n },\n additionalProperties: false\n }\n },\n additionalProperties: false\n },\n cli: {\n type: \"object\",\n required: [\"command\"],\n properties: {\n command: { type: \"string\", minLength: 1 },\n jsonFields: {\n type: \"array\",\n items: { type: \"string\", minLength: 1 }\n },\n jq: { type: \"string\" },\n limits: {\n type: \"object\",\n properties: {\n maxItemsPerCall: { type: \"number\" }\n },\n additionalProperties: false\n }\n },\n additionalProperties: false\n },\n rest: {\n type: \"object\",\n required: [\"endpoints\"],\n properties: {\n endpoints: {\n type: \"array\",\n items: {\n type: \"object\",\n required: [\"method\", \"path\"],\n properties: {\n method: { type: \"string\" },\n path: { type: \"string\" }\n },\n additionalProperties: false\n }\n }\n },\n additionalProperties: false\n },\n examples: {\n type: \"array\",\n items: {\n type: \"object\",\n required: [\"title\", \"input\"],\n properties: {\n title: { type: \"string\" },\n input: { type: \"object\" }\n },\n additionalProperties: false\n }\n }\n },\n additionalProperties: false\n} as const\n"],"mappings":";AAAO,IAAM,sBAAsB;AAAA,EACjC,KAAK;AAAA,EACL,MAAM;AAAA,EACN,UAAU,CAAC,iBAAiB,WAAW,eAAe,gBAAgB,iBAAiB,SAAS;AAAA,EAChG,YAAY;AAAA,IACV,eAAe,EAAE,MAAM,UAAU,WAAW,EAAE;AAAA,IAC9C,SAAS,EAAE,MAAM,UAAU,WAAW,EAAE;AAAA,IACxC,aAAa,EAAE,MAAM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AAA,MACH,MAAM;AAAA,MACN,UAAU,CAAC,SAAS;AAAA,MACpB,YAAY;AAAA,QACV,SAAS,EAAE,MAAM,UAAU,WAAW,EAAE;AAAA,QACxC,YAAY;AAAA,UACV,MAAM;AAAA,UACN,OAAO,EAAE,MAAM,UAAU,WAAW,EAAE;AAAA,QACxC;AAAA,QACA,IAAI,EAAE,MAAM,SAAS;AAAA,QACrB,QAAQ;AAAA,UACN,MAAM;AAAA,UACN,YAAY;AAAA,YACV,iBAAiB,EAAE,MAAM,SAAS;AAAA,UACpC;AAAA,UACA,sBAAsB;AAAA,QACxB;AAAA,MACF;AAAA,MACA,sBAAsB;AAAA,IACxB;AAAA,IACA,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,UAAU,CAAC,WAAW;AAAA,MACtB,YAAY;AAAA,QACV,WAAW;AAAA,UACT,MAAM;AAAA,UACN,OAAO;AAAA,YACL,MAAM;AAAA,YACN,UAAU,CAAC,UAAU,MAAM;AAAA,YAC3B,YAAY;AAAA,cACV,QAAQ,EAAE,MAAM,SAAS;AAAA,cACzB,MAAM,EAAE,MAAM,SAAS;AAAA,YACzB;AAAA,YACA,sBAAsB;AAAA,UACxB;AAAA,QACF;AAAA,MACF;AAAA,MACA,sBAAsB;AAAA,IACxB;AAAA,IACA,UAAU;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,QACL,MAAM;AAAA,QACN,UAAU,CAAC,SAAS,OAAO;AAAA,QAC3B,YAAY;AAAA,UACV,OAAO,EAAE,MAAM,SAAS;AAAA,UACxB,OAAO,EAAE,MAAM,SAAS;AAAA,QAC1B;AAAA,QACA,sBAAsB;AAAA,MACxB;AAAA,IACF;AAAA,EACF;AAAA,EACA,sBAAsB;AACxB;","names":[]}
|
package/dist/chunk-3MRJX72M.js
DELETED
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
validateInput,
|
|
3
|
-
validateOutput
|
|
4
|
-
} from "./chunk-5JRLVOF2.js";
|
|
5
|
-
import {
|
|
6
|
-
logMetric
|
|
7
|
-
} from "./chunk-W2TKG2UL.js";
|
|
8
|
-
import {
|
|
9
|
-
normalizeError
|
|
10
|
-
} from "./chunk-QEAMC4IJ.js";
|
|
11
|
-
import {
|
|
12
|
-
errorCodes
|
|
13
|
-
} from "./chunk-UOJWOHRM.js";
|
|
14
|
-
|
|
15
|
-
// src/core/execute/execute.ts
|
|
16
|
-
function parsePredicateValue(raw) {
|
|
17
|
-
const value = raw.trim();
|
|
18
|
-
if (value === "true") {
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
if (value === "false") {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
if (value === "null") {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
const numeric = Number(value);
|
|
28
|
-
if (!Number.isNaN(numeric) && value.length > 0) {
|
|
29
|
-
return numeric;
|
|
30
|
-
}
|
|
31
|
-
return value.replace(/^['"]|['"]$/g, "");
|
|
32
|
-
}
|
|
33
|
-
function resolvePathValue(source, path) {
|
|
34
|
-
const segments = path.split(".").filter((segment) => segment.length > 0);
|
|
35
|
-
let current = source;
|
|
36
|
-
for (const segment of segments) {
|
|
37
|
-
if (typeof current !== "object" || current === null || Array.isArray(current)) {
|
|
38
|
-
return void 0;
|
|
39
|
-
}
|
|
40
|
-
current = current[segment];
|
|
41
|
-
}
|
|
42
|
-
return current;
|
|
43
|
-
}
|
|
44
|
-
function evaluateSuitabilityPreferred(card, params, routingContext) {
|
|
45
|
-
const rules = card.routing.suitability ?? [];
|
|
46
|
-
for (const rule of rules) {
|
|
47
|
-
const alwaysMatch = /^(cli|graphql|rest)$/i.exec(rule.predicate.trim());
|
|
48
|
-
const alwaysRoute = alwaysMatch?.[1];
|
|
49
|
-
if (rule.when === "always" && alwaysRoute) {
|
|
50
|
-
return alwaysRoute.toLowerCase();
|
|
51
|
-
}
|
|
52
|
-
const conditionalMatch = /^(cli|graphql|rest)\s+if\s+([a-zA-Z0-9_.]+)\s*(==|!=)\s*(.+)$/i.exec(
|
|
53
|
-
rule.predicate.trim()
|
|
54
|
-
);
|
|
55
|
-
if (!conditionalMatch) {
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
const [, targetRouteRaw = "", rawPath = "", operator = "==", rawExpected = ""] = conditionalMatch;
|
|
59
|
-
const targetRoute = targetRouteRaw.toLowerCase();
|
|
60
|
-
const source = rule.when === "env" ? routingContext : params;
|
|
61
|
-
const path = rawPath.startsWith("params.") || rawPath.startsWith("env.") ? rawPath.split(".").slice(1).join(".") : rawPath;
|
|
62
|
-
const actual = resolvePathValue(source, path);
|
|
63
|
-
const expected = parsePredicateValue(rawExpected);
|
|
64
|
-
const matches = operator === "==" ? actual === expected : actual !== expected;
|
|
65
|
-
if (matches) {
|
|
66
|
-
return targetRoute;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return card.routing.preferred;
|
|
70
|
-
}
|
|
71
|
-
function routePlan(card, params, routingContext) {
|
|
72
|
-
const preferred = evaluateSuitabilityPreferred(card, params, routingContext);
|
|
73
|
-
const planned = /* @__PURE__ */ new Set([preferred, ...card.routing.fallbacks]);
|
|
74
|
-
return [...planned];
|
|
75
|
-
}
|
|
76
|
-
async function execute(options) {
|
|
77
|
-
const inputValidation = validateInput(options.card.input_schema, options.params);
|
|
78
|
-
if (!inputValidation.ok) {
|
|
79
|
-
return normalizeError(
|
|
80
|
-
{
|
|
81
|
-
code: errorCodes.Validation,
|
|
82
|
-
message: "Input schema validation failed",
|
|
83
|
-
retryable: false,
|
|
84
|
-
details: { ajvErrors: inputValidation.errors }
|
|
85
|
-
},
|
|
86
|
-
options.card.routing.preferred,
|
|
87
|
-
{
|
|
88
|
-
capabilityId: options.card.capability_id,
|
|
89
|
-
reason: "INPUT_VALIDATION"
|
|
90
|
-
}
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
const attempts = [];
|
|
94
|
-
const maxAttemptsPerRoute = Math.max(1, options.retry?.maxAttemptsPerRoute ?? 1);
|
|
95
|
-
let lastError;
|
|
96
|
-
let firstError;
|
|
97
|
-
const routingContext = options.routingContext ?? {};
|
|
98
|
-
for (const route of routePlan(options.card, options.params, routingContext)) {
|
|
99
|
-
logMetric("route.plan", 1, {
|
|
100
|
-
capability_id: options.card.capability_id,
|
|
101
|
-
route
|
|
102
|
-
});
|
|
103
|
-
const preflight = await options.preflight(route);
|
|
104
|
-
if (!preflight.ok) {
|
|
105
|
-
logMetric("route.preflight_skipped", 1, {
|
|
106
|
-
capability_id: options.card.capability_id,
|
|
107
|
-
route,
|
|
108
|
-
error_code: preflight.code
|
|
109
|
-
});
|
|
110
|
-
attempts.push({ route, status: "skipped", error_code: preflight.code });
|
|
111
|
-
lastError = {
|
|
112
|
-
code: preflight.code,
|
|
113
|
-
message: preflight.message,
|
|
114
|
-
retryable: preflight.retryable,
|
|
115
|
-
...preflight.details ? { details: preflight.details } : {}
|
|
116
|
-
};
|
|
117
|
-
firstError ??= lastError;
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
const routeHandler = options.routes[route];
|
|
121
|
-
if (typeof routeHandler !== "function") {
|
|
122
|
-
logMetric("route.missing_handler", 1, {
|
|
123
|
-
capability_id: options.card.capability_id,
|
|
124
|
-
route
|
|
125
|
-
});
|
|
126
|
-
const handlerError = {
|
|
127
|
-
code: errorCodes.AdapterUnsupported,
|
|
128
|
-
message: `No route handler configured for '${route}'`,
|
|
129
|
-
retryable: false,
|
|
130
|
-
details: { route }
|
|
131
|
-
};
|
|
132
|
-
attempts.push({ route, status: "skipped", error_code: errorCodes.AdapterUnsupported });
|
|
133
|
-
lastError = handlerError;
|
|
134
|
-
firstError ??= handlerError;
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
for (let attempt = 0; attempt < maxAttemptsPerRoute; attempt += 1) {
|
|
138
|
-
const result = await routeHandler(options.params);
|
|
139
|
-
logMetric("route.attempt", 1, {
|
|
140
|
-
capability_id: options.card.capability_id,
|
|
141
|
-
route,
|
|
142
|
-
ok: result.ok
|
|
143
|
-
});
|
|
144
|
-
const attemptRecord = {
|
|
145
|
-
route,
|
|
146
|
-
status: result.ok ? "success" : "error"
|
|
147
|
-
};
|
|
148
|
-
if (result.error?.code) {
|
|
149
|
-
attemptRecord.error_code = result.error.code;
|
|
150
|
-
}
|
|
151
|
-
attempts.push(attemptRecord);
|
|
152
|
-
if (result.ok) {
|
|
153
|
-
const outputValidation = validateOutput(options.card.output_schema, result.data);
|
|
154
|
-
if (!outputValidation.ok) {
|
|
155
|
-
const envelope2 = normalizeError(
|
|
156
|
-
{
|
|
157
|
-
code: errorCodes.Server,
|
|
158
|
-
message: "Output schema validation failed",
|
|
159
|
-
retryable: false,
|
|
160
|
-
details: { ajvErrors: outputValidation.errors }
|
|
161
|
-
},
|
|
162
|
-
route,
|
|
163
|
-
{
|
|
164
|
-
capabilityId: options.card.capability_id,
|
|
165
|
-
reason: "OUTPUT_VALIDATION"
|
|
166
|
-
}
|
|
167
|
-
);
|
|
168
|
-
if (options.trace) {
|
|
169
|
-
envelope2.meta.attempts = attempts;
|
|
170
|
-
}
|
|
171
|
-
return envelope2;
|
|
172
|
-
}
|
|
173
|
-
if (options.trace) {
|
|
174
|
-
result.meta.attempts = attempts;
|
|
175
|
-
}
|
|
176
|
-
return result;
|
|
177
|
-
}
|
|
178
|
-
lastError = result.error;
|
|
179
|
-
firstError ??= result.error;
|
|
180
|
-
if (!result.error?.retryable) {
|
|
181
|
-
if (result.error?.code !== errorCodes.AdapterUnsupported) {
|
|
182
|
-
if (options.trace) {
|
|
183
|
-
result.meta.attempts = attempts;
|
|
184
|
-
}
|
|
185
|
-
return result;
|
|
186
|
-
}
|
|
187
|
-
break;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
const finalError = lastError ?? firstError ?? {
|
|
192
|
-
code: errorCodes.Unknown,
|
|
193
|
-
message: "No route produced a result",
|
|
194
|
-
retryable: false
|
|
195
|
-
};
|
|
196
|
-
const envelope = normalizeError(finalError, options.card.routing.preferred, {
|
|
197
|
-
capabilityId: options.card.capability_id,
|
|
198
|
-
reason: "CARD_FALLBACK"
|
|
199
|
-
});
|
|
200
|
-
if (options.trace) {
|
|
201
|
-
envelope.meta.attempts = attempts;
|
|
202
|
-
}
|
|
203
|
-
return envelope;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
export {
|
|
207
|
-
execute
|
|
208
|
-
};
|
|
209
|
-
//# sourceMappingURL=chunk-3MRJX72M.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/execute/execute.ts"],"sourcesContent":["import type { ErrorCode } from \"../errors/codes.js\"\nimport { errorCodes } from \"../errors/codes.js\"\nimport type { ResultEnvelope, RouteSource } from \"../contracts/envelope.js\"\nimport type { OperationCard } from \"../registry/types.js\"\nimport { validateInput, validateOutput } from \"../registry/schema-validator.js\"\nimport { normalizeError } from \"../execution/normalizer.js\"\nimport { logMetric } from \"../telemetry/logger.js\"\n\ntype PreflightResult =\n | { ok: true }\n | { ok: false; code: ErrorCode; message: string; retryable: boolean; details?: Record<string, unknown> }\n\ntype ExecuteOptions = {\n card: OperationCard\n params: Record<string, unknown>\n routingContext?: Record<string, unknown>\n trace?: boolean\n retry?: {\n maxAttemptsPerRoute?: number\n }\n preflight: (route: RouteSource) => Promise<PreflightResult>\n routes: Record<RouteSource, (params: Record<string, unknown>) => Promise<ResultEnvelope>>\n}\n\nfunction parsePredicateValue(raw: string): unknown {\n const value = raw.trim()\n if (value === \"true\") {\n return true\n }\n if (value === \"false\") {\n return false\n }\n if (value === \"null\") {\n return null\n }\n\n const numeric = Number(value)\n if (!Number.isNaN(numeric) && value.length > 0) {\n return numeric\n }\n\n return value.replace(/^['\"]|['\"]$/g, \"\")\n}\n\nfunction resolvePathValue(source: Record<string, unknown>, path: string): unknown {\n const segments = path.split(\".\").filter((segment) => segment.length > 0)\n let current: unknown = source\n\n for (const segment of segments) {\n if (typeof current !== \"object\" || current === null || Array.isArray(current)) {\n return undefined\n }\n\n current = (current as Record<string, unknown>)[segment]\n }\n\n return current\n}\n\nfunction evaluateSuitabilityPreferred(\n card: OperationCard,\n params: Record<string, unknown>,\n routingContext: Record<string, unknown>\n): RouteSource {\n const rules = card.routing.suitability ?? []\n\n for (const rule of rules) {\n const alwaysMatch = /^(cli|graphql|rest)$/i.exec(rule.predicate.trim())\n const alwaysRoute = alwaysMatch?.[1]\n if (rule.when === \"always\" && alwaysRoute) {\n return alwaysRoute.toLowerCase() as RouteSource\n }\n\n const conditionalMatch = /^(cli|graphql|rest)\\s+if\\s+([a-zA-Z0-9_.]+)\\s*(==|!=)\\s*(.+)$/i.exec(\n rule.predicate.trim()\n )\n\n if (!conditionalMatch) {\n continue\n }\n\n const [, targetRouteRaw = \"\", rawPath = \"\", operator = \"==\", rawExpected = \"\"] = conditionalMatch\n const targetRoute = targetRouteRaw.toLowerCase() as RouteSource\n const source = rule.when === \"env\" ? routingContext : params\n const path = rawPath.startsWith(\"params.\") || rawPath.startsWith(\"env.\")\n ? rawPath.split(\".\").slice(1).join(\".\")\n : rawPath\n const actual = resolvePathValue(source, path)\n const expected = parsePredicateValue(rawExpected)\n const matches = operator === \"==\" ? actual === expected : actual !== expected\n\n if (matches) {\n return targetRoute\n }\n }\n\n return card.routing.preferred\n}\n\nfunction routePlan(\n card: OperationCard,\n params: Record<string, unknown>,\n routingContext: Record<string, unknown>\n): RouteSource[] {\n const preferred = evaluateSuitabilityPreferred(card, params, routingContext)\n const planned = new Set<RouteSource>([preferred, ...card.routing.fallbacks])\n return [...planned]\n}\n\nexport async function execute(options: ExecuteOptions): Promise<ResultEnvelope> {\n const inputValidation = validateInput(options.card.input_schema, options.params)\n if (!inputValidation.ok) {\n return normalizeError(\n {\n code: errorCodes.Validation,\n message: \"Input schema validation failed\",\n retryable: false,\n details: { ajvErrors: inputValidation.errors }\n },\n options.card.routing.preferred,\n {\n capabilityId: options.card.capability_id,\n reason: \"INPUT_VALIDATION\"\n }\n )\n }\n\n const attempts: NonNullable<ResultEnvelope[\"meta\"][\"attempts\"]> = []\n const maxAttemptsPerRoute = Math.max(1, options.retry?.maxAttemptsPerRoute ?? 1)\n let lastError: ResultEnvelope[\"error\"]\n let firstError: ResultEnvelope[\"error\"]\n\n const routingContext = options.routingContext ?? {}\n\n for (const route of routePlan(options.card, options.params, routingContext)) {\n logMetric(\"route.plan\", 1, {\n capability_id: options.card.capability_id,\n route\n })\n\n const preflight = await options.preflight(route)\n if (!preflight.ok) {\n logMetric(\"route.preflight_skipped\", 1, {\n capability_id: options.card.capability_id,\n route,\n error_code: preflight.code\n })\n attempts.push({ route, status: \"skipped\", error_code: preflight.code })\n lastError = {\n code: preflight.code,\n message: preflight.message,\n retryable: preflight.retryable,\n ...(preflight.details ? { details: preflight.details } : {})\n }\n firstError ??= lastError\n continue\n }\n\n const routeHandler = options.routes[route]\n if (typeof routeHandler !== \"function\") {\n logMetric(\"route.missing_handler\", 1, {\n capability_id: options.card.capability_id,\n route\n })\n\n const handlerError = {\n code: errorCodes.AdapterUnsupported,\n message: `No route handler configured for '${route}'`,\n retryable: false,\n details: { route }\n }\n\n attempts.push({ route, status: \"skipped\", error_code: errorCodes.AdapterUnsupported })\n lastError = handlerError\n firstError ??= handlerError\n continue\n }\n\n for (let attempt = 0; attempt < maxAttemptsPerRoute; attempt += 1) {\n const result = await routeHandler(options.params)\n logMetric(\"route.attempt\", 1, {\n capability_id: options.card.capability_id,\n route,\n ok: result.ok\n })\n const attemptRecord: { route: RouteSource; status: \"success\" | \"error\"; error_code?: ErrorCode } = {\n route,\n status: result.ok ? \"success\" : \"error\"\n }\n if (result.error?.code) {\n attemptRecord.error_code = result.error.code\n }\n attempts.push(attemptRecord)\n\n if (result.ok) {\n const outputValidation = validateOutput(options.card.output_schema, result.data)\n if (!outputValidation.ok) {\n const envelope = normalizeError(\n {\n code: errorCodes.Server,\n message: \"Output schema validation failed\",\n retryable: false,\n details: { ajvErrors: outputValidation.errors }\n },\n route,\n {\n capabilityId: options.card.capability_id,\n reason: \"OUTPUT_VALIDATION\"\n }\n )\n\n if (options.trace) {\n envelope.meta.attempts = attempts\n }\n\n return envelope\n }\n\n if (options.trace) {\n result.meta.attempts = attempts\n }\n return result\n }\n\n lastError = result.error\n firstError ??= result.error\n if (!result.error?.retryable) {\n if (result.error?.code !== errorCodes.AdapterUnsupported) {\n if (options.trace) {\n result.meta.attempts = attempts\n }\n return result\n }\n break\n }\n }\n }\n\n const finalError = lastError ?? firstError ?? {\n code: errorCodes.Unknown,\n message: \"No route produced a result\",\n retryable: false\n }\n\n const envelope = normalizeError(finalError, options.card.routing.preferred, {\n capabilityId: options.card.capability_id,\n reason: \"CARD_FALLBACK\"\n })\n\n if (options.trace) {\n envelope.meta.attempts = attempts\n }\n\n return envelope\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,SAAS,oBAAoB,KAAsB;AACjD,QAAM,QAAQ,IAAI,KAAK;AACvB,MAAI,UAAU,QAAQ;AACpB,WAAO;AAAA,EACT;AACA,MAAI,UAAU,SAAS;AACrB,WAAO;AAAA,EACT;AACA,MAAI,UAAU,QAAQ;AACpB,WAAO;AAAA,EACT;AAEA,QAAM,UAAU,OAAO,KAAK;AAC5B,MAAI,CAAC,OAAO,MAAM,OAAO,KAAK,MAAM,SAAS,GAAG;AAC9C,WAAO;AAAA,EACT;AAEA,SAAO,MAAM,QAAQ,gBAAgB,EAAE;AACzC;AAEA,SAAS,iBAAiB,QAAiC,MAAuB;AAChF,QAAM,WAAW,KAAK,MAAM,GAAG,EAAE,OAAO,CAAC,YAAY,QAAQ,SAAS,CAAC;AACvE,MAAI,UAAmB;AAEvB,aAAW,WAAW,UAAU;AAC9B,QAAI,OAAO,YAAY,YAAY,YAAY,QAAQ,MAAM,QAAQ,OAAO,GAAG;AAC7E,aAAO;AAAA,IACT;AAEA,cAAW,QAAoC,OAAO;AAAA,EACxD;AAEA,SAAO;AACT;AAEA,SAAS,6BACP,MACA,QACA,gBACa;A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AA,MACF;AAAA,IACF;AAAA,EACF;AAEA,QAAM,aAAa,aAAa,cAAc;AAAA,IAC5C,MAAM,WAAW;AAAA,IACjB,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAEA,QAAM,WAAW,eAAe,YAAY,QAAQ,KAAK,QAAQ,WAAW;AAAA,IAC1E,cAAc,QAAQ,KAAK;AAAA,IAC3B,QAAQ;AAAA,EACV,CAAC;AAED,MAAI,QAAQ,OAAO;AACjB,aAAS,KAAK,WAAW;AAAA,EAC3B;AAEA,SAAO;AACT;","names":["envelope"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/agent-interface/tools/explain-tool.ts"],"sourcesContent":["import { getOperationCard } from \"../../core/registry/index.js\"\n\nexport type CapabilityExplanation = {\n capability_id: string\n purpose: string\n required_inputs: string[]\n preferred_route: \"cli\" | \"graphql\" | \"rest\"\n fallback_routes: Array<\"cli\" | \"graphql\" | \"rest\">\n output_fields: string[]\n}\n\nfunction extractRequiredInputs(inputSchema: Record<string, unknown> | null | undefined): string[] {\n if (!inputSchema || typeof inputSchema !== \"object\") {\n return []\n }\n\n const required = (inputSchema as Record<string, unknown>).required\n if (!Array.isArray(required)) {\n return []\n }\n\n return required.filter((entry): entry is string => typeof entry === \"string\")\n}\n\nfunction extractOutputFields(outputSchema: Record<string, unknown> | null | undefined): string[] {\n if (!outputSchema || typeof outputSchema !== \"object\") {\n return []\n }\n\n const properties = (outputSchema as Record<string, unknown>).properties\n if (!properties || typeof properties !== \"object\") {\n return []\n }\n\n return Object.keys(properties)\n}\n\nexport function explainCapability(capabilityId: string): CapabilityExplanation {\n const card = getOperationCard(capabilityId)\n if (!card) {\n throw new Error(`Unknown capability: ${capabilityId}`)\n }\n\n return {\n capability_id: card.capability_id,\n purpose: card.description,\n required_inputs: extractRequiredInputs(card.input_schema),\n preferred_route: card.routing.preferred,\n fallback_routes: [...card.routing.fallbacks],\n output_fields: extractOutputFields(card.output_schema)\n }\n}\n"],"mappings":";;;;;AAWA,SAAS,sBAAsB,aAAmE;AAChG,MAAI,CAAC,eAAe,OAAO,gBAAgB,UAAU;AACnD,WAAO,CAAC;AAAA,EACV;AAEA,QAAM,WAAY,YAAwC;AAC1D,MAAI,CAAC,MAAM,QAAQ,QAAQ,GAAG;AAC5B,WAAO,CAAC;AAAA,EACV;AAEA,SAAO,SAAS,OAAO,CAAC,UAA2B,OAAO,UAAU,QAAQ;AAC9E;AAEA,SAAS,oBAAoB,cAAoE;AAC/F,MAAI,CAAC,gBAAgB,OAAO,iBAAiB,UAAU;AACrD,WAAO,CAAC;AAAA,EACV;AAEA,QAAM,aAAc,aAAyC;AAC7D,MAAI,CAAC,cAAc,OAAO,eAAe,UAAU;AACjD,WAAO,CAAC;AAAA,EACV;AAEA,SAAO,OAAO,KAAK,UAAU;AAC/B;AAEO,SAAS,kBAAkB,cAA6C;AAC7E,QAAM,OAAO,iBAAiB,YAAY;AAC1C,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,MAAM,uBAAuB,YAAY,EAAE;AAAA,EACvD;AAEA,SAAO;AAAA,IACL,eAAe,KAAK;AAAA,IACpB,SAAS,KAAK;AAAA,IACd,iBAAiB,sBAAsB,KAAK,YAAY;AAAA,IACxD,iBAAiB,KAAK,QAAQ;AAAA,IAC9B,iBAAiB,CAAC,GAAG,KAAK,QAAQ,SAAS;AAAA,IAC3C,eAAe,oBAAoB,KAAK,aAAa;AAAA,EACvD;AACF;","names":[]}
|
package/dist/chunk-573MDG3I.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
errorCodes
|
|
3
|
-
} from "./chunk-UOJWOHRM.js";
|
|
4
|
-
|
|
5
|
-
// src/core/errors/retryability.ts
|
|
6
|
-
var retryableCodes = /* @__PURE__ */ new Set([
|
|
7
|
-
errorCodes.Network,
|
|
8
|
-
errorCodes.RateLimit,
|
|
9
|
-
errorCodes.Server
|
|
10
|
-
]);
|
|
11
|
-
function isRetryableErrorCode(code) {
|
|
12
|
-
return retryableCodes.has(code);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
isRetryableErrorCode
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=chunk-573MDG3I.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/errors/retryability.ts"],"sourcesContent":["import { errorCodes } from \"./codes.js\"\n\nconst retryableCodes = new Set<string>([\n errorCodes.Network,\n errorCodes.RateLimit,\n errorCodes.Server\n])\n\nexport function isRetryableErrorCode(code: string): boolean {\n return retryableCodes.has(code)\n}\n"],"mappings":";;;;;AAEA,IAAM,iBAAiB,oBAAI,IAAY;AAAA,EACrC,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AACb,CAAC;AAEM,SAAS,qBAAqB,MAAuB;AAC1D,SAAO,eAAe,IAAI,IAAI;AAChC;","names":[]}
|
package/dist/chunk-5JRLVOF2.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// src/core/registry/schema-validator.ts
|
|
2
|
-
import Ajv from "ajv";
|
|
3
|
-
var ajv = new Ajv({
|
|
4
|
-
allErrors: true,
|
|
5
|
-
strict: false
|
|
6
|
-
});
|
|
7
|
-
var validatorCache = /* @__PURE__ */ new WeakMap();
|
|
8
|
-
function mapAjvErrors(errors) {
|
|
9
|
-
if (!errors) {
|
|
10
|
-
return [];
|
|
11
|
-
}
|
|
12
|
-
return errors.map((error) => ({
|
|
13
|
-
instancePath: error.instancePath,
|
|
14
|
-
message: error.message ?? "schema validation failed",
|
|
15
|
-
keyword: error.keyword,
|
|
16
|
-
params: error.params
|
|
17
|
-
}));
|
|
18
|
-
}
|
|
19
|
-
function getValidator(schema) {
|
|
20
|
-
const cached = validatorCache.get(schema);
|
|
21
|
-
if (cached) {
|
|
22
|
-
return cached;
|
|
23
|
-
}
|
|
24
|
-
const validator = ajv.compile(schema);
|
|
25
|
-
validatorCache.set(schema, validator);
|
|
26
|
-
return validator;
|
|
27
|
-
}
|
|
28
|
-
function validate(schema, payload) {
|
|
29
|
-
const validator = getValidator(schema);
|
|
30
|
-
const ok = validator(payload);
|
|
31
|
-
if (ok) {
|
|
32
|
-
return { ok: true };
|
|
33
|
-
}
|
|
34
|
-
return {
|
|
35
|
-
ok: false,
|
|
36
|
-
errors: mapAjvErrors(validator.errors)
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
function validateInput(inputSchema, params) {
|
|
40
|
-
return validate(inputSchema, params);
|
|
41
|
-
}
|
|
42
|
-
function validateOutput(outputSchema, data) {
|
|
43
|
-
return validate(outputSchema, data);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export {
|
|
47
|
-
validateInput,
|
|
48
|
-
validateOutput
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=chunk-5JRLVOF2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/registry/schema-validator.ts"],"sourcesContent":["import Ajv from \"ajv\"\nimport type { ErrorObject, ValidateFunction } from \"ajv\"\n\ntype SchemaValidationError = {\n instancePath: string\n message: string\n keyword: string\n params: Record<string, unknown>\n}\n\ntype SchemaValidationResult =\n | { ok: true }\n | {\n ok: false\n errors: SchemaValidationError[]\n }\n\nconst ajv = new Ajv({\n allErrors: true,\n strict: false\n})\n\nconst validatorCache = new WeakMap<Record<string, unknown>, ValidateFunction>()\n\nfunction mapAjvErrors(errors: ErrorObject[] | null | undefined): SchemaValidationError[] {\n if (!errors) {\n return []\n }\n\n return errors.map((error) => ({\n instancePath: error.instancePath,\n message: error.message ?? \"schema validation failed\",\n keyword: error.keyword,\n params: error.params\n }))\n}\n\nfunction getValidator(schema: Record<string, unknown>): ValidateFunction {\n const cached = validatorCache.get(schema)\n if (cached) {\n return cached\n }\n\n const validator = ajv.compile(schema)\n validatorCache.set(schema, validator)\n return validator\n}\n\nfunction validate(schema: Record<string, unknown>, payload: unknown): SchemaValidationResult {\n const validator = getValidator(schema)\n const ok = validator(payload)\n\n if (ok) {\n return { ok: true }\n }\n\n return {\n ok: false,\n errors: mapAjvErrors(validator.errors)\n }\n}\n\nexport function validateInput(inputSchema: Record<string, unknown>, params: Record<string, unknown>): SchemaValidationResult {\n return validate(inputSchema, params)\n}\n\nexport function validateOutput(outputSchema: Record<string, unknown>, data: unknown): SchemaValidationResult {\n return validate(outputSchema, data)\n}\n"],"mappings":";AAAA,OAAO,SAAS;AAiBhB,IAAM,MAAM,IAAI,IAAI;AAAA,EAClB,WAAW;AAAA,EACX,QAAQ;AACV,CAAC;AAED,IAAM,iBAAiB,oBAAI,QAAmD;AAE9E,SAAS,aAAa,QAAmE;AACvF,MAAI,CAAC,QAAQ;AACX,WAAO,CAAC;AAAA,EACV;AAEA,SAAO,OAAO,IAAI,CAAC,WAAW;AAAA,IAC5B,cAAc,MAAM;AAAA,IACpB,SAAS,MAAM,WAAW;AAAA,IAC1B,SAAS,MAAM;AAAA,IACf,QAAQ,MAAM;AAAA,EAChB,EAAE;AACJ;AAEA,SAAS,aAAa,QAAmD;AACvE,QAAM,SAAS,eAAe,IAAI,MAAM;AACxC,MAAI,QAAQ;AACV,WAAO;AAAA,EACT;AAEA,QAAM,YAAY,IAAI,QAAQ,MAAM;AACpC,iBAAe,IAAI,QAAQ,SAAS;AACpC,SAAO;AACT;AAEA,SAAS,SAAS,QAAiC,SAA0C;AAC3F,QAAM,YAAY,aAAa,MAAM;AACrC,QAAM,KAAK,UAAU,OAAO;AAE5B,MAAI,IAAI;AACN,WAAO,EAAE,IAAI,KAAK;AAAA,EACpB;AAEA,SAAO;AAAA,IACL,IAAI;AAAA,IACJ,QAAQ,aAAa,UAAU,MAAM;AAAA,EACvC;AACF;AAEO,SAAS,cAAc,aAAsC,QAAyD;AAC3H,SAAO,SAAS,aAAa,MAAM;AACrC;AAEO,SAAS,eAAe,cAAuC,MAAuC;AAC3G,SAAO,SAAS,cAAc,IAAI;AACpC;","names":[]}
|
package/dist/chunk-B6RLMKS4.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
errorCodes
|
|
3
|
-
} from "./chunk-UOJWOHRM.js";
|
|
4
|
-
|
|
5
|
-
// src/core/errors/map-error.ts
|
|
6
|
-
function toMessage(error) {
|
|
7
|
-
if (error instanceof Error) {
|
|
8
|
-
return error.message;
|
|
9
|
-
}
|
|
10
|
-
return String(error);
|
|
11
|
-
}
|
|
12
|
-
function mapErrorToCode(error) {
|
|
13
|
-
const message = toMessage(error).toLowerCase();
|
|
14
|
-
if (message.includes("rate limit") || message.includes(" 429") || message.includes("too many requests")) {
|
|
15
|
-
return errorCodes.RateLimit;
|
|
16
|
-
}
|
|
17
|
-
if (message.includes("timeout")) {
|
|
18
|
-
return errorCodes.Network;
|
|
19
|
-
}
|
|
20
|
-
if (message.includes("econn") || message.includes("enotfound") || message.includes("eai_again") || message.includes("network") || message.includes("connection reset")) {
|
|
21
|
-
return errorCodes.Network;
|
|
22
|
-
}
|
|
23
|
-
if (message.includes(" 500") || message.includes(" 502") || message.includes(" 503") || message.includes(" 504")) {
|
|
24
|
-
return errorCodes.Server;
|
|
25
|
-
}
|
|
26
|
-
if (message.includes("auth") || message.includes("forbidden") || message.includes("unauthorized")) {
|
|
27
|
-
return errorCodes.Auth;
|
|
28
|
-
}
|
|
29
|
-
if (message.includes("validation") || message.includes("invalid") || message.includes("required") || message.includes("positive integer")) {
|
|
30
|
-
return errorCodes.Validation;
|
|
31
|
-
}
|
|
32
|
-
if (message.includes("not found") || message.includes(" 404")) {
|
|
33
|
-
return errorCodes.NotFound;
|
|
34
|
-
}
|
|
35
|
-
return errorCodes.Unknown;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export {
|
|
39
|
-
mapErrorToCode
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=chunk-B6RLMKS4.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/errors/map-error.ts"],"sourcesContent":["import { errorCodes } from \"./codes.js\"\nimport type { ErrorCode } from \"./codes.js\"\n\nfunction toMessage(error: unknown): string {\n if (error instanceof Error) {\n return error.message\n }\n\n return String(error)\n}\n\nexport function mapErrorToCode(error: unknown): ErrorCode {\n const message = toMessage(error).toLowerCase()\n\n if (message.includes(\"rate limit\") || message.includes(\" 429\") || message.includes(\"too many requests\")) {\n return errorCodes.RateLimit\n }\n\n if (message.includes(\"timeout\")) {\n return errorCodes.Network\n }\n\n if (\n message.includes(\"econn\") ||\n message.includes(\"enotfound\") ||\n message.includes(\"eai_again\") ||\n message.includes(\"network\") ||\n message.includes(\"connection reset\")\n ) {\n return errorCodes.Network\n }\n\n if (message.includes(\" 500\") || message.includes(\" 502\") || message.includes(\" 503\") || message.includes(\" 504\")) {\n return errorCodes.Server\n }\n\n if (message.includes(\"auth\") || message.includes(\"forbidden\") || message.includes(\"unauthorized\")) {\n return errorCodes.Auth\n }\n\n if (\n message.includes(\"validation\") ||\n message.includes(\"invalid\") ||\n message.includes(\"required\") ||\n message.includes(\"positive integer\")\n ) {\n return errorCodes.Validation\n }\n\n if (message.includes(\"not found\") || message.includes(\" 404\")) {\n return errorCodes.NotFound\n }\n\n return errorCodes.Unknown\n}\n"],"mappings":";;;;;AAGA,SAAS,UAAU,OAAwB;AACzC,MAAI,iBAAiB,OAAO;AAC1B,WAAO,MAAM;AAAA,EACf;AAEA,SAAO,OAAO,KAAK;AACrB;AAEO,SAAS,eAAe,OAA2B;AACxD,QAAM,UAAU,UAAU,KAAK,EAAE,YAAY;AAE7C,MAAI,QAAQ,SAAS,YAAY,KAAK,QAAQ,SAAS,MAAM,KAAK,QAAQ,SAAS,mBAAmB,GAAG;AACvG,WAAO,WAAW;AAAA,EACpB;AAEA,MAAI,QAAQ,SAAS,SAAS,GAAG;AAC/B,WAAO,WAAW;AAAA,EACpB;AAEA,MACE,QAAQ,SAAS,OAAO,KACxB,QAAQ,SAAS,WAAW,KAC5B,QAAQ,SAAS,WAAW,KAC5B,QAAQ,SAAS,SAAS,KAC1B,QAAQ,SAAS,kBAAkB,GACnC;AACA,WAAO,WAAW;AAAA,EACpB;AAEA,MAAI,QAAQ,SAAS,MAAM,KAAK,QAAQ,SAAS,MAAM,KAAK,QAAQ,SAAS,MAAM,KAAK,QAAQ,SAAS,MAAM,GAAG;AAChH,WAAO,WAAW;AAAA,EACpB;AAEA,MAAI,QAAQ,SAAS,MAAM,KAAK,QAAQ,SAAS,WAAW,KAAK,QAAQ,SAAS,cAAc,GAAG;AACjG,WAAO,WAAW;AAAA,EACpB;AAEA,MACE,QAAQ,SAAS,YAAY,KAC7B,QAAQ,SAAS,SAAS,KAC1B,QAAQ,SAAS,UAAU,KAC3B,QAAQ,SAAS,kBAAkB,GACnC;AACA,WAAO,WAAW;AAAA,EACpB;AAEA,MAAI,QAAQ,SAAS,WAAW,KAAK,QAAQ,SAAS,MAAM,GAAG;AAC7D,WAAO,WAAW;AAAA,EACpB;AAEA,SAAO,WAAW;AACpB;","names":[]}
|
package/dist/chunk-D746VR3B.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// src/gql/operations/issue-list.generated.ts
|
|
2
|
-
var IssueListDocument = `
|
|
3
|
-
query IssueList($owner: String!, $name: String!, $first: Int!, $after: String) {
|
|
4
|
-
repository(owner: $owner, name: $name) {
|
|
5
|
-
issues(
|
|
6
|
-
first: $first
|
|
7
|
-
after: $after
|
|
8
|
-
orderBy: {field: CREATED_AT, direction: DESC}
|
|
9
|
-
) {
|
|
10
|
-
nodes {
|
|
11
|
-
id
|
|
12
|
-
number
|
|
13
|
-
title
|
|
14
|
-
state
|
|
15
|
-
url
|
|
16
|
-
}
|
|
17
|
-
pageInfo {
|
|
18
|
-
endCursor
|
|
19
|
-
hasNextPage
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
`;
|
|
25
|
-
var defaultWrapper = (action, _operationName, _operationType, _variables) => action();
|
|
26
|
-
function getSdk(client, withWrapper = defaultWrapper) {
|
|
27
|
-
return {
|
|
28
|
-
IssueList(variables, requestHeaders, signal) {
|
|
29
|
-
return withWrapper((wrappedRequestHeaders) => client.request({ document: IssueListDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "IssueList", "query", variables);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export {
|
|
35
|
-
IssueListDocument,
|
|
36
|
-
getSdk
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=chunk-D746VR3B.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/gql/operations/issue-list.generated.ts"],"sourcesContent":["import type * as Types from '../generated/common-types';\n\nimport type { GraphQLClient, RequestOptions } from 'graphql-request';\ntype GraphQLClientRequestHeaders = RequestOptions['requestHeaders'];\nexport type IssueListQueryVariables = Types.Exact<{\n owner: Types.Scalars['String']['input'];\n name: Types.Scalars['String']['input'];\n first: Types.Scalars['Int']['input'];\n after?: Types.InputMaybe<Types.Scalars['String']['input']>;\n}>;\n\n\nexport type IssueListQuery = { __typename?: 'Query', repository?: { __typename?: 'Repository', issues: { __typename?: 'IssueConnection', nodes?: Array<{ __typename?: 'Issue', id: string, number: number, title: string, state: Types.IssueState, url: any } | null> | null, pageInfo: { __typename?: 'PageInfo', endCursor?: string | null, hasNextPage: boolean } } } | null };\n\n\nexport const IssueListDocument = `\n query IssueList($owner: String!, $name: String!, $first: Int!, $after: String) {\n repository(owner: $owner, name: $name) {\n issues(\n first: $first\n after: $after\n orderBy: {field: CREATED_AT, direction: DESC}\n ) {\n nodes {\n id\n number\n title\n state\n url\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n}\n `;\n\nexport type SdkFunctionWrapper = <T>(action: (requestHeaders?:Record<string, string>) => Promise<T>, operationName: string, operationType?: string, variables?: any) => Promise<T>;\n\n\nconst defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType, _variables) => action();\n\nexport function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper = defaultWrapper) {\n return {\n IssueList(variables: IssueListQueryVariables, requestHeaders?: GraphQLClientRequestHeaders, signal?: RequestInit['signal']): Promise<IssueListQuery> {\n return withWrapper((wrappedRequestHeaders) => client.request<IssueListQuery>({ document: IssueListDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), 'IssueList', 'query', variables);\n }\n };\n}\nexport type Sdk = ReturnType<typeof getSdk>;"],"mappings":";AAeO,IAAM,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BjC,IAAM,iBAAqC,CAAC,QAAQ,gBAAgB,gBAAgB,eAAe,OAAO;AAEnG,SAAS,OAAO,QAAuB,cAAkC,gBAAgB;AAC9F,SAAO;AAAA,IACL,UAAU,WAAoC,gBAA8C,QAAyD;AACnJ,aAAO,YAAY,CAAC,0BAA0B,OAAO,QAAwB,EAAE,UAAU,mBAAmB,WAAW,gBAAgB,EAAE,GAAG,gBAAgB,GAAG,sBAAsB,GAAG,OAAO,CAAC,GAAG,aAAa,SAAS,SAAS;AAAA,IACpO;AAAA,EACF;AACF;","names":[]}
|