@cursor/july 0.1.80 → 0.1.82
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 +0 -12
- package/dist/channels/github/cursor-account.d.ts +11 -0
- package/dist/channels/github/cursor-account.d.ts.map +1 -1
- package/dist/channels/github/cursor-account.js +13 -0
- package/dist/channels/github/github-channel.d.ts.map +1 -1
- package/dist/channels/github/github-channel.js +29 -1
- package/dist/channels/github/types.d.ts +8 -0
- package/dist/channels/github/types.d.ts.map +1 -1
- package/dist/channels/origin/origin-channel.d.ts.map +1 -1
- package/dist/channels/origin/origin-channel.js +32 -10
- package/dist/channels/origin/types.d.ts +7 -0
- package/dist/channels/origin/types.d.ts.map +1 -1
- package/dist/channels/slack/cursor-account.d.ts.map +1 -1
- package/dist/channels/slack/cursor-account.js +2 -2
- package/dist/channels/slack/dispatch.d.ts +3 -0
- package/dist/channels/slack/dispatch.d.ts.map +1 -1
- package/dist/channels/slack/dispatch.js +18 -18
- package/dist/channels/slack/interactive.d.ts +2 -0
- package/dist/channels/slack/interactive.d.ts.map +1 -1
- package/dist/channels/slack/interactive.js +4 -16
- package/dist/channels/slack/slack-channel.d.ts +1 -1
- package/dist/channels/slack/slack-channel.d.ts.map +1 -1
- package/dist/channels/slack/slack-channel.js +21 -10
- package/dist/channels/slack/types.d.ts +7 -0
- package/dist/channels/slack/types.d.ts.map +1 -1
- package/dist/channels.d.ts.map +1 -1
- package/dist/channels.js +4 -0
- package/dist/continuation.d.ts +20 -0
- package/dist/continuation.d.ts.map +1 -0
- package/dist/continuation.js +18 -0
- package/dist/docs/404.html +1 -1
- package/dist/docs/ab.html +2 -2
- package/dist/docs/assets/{app.e4_wtjUS.js → app.BEHVaPKt.js} +1 -1
- package/dist/docs/assets/chunks/{@localSearchIndexroot.BGiMJpnL.js → @localSearchIndexroot.Vvio4stV.js} +1 -1
- package/dist/docs/assets/chunks/{VPLocalSearchBox.DbdzyEie.js → VPLocalSearchBox.D2-5PKih.js} +1 -1
- package/dist/docs/assets/chunks/{theme.D8HpLrLK.js → theme.uNqJ4MUO.js} +2 -2
- package/dist/docs/building-with-agents.html +2 -2
- package/dist/docs/concepts.html +2 -2
- package/dist/docs/deployment.html +2 -2
- package/dist/docs/evals.html +2 -2
- package/dist/docs/example-agents/approval-buddy.html +2 -2
- package/dist/docs/example-agents/benny.html +2 -2
- package/dist/docs/example-agents/bugbot.html +2 -2
- package/dist/docs/example-agents/codebase-wiki.html +2 -2
- package/dist/docs/example-agents/codeowners-review.html +2 -2
- package/dist/docs/example-agents/concierge.html +2 -2
- package/dist/docs/example-agents/fsd.html +2 -2
- package/dist/docs/example-agents/index.html +2 -2
- package/dist/docs/example-agents/knowledge-base.html +2 -2
- package/dist/docs/example-agents/oncall.html +2 -2
- package/dist/docs/example-agents/security-reviewer.html +2 -2
- package/dist/docs/example-agents/slack-agent.html +2 -2
- package/dist/docs/example-agents/weather-agent.html +2 -2
- package/dist/docs/guides/agent-to-agent.html +2 -2
- package/dist/docs/guides/cloud-runtime.html +2 -2
- package/dist/docs/guides/convert-automation.html +2 -2
- package/dist/docs/guides/github.html +2 -2
- package/dist/docs/guides/human-in-the-loop.html +2 -2
- package/dist/docs/guides/mcp-oauth.html +2 -2
- package/dist/docs/guides/opentelemetry.html +2 -2
- package/dist/docs/guides/slack.html +2 -2
- package/dist/docs/guides/webhooks.html +2 -2
- package/dist/docs/hillclimbing.html +2 -2
- package/dist/docs/index.html +2 -2
- package/dist/docs/quickstart.html +2 -2
- package/dist/docs/reference/agent-config.html +2 -2
- package/dist/docs/reference/artifacts.html +2 -2
- package/dist/docs/reference/channels.html +2 -2
- package/dist/docs/reference/cli.html +2 -2
- package/dist/docs/reference/connections.html +2 -2
- package/dist/docs/reference/hooks.html +2 -2
- package/dist/docs/reference/http-api.html +2 -2
- package/dist/docs/reference/instructions.html +2 -2
- package/dist/docs/reference/playground.html +2 -2
- package/dist/docs/reference/project-layout.html +2 -2
- package/dist/docs/reference/prompt.html +2 -2
- package/dist/docs/reference/schedules.html +2 -2
- package/dist/docs/reference/sessions.html +2 -2
- package/dist/docs/reference/skills.html +2 -2
- package/dist/docs/reference/subagents.html +2 -2
- package/dist/docs/reference/tools.html +2 -2
- package/dist/docs/scaffolding-agents.html +2 -2
- package/dist/docs/storage.html +2 -2
- package/dist/docs/templates/agentic-owners.html +2 -2
- package/dist/docs/templates/demo.html +2 -2
- package/dist/docs/templates/pr-autofixer.html +2 -2
- package/dist/docs/templates/security-reviewer.html +2 -2
- package/dist/docs/templates/triage.html +2 -2
- package/dist/docs/troubleshooting.html +2 -2
- package/dist/files.d.ts +9 -3
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +9 -3
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/internal/continuation-channel.d.ts +29 -0
- package/dist/internal/continuation-channel.d.ts.map +1 -0
- package/dist/internal/continuation-channel.js +88 -0
- package/dist/internal/continuation-identity.d.ts +95 -0
- package/dist/internal/continuation-identity.d.ts.map +1 -0
- package/dist/internal/continuation-identity.js +445 -0
- package/dist/internal/deploy-manifest.d.ts +12 -2
- package/dist/internal/deploy-manifest.d.ts.map +1 -1
- package/dist/internal/deploy-manifest.js +15 -7
- package/dist/internal/discovery.d.ts.map +1 -1
- package/dist/internal/discovery.js +32 -5
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +18 -8
- package/dist/internal/session-engine.d.ts +24 -0
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +104 -34
- package/dist/internal/session-store.d.ts.map +1 -1
- package/dist/internal/session-store.js +6 -0
- package/dist/internal/skills-sync.d.ts +25 -0
- package/dist/internal/skills-sync.d.ts.map +1 -0
- package/dist/internal/skills-sync.js +96 -0
- package/dist/playground/assets/{index-DJzcIeGt.css → index-ChETdG-_.css} +1 -1
- package/dist/playground/assets/{index-K3Sxyx0I.js → index-CkuIrhg4.js} +3 -3
- package/dist/playground/index.html +2 -2
- package/dist/types.d.ts +44 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/channels/github/cursor-account.ts +20 -0
- package/src/channels/github/github-channel.ts +52 -1
- package/src/channels/github/types.ts +8 -0
- package/src/channels/origin/origin-channel.ts +48 -10
- package/src/channels/origin/types.ts +7 -0
- package/src/channels/slack/cursor-account.ts +1 -0
- package/src/channels/slack/dispatch.ts +44 -2
- package/src/channels/slack/interactive.ts +5 -0
- package/src/channels/slack/slack-channel.ts +23 -2
- package/src/channels/slack/types.ts +7 -0
- package/src/channels.ts +7 -0
- package/src/continuation.ts +49 -0
- package/src/files.ts +10 -3
- package/src/index.ts +30 -1
- package/src/internal/continuation-channel.ts +129 -0
- package/src/internal/continuation-identity.ts +597 -0
- package/src/internal/deploy-manifest.ts +36 -3
- package/src/internal/discovery.ts +40 -2
- package/src/internal/server.ts +23 -9
- package/src/internal/session-engine.ts +132 -37
- package/src/internal/session-store.ts +6 -0
- package/src/internal/skills-sync.ts +107 -0
- package/src/types.ts +55 -0
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Continuation identity is a closed selector string. Omitted `continuation`
|
|
3
|
+
* on a channel constructor stays `/v1` (engine pack minting) so existing
|
|
4
|
+
* agents do not change: `githubChannel()` → `github.pr/v1`, `slackChannel()`
|
|
5
|
+
* → `slack.thread/v1`, `originChannel()` → `origin.pr/v1`, `httpChannel()`
|
|
6
|
+
* → `none/v1`.
|
|
7
|
+
*
|
|
8
|
+
* Opt the whole agent into the v2 control plane with
|
|
9
|
+
* `defineAgent({ architecture: "v2" })`. That stamps `/v2` defaults from
|
|
10
|
+
* the channel kind and declared events (`github.pr/v2`, `github.issue/v2`,
|
|
11
|
+
* `github.none/v2`, `slack.thread/v2`, …) onto every channel that omitted
|
|
12
|
+
* a selector. An explicit per-channel selector still overrides. JSONPath
|
|
13
|
+
* and per-agent format strings are rejected.
|
|
14
|
+
*/
|
|
15
|
+
import { randomBytes } from "node:crypto";
|
|
16
|
+
export const CONTINUATION_SELECTORS = [
|
|
17
|
+
"github.pr/v1",
|
|
18
|
+
"github.pr/v2",
|
|
19
|
+
"github.issue/v1",
|
|
20
|
+
"github.issue/v2",
|
|
21
|
+
"github.none/v2",
|
|
22
|
+
"slack.thread/v1",
|
|
23
|
+
"slack.thread/v2",
|
|
24
|
+
"slack.none/v2",
|
|
25
|
+
"origin.pr/v1",
|
|
26
|
+
"origin.pr/v2",
|
|
27
|
+
"origin.none/v2",
|
|
28
|
+
"none/v1",
|
|
29
|
+
"none/v2",
|
|
30
|
+
];
|
|
31
|
+
export const BUILTINS = [
|
|
32
|
+
{
|
|
33
|
+
type: "pr",
|
|
34
|
+
kind: "github",
|
|
35
|
+
events: [
|
|
36
|
+
"pull_request",
|
|
37
|
+
"issue_comment",
|
|
38
|
+
"pull_request_review",
|
|
39
|
+
"pull_request_review_comment",
|
|
40
|
+
"check_suite",
|
|
41
|
+
"check_run",
|
|
42
|
+
],
|
|
43
|
+
format: "github-pr:{fullName}#{number}",
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
type: "issue",
|
|
47
|
+
kind: "github",
|
|
48
|
+
events: ["issues", "issue_comment"],
|
|
49
|
+
format: "github-issue:{fullName}#{number}",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
type: "thread",
|
|
53
|
+
kind: "slack",
|
|
54
|
+
events: ["message", "app_mention"],
|
|
55
|
+
format: "{channelId}:{threadTs}",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: "origin-pr",
|
|
59
|
+
kind: "origin",
|
|
60
|
+
events: [
|
|
61
|
+
"pull_request.created",
|
|
62
|
+
"pull_request.published",
|
|
63
|
+
"pull_request.head_ref.pushed",
|
|
64
|
+
"pull_request.base_ref.updated",
|
|
65
|
+
"pull_request.closed",
|
|
66
|
+
"pull_request.merged",
|
|
67
|
+
"pull_request.comment.created",
|
|
68
|
+
"pull_request.review.submitted",
|
|
69
|
+
],
|
|
70
|
+
format: "origin-pr:{fullName}#{number}",
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
export class V2EngineError extends Error {
|
|
74
|
+
constructor(message) {
|
|
75
|
+
super(message);
|
|
76
|
+
this.name = "V2EngineError";
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const SELECTOR_FIELDS = {
|
|
80
|
+
"github.pr/v1": { version: 1, type: "pr", kind: "github" },
|
|
81
|
+
"github.pr/v2": { version: 2, type: "pr", kind: "github" },
|
|
82
|
+
"github.issue/v1": { version: 1, type: "issue", kind: "github" },
|
|
83
|
+
"github.issue/v2": { version: 2, type: "issue", kind: "github" },
|
|
84
|
+
"github.none/v2": { version: 2, type: "none", kind: "github" },
|
|
85
|
+
"slack.thread/v1": { version: 1, type: "thread", kind: "slack" },
|
|
86
|
+
"slack.thread/v2": { version: 2, type: "thread", kind: "slack" },
|
|
87
|
+
"slack.none/v2": { version: 2, type: "none", kind: "slack" },
|
|
88
|
+
"origin.pr/v1": { version: 1, type: "origin-pr", kind: "origin" },
|
|
89
|
+
"origin.pr/v2": { version: 2, type: "origin-pr", kind: "origin" },
|
|
90
|
+
"origin.none/v2": { version: 2, type: "none", kind: "origin" },
|
|
91
|
+
"none/v1": { version: 1, type: "none", kind: "http" },
|
|
92
|
+
"none/v2": { version: 2, type: "none", kind: "http" },
|
|
93
|
+
};
|
|
94
|
+
export function isContinuationSelector(value) {
|
|
95
|
+
return Object.hasOwn(SELECTOR_FIELDS, value);
|
|
96
|
+
}
|
|
97
|
+
export function defaultContinuationSelector(kind, version = "v1", eventTypes) {
|
|
98
|
+
if (version !== "v2") {
|
|
99
|
+
switch (kind) {
|
|
100
|
+
case "github":
|
|
101
|
+
return "github.pr/v1";
|
|
102
|
+
case "slack":
|
|
103
|
+
return "slack.thread/v1";
|
|
104
|
+
case "origin":
|
|
105
|
+
return "origin.pr/v1";
|
|
106
|
+
default:
|
|
107
|
+
return "none/v1";
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
switch (kind) {
|
|
111
|
+
case "github":
|
|
112
|
+
return githubV2Default(eventTypes);
|
|
113
|
+
case "slack":
|
|
114
|
+
return "slack.thread/v2";
|
|
115
|
+
case "origin":
|
|
116
|
+
return originV2Default(eventTypes);
|
|
117
|
+
default:
|
|
118
|
+
return "none/v2";
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function githubV2Default(eventTypes) {
|
|
122
|
+
var _a, _b;
|
|
123
|
+
var _c, _d;
|
|
124
|
+
const events = eventTypes !== null && eventTypes !== void 0 ? eventTypes : [];
|
|
125
|
+
const issueEvents = new Set((_c = (_a = builtinForType("issue")) === null || _a === void 0 ? void 0 : _a.events) !== null && _c !== void 0 ? _c : []);
|
|
126
|
+
const prEvents = new Set((_d = (_b = builtinForType("pr")) === null || _b === void 0 ? void 0 : _b.events) !== null && _d !== void 0 ? _d : []);
|
|
127
|
+
if (events.length > 0 && events.every((event) => issueEvents.has(event))) {
|
|
128
|
+
return "github.issue/v2";
|
|
129
|
+
}
|
|
130
|
+
if (events.some((event) => !prEvents.has(event))) {
|
|
131
|
+
return "github.none/v2";
|
|
132
|
+
}
|
|
133
|
+
return "github.pr/v2";
|
|
134
|
+
}
|
|
135
|
+
function originV2Default(eventTypes) {
|
|
136
|
+
var _a;
|
|
137
|
+
var _b;
|
|
138
|
+
const events = eventTypes !== null && eventTypes !== void 0 ? eventTypes : [];
|
|
139
|
+
const prEvents = new Set((_b = (_a = builtinForType("origin-pr")) === null || _a === void 0 ? void 0 : _a.events) !== null && _b !== void 0 ? _b : []);
|
|
140
|
+
if (events.some((event) => !prEvents.has(event))) {
|
|
141
|
+
return "origin.none/v2";
|
|
142
|
+
}
|
|
143
|
+
return "origin.pr/v2";
|
|
144
|
+
}
|
|
145
|
+
export function parseContinuationSelector(selector) {
|
|
146
|
+
if (!isContinuationSelector(selector)) {
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
return Object.assign({ selector }, SELECTOR_FIELDS[selector]);
|
|
150
|
+
}
|
|
151
|
+
export function resolveContinuation(raw, kind) {
|
|
152
|
+
const selector = raw !== null && raw !== void 0 ? raw : defaultContinuationSelector(kind);
|
|
153
|
+
const parsed = parseContinuationSelector(selector);
|
|
154
|
+
if (parsed === undefined) {
|
|
155
|
+
throw new V2EngineError(`v2: invalid continuation selector ${JSON.stringify(selector)}`);
|
|
156
|
+
}
|
|
157
|
+
return parsed;
|
|
158
|
+
}
|
|
159
|
+
export function normalizeIdentity(raw, kind) {
|
|
160
|
+
return resolveContinuation(raw, kind).selector;
|
|
161
|
+
}
|
|
162
|
+
export function continuationSource(identity, kind) {
|
|
163
|
+
return resolveContinuation(identity, kind).version === 2
|
|
164
|
+
? "control-plane"
|
|
165
|
+
: "engine";
|
|
166
|
+
}
|
|
167
|
+
export function isV2DurableContinuationKey(key) {
|
|
168
|
+
return key.startsWith("cont:") || key.startsWith("evt:");
|
|
169
|
+
}
|
|
170
|
+
export function newEvtKey() {
|
|
171
|
+
return `evt:${randomBytes(16).toString("hex")}`;
|
|
172
|
+
}
|
|
173
|
+
export function builtinForType(type) {
|
|
174
|
+
return BUILTINS.find((builtin) => builtin.type === type);
|
|
175
|
+
}
|
|
176
|
+
export function formatConversationKey(type, fields) {
|
|
177
|
+
switch (type) {
|
|
178
|
+
case "pr":
|
|
179
|
+
return `github-pr:${fields.fullName}#${fields.number}`;
|
|
180
|
+
case "issue":
|
|
181
|
+
return `github-issue:${fields.fullName}#${fields.number}`;
|
|
182
|
+
case "origin-pr":
|
|
183
|
+
return `origin-pr:${fields.fullName}#${fields.number}`;
|
|
184
|
+
case "thread":
|
|
185
|
+
return `${fields.channelId}:${fields.threadTs}`;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
export function mintClaim(claim) {
|
|
189
|
+
const resource = claim.resource;
|
|
190
|
+
if ("channelId" in resource && "threadTs" in resource) {
|
|
191
|
+
if (claim.type !== "thread") {
|
|
192
|
+
throw new V2EngineError(`v2: claim type ${claim.type} does not match thread resource`);
|
|
193
|
+
}
|
|
194
|
+
return `cont:${formatConversationKey("thread", resource)}`;
|
|
195
|
+
}
|
|
196
|
+
const fullName = "fullName" in resource
|
|
197
|
+
? resource.fullName
|
|
198
|
+
: `${resource.owner}/${resource.repo}`;
|
|
199
|
+
if (claim.type === "thread") {
|
|
200
|
+
throw new V2EngineError("v2: thread claim requires channelId and threadTs");
|
|
201
|
+
}
|
|
202
|
+
return `cont:${formatConversationKey(claim.type, {
|
|
203
|
+
fullName,
|
|
204
|
+
number: resource.number,
|
|
205
|
+
})}`;
|
|
206
|
+
}
|
|
207
|
+
export function handshakeContinuation(input) {
|
|
208
|
+
var _a;
|
|
209
|
+
if (input.identity === undefined) {
|
|
210
|
+
return { ok: true };
|
|
211
|
+
}
|
|
212
|
+
const parsed = parseContinuationSelector(input.identity);
|
|
213
|
+
if (parsed === undefined) {
|
|
214
|
+
return {
|
|
215
|
+
ok: false,
|
|
216
|
+
error: `v2: invalid continuation selector ${JSON.stringify(input.identity)}`,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
if (parsed.version !== 2 || parsed.type === "none") {
|
|
220
|
+
return { ok: true };
|
|
221
|
+
}
|
|
222
|
+
if (input.kind !== undefined &&
|
|
223
|
+
parsed.kind !== "http" &&
|
|
224
|
+
input.kind !== parsed.kind) {
|
|
225
|
+
return {
|
|
226
|
+
ok: false,
|
|
227
|
+
error: `v2: continuation ${parsed.selector} does not match channel kind ${input.kind}`,
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
const builtin = builtinForType(parsed.type);
|
|
231
|
+
if (builtin === undefined) {
|
|
232
|
+
return {
|
|
233
|
+
ok: false,
|
|
234
|
+
error: `v2: unknown continuation type ${parsed.type}`,
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
const eventTypes = (_a = input.eventTypes) !== null && _a !== void 0 ? _a : [];
|
|
238
|
+
const allowed = new Set(builtin.events);
|
|
239
|
+
const unexpected = eventTypes.filter((event) => !allowed.has(event));
|
|
240
|
+
if (unexpected.length > 0) {
|
|
241
|
+
return {
|
|
242
|
+
ok: false,
|
|
243
|
+
error: `v2: eventTypes ${unexpected.join(", ")} are not in the ${parsed.type} membership`,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
return { ok: true };
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* CP/pack extract. Returns a `cont:` key when the payload binds the
|
|
250
|
+
* identity type; undefined on membership miss or missing number (caller
|
|
251
|
+
* stamps `evt:` and does not join the conversation index).
|
|
252
|
+
*/
|
|
253
|
+
export function extractContinuation(type, eventName, payload) {
|
|
254
|
+
const builtin = builtinForType(type);
|
|
255
|
+
if (builtin === undefined) {
|
|
256
|
+
return undefined;
|
|
257
|
+
}
|
|
258
|
+
if (!builtin.events.includes(eventName)) {
|
|
259
|
+
return undefined;
|
|
260
|
+
}
|
|
261
|
+
switch (type) {
|
|
262
|
+
case "pr":
|
|
263
|
+
case "issue":
|
|
264
|
+
return extractGitHub(type, eventName, payload);
|
|
265
|
+
case "thread":
|
|
266
|
+
return extractSlack(payload);
|
|
267
|
+
case "origin-pr":
|
|
268
|
+
return extractOrigin(payload);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
export function stampMailboxContinuation(identity, eventName, payload, kind) {
|
|
272
|
+
const parsed = resolveContinuation(identity, kind);
|
|
273
|
+
if (parsed.version !== 2) {
|
|
274
|
+
throw new V2EngineError("v2: refusing to stamp a mailbox key for v1");
|
|
275
|
+
}
|
|
276
|
+
if (parsed.type === "none") {
|
|
277
|
+
return { key: newEvtKey() };
|
|
278
|
+
}
|
|
279
|
+
const extracted = extractContinuation(parsed.type, eventName, payload);
|
|
280
|
+
if (extracted === undefined) {
|
|
281
|
+
return { key: newEvtKey() };
|
|
282
|
+
}
|
|
283
|
+
return { key: extracted };
|
|
284
|
+
}
|
|
285
|
+
export function resolveV2Key(identity, options, kind) {
|
|
286
|
+
const parsed = resolveContinuation(identity, kind);
|
|
287
|
+
if (parsed.version !== 2) {
|
|
288
|
+
throw new V2EngineError("v2: resolveV2Key requires a /v2 selector");
|
|
289
|
+
}
|
|
290
|
+
if (options.continuationToken !== undefined) {
|
|
291
|
+
throw new V2EngineError("v2: do not pass continuationToken; use mailboxContinuation or claim");
|
|
292
|
+
}
|
|
293
|
+
if (options.claim !== undefined) {
|
|
294
|
+
if (parsed.type === "none") {
|
|
295
|
+
throw new V2EngineError("v2: type none cannot take a claim");
|
|
296
|
+
}
|
|
297
|
+
if (options.claim.type !== parsed.type) {
|
|
298
|
+
throw new V2EngineError(`v2: claim type ${options.claim.type} does not match identity type ${parsed.type}`);
|
|
299
|
+
}
|
|
300
|
+
return mintClaim(options.claim);
|
|
301
|
+
}
|
|
302
|
+
if (options.mailboxContinuation !== undefined) {
|
|
303
|
+
return options.mailboxContinuation.key;
|
|
304
|
+
}
|
|
305
|
+
if (parsed.type === "none") {
|
|
306
|
+
return newEvtKey();
|
|
307
|
+
}
|
|
308
|
+
throw new V2EngineError("v2: no CP key on mailbox and no claim; refusing to mint in the engine");
|
|
309
|
+
}
|
|
310
|
+
export function bindMailboxContinuationSend(send, mailbox) {
|
|
311
|
+
if (mailbox === undefined) {
|
|
312
|
+
return send;
|
|
313
|
+
}
|
|
314
|
+
return (message, options) => { var _a; return send(message, Object.assign(Object.assign({}, options), { mailboxContinuation: (_a = options === null || options === void 0 ? void 0 : options.mailboxContinuation) !== null && _a !== void 0 ? _a : mailbox })); };
|
|
315
|
+
}
|
|
316
|
+
function extractGitHub(type, eventName, payload) {
|
|
317
|
+
const record = asRecord(payload);
|
|
318
|
+
if (record === undefined) {
|
|
319
|
+
return undefined;
|
|
320
|
+
}
|
|
321
|
+
const fullName = githubFullName(record);
|
|
322
|
+
if (fullName === undefined) {
|
|
323
|
+
return undefined;
|
|
324
|
+
}
|
|
325
|
+
const bound = githubBoundConversation(eventName, record);
|
|
326
|
+
if (bound === undefined || bound.type !== type) {
|
|
327
|
+
return undefined;
|
|
328
|
+
}
|
|
329
|
+
return `cont:${formatConversationKey(type, {
|
|
330
|
+
fullName,
|
|
331
|
+
number: bound.number,
|
|
332
|
+
})}`;
|
|
333
|
+
}
|
|
334
|
+
function githubBoundConversation(eventName, payload) {
|
|
335
|
+
var _a, _b;
|
|
336
|
+
var _c;
|
|
337
|
+
switch (eventName) {
|
|
338
|
+
case "pull_request":
|
|
339
|
+
case "pull_request_review":
|
|
340
|
+
case "pull_request_review_comment":
|
|
341
|
+
case "pull_request_review_thread": {
|
|
342
|
+
const number = positiveInt((_a = asRecord(payload.pull_request)) === null || _a === void 0 ? void 0 : _a.number);
|
|
343
|
+
return number === undefined ? undefined : { type: "pr", number };
|
|
344
|
+
}
|
|
345
|
+
case "issues": {
|
|
346
|
+
const number = positiveInt((_b = asRecord(payload.issue)) === null || _b === void 0 ? void 0 : _b.number);
|
|
347
|
+
return number === undefined ? undefined : { type: "issue", number };
|
|
348
|
+
}
|
|
349
|
+
case "issue_comment": {
|
|
350
|
+
const issue = asRecord(payload.issue);
|
|
351
|
+
const number = positiveInt(issue === null || issue === void 0 ? void 0 : issue.number);
|
|
352
|
+
if (number === undefined) {
|
|
353
|
+
return undefined;
|
|
354
|
+
}
|
|
355
|
+
return (issue === null || issue === void 0 ? void 0 : issue.pull_request) !== undefined && issue.pull_request !== null
|
|
356
|
+
? { type: "pr", number }
|
|
357
|
+
: { type: "issue", number };
|
|
358
|
+
}
|
|
359
|
+
case "check_suite": {
|
|
360
|
+
const number = firstPullRequestNumber(asRecord(payload.check_suite));
|
|
361
|
+
return number === undefined ? undefined : { type: "pr", number };
|
|
362
|
+
}
|
|
363
|
+
case "check_run": {
|
|
364
|
+
const checkRun = asRecord(payload.check_run);
|
|
365
|
+
const number = (_c = firstPullRequestNumber(checkRun)) !== null && _c !== void 0 ? _c : firstPullRequestNumber(asRecord(checkRun === null || checkRun === void 0 ? void 0 : checkRun.check_suite));
|
|
366
|
+
return number === undefined ? undefined : { type: "pr", number };
|
|
367
|
+
}
|
|
368
|
+
default:
|
|
369
|
+
return undefined;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
function extractSlack(payload) {
|
|
373
|
+
var _a, _b, _c, _d;
|
|
374
|
+
const record = asRecord(payload);
|
|
375
|
+
if (record === undefined) {
|
|
376
|
+
return undefined;
|
|
377
|
+
}
|
|
378
|
+
const channelId = (_b = (_a = nonEmpty(record.channelId)) !== null && _a !== void 0 ? _a : nonEmpty(record.channel_id)) !== null && _b !== void 0 ? _b : nonEmpty(record.channel);
|
|
379
|
+
const threadTs = (_d = (_c = nonEmpty(record.threadTs)) !== null && _c !== void 0 ? _c : nonEmpty(record.thread_ts)) !== null && _d !== void 0 ? _d : nonEmpty(record.ts);
|
|
380
|
+
if (channelId === undefined || threadTs === undefined) {
|
|
381
|
+
return undefined;
|
|
382
|
+
}
|
|
383
|
+
return `cont:${formatConversationKey("thread", { channelId, threadTs })}`;
|
|
384
|
+
}
|
|
385
|
+
function extractOrigin(payload) {
|
|
386
|
+
var _a, _b, _c, _d;
|
|
387
|
+
var _e, _f, _g, _h;
|
|
388
|
+
const record = asRecord(payload);
|
|
389
|
+
if (record === undefined) {
|
|
390
|
+
return undefined;
|
|
391
|
+
}
|
|
392
|
+
const inner = (_e = asRecord(record.pullRequest)) !== null && _e !== void 0 ? _e : asRecord(record.pull_request);
|
|
393
|
+
const number = positiveInt(inner === null || inner === void 0 ? void 0 : inner.number);
|
|
394
|
+
const repository = (_f = asRecord(record.repository)) !== null && _f !== void 0 ? _f : asRecord((_b = asRecord((_a = asRecord(record.event)) === null || _a === void 0 ? void 0 : _a.payload)) === null || _b === void 0 ? void 0 : _b.repository);
|
|
395
|
+
const fullName = (_h = (_g = nonEmpty((_c = asRecord(repository)) === null || _c === void 0 ? void 0 : _c.fullName)) !== null && _g !== void 0 ? _g : nonEmpty((_d = asRecord(repository)) === null || _d === void 0 ? void 0 : _d.full_name)) !== null && _h !== void 0 ? _h : originFullName(repository);
|
|
396
|
+
if (number === undefined || fullName === undefined) {
|
|
397
|
+
return undefined;
|
|
398
|
+
}
|
|
399
|
+
return `cont:${formatConversationKey("origin-pr", { fullName, number })}`;
|
|
400
|
+
}
|
|
401
|
+
function githubFullName(payload) {
|
|
402
|
+
var _a;
|
|
403
|
+
const repository = asRecord(payload.repository);
|
|
404
|
+
return (_a = nonEmpty(repository === null || repository === void 0 ? void 0 : repository.full_name)) !== null && _a !== void 0 ? _a : originFullName(repository);
|
|
405
|
+
}
|
|
406
|
+
function originFullName(repository) {
|
|
407
|
+
var _a, _b;
|
|
408
|
+
var _c, _d;
|
|
409
|
+
if (repository === undefined) {
|
|
410
|
+
return undefined;
|
|
411
|
+
}
|
|
412
|
+
const owner = (_d = (_c = nonEmpty(repository.owner)) !== null && _c !== void 0 ? _c : nonEmpty((_a = asRecord(repository.owner)) === null || _a === void 0 ? void 0 : _a.login)) !== null && _d !== void 0 ? _d : nonEmpty((_b = asRecord(repository.owner)) === null || _b === void 0 ? void 0 : _b.name);
|
|
413
|
+
const name = nonEmpty(repository.name);
|
|
414
|
+
if (owner === undefined || name === undefined) {
|
|
415
|
+
return undefined;
|
|
416
|
+
}
|
|
417
|
+
return `${owner}/${name}`;
|
|
418
|
+
}
|
|
419
|
+
function firstPullRequestNumber(record) {
|
|
420
|
+
var _a;
|
|
421
|
+
const pullRequests = record === null || record === void 0 ? void 0 : record.pull_requests;
|
|
422
|
+
if (!Array.isArray(pullRequests) || pullRequests.length === 0) {
|
|
423
|
+
return undefined;
|
|
424
|
+
}
|
|
425
|
+
return positiveInt((_a = asRecord(pullRequests[0])) === null || _a === void 0 ? void 0 : _a.number);
|
|
426
|
+
}
|
|
427
|
+
function asRecord(value) {
|
|
428
|
+
return typeof value === "object" && value !== null && !Array.isArray(value)
|
|
429
|
+
? value
|
|
430
|
+
: undefined;
|
|
431
|
+
}
|
|
432
|
+
function nonEmpty(value) {
|
|
433
|
+
return typeof value === "string" && value.trim() !== ""
|
|
434
|
+
? value.trim()
|
|
435
|
+
: undefined;
|
|
436
|
+
}
|
|
437
|
+
function positiveInt(value) {
|
|
438
|
+
if (typeof value === "number" && Number.isInteger(value) && value > 0) {
|
|
439
|
+
return value;
|
|
440
|
+
}
|
|
441
|
+
if (typeof value === "string" && /^[1-9]\d*$/.test(value)) {
|
|
442
|
+
return Number(value);
|
|
443
|
+
}
|
|
444
|
+
return undefined;
|
|
445
|
+
}
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
* Keep that capability per-channel: do not reintroduce a provider-wide event
|
|
29
29
|
* union for control-plane consumers.
|
|
30
30
|
*/
|
|
31
|
+
import type { ContinuationIdentity } from "../continuation.js";
|
|
31
32
|
import type { AgentProject, AgentProjectInfo } from "../types.js";
|
|
32
33
|
export declare const DEPLOY_MANIFEST_VERSION: 1;
|
|
33
34
|
export interface AgentDeployManifestDeclarations {
|
|
@@ -35,16 +36,25 @@ export interface AgentDeployManifestDeclarations {
|
|
|
35
36
|
publicRoutePaths: string[];
|
|
36
37
|
/** Where this runtime mirrors framework-owned sessions and event chunks. */
|
|
37
38
|
frameworkStorage?: "cursor-hosted" | "other" | "none";
|
|
39
|
+
/**
|
|
40
|
+
* Hosted architecture this release deploys onto. `"v2"` selects the v2
|
|
41
|
+
* control plane; omitted channel constructors inherit kind `/v2`
|
|
42
|
+
* continuation defaults. Omit or `"v1"` keeps engine minting.
|
|
43
|
+
*/
|
|
44
|
+
architecture?: "v1" | "v2";
|
|
38
45
|
/**
|
|
39
46
|
* Mounted channels with their kinds and per-channel event capability.
|
|
40
47
|
* Scope keys are installation config and are never extracted here.
|
|
41
|
-
*
|
|
42
|
-
*
|
|
48
|
+
* Omitted channel `continuation` is `/v1` (engine minting) unless the
|
|
49
|
+
* agent set `architecture: "v2"`, which stamps kind `/v2` defaults
|
|
50
|
+
* (`github.pr/v2`, `slack.thread/v2`, `origin.pr/v2`). Per-channel
|
|
51
|
+
* selectors still override type.
|
|
43
52
|
*/
|
|
44
53
|
channels: Array<{
|
|
45
54
|
id: string;
|
|
46
55
|
kind?: string;
|
|
47
56
|
eventTypes?: string[];
|
|
57
|
+
continuation: ContinuationIdentity;
|
|
48
58
|
}>;
|
|
49
59
|
}
|
|
50
60
|
export interface AgentDeployManifestV1 {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-manifest.d.ts","sourceRoot":"","sources":["../../src/internal/deploy-manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;
|
|
1
|
+
{"version":3,"file":"deploy-manifest.d.ts","sourceRoot":"","sources":["../../src/internal/deploy-manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAIH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAUlE,eAAO,MAAM,uBAAuB,EAAE,CAAK,CAAC;AAiC5C,MAAM,WAAW,+BAA+B;IAC9C,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,4EAA4E;IAC5E,gBAAgB,CAAC,EAAE,eAAe,GAAG,OAAO,GAAG,MAAM,CAAC;IACtD;;;;OAIG;IACH,YAAY,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC3B;;;;;;;OAOG;IACH,QAAQ,EAAE,KAAK,CAAC;QACd,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QACtB,YAAY,EAAE,oBAAoB,CAAC;KACpC,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,qBAAqB;IACpC,eAAe,EAAE,CAAC,CAAC;IACnB,6BAA6B;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,+BAA+B,CAAC;IAC9C;;;OAGG;IACH,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,YAAY,EACrB,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAChD,qBAAqB,CAoDvB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,OAAO,GACX,qBAAqB,GAAG,SAAS,CAOnC"}
|
|
@@ -31,6 +31,8 @@
|
|
|
31
31
|
import { z } from "zod";
|
|
32
32
|
import { isPublicEndpointPolicy } from "../channels.js";
|
|
33
33
|
import { isCursorHostedStorage } from "../storage-backends/cursor-hosted.js";
|
|
34
|
+
import { applyAgentContinuationDefaults, channelContinuationIdentity, handshakeChannelContinuation, } from "./continuation-channel.js";
|
|
35
|
+
import { CONTINUATION_SELECTORS } from "./continuation-identity.js";
|
|
34
36
|
import { projectInfo } from "./discovery.js";
|
|
35
37
|
import { packageVersion } from "./distribution.js";
|
|
36
38
|
export const DEPLOY_MANIFEST_VERSION = 1;
|
|
@@ -39,6 +41,7 @@ export const DEPLOY_MANIFEST_VERSION = 1;
|
|
|
39
41
|
* module-private (the package builds with isolated declarations); consumers
|
|
40
42
|
* use {@link parseAgentDeployManifest} and the explicit interfaces below.
|
|
41
43
|
*/
|
|
44
|
+
const continuationIdentitySchema = z.enum(CONTINUATION_SELECTORS);
|
|
42
45
|
const agentDeployManifestV1Schema = z.object({
|
|
43
46
|
manifestVersion: z.literal(DEPLOY_MANIFEST_VERSION),
|
|
44
47
|
generatedAtMs: z.number().int().nonnegative(),
|
|
@@ -47,11 +50,13 @@ const agentDeployManifestV1Schema = z.object({
|
|
|
47
50
|
egressDomains: z.array(z.string().min(1)).max(64),
|
|
48
51
|
publicRoutePaths: z.array(z.string().min(1)).max(64),
|
|
49
52
|
frameworkStorage: z.enum(["cursor-hosted", "other", "none"]).optional(),
|
|
53
|
+
architecture: z.enum(["v1", "v2"]).optional(),
|
|
50
54
|
channels: z
|
|
51
55
|
.array(z.object({
|
|
52
56
|
id: z.string().min(1).max(128),
|
|
53
57
|
kind: z.string().min(1).max(32).optional(),
|
|
54
58
|
eventTypes: z.array(z.string().min(1).max(64)).max(64).optional(),
|
|
59
|
+
continuation: continuationIdentitySchema,
|
|
55
60
|
}))
|
|
56
61
|
.max(64),
|
|
57
62
|
}),
|
|
@@ -65,8 +70,13 @@ const agentDeployManifestV1Schema = z.object({
|
|
|
65
70
|
export function buildAgentDeployManifest(project, options) {
|
|
66
71
|
var _a;
|
|
67
72
|
var _b, _c, _d;
|
|
73
|
+
applyAgentContinuationDefaults(project);
|
|
68
74
|
const channels = project.channels.map((channel) => {
|
|
69
75
|
var _a, _b, _c;
|
|
76
|
+
const handshake = handshakeChannelContinuation(channel);
|
|
77
|
+
if (!handshake.ok) {
|
|
78
|
+
throw new Error(handshake.error);
|
|
79
|
+
}
|
|
70
80
|
const kind = (_a = channel.definition.meta) === null || _a === void 0 ? void 0 : _a.kind;
|
|
71
81
|
const githubEvents = (_b = channel.definition.meta) === null || _b === void 0 ? void 0 : _b.githubWebhookEvents;
|
|
72
82
|
const originEvents = (_c = channel.definition.meta) === null || _c === void 0 ? void 0 : _c.originWebhookEvents;
|
|
@@ -79,6 +89,7 @@ export function buildAgentDeployManifest(project, options) {
|
|
|
79
89
|
id: channel.id,
|
|
80
90
|
kind,
|
|
81
91
|
eventTypes,
|
|
92
|
+
continuation: channelContinuationIdentity(channel.definition),
|
|
82
93
|
};
|
|
83
94
|
});
|
|
84
95
|
// Same mapping as `july deploy` (cli-deploy.ts): channels declared public
|
|
@@ -90,16 +101,13 @@ export function buildAgentDeployManifest(project, options) {
|
|
|
90
101
|
manifestVersion: DEPLOY_MANIFEST_VERSION,
|
|
91
102
|
generatedAtMs: (_b = options === null || options === void 0 ? void 0 : options.nowMs) !== null && _b !== void 0 ? _b : Date.now(),
|
|
92
103
|
cliVersion: (_c = options === null || options === void 0 ? void 0 : options.cliVersion) !== null && _c !== void 0 ? _c : packageVersion(),
|
|
93
|
-
declarations: {
|
|
94
|
-
egressDomains: [...((_d = (_a = project.agent.hosting) === null || _a === void 0 ? void 0 : _a.egressDomains) !== null && _d !== void 0 ? _d : [])],
|
|
95
|
-
publicRoutePaths,
|
|
96
|
-
frameworkStorage: project.storage === undefined
|
|
104
|
+
declarations: Object.assign(Object.assign({ egressDomains: [...((_d = (_a = project.agent.hosting) === null || _a === void 0 ? void 0 : _a.egressDomains) !== null && _d !== void 0 ? _d : [])], publicRoutePaths, frameworkStorage: project.storage === undefined
|
|
97
105
|
? "none"
|
|
98
106
|
: isCursorHostedStorage(project.storage)
|
|
99
107
|
? "cursor-hosted"
|
|
100
|
-
: "other",
|
|
101
|
-
|
|
102
|
-
|
|
108
|
+
: "other" }, (project.agent.architecture === undefined
|
|
109
|
+
? {}
|
|
110
|
+
: { architecture: project.agent.architecture })), { channels }),
|
|
103
111
|
info: projectInfo(project),
|
|
104
112
|
};
|
|
105
113
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/internal/discovery.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAkBH,OAAO,
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/internal/discovery.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAkBH,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EASrB,KAAK,UAAU,EAuBhB,MAAM,aAAa,CAAC;AAgCrB,MAAM,WAAW,uBAAuB;IACtC,sDAAsD;IACtD,YAAY,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC3E;AAmBD;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CASrE;AAED,sEAAsE;AACtE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,aAAa,EAAE,CAAC,CA2B1B;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,YAAY,CAAA;CAAE,CAAC,CAAC,CA6BzD;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,uBAAuB,GAAG;IACjC,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CACtB,GACL,OAAO,CAAC,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,YAAY,CAAA;CAAE,CAAC,CAAC,CAgBzD;AAWD,iFAAiF;AACjF,eAAO,MAAM,cAAc,EAAE,GAAG,CAAC,MAAM,CAIrC,CAAC;AAEH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,YAAY,CAAC,CA0EvB;AAED,qEAAqE;AACrE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAElE;AAED,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,CAOnE;AAiyBD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAiB3E;AAo2BD,wBAAgB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,gBAAgB,CA4JnE"}
|
|
@@ -36,6 +36,7 @@ import { registerAuthoredModuleLoaders } from "./authored-loaders.js";
|
|
|
36
36
|
import { normalizePositiveInt } from "./bounded-int.js";
|
|
37
37
|
import { getDefinitionKind } from "./brand.js";
|
|
38
38
|
import { artifactBuiltinTool, builtinTools, TAG_ARTIFACT_TOOL_NAME, } from "./builtin-tools/index.js";
|
|
39
|
+
import { applyAgentContinuationDefaults } from "./continuation-channel.js";
|
|
39
40
|
import { isValidCron } from "./cron.js";
|
|
40
41
|
import { parseFrontmatter } from "./frontmatter.js";
|
|
41
42
|
import { isReservedSecretName, MAX_EGRESS_DOMAINS, validateEgressDomain, validateSecretName, } from "./hosting.js";
|
|
@@ -218,12 +219,18 @@ export function loadAgentProject(dir_1) {
|
|
|
218
219
|
if (agentDir !== rootDir) {
|
|
219
220
|
yield warnUnknownSlots(ctx, agentDir);
|
|
220
221
|
}
|
|
222
|
+
const resolvedHttpChannel = httpChannelDefinition !== null && httpChannelDefinition !== void 0 ? httpChannelDefinition : httpChannel();
|
|
223
|
+
applyAgentContinuationDefaults({
|
|
224
|
+
agent,
|
|
225
|
+
channels,
|
|
226
|
+
httpChannel: resolvedHttpChannel,
|
|
227
|
+
});
|
|
221
228
|
return {
|
|
222
229
|
rootDir,
|
|
223
230
|
agentDir,
|
|
224
231
|
name: agent.name,
|
|
225
232
|
agent,
|
|
226
|
-
httpChannel:
|
|
233
|
+
httpChannel: resolvedHttpChannel,
|
|
227
234
|
channels,
|
|
228
235
|
schedules,
|
|
229
236
|
hooks,
|
|
@@ -282,6 +289,13 @@ function loadAgent(ctx, agentDir, options) {
|
|
|
282
289
|
message: "tools is not supported on subagents (they keep the harness task-tool toolset); ignoring.",
|
|
283
290
|
});
|
|
284
291
|
}
|
|
292
|
+
if ((config === null || config === void 0 ? void 0 : config.architecture) !== undefined) {
|
|
293
|
+
ctx.diagnostics.push({
|
|
294
|
+
severity: "warning",
|
|
295
|
+
path: displayPath(ctx, join(agentDir, "agent.ts")),
|
|
296
|
+
message: "architecture is not supported on subagents; ignoring.",
|
|
297
|
+
});
|
|
298
|
+
}
|
|
285
299
|
const artifactsPath = yield findModuleFile(agentDir, "artifacts");
|
|
286
300
|
if (artifactsPath !== undefined) {
|
|
287
301
|
ctx.diagnostics.push({
|
|
@@ -371,6 +385,7 @@ function loadAgent(ctx, agentDir, options) {
|
|
|
371
385
|
};
|
|
372
386
|
const hosting = resolveHosting(ctx, agentDir, config === null || config === void 0 ? void 0 : config.hosting);
|
|
373
387
|
const concurrency = resolveConcurrency(ctx, agentDir, config === null || config === void 0 ? void 0 : config.concurrency);
|
|
388
|
+
const architecture = resolveArchitecture(ctx, agentDir, config === null || config === void 0 ? void 0 : config.architecture);
|
|
374
389
|
if (runtime === "cloud") {
|
|
375
390
|
warnCloudRuntimeLimitations(ctx, agentDir, {
|
|
376
391
|
agentTools: tools.filter((tool) => tool.execution === "agent").length,
|
|
@@ -380,20 +395,32 @@ function loadAgent(ctx, agentDir, options) {
|
|
|
380
395
|
});
|
|
381
396
|
}
|
|
382
397
|
appendBuiltinTools(ctx, agentDir, tools, config === null || config === void 0 ? void 0 : config.builtinTools);
|
|
383
|
-
return Object.assign(Object.assign({ name, description: config === null || config === void 0 ? void 0 : config.description,
|
|
398
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({ name, description: config === null || config === void 0 ? void 0 : config.description,
|
|
384
399
|
// Root agents always get a concrete model: authored value or DEFAULT_MODEL.
|
|
385
400
|
model: isValidModelSetting(config === null || config === void 0 ? void 0 : config.model) ? config.model : DEFAULT_MODEL, instructions,
|
|
386
401
|
runtime,
|
|
387
402
|
cloud,
|
|
388
403
|
local }, (allowedTools === undefined ? {} : { allowedTools })), { hosting,
|
|
389
|
-
concurrency,
|
|
390
|
-
tools,
|
|
404
|
+
concurrency }), (architecture === undefined ? {} : { architecture })), { tools,
|
|
391
405
|
skills,
|
|
392
406
|
connections,
|
|
393
407
|
subagents,
|
|
394
408
|
seedFiles });
|
|
395
409
|
});
|
|
396
410
|
}
|
|
411
|
+
function resolveArchitecture(ctx, agentDir, architecture) {
|
|
412
|
+
if (architecture === undefined ||
|
|
413
|
+
architecture === "v1" ||
|
|
414
|
+
architecture === "v2") {
|
|
415
|
+
return architecture;
|
|
416
|
+
}
|
|
417
|
+
ctx.diagnostics.push({
|
|
418
|
+
severity: "error",
|
|
419
|
+
path: displayPath(ctx, join(agentDir, "agent.ts")),
|
|
420
|
+
message: `architecture must be "v1" or "v2"; got ${JSON.stringify(architecture)}.`,
|
|
421
|
+
});
|
|
422
|
+
return undefined;
|
|
423
|
+
}
|
|
397
424
|
/** Absolute harness cwd parent, or undefined when unset / blank. */
|
|
398
425
|
function resolveAgentCwd(ctx, authored) {
|
|
399
426
|
if (authored === undefined) {
|
|
@@ -1241,7 +1268,7 @@ function warnCloudRuntimeLimitations(ctx, agentDir, counts) {
|
|
|
1241
1268
|
ctx.diagnostics.push({
|
|
1242
1269
|
severity: "warning",
|
|
1243
1270
|
path: displayPath(ctx, join(agentDir, "skills")),
|
|
1244
|
-
message: "Authored skills
|
|
1271
|
+
message: "Authored skills reach cloud agents on hosted deployments via the deployment store's skills/ directory (native skill discovery). Cloud turns started outside hosting (dev serve/run) see only skills already in the cloud repo.",
|
|
1245
1272
|
});
|
|
1246
1273
|
}
|
|
1247
1274
|
if (counts.seedFiles > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/internal/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/internal/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA0CH,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAOhB,YAAY,EACb,MAAM,aAAa,CAAC;AAwHrB,OAAO,EAAE,KAAK,WAAW,EAAmB,MAAM,iBAAiB,CAAC;AAwBpE,8EAA8E;AAC9E,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,YAAY,CAAC;CACvB;AAaD,6EAA6E;AAC7E,MAAM,WAAW,0BAA0B;IACzC,oEAAoE;IACpE,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,UAAU,EAAE,EACpB,OAAO,GAAE,YAAY,GAAG,0BAA+B,GACtD,OAAO,CAAC,gBAAgB,CAAC,CAo0B3B"}
|