@cursor/july 0.1.42 → 0.1.45
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/AGENTS.md +1 -0
- package/dist/bin/agent-serve.js +3 -1
- package/dist/channels/github/api.d.ts +5 -0
- package/dist/channels/github/api.d.ts.map +1 -1
- package/dist/channels/github/api.js +18 -0
- package/dist/channels/github/defaults.d.ts +4 -5
- package/dist/channels/github/defaults.d.ts.map +1 -1
- package/dist/channels/github/defaults.js +27 -1
- package/dist/channels/github/github-channel.d.ts.map +1 -1
- package/dist/channels/github/github-channel.js +41 -10
- package/dist/channels/github/index.d.ts +1 -0
- package/dist/channels/github/index.d.ts.map +1 -1
- package/dist/channels/github/index.js +1 -0
- package/dist/channels/github/progress.d.ts +54 -0
- package/dist/channels/github/progress.d.ts.map +1 -0
- package/dist/channels/github/progress.js +168 -0
- package/dist/channels/github/state.d.ts +2 -0
- package/dist/channels/github/state.d.ts.map +1 -1
- package/dist/channels/github/state.js +1 -1
- package/dist/channels/github/types.d.ts +16 -4
- package/dist/channels/github/types.d.ts.map +1 -1
- package/dist/channels/slack/slack-channel.d.ts +4 -0
- package/dist/channels/slack/slack-channel.d.ts.map +1 -1
- package/dist/channels/slack/slack-channel.js +4 -0
- package/dist/channels.d.ts +17 -0
- package/dist/channels.d.ts.map +1 -1
- package/dist/channels.js +31 -0
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +4 -4
- package/dist/docs/assets/{app.C4-Gwi7g.js → app.fHnNXEJ6.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.BMT0xM4I.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.DDoLm843.js → VPLocalSearchBox.Cf6ghfFY.js} +1 -1
- package/dist/docs/assets/chunks/{theme.SbjGIiM0.js → theme.B_5-VLe8.js} +2 -2
- package/dist/docs/assets/{deployment.md.BHVjVqRa.js → deployment.md.Cdp4rTE4.js} +1 -1
- package/dist/docs/assets/{guides_github.md.R2QlpR75.js → guides_github.md.DSg0j9qj.js} +29 -3
- package/dist/docs/assets/{guides_github.md.R2QlpR75.lean.js → guides_github.md.DSg0j9qj.lean.js} +1 -1
- package/dist/docs/assets/guides_opentelemetry.md.Csn7ZI25.js +27 -0
- package/dist/docs/assets/guides_opentelemetry.md.Csn7ZI25.lean.js +1 -0
- package/dist/docs/assets/index.md.COeoSkcF.js +5 -0
- package/dist/docs/assets/index.md.COeoSkcF.lean.js +1 -0
- package/dist/docs/assets/{quickstart.md.rIbfahJM.js → quickstart.md.DZxBu44y.js} +18 -49
- package/dist/docs/assets/quickstart.md.DZxBu44y.lean.js +1 -0
- package/dist/docs/assets/{reference_agent-config.md.CRmkoxd6.js → reference_agent-config.md.XRpxctsA.js} +9 -4
- package/dist/docs/assets/{reference_agent-config.md.CRmkoxd6.lean.js → reference_agent-config.md.XRpxctsA.lean.js} +1 -1
- package/dist/docs/assets/{reference_channels.md.BIabFUAI.js → reference_channels.md.MN8iDy8V.js} +1 -1
- package/dist/docs/assets/{reference_cli.md.DqEqQpGn.js → reference_cli.md.BDmjPPAm.js} +2 -2
- package/dist/docs/assets/{reference_hooks.md.B40QAG6m.js → reference_hooks.md.4cbRRIIu.js} +2 -2
- package/dist/docs/assets/{reference_hooks.md.B40QAG6m.lean.js → reference_hooks.md.4cbRRIIu.lean.js} +1 -1
- package/dist/docs/assets/{reference_project-layout.md._XdeMahr.js → reference_project-layout.md.D3MdHM2z.js} +2 -1
- package/dist/docs/assets/{reference_tools.md.lSrsTxYJ.js → reference_tools.md.kJfJAP2m.js} +1 -1
- package/dist/docs/assets/templates_triage.md.CConZt1z.js +11 -0
- package/dist/docs/assets/templates_triage.md.CConZt1z.lean.js +1 -0
- package/dist/docs/building-with-agents.html +5 -5
- package/dist/docs/concepts.html +5 -5
- package/dist/docs/deployment.html +6 -6
- package/dist/docs/evals.html +4 -4
- package/dist/docs/example-agents/approval-buddy.html +4 -4
- package/dist/docs/example-agents/benny.html +4 -4
- package/dist/docs/example-agents/bugbot.html +4 -4
- package/dist/docs/example-agents/codebase-wiki.html +4 -4
- package/dist/docs/example-agents/codeowners-review.html +4 -4
- package/dist/docs/example-agents/concierge.html +4 -4
- package/dist/docs/example-agents/fsd.html +4 -4
- package/dist/docs/example-agents/index.html +5 -5
- package/dist/docs/example-agents/knowledge-base.html +4 -4
- package/dist/docs/example-agents/oncall.html +4 -4
- package/dist/docs/example-agents/security-reviewer.html +4 -4
- package/dist/docs/example-agents/slack-agent.html +4 -4
- package/dist/docs/example-agents/weather-agent.html +4 -4
- package/dist/docs/guides/agent-to-agent.html +4 -4
- package/dist/docs/guides/cloud-runtime.html +5 -5
- package/dist/docs/guides/github.html +33 -7
- package/dist/docs/guides/human-in-the-loop.html +4 -4
- package/dist/docs/guides/mcp-oauth.html +4 -4
- package/dist/docs/guides/opentelemetry.html +51 -0
- package/dist/docs/guides/slack.html +4 -4
- package/dist/docs/guides/webhooks.html +4 -4
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +4 -4
- package/dist/docs/index.html +8 -27
- package/dist/docs/quickstart.html +24 -55
- package/dist/docs/reference/agent-config.html +12 -7
- package/dist/docs/reference/artifacts.html +4 -4
- package/dist/docs/reference/channels.html +6 -6
- package/dist/docs/reference/cli.html +7 -7
- package/dist/docs/reference/connections.html +4 -4
- package/dist/docs/reference/hooks.html +6 -6
- package/dist/docs/reference/http-api.html +4 -4
- package/dist/docs/reference/instructions.html +4 -4
- package/dist/docs/reference/playground.html +4 -4
- package/dist/docs/reference/project-layout.html +7 -6
- package/dist/docs/reference/prompt.html +4 -4
- package/dist/docs/reference/schedules.html +4 -4
- package/dist/docs/reference/sessions.html +4 -4
- package/dist/docs/reference/skills.html +4 -4
- package/dist/docs/reference/subagents.html +4 -4
- package/dist/docs/reference/tools.html +6 -6
- package/dist/docs/scaffolding-agents.html +4 -4
- package/dist/docs/storage.html +4 -4
- package/dist/docs/templates/triage.html +35 -0
- package/dist/docs/troubleshooting.html +4 -4
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/internal/cli-ax.d.ts +1 -0
- package/dist/internal/cli-ax.d.ts.map +1 -1
- package/dist/internal/cli-ax.js +20 -5
- package/dist/internal/cli-deploy.d.ts.map +1 -1
- package/dist/internal/cli-deploy.js +38 -7
- package/dist/internal/deploy-client.d.ts +8 -0
- package/dist/internal/deploy-client.d.ts.map +1 -1
- package/dist/internal/deploy-client.js +5 -2
- package/dist/internal/discovery.d.ts.map +1 -1
- package/dist/internal/discovery.js +82 -13
- package/dist/internal/distribution.d.ts.map +1 -1
- package/dist/internal/distribution.js +1 -0
- package/dist/internal/host-otel.d.ts +25 -0
- package/dist/internal/host-otel.d.ts.map +1 -0
- package/dist/internal/host-otel.js +162 -0
- package/dist/internal/init-project.d.ts +24 -0
- package/dist/internal/init-project.d.ts.map +1 -1
- package/dist/internal/init-project.js +136 -17
- package/dist/internal/otel/attrs.d.ts +7 -0
- package/dist/internal/otel/attrs.d.ts.map +1 -0
- package/dist/internal/otel/attrs.js +13 -0
- package/dist/internal/otel/collector.d.ts +21 -0
- package/dist/internal/otel/collector.d.ts.map +1 -0
- package/dist/internal/otel/collector.js +605 -0
- package/dist/internal/otel/config.d.ts +42 -0
- package/dist/internal/otel/config.d.ts.map +1 -0
- package/dist/internal/otel/config.js +236 -0
- package/dist/internal/otel/http.d.ts +11 -0
- package/dist/internal/otel/http.d.ts.map +1 -0
- package/dist/internal/otel/http.js +97 -0
- package/dist/internal/otel/runtime.d.ts +21 -0
- package/dist/internal/otel/runtime.d.ts.map +1 -0
- package/dist/internal/otel/runtime.js +188 -0
- package/dist/internal/sdk-runner.d.ts +1 -1
- package/dist/internal/sdk-runner.d.ts.map +1 -1
- package/dist/internal/sdk-runner.js +1 -1
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +26 -1
- package/dist/internal/session-engine.d.ts +15 -2
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +58 -7
- package/dist/memory.d.ts +4 -0
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +4 -0
- package/dist/otel.d.ts +88 -0
- package/dist/otel.d.ts.map +1 -0
- package/dist/otel.js +64 -0
- package/dist/playground/assets/index-CZH9EFvO.css +1 -0
- package/dist/playground/assets/{index-B3HBneZZ.js → index-Dces8BDp.js} +34 -34
- package/dist/playground/index.html +2 -2
- package/dist/types.d.ts +103 -3
- package/dist/types.d.ts.map +1 -1
- package/docs/README.md +35 -105
- package/docs/deployment.md +2 -1
- package/docs/guides/github.md +79 -6
- package/docs/guides/opentelemetry.md +214 -0
- package/docs/quickstart.md +89 -227
- package/docs/reference/agent-config.md +52 -0
- package/docs/reference/channels.md +3 -1
- package/docs/reference/cli.md +2 -2
- package/docs/reference/hooks.md +21 -4
- package/docs/reference/project-layout.md +2 -0
- package/docs/reference/tools.md +5 -4
- package/docs/templates/triage.md +147 -0
- package/package.json +24 -2
- package/skills/create-agent/SKILL.md +2 -2
- package/skills/framework-map/SKILL.md +2 -0
- package/skills/otel/SKILL.md +98 -0
- package/src/bin/agent-serve.ts +3 -1
- package/src/channels/github/api.ts +22 -0
- package/src/channels/github/defaults.ts +27 -6
- package/src/channels/github/github-channel.ts +36 -1
- package/src/channels/github/index.ts +1 -0
- package/src/channels/github/progress.ts +243 -0
- package/src/channels/github/state.ts +3 -0
- package/src/channels/github/types.ts +12 -4
- package/src/channels/slack/slack-channel.ts +4 -0
- package/src/channels.ts +38 -0
- package/src/index.ts +7 -0
- package/src/internal/cli-ax.ts +21 -3
- package/src/internal/cli-deploy.ts +58 -3
- package/src/internal/deploy-client.ts +11 -0
- package/src/internal/discovery.ts +108 -4
- package/src/internal/distribution.ts +1 -0
- package/src/internal/host-otel.ts +252 -0
- package/src/internal/init-project.ts +160 -17
- package/src/internal/otel/attrs.ts +18 -0
- package/src/internal/otel/collector.ts +881 -0
- package/src/internal/otel/config.ts +307 -0
- package/src/internal/otel/http.ts +126 -0
- package/src/internal/otel/runtime.ts +271 -0
- package/src/internal/sdk-runner.ts +6 -0
- package/src/internal/server.ts +39 -1
- package/src/internal/session-engine.ts +83 -2
- package/src/memory.ts +4 -0
- package/src/otel.ts +155 -0
- package/src/types.ts +109 -3
- package/templates/triage/README.md +48 -0
- package/templates/triage/agent/agent.ts +14 -0
- package/templates/triage/agent/channels/intake.ts +20 -0
- package/templates/triage/agent/channels/slack.ts +3 -0
- package/templates/triage/agent/hooks/memory.ts +3 -0
- package/templates/triage/agent/instructions.md +27 -0
- package/templates/triage/agent/skills/triage-rubric.md +43 -0
- package/templates/triage/agent/tools/record_triage.ts +23 -0
- package/templates/triage/evals/evals.config.ts +5 -0
- package/templates/triage/evals/triage.eval.ts +43 -0
- package/templates/triage/package.json +18 -0
- package/templates/triage/tsconfig.json +12 -0
- package/dist/docs/assets/chunks/@localSearchIndexroot.BlU3A8EB.js +0 -1
- package/dist/docs/assets/index.md.BKpbkCa6.js +0 -24
- package/dist/docs/assets/index.md.BKpbkCa6.lean.js +0 -1
- package/dist/docs/assets/quickstart.md.rIbfahJM.lean.js +0 -1
- package/dist/playground/assets/index-Bqk9nplh.css +0 -1
- /package/dist/docs/assets/{deployment.md.BHVjVqRa.lean.js → deployment.md.Cdp4rTE4.lean.js} +0 -0
- /package/dist/docs/assets/{reference_channels.md.BIabFUAI.lean.js → reference_channels.md.MN8iDy8V.lean.js} +0 -0
- /package/dist/docs/assets/{reference_cli.md.DqEqQpGn.lean.js → reference_cli.md.BDmjPPAm.lean.js} +0 -0
- /package/dist/docs/assets/{reference_project-layout.md._XdeMahr.lean.js → reference_project-layout.md.D3MdHM2z.lean.js} +0 -0
- /package/dist/docs/assets/{reference_tools.md.lSrsTxYJ.lean.js → reference_tools.md.kJfJAP2m.lean.js} +0 -0
package/AGENTS.md
CHANGED
|
@@ -29,6 +29,7 @@ Open them directly — there are no `.cursor/skills/` stubs for authoring.
|
|
|
29
29
|
| `skills/create-agent/SKILL.md` | Scaffolding a new agent (interview → scaffold → verify) |
|
|
30
30
|
| `skills/evals/SKILL.md` | Writing evals; fixture strategy; the regression ratchet |
|
|
31
31
|
| `skills/ab/SKILL.md` | Live A/B metrics (`defineAB` under `agent/ab`); not a test runner |
|
|
32
|
+
| `skills/otel/SKILL.md` | OpenTelemetry export (`defineOtel` / OTLP env / `ctx.host.otel`) |
|
|
32
33
|
| `skills/hillclimb/SKILL.md` | Improving an existing agent measurably |
|
|
33
34
|
| `skills/github/SKILL.md` | GitHub webhook agents; replay / forward / fixtures / cursor-events |
|
|
34
35
|
| `skills/setup-slack/SKILL.md` | Slack wiring and Slack tool approvals |
|
package/dist/bin/agent-serve.js
CHANGED
|
@@ -70,7 +70,7 @@ Usage:
|
|
|
70
70
|
${CLI} trajectory --events <file.ndjson> [--text]
|
|
71
71
|
${CLI} call <tool> [--input <json>] [--dir <path> | --url <baseUrl> | --prod]
|
|
72
72
|
[--session <id>] [--slug <slug>] [--team <id>]
|
|
73
|
-
${CLI} init [dir] [--json]
|
|
73
|
+
${CLI} init [dir] [--template <name>] [--json]
|
|
74
74
|
${CLI} convert-automation <url> [--dir <path>] [--json]
|
|
75
75
|
${CLI} install-skills [--print] [--json]
|
|
76
76
|
${CLI} mcp --prod [--slug <slug>] [--team <id>] [--dir <path>]
|
|
@@ -433,6 +433,7 @@ function main(argv) {
|
|
|
433
433
|
allowPositionals: true,
|
|
434
434
|
options: {
|
|
435
435
|
dir: { type: "string", default: "." },
|
|
436
|
+
template: { type: "string" },
|
|
436
437
|
port: { type: "string" },
|
|
437
438
|
host: { type: "string" },
|
|
438
439
|
mode: { type: "string" },
|
|
@@ -584,6 +585,7 @@ function main(argv) {
|
|
|
584
585
|
return cmdInit({
|
|
585
586
|
dir,
|
|
586
587
|
initTarget: positionals[0],
|
|
588
|
+
template: values.template,
|
|
587
589
|
json: values.json,
|
|
588
590
|
});
|
|
589
591
|
}
|
|
@@ -77,6 +77,11 @@ export declare function createGitHubIssueComment(input: GitHubResourceInput & {
|
|
|
77
77
|
body: string;
|
|
78
78
|
issueNumber: number;
|
|
79
79
|
}): Promise<GitHubPostedComment>;
|
|
80
|
+
/** Update an issue or PR timeline comment by id. */
|
|
81
|
+
export declare function updateGitHubIssueComment(input: GitHubResourceInput & {
|
|
82
|
+
body: string;
|
|
83
|
+
commentId: number;
|
|
84
|
+
}): Promise<GitHubPostedComment>;
|
|
80
85
|
/** Reply to an inline pull-request review comment thread. */
|
|
81
86
|
export declare function createGitHubReviewCommentReply(input: GitHubResourceInput & {
|
|
82
87
|
body: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/channels/github/api.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,KAAK,oBAAoB,EAO1B,MAAM,WAAW,CAAC;AAMnB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAE3D,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACvD,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;AAE1E,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB;CAAG;AAEjE,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,OAAO;IAC5C,IAAI,EAAE,CAAC,CAAC;IACR,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,YAAY,KAAK,EAAE;QACjB,IAAI,EAAE,O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E,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,GACA,OAAO,CAAC,mBAAmB,CAAC,CAkB9B;AAED,uDAAuD;AACvD,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,mBAAmB,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,qBAAqB,CAAC;IAC/B,OAAO,EAAE,eAAe,GAAG,6BAA6B,CAAC;CAC1D,GACA,OAAO,CAAC,iBAAiB,CAAC,CA+B5B;AAED,sDAAsD;AACtD,wBAAsB,wBAAwB,CAC5C,KAAK,EAAE,mBAAmB,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GACA,OAAO,CAAC,iBAAiB,CAAC,CA0B5B"}
|
|
@@ -154,6 +154,24 @@ export function createGitHubIssueComment(input) {
|
|
|
154
154
|
}
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
|
+
/** Update an issue or PR timeline comment by id. */
|
|
158
|
+
export function updateGitHubIssueComment(input) {
|
|
159
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
160
|
+
const octokit = yield createGitHubOctokit(input);
|
|
161
|
+
try {
|
|
162
|
+
const response = yield octokit.rest.issues.updateComment({
|
|
163
|
+
owner: input.owner,
|
|
164
|
+
repo: input.repo,
|
|
165
|
+
comment_id: input.commentId,
|
|
166
|
+
body: input.body,
|
|
167
|
+
});
|
|
168
|
+
return toPostedComment(response.data);
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
throw wrapOctokitError(error, "PATCH", `/repos/${input.owner}/${input.repo}/issues/comments/${input.commentId}`);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}
|
|
157
175
|
/** Reply to an inline pull-request review comment thread. */
|
|
158
176
|
export function createGitHubReviewCommentReply(input) {
|
|
159
177
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { ChannelEventHandlers } from "../../types.js";
|
|
5
5
|
import type { GitHubBindingConfig } from "./binding.js";
|
|
6
|
+
import { type GitHubProgressConfig } from "./progress.js";
|
|
6
7
|
import type { GitHubChannelState } from "./state.js";
|
|
7
|
-
export interface GitHubProgressConfig {
|
|
8
|
-
/** When false, skip the eyes reaction on turn.started. Defaults to true. */
|
|
9
|
-
reactions?: boolean;
|
|
10
|
-
}
|
|
11
8
|
export interface BuildDefaultGitHubEventsOptions extends GitHubBindingConfig {
|
|
9
|
+
botName?: string;
|
|
12
10
|
progress?: GitHubProgressConfig;
|
|
13
11
|
/**
|
|
14
12
|
* When false, skip posting completed assistant messages back to GitHub.
|
|
@@ -17,7 +15,8 @@ export interface BuildDefaultGitHubEventsOptions extends GitHubBindingConfig {
|
|
|
17
15
|
deliverReplies?: boolean;
|
|
18
16
|
}
|
|
19
17
|
/**
|
|
20
|
-
* Built-in delivery: eyes reaction on turn start,
|
|
18
|
+
* Built-in delivery: eyes reaction on turn start, optional commit status /
|
|
19
|
+
* sticky banner via {@link GitHubProgressConfig}, post assistant text on
|
|
21
20
|
* `message.completed`, and a short error comment on turn/session failure.
|
|
22
21
|
*/
|
|
23
22
|
export declare function buildDefaultGitHubEvents(options?: BuildDefaultGitHubEventsOptions): ChannelEventHandlers<GitHubChannelState>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/channels/github/defaults.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/channels/github/defaults.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,EAAuB,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,MAAM,WAAW,+BAAgC,SAAQ,mBAAmB;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,GAAE,+BAAoC,GAC5C,oBAAoB,CAAC,kBAAkB,CAAC,CA0E1C"}
|
|
@@ -11,8 +11,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
});
|
|
12
12
|
};
|
|
13
13
|
import { buildGitHubBinding, formatGitHubOutboundComment } from "./binding.js";
|
|
14
|
+
import { applyGitHubProgress } from "./progress.js";
|
|
14
15
|
/**
|
|
15
|
-
* Built-in delivery: eyes reaction on turn start,
|
|
16
|
+
* Built-in delivery: eyes reaction on turn start, optional commit status /
|
|
17
|
+
* sticky banner via {@link GitHubProgressConfig}, post assistant text on
|
|
16
18
|
* `message.completed`, and a short error comment on turn/session failure.
|
|
17
19
|
*/
|
|
18
20
|
export function buildDefaultGitHubEvents(options = {}) {
|
|
@@ -21,6 +23,11 @@ export function buildDefaultGitHubEvents(options = {}) {
|
|
|
21
23
|
"turn.started"(_event, channel) {
|
|
22
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
25
|
var _a;
|
|
26
|
+
yield applyGitHubProgress({
|
|
27
|
+
phase: "pending",
|
|
28
|
+
channel,
|
|
29
|
+
options,
|
|
30
|
+
});
|
|
24
31
|
if (((_a = options.progress) === null || _a === void 0 ? void 0 : _a.reactions) === false) {
|
|
25
32
|
return;
|
|
26
33
|
}
|
|
@@ -39,6 +46,15 @@ export function buildDefaultGitHubEvents(options = {}) {
|
|
|
39
46
|
}
|
|
40
47
|
});
|
|
41
48
|
},
|
|
49
|
+
"turn.completed"(_event, channel) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
yield applyGitHubProgress({
|
|
52
|
+
phase: "success",
|
|
53
|
+
channel,
|
|
54
|
+
options,
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
},
|
|
42
58
|
"message.completed"(event, channel) {
|
|
43
59
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
60
|
if (!deliverReplies) {
|
|
@@ -64,11 +80,21 @@ export function buildDefaultGitHubEvents(options = {}) {
|
|
|
64
80
|
},
|
|
65
81
|
"turn.failed"(event, channel) {
|
|
66
82
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
yield applyGitHubProgress({
|
|
84
|
+
phase: "failure",
|
|
85
|
+
channel,
|
|
86
|
+
options,
|
|
87
|
+
});
|
|
67
88
|
yield postFailure(channel, options, event.data.message);
|
|
68
89
|
});
|
|
69
90
|
},
|
|
70
91
|
"session.failed"(event, channel) {
|
|
71
92
|
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
yield applyGitHubProgress({
|
|
94
|
+
phase: "failure",
|
|
95
|
+
channel,
|
|
96
|
+
options,
|
|
97
|
+
});
|
|
72
98
|
yield postFailure(channel, options, event.data.message);
|
|
73
99
|
});
|
|
74
100
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-channel.d.ts","sourceRoot":"","sources":["../../../src/channels/github/github-channel.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAGV,WAAW,EACX,iBAAiB,EAEjB,kB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;;;;;;;;;;;;;;;GAkCG;AACH;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,KAAK,EAAE;IACjD,OAAO,EAAE,oBAAoB,CAAC;IAC9B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,kBAAkB,CAAC;CAC1B,GAAG,OAAO,CAAC,QAAQ,CAAC,CAiGpB;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,CAAC,KAAK,EAAE;IACtD,OAAO,EAAE,oBAAoB,CAAC;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,kBAAkB,CAAC;IACzB,mEAAmE;IACnE,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAiCpB;AAQD;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,MAAM,GACjB,oBAAoB,GAAG,SAAS,CAElC;AAED,wBAAgB,aAAa,CAC3B,OAAO,GAAE,oBAAyB,GACjC,iBAAiB,CAAC,kBAAkB,CAAC,CAqGvC;AAk0BD,wEAAwE;AACxE,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,UAAU,GAAG,SAAS,EAC9B,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,OAAO,CAeT"}
|
|
@@ -77,6 +77,12 @@ const githubPullRequestPayloadSchema = z.object({
|
|
|
77
77
|
}),
|
|
78
78
|
sender: senderSchema,
|
|
79
79
|
installation: installationSchema,
|
|
80
|
+
label: z
|
|
81
|
+
.object({
|
|
82
|
+
name: z.string().min(1),
|
|
83
|
+
})
|
|
84
|
+
.nullable()
|
|
85
|
+
.optional(),
|
|
80
86
|
});
|
|
81
87
|
/**
|
|
82
88
|
* Derive the turn's auth from the actor that triggered the delivery — the
|
|
@@ -189,8 +195,8 @@ export function extractGitHubCommentTrigger(args) {
|
|
|
189
195
|
return { message: stripped };
|
|
190
196
|
}
|
|
191
197
|
export function parseGitHubPullRequestEvent(args) {
|
|
192
|
-
var _a, _b;
|
|
193
|
-
var
|
|
198
|
+
var _a, _b, _c;
|
|
199
|
+
var _d;
|
|
194
200
|
const parsed = githubPullRequestPayloadSchema.safeParse(args.payload);
|
|
195
201
|
if (!parsed.success) {
|
|
196
202
|
return null;
|
|
@@ -204,14 +210,16 @@ export function parseGitHubPullRequestEvent(args) {
|
|
|
204
210
|
number: payload.pull_request.number,
|
|
205
211
|
url: payload.pull_request.html_url,
|
|
206
212
|
} }), (sender === undefined ? {} : { sender, senderLogin: sender.login })), (installationId === undefined ? {} : { installationId }));
|
|
207
|
-
const pullRequest = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ action: payload.action, number: payload.pull_request.number, url: payload.pull_request.html_url, title: payload.pull_request.title }, (payload.pull_request.body === undefined ||
|
|
213
|
+
const pullRequest = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ action: payload.action, number: payload.pull_request.number, url: payload.pull_request.html_url, title: payload.pull_request.title }, (payload.pull_request.body === undefined ||
|
|
208
214
|
payload.pull_request.body === null
|
|
209
215
|
? {}
|
|
210
216
|
: { body: payload.pull_request.body })), { headRef: payload.pull_request.head.ref, headSha: payload.pull_request.head.sha, baseRef: payload.pull_request.base.ref }), (payload.pull_request.base.sha === undefined
|
|
211
217
|
? {}
|
|
212
|
-
: { baseSha: payload.pull_request.base.sha })), { draft: (
|
|
218
|
+
: { baseSha: payload.pull_request.base.sha })), { draft: (_d = payload.pull_request.draft) !== null && _d !== void 0 ? _d : false, merged: payload.pull_request.merged === true }), (((_b = payload.pull_request.user) === null || _b === void 0 ? void 0 : _b.login) === undefined
|
|
219
|
+
? {}
|
|
220
|
+
: { authorLogin: payload.pull_request.user.login })), (((_c = payload.label) === null || _c === void 0 ? void 0 : _c.name) === undefined
|
|
213
221
|
? {}
|
|
214
|
-
: {
|
|
222
|
+
: { label: { name: payload.label.name } }));
|
|
215
223
|
return { ctx, pullRequest };
|
|
216
224
|
}
|
|
217
225
|
export function verifyGitHubWebhookSignature(args) {
|
|
@@ -709,6 +717,9 @@ function handleReviewComment(input) {
|
|
|
709
717
|
binding,
|
|
710
718
|
deliveryId: ctx.deliveryId,
|
|
711
719
|
eventName: ctx.eventName,
|
|
720
|
+
headSha: parsed.headSha,
|
|
721
|
+
headRef: parsed.headRef,
|
|
722
|
+
baseRef: parsed.baseRef,
|
|
712
723
|
}),
|
|
713
724
|
});
|
|
714
725
|
});
|
|
@@ -1128,7 +1139,9 @@ function handleGenericEvent(input) {
|
|
|
1128
1139
|
function startTurn(input) {
|
|
1129
1140
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1130
1141
|
var _a;
|
|
1131
|
-
const session = yield input.args.send(input.message, Object.assign(Object.assign({ auth: input.dispatch.auth, continuationToken: githubContinuationKey(input.ctx), title: (_a = input.dispatch.title) !== null && _a !== void 0 ? _a : defaultGitHubTitle(input.ctx) }, (input.cloud === undefined ? {} : { cloud: input.cloud })), { state: input.state
|
|
1142
|
+
const session = yield input.args.send(input.message, Object.assign(Object.assign({ auth: input.dispatch.auth, continuationToken: githubContinuationKey(input.ctx), title: (_a = input.dispatch.title) !== null && _a !== void 0 ? _a : defaultGitHubTitle(input.ctx) }, (input.cloud === undefined ? {} : { cloud: input.cloud })), { state: input.state,
|
|
1143
|
+
// Resume must refresh headSha / refs without wiping sticky banner id.
|
|
1144
|
+
refreshState: input.state }));
|
|
1132
1145
|
return Response.json({
|
|
1133
1146
|
ok: true,
|
|
1134
1147
|
sessionId: session.id,
|
|
@@ -1226,14 +1239,25 @@ function parseIssueCommentEvent(args) {
|
|
|
1226
1239
|
return { action: payload.action, ctx, comment };
|
|
1227
1240
|
}
|
|
1228
1241
|
function parseReviewCommentEvent(args) {
|
|
1229
|
-
var _a;
|
|
1230
|
-
var
|
|
1242
|
+
var _a, _b, _c, _d;
|
|
1243
|
+
var _e;
|
|
1231
1244
|
const schema = z.object({
|
|
1232
1245
|
action: z.string().min(1),
|
|
1233
1246
|
repository: repositorySchema,
|
|
1234
1247
|
pull_request: z.object({
|
|
1235
1248
|
number: z.number().int().positive(),
|
|
1236
1249
|
html_url: z.string().url(),
|
|
1250
|
+
head: z
|
|
1251
|
+
.object({
|
|
1252
|
+
sha: z.string().min(1).optional(),
|
|
1253
|
+
ref: z.string().min(1).optional(),
|
|
1254
|
+
})
|
|
1255
|
+
.optional(),
|
|
1256
|
+
base: z
|
|
1257
|
+
.object({
|
|
1258
|
+
ref: z.string().min(1).optional(),
|
|
1259
|
+
})
|
|
1260
|
+
.optional(),
|
|
1237
1261
|
}),
|
|
1238
1262
|
comment: z.object({
|
|
1239
1263
|
id: z.number(),
|
|
@@ -1269,7 +1293,7 @@ function parseReviewCommentEvent(args) {
|
|
|
1269
1293
|
number: payload.pull_request.number,
|
|
1270
1294
|
url: payload.pull_request.html_url,
|
|
1271
1295
|
} }), (sender === undefined ? {} : { sender, senderLogin: sender.login })), (installationId === undefined ? {} : { installationId }));
|
|
1272
|
-
const comment = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ id: payload.comment.id, body: payload.comment.body, htmlUrl: payload.comment.html_url, url: (
|
|
1296
|
+
const comment = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ id: payload.comment.id, body: payload.comment.body, htmlUrl: payload.comment.html_url, url: (_e = payload.comment.url) !== null && _e !== void 0 ? _e : payload.comment.html_url }, (author === undefined ? {} : { author })), (payload.comment.path === undefined
|
|
1273
1297
|
? {}
|
|
1274
1298
|
: { path: payload.comment.path })), (payload.comment.line === undefined
|
|
1275
1299
|
? {}
|
|
@@ -1278,7 +1302,14 @@ function parseReviewCommentEvent(args) {
|
|
|
1278
1302
|
: { pullRequestReviewId: payload.comment.pull_request_review_id })), (payload.comment.in_reply_to_id === undefined
|
|
1279
1303
|
? {}
|
|
1280
1304
|
: { inReplyToId: payload.comment.in_reply_to_id }));
|
|
1281
|
-
return {
|
|
1305
|
+
return {
|
|
1306
|
+
action: payload.action,
|
|
1307
|
+
ctx,
|
|
1308
|
+
comment,
|
|
1309
|
+
headSha: (_b = payload.pull_request.head) === null || _b === void 0 ? void 0 : _b.sha,
|
|
1310
|
+
headRef: (_c = payload.pull_request.head) === null || _c === void 0 ? void 0 : _c.ref,
|
|
1311
|
+
baseRef: (_d = payload.pull_request.base) === null || _d === void 0 ? void 0 : _d.ref,
|
|
1312
|
+
};
|
|
1282
1313
|
}
|
|
1283
1314
|
function parseIssueEvent(args) {
|
|
1284
1315
|
var _a, _b;
|
|
@@ -46,6 +46,7 @@ export * from "./defaults.js";
|
|
|
46
46
|
export * from "./events.js";
|
|
47
47
|
export * from "./forward.js";
|
|
48
48
|
export * from "./github-channel.js";
|
|
49
|
+
export * from "./progress.js";
|
|
49
50
|
export * from "./replay.js";
|
|
50
51
|
export * from "./state.js";
|
|
51
52
|
export * from "./types.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/channels/github/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/channels/github/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
|
|
@@ -46,6 +46,7 @@ export * from "./defaults.js";
|
|
|
46
46
|
export * from "./events.js";
|
|
47
47
|
export * from "./forward.js";
|
|
48
48
|
export * from "./github-channel.js";
|
|
49
|
+
export * from "./progress.js";
|
|
49
50
|
export * from "./replay.js";
|
|
50
51
|
export * from "./state.js";
|
|
51
52
|
export * from "./types.js";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opt-in PR progress surfaces: commit status + sticky banner comment.
|
|
3
|
+
*/
|
|
4
|
+
import type { GitHubBindingConfig } from "./binding.js";
|
|
5
|
+
import type { GitHubChannelState } from "./state.js";
|
|
6
|
+
export type GitHubProgressPhase = "pending" | "success" | "failure";
|
|
7
|
+
export interface GitHubProgressPhaseCopy {
|
|
8
|
+
pending?: string;
|
|
9
|
+
success?: string;
|
|
10
|
+
failure?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface GitHubCommitStatusProgress extends GitHubProgressPhaseCopy {
|
|
13
|
+
/** Commit status context (unique per check in the merge box). */
|
|
14
|
+
context: string;
|
|
15
|
+
}
|
|
16
|
+
export type GitHubBannerProgress = GitHubProgressPhaseCopy;
|
|
17
|
+
export interface GitHubProgressConfig {
|
|
18
|
+
/** When false, skip the eyes reaction on turn.started. Defaults to true. */
|
|
19
|
+
reactions?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Opt-in commit status on the PR head. Omit or `false` keeps today's
|
|
22
|
+
* behavior (no statuses from default events). With `cursorAccount`,
|
|
23
|
+
* needs `permissions: "contents-write"` (push-equivalent).
|
|
24
|
+
*/
|
|
25
|
+
commitStatus?: false | GitHubCommitStatusProgress;
|
|
26
|
+
/**
|
|
27
|
+
* Opt-in sticky PR/issue timeline comment. Created on first pending,
|
|
28
|
+
* PATCHed on later phases. Omit or `false` disables.
|
|
29
|
+
*/
|
|
30
|
+
banner?: false | GitHubBannerProgress;
|
|
31
|
+
}
|
|
32
|
+
export interface GitHubProgressOptions extends GitHubBindingConfig {
|
|
33
|
+
botName?: string;
|
|
34
|
+
progress?: GitHubProgressConfig;
|
|
35
|
+
}
|
|
36
|
+
export declare function resolveCommitStatusProgress(progress: GitHubProgressConfig | undefined): GitHubCommitStatusProgress | null;
|
|
37
|
+
export declare function resolveBannerProgress(progress: GitHubProgressConfig | undefined): GitHubBannerProgress | null;
|
|
38
|
+
export declare function progressPhaseCopy(input: {
|
|
39
|
+
copy: GitHubProgressPhaseCopy | undefined;
|
|
40
|
+
phase: GitHubProgressPhase;
|
|
41
|
+
label: string;
|
|
42
|
+
}): string;
|
|
43
|
+
/**
|
|
44
|
+
* Post or update opt-in progress surfaces for a turn phase.
|
|
45
|
+
* Soft-fails on API errors (same posture as eyes / reply delivery).
|
|
46
|
+
*/
|
|
47
|
+
export declare function applyGitHubProgress(input: {
|
|
48
|
+
phase: GitHubProgressPhase;
|
|
49
|
+
channel: {
|
|
50
|
+
state: GitHubChannelState;
|
|
51
|
+
};
|
|
52
|
+
options: GitHubProgressOptions;
|
|
53
|
+
}): Promise<void>;
|
|
54
|
+
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../../src/channels/github/progress.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAKrD,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAEpE,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,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this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
8
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
9
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
10
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
import { createGitHubCommitStatus, createGitHubIssueComment, GitHubApiError, updateGitHubIssueComment, } from "./api.js";
|
|
14
|
+
import { formatGitHubOutboundComment } from "./binding.js";
|
|
15
|
+
/** GitHub commit-status descriptions are capped at 140 characters. */
|
|
16
|
+
const STATUS_DESCRIPTION_MAX = 140;
|
|
17
|
+
export function resolveCommitStatusProgress(progress) {
|
|
18
|
+
if ((progress === null || progress === void 0 ? void 0 : progress.commitStatus) === undefined || progress.commitStatus === false) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return progress.commitStatus;
|
|
22
|
+
}
|
|
23
|
+
export function resolveBannerProgress(progress) {
|
|
24
|
+
if ((progress === null || progress === void 0 ? void 0 : progress.banner) === undefined || progress.banner === false) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return progress.banner;
|
|
28
|
+
}
|
|
29
|
+
export function progressPhaseCopy(input) {
|
|
30
|
+
var _a;
|
|
31
|
+
const custom = (_a = input.copy) === null || _a === void 0 ? void 0 : _a[input.phase];
|
|
32
|
+
if (custom !== undefined && custom.trim() !== "") {
|
|
33
|
+
return custom;
|
|
34
|
+
}
|
|
35
|
+
switch (input.phase) {
|
|
36
|
+
case "pending":
|
|
37
|
+
return `${input.label} running`;
|
|
38
|
+
case "success":
|
|
39
|
+
return `${input.label} finished`;
|
|
40
|
+
case "failure":
|
|
41
|
+
return `${input.label} failed`;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function clipStatusDescription(text) {
|
|
45
|
+
if (text.length <= STATUS_DESCRIPTION_MAX) {
|
|
46
|
+
return text;
|
|
47
|
+
}
|
|
48
|
+
return `${text.slice(0, STATUS_DESCRIPTION_MAX - 1)}…`;
|
|
49
|
+
}
|
|
50
|
+
function progressLabel(options, context) {
|
|
51
|
+
var _a;
|
|
52
|
+
const bot = (_a = options.botName) === null || _a === void 0 ? void 0 : _a.trim();
|
|
53
|
+
if (bot !== undefined && bot !== "") {
|
|
54
|
+
return bot;
|
|
55
|
+
}
|
|
56
|
+
if (context !== undefined && context.trim() !== "") {
|
|
57
|
+
return context;
|
|
58
|
+
}
|
|
59
|
+
return "Agent";
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Post or update opt-in progress surfaces for a turn phase.
|
|
63
|
+
* Soft-fails on API errors (same posture as eyes / reply delivery).
|
|
64
|
+
*/
|
|
65
|
+
export function applyGitHubProgress(input) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
const commitStatus = resolveCommitStatusProgress(input.options.progress);
|
|
68
|
+
const banner = resolveBannerProgress(input.options.progress);
|
|
69
|
+
if (commitStatus === null && banner === null) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const tasks = [];
|
|
73
|
+
if (commitStatus !== null) {
|
|
74
|
+
tasks.push(postCommitStatus({
|
|
75
|
+
phase: input.phase,
|
|
76
|
+
channel: input.channel,
|
|
77
|
+
options: input.options,
|
|
78
|
+
commitStatus,
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
if (banner !== null) {
|
|
82
|
+
tasks.push(upsertBanner({
|
|
83
|
+
phase: input.phase,
|
|
84
|
+
channel: input.channel,
|
|
85
|
+
options: input.options,
|
|
86
|
+
banner,
|
|
87
|
+
context: commitStatus === null || commitStatus === void 0 ? void 0 : commitStatus.context,
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
yield Promise.all(tasks);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function postCommitStatus(input) {
|
|
94
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
+
var _a;
|
|
96
|
+
const state = input.channel.state;
|
|
97
|
+
if (state.owner === "" ||
|
|
98
|
+
state.repo === "" ||
|
|
99
|
+
state.headSha === null ||
|
|
100
|
+
state.headSha === "") {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const description = clipStatusDescription(progressPhaseCopy({
|
|
104
|
+
copy: input.commitStatus,
|
|
105
|
+
phase: input.phase,
|
|
106
|
+
label: progressLabel(input.options, input.commitStatus.context),
|
|
107
|
+
}));
|
|
108
|
+
try {
|
|
109
|
+
yield createGitHubCommitStatus({
|
|
110
|
+
api: input.options.api,
|
|
111
|
+
credentials: input.options.credentials,
|
|
112
|
+
installationId: (_a = state.installationId) !== null && _a !== void 0 ? _a : undefined,
|
|
113
|
+
owner: state.owner,
|
|
114
|
+
repo: state.repo,
|
|
115
|
+
sha: state.headSha,
|
|
116
|
+
state: input.phase,
|
|
117
|
+
context: input.commitStatus.context,
|
|
118
|
+
description,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
catch (_b) {
|
|
122
|
+
// Soft-fail: missing token / permission is fine.
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
function upsertBanner(input) {
|
|
127
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
128
|
+
var _a, _b;
|
|
129
|
+
const state = input.channel.state;
|
|
130
|
+
const issueNumber = (_a = state.issueNumber) !== null && _a !== void 0 ? _a : state.pullRequestNumber;
|
|
131
|
+
if (state.owner === "" || state.repo === "" || issueNumber === null) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const body = formatGitHubOutboundComment(progressPhaseCopy({
|
|
135
|
+
copy: input.banner,
|
|
136
|
+
phase: input.phase,
|
|
137
|
+
label: progressLabel(input.options, input.context),
|
|
138
|
+
}));
|
|
139
|
+
const resource = {
|
|
140
|
+
api: input.options.api,
|
|
141
|
+
credentials: input.options.credentials,
|
|
142
|
+
installationId: (_b = state.installationId) !== null && _b !== void 0 ? _b : undefined,
|
|
143
|
+
owner: state.owner,
|
|
144
|
+
repo: state.repo,
|
|
145
|
+
};
|
|
146
|
+
try {
|
|
147
|
+
if (state.progressBannerCommentId !== null) {
|
|
148
|
+
try {
|
|
149
|
+
yield updateGitHubIssueComment(Object.assign(Object.assign({}, resource), { body, commentId: state.progressBannerCommentId }));
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
if (!(error instanceof GitHubApiError) || error.status !== 404) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
// Comment gone; clear sticky id and recreate below.
|
|
157
|
+
state.progressBannerCommentId = null;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const posted = yield createGitHubIssueComment(Object.assign(Object.assign({}, resource), { body,
|
|
161
|
+
issueNumber }));
|
|
162
|
+
state.progressBannerCommentId = posted.id;
|
|
163
|
+
}
|
|
164
|
+
catch (_c) {
|
|
165
|
+
// Soft-fail.
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
@@ -9,6 +9,8 @@ export interface GitHubChannelState extends GitHubBindingState {
|
|
|
9
9
|
headSha: string | null;
|
|
10
10
|
baseRef: string | null;
|
|
11
11
|
headRef: string | null;
|
|
12
|
+
/** Sticky progress banner comment id (issue/PR timeline). */
|
|
13
|
+
progressBannerCommentId: number | null;
|
|
12
14
|
}
|
|
13
15
|
export declare function emptyGitHubChannelState(overrides?: Partial<GitHubChannelState>): GitHubChannelState;
|
|
14
16
|
/** Build binding fields for an inbound conversation. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/channels/github/state.ts"],"names":[],"mappings":"AAAA;;GAEG;A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AC;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACpC,GAAG,kBAAkB,CA6CrB"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Durable per-session GitHub channel state.
|
|
3
3
|
*/
|
|
4
4
|
export function emptyGitHubChannelState(overrides = {}) {
|
|
5
|
-
return Object.assign({ conversationKind: "pull_request", installationId: null, issueNumber: null, owner: "", pullRequestNumber: null, repo: "", repositoryId: null, reviewCommentId: null, reviewThreadRootCommentId: null, triggeringCommentId: null, deliveryId: null, eventName: null, headSha: null, baseRef: null, headRef: null }, overrides);
|
|
5
|
+
return Object.assign({ conversationKind: "pull_request", installationId: null, issueNumber: null, owner: "", pullRequestNumber: null, repo: "", repositoryId: null, reviewCommentId: null, reviewThreadRootCommentId: null, triggeringCommentId: null, deliveryId: null, eventName: null, headSha: null, baseRef: null, headRef: null, progressBannerCommentId: null }, overrides);
|
|
6
6
|
}
|
|
7
7
|
/** Build binding fields for an inbound conversation. */
|
|
8
8
|
export function githubBindingStateForEvent(input) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AgentCloudOptions, ArtifactsApi, AuthContext, AuthPolicy, ChannelEventHandlers, ChannelStartArgs, HostContext } from "../../types.js";
|
|
2
2
|
import type { GitHubApiOptions } from "./api.js";
|
|
3
3
|
import type { GitHubHandle, GitHubThread } from "./binding.js";
|
|
4
|
-
import type { GitHubProgressConfig } from "./
|
|
4
|
+
import type { GitHubProgressConfig } from "./progress.js";
|
|
5
5
|
import type { GitHubChannelState } from "./state.js";
|
|
6
6
|
/** A credential value: a literal or a lazy resolver fetched on demand. */
|
|
7
7
|
export type GitHubCredentialValue = string | (() => string | undefined | Promise<string | undefined>);
|
|
@@ -112,6 +112,10 @@ export type GitHubPullRequestPayload = {
|
|
|
112
112
|
installation?: {
|
|
113
113
|
id?: number;
|
|
114
114
|
} | null;
|
|
115
|
+
/** Present on `labeled` / `unlabeled` pull_request deliveries. */
|
|
116
|
+
label?: {
|
|
117
|
+
name: string;
|
|
118
|
+
} | null;
|
|
115
119
|
};
|
|
116
120
|
/** Normalized `pull_request` event handed to {@link GitHubPullRequestHook}. */
|
|
117
121
|
export interface GitHubPullRequestEvent {
|
|
@@ -128,6 +132,10 @@ export interface GitHubPullRequestEvent {
|
|
|
128
132
|
/** True when the PR was merged (from the webhook payload). */
|
|
129
133
|
merged: boolean;
|
|
130
134
|
authorLogin?: string;
|
|
135
|
+
/** Label added/removed on `labeled` / `unlabeled` actions. */
|
|
136
|
+
label?: {
|
|
137
|
+
name: string;
|
|
138
|
+
};
|
|
131
139
|
}
|
|
132
140
|
/** Normalized `issues` event. */
|
|
133
141
|
export interface GitHubIssueEvent {
|
|
@@ -339,7 +347,7 @@ export interface GitHubChannelOptions {
|
|
|
339
347
|
* Token capability tier:
|
|
340
348
|
* - `"read"` — PR/issue/status read
|
|
341
349
|
* - `"pr-write"` (default) — comments / PR+issue write, no `contents:write`
|
|
342
|
-
* - `"contents-write"` —
|
|
350
|
+
* - `"contents-write"` — push code and create commit statuses (host-held)
|
|
343
351
|
*/
|
|
344
352
|
permissions?: "read" | "pr-write" | "contents-write";
|
|
345
353
|
};
|
|
@@ -391,10 +399,14 @@ export interface GitHubChannelOptions {
|
|
|
391
399
|
onEvent?: GitHubEventHook;
|
|
392
400
|
/**
|
|
393
401
|
* Override / extend default stream-event handlers (eyes reaction, reply
|
|
394
|
-
* posting). Handlers you provide replace
|
|
402
|
+
* posting, opt-in commit status / banner). Handlers you provide replace
|
|
403
|
+
* the matching defaults.
|
|
395
404
|
*/
|
|
396
405
|
events?: ChannelEventHandlers<GitHubChannelState>;
|
|
397
|
-
/**
|
|
406
|
+
/**
|
|
407
|
+
* Acknowledgement progress surfaces. Reactions default on; commit status
|
|
408
|
+
* and sticky banner are opt-in via `commitStatus` / `banner`.
|
|
409
|
+
*/
|
|
398
410
|
progress?: GitHubProgressConfig;
|
|
399
411
|
/**
|
|
400
412
|
* When false, skip posting assistant / error comments back to GitHub.
|