@cursor/july 0.1.80 → 0.1.83
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/README.md +2 -2
- 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 +2 -2
- package/dist/docs/ab.html +3 -3
- package/dist/docs/assets/{app.e4_wtjUS.js → app.6THHGRH-.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.D9uScPWb.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.DbdzyEie.js → VPLocalSearchBox.BpHB9ulP.js} +1 -1
- package/dist/docs/assets/chunks/{theme.D8HpLrLK.js → theme.DBJvJznv.js} +2 -2
- package/dist/docs/assets/{guides_cloud-runtime.md.V5igN4Sq.js → guides_cloud-runtime.md.CbklWfzh.js} +1 -1
- package/dist/docs/assets/{guides_cloud-runtime.md.V5igN4Sq.lean.js → guides_cloud-runtime.md.CbklWfzh.lean.js} +1 -1
- package/dist/docs/assets/{reference_agent-config.md.BZnEKfEc.js → reference_agent-config.md.CTWp4DnU.js} +1 -1
- package/dist/docs/assets/{reference_skills.md.B_jHN7JL.js → reference_skills.md.BRF2nDv9.js} +2 -2
- package/dist/docs/assets/{reference_skills.md.B_jHN7JL.lean.js → reference_skills.md.BRF2nDv9.lean.js} +1 -1
- package/dist/docs/assets/troubleshooting.md.KgmmaCgw.js +1 -0
- package/dist/docs/building-with-agents.html +3 -3
- package/dist/docs/concepts.html +3 -3
- package/dist/docs/deployment.html +3 -3
- package/dist/docs/evals.html +3 -3
- package/dist/docs/example-agents/approval-buddy.html +3 -3
- package/dist/docs/example-agents/benny.html +3 -3
- package/dist/docs/example-agents/bugbot.html +3 -3
- package/dist/docs/example-agents/codebase-wiki.html +3 -3
- package/dist/docs/example-agents/codeowners-review.html +3 -3
- package/dist/docs/example-agents/concierge.html +3 -3
- package/dist/docs/example-agents/fsd.html +3 -3
- package/dist/docs/example-agents/index.html +3 -3
- package/dist/docs/example-agents/knowledge-base.html +3 -3
- package/dist/docs/example-agents/oncall.html +3 -3
- package/dist/docs/example-agents/security-reviewer.html +3 -3
- package/dist/docs/example-agents/slack-agent.html +3 -3
- package/dist/docs/example-agents/weather-agent.html +3 -3
- package/dist/docs/guides/agent-to-agent.html +3 -3
- package/dist/docs/guides/cloud-runtime.html +5 -5
- package/dist/docs/guides/convert-automation.html +3 -3
- package/dist/docs/guides/github.html +3 -3
- package/dist/docs/guides/human-in-the-loop.html +3 -3
- package/dist/docs/guides/mcp-oauth.html +3 -3
- package/dist/docs/guides/opentelemetry.html +3 -3
- package/dist/docs/guides/slack.html +3 -3
- package/dist/docs/guides/webhooks.html +3 -3
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +3 -3
- package/dist/docs/index.html +3 -3
- package/dist/docs/quickstart.html +3 -3
- package/dist/docs/reference/agent-config.html +5 -5
- package/dist/docs/reference/artifacts.html +3 -3
- package/dist/docs/reference/channels.html +3 -3
- package/dist/docs/reference/cli.html +3 -3
- package/dist/docs/reference/connections.html +3 -3
- package/dist/docs/reference/hooks.html +3 -3
- package/dist/docs/reference/http-api.html +3 -3
- package/dist/docs/reference/instructions.html +3 -3
- package/dist/docs/reference/playground.html +3 -3
- package/dist/docs/reference/project-layout.html +3 -3
- package/dist/docs/reference/prompt.html +3 -3
- package/dist/docs/reference/schedules.html +3 -3
- package/dist/docs/reference/sessions.html +3 -3
- package/dist/docs/reference/skills.html +5 -5
- package/dist/docs/reference/subagents.html +3 -3
- package/dist/docs/reference/tools.html +3 -3
- package/dist/docs/scaffolding-agents.html +3 -3
- package/dist/docs/storage.html +3 -3
- package/dist/docs/templates/agentic-owners.html +3 -3
- package/dist/docs/templates/demo.html +3 -3
- package/dist/docs/templates/pr-autofixer.html +3 -3
- package/dist/docs/templates/security-reviewer.html +3 -3
- package/dist/docs/templates/triage.html +3 -3
- package/dist/docs/troubleshooting.html +5 -5
- package/dist/files-backends/cursor-hosted.d.ts +6 -0
- package/dist/files-backends/cursor-hosted.d.ts.map +1 -1
- package/dist/files-backends/cursor-hosted.js +19 -0
- package/dist/files.d.ts +22 -3
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +22 -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/sdk-runner.d.ts.map +1 -1
- package/dist/internal/sdk-runner.js +6 -9
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +18 -8
- package/dist/internal/session-engine.d.ts +30 -0
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +140 -36
- 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 +27 -0
- package/dist/internal/skills-sync.d.ts.map +1 -0
- package/dist/internal/skills-sync.js +98 -0
- package/dist/playground/assets/{index-DJzcIeGt.css → index-ChETdG-_.css} +1 -1
- package/dist/playground/assets/{index-K3Sxyx0I.js → index-Cspgk9jC.js} +45 -45
- package/dist/playground/index.html +2 -2
- package/dist/types.d.ts +49 -0
- package/dist/types.d.ts.map +1 -1
- package/docs/guides/cloud-runtime.md +6 -1
- package/docs/reference/agent-config.md +6 -5
- package/docs/reference/skills.md +12 -3
- package/docs/troubleshooting.md +1 -1
- package/package.json +1 -1
- package/skills/framework-map/SKILL.md +2 -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-backends/cursor-hosted.ts +21 -0
- package/src/files.ts +29 -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/sdk-runner.ts +10 -11
- package/src/internal/server.ts +23 -9
- package/src/internal/session-engine.ts +178 -37
- package/src/internal/session-store.ts +6 -0
- package/src/internal/skills-sync.ts +110 -0
- package/src/types.ts +60 -0
- package/dist/docs/assets/chunks/@localSearchIndexroot.BGiMJpnL.js +0 -1
- package/dist/docs/assets/troubleshooting.md.DQ-hYuZT.js +0 -1
- /package/dist/docs/assets/{reference_agent-config.md.BZnEKfEc.lean.js → reference_agent-config.md.CTWp4DnU.lean.js} +0 -0
- /package/dist/docs/assets/{troubleshooting.md.DQ-hYuZT.lean.js → troubleshooting.md.KgmmaCgw.lean.js} +0 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sync authored skills onto an Agent Store so cloud-runtime turns discover
|
|
3
|
+
* them natively. Hosted deployments write store-root `skills/<name>/…` (the
|
|
4
|
+
* VM's `--agent-store-skills-dir /cursor/stores/deployment/skills`). Local
|
|
5
|
+
* `serve`/`run` with `runtime: "cloud"` writes
|
|
6
|
+
* `agent-serve/<agent>/skills/<name>/…` on the USER store.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { readFile } from "node:fs/promises";
|
|
10
|
+
import { posix } from "node:path";
|
|
11
|
+
import { agentStoreKeys, FileConflictError, type FileSink } from "../files.js";
|
|
12
|
+
import { STORAGE_KEY_ROOT } from "../storage.js";
|
|
13
|
+
import type { DiscoveredSkill, SkillFileSource } from "../types.js";
|
|
14
|
+
import { buildSkillMd } from "./workspace.js";
|
|
15
|
+
|
|
16
|
+
/** Pre-native layout. Deleted on every sync so a rolled-forward deploy does not leave undiscoverable copies. */
|
|
17
|
+
function legacySkillsPrefix(agent: string): string {
|
|
18
|
+
return `${STORAGE_KEY_ROOT}/${agent}/skills/`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Mirror the agent's skills onto the store: write every SKILL.md (with the
|
|
23
|
+
* same generated frontmatter local materialization uses) plus sibling files,
|
|
24
|
+
* and delete keys no authored skill claims so redeploys drop removed skills.
|
|
25
|
+
*
|
|
26
|
+
* Everything loads and validates before the store is touched, and writes
|
|
27
|
+
* land before stale deletes, so a failed sync never leaves a gap a
|
|
28
|
+
* concurrent cloud reader could see.
|
|
29
|
+
*/
|
|
30
|
+
export async function syncSkillsToStore(args: {
|
|
31
|
+
sink: FileSink;
|
|
32
|
+
/** Sweeps leftover keys from the pre-native `agentkit/v1/{agent}/skills/` prefix. */
|
|
33
|
+
agentName: string;
|
|
34
|
+
skills: readonly DiscoveredSkill[];
|
|
35
|
+
/** Store-root directory that holds SKILL.md files. Defaults to `skills/`. */
|
|
36
|
+
skillsPrefix?: string;
|
|
37
|
+
}): Promise<void> {
|
|
38
|
+
const skillsPrefix = args.skillsPrefix ?? agentStoreKeys.skillsPrefix();
|
|
39
|
+
const desired = new Map<string, Uint8Array>();
|
|
40
|
+
for (const skill of args.skills) {
|
|
41
|
+
const key = (relPath: string): string =>
|
|
42
|
+
agentStoreKeys.skillFile(skill.name, relPath, skillsPrefix);
|
|
43
|
+
desired.set(key("SKILL.md"), Buffer.from(buildSkillMd(skill), "utf8"));
|
|
44
|
+
for (const [relPath, source] of Object.entries(skill.files)) {
|
|
45
|
+
desired.set(key(storeRelPath(relPath)), await sourceBytes(source));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
await Promise.all(
|
|
49
|
+
[...desired].map(([key, body]) => putLastWriterWins(args.sink, key, body))
|
|
50
|
+
);
|
|
51
|
+
const [existing, leftover] = await Promise.all([
|
|
52
|
+
args.sink.list(skillsPrefix),
|
|
53
|
+
args.sink.list(legacySkillsPrefix(args.agentName)),
|
|
54
|
+
]);
|
|
55
|
+
await Promise.all(
|
|
56
|
+
[...existing.filter((entry) => !desired.has(entry.key)), ...leftover].map(
|
|
57
|
+
(entry) => args.sink.delete(entry.key)
|
|
58
|
+
)
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Same refusals as local materialization's `resolveInside`: a rel that
|
|
64
|
+
* escapes the skill directory or would not round-trip through the FUSE
|
|
65
|
+
* mount (`..`, `.`, `//`, absolute) fails the sync, exactly as it fails a
|
|
66
|
+
* local turn's workspace write. Backslashes are refused too — the store
|
|
67
|
+
* normalizes `\` to `/` on write, so the stored key would differ from the
|
|
68
|
+
* desired one and the stale pass would delete the file it just wrote.
|
|
69
|
+
*/
|
|
70
|
+
function storeRelPath(relPath: string): string {
|
|
71
|
+
if (
|
|
72
|
+
relPath.includes("\0") ||
|
|
73
|
+
relPath.includes("\\") ||
|
|
74
|
+
posix.isAbsolute(relPath) ||
|
|
75
|
+
relPath.endsWith("/") ||
|
|
76
|
+
relPath.split("/").some((seg) => seg === ".." || seg === ".") ||
|
|
77
|
+
posix.normalize(relPath) !== relPath
|
|
78
|
+
) {
|
|
79
|
+
throw new Error(
|
|
80
|
+
`Refusing skill file path "${relPath}" (must be a normalized relative path)`
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
return relPath;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Last writer wins. A raced conditional put (dual engine pods during a
|
|
88
|
+
* deploy rollover) clears the sink's cached etag, so one retry re-learns
|
|
89
|
+
* the current version and lands.
|
|
90
|
+
*/
|
|
91
|
+
async function putLastWriterWins(
|
|
92
|
+
sink: FileSink,
|
|
93
|
+
key: string,
|
|
94
|
+
body: Uint8Array
|
|
95
|
+
): Promise<void> {
|
|
96
|
+
try {
|
|
97
|
+
await sink.put(key, body);
|
|
98
|
+
} catch (error) {
|
|
99
|
+
if (!(error instanceof FileConflictError)) {
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
102
|
+
await sink.put(key, body);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async function sourceBytes(source: SkillFileSource): Promise<Uint8Array> {
|
|
107
|
+
return "contents" in source
|
|
108
|
+
? Buffer.from(source.contents, "utf8")
|
|
109
|
+
: readFile(source.sourcePath);
|
|
110
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -11,9 +11,21 @@
|
|
|
11
11
|
import type { InteractionUpdate, SDKCustomTool, ToolName } from "@cursor/sdk";
|
|
12
12
|
import type { z } from "zod";
|
|
13
13
|
import type { ABConfigFile } from "./ab.js";
|
|
14
|
+
import type {
|
|
15
|
+
ContinuationClaim,
|
|
16
|
+
ContinuationIdentity,
|
|
17
|
+
MailboxContinuation,
|
|
18
|
+
} from "./continuation.js";
|
|
14
19
|
import type { OtelConfig, OtelDefinition } from "./otel.js";
|
|
15
20
|
import type { StorageDefinition } from "./storage.js";
|
|
16
21
|
|
|
22
|
+
export type {
|
|
23
|
+
ContinuationClaim,
|
|
24
|
+
ContinuationIdentity,
|
|
25
|
+
ConversationType,
|
|
26
|
+
MailboxContinuation,
|
|
27
|
+
} from "./continuation.js";
|
|
28
|
+
|
|
17
29
|
// ============================================================================
|
|
18
30
|
// JSON
|
|
19
31
|
// ============================================================================
|
|
@@ -240,8 +252,26 @@ export interface AgentConfig {
|
|
|
240
252
|
* it only shapes what the model can call.
|
|
241
253
|
*/
|
|
242
254
|
tools?: ToolName[];
|
|
255
|
+
/**
|
|
256
|
+
* Hosted architecture this agent deploys onto. Omit or `"v1"` keeps the
|
|
257
|
+
* current control plane and engine-minted conversation keys. `"v2"`
|
|
258
|
+
* deploys onto the v2 control plane (v2 APIs and schemas). Omitted
|
|
259
|
+
* channel `continuation` then inherits from declared events (`github.pr/v2`,
|
|
260
|
+
* `github.issue/v2`, `github.none/v2`, `slack.thread/v2`, `origin.pr/v2`,
|
|
261
|
+
* `none/v2`). An explicit per-channel selector still overrides.
|
|
262
|
+
*
|
|
263
|
+
* ```ts
|
|
264
|
+
* export default defineAgent({
|
|
265
|
+
* architecture: "v2",
|
|
266
|
+
* });
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
269
|
+
architecture?: AgentArchitecture;
|
|
243
270
|
}
|
|
244
271
|
|
|
272
|
+
/** Hosted architecture on {@link AgentConfig.architecture}. */
|
|
273
|
+
export type AgentArchitecture = "v1" | "v2";
|
|
274
|
+
|
|
245
275
|
/**
|
|
246
276
|
* Built-in tools on {@link AgentConfig.builtinTools}. Each enabled
|
|
247
277
|
* capability materializes as ordinary server tools at discovery time, so
|
|
@@ -1595,8 +1625,21 @@ export interface SendMessageOptions {
|
|
|
1595
1625
|
* Channel-local continuation token. When it addresses an existing session
|
|
1596
1626
|
* the message is a follow-up; otherwise a new session is created keyed by
|
|
1597
1627
|
* this token. Omit to always create a fresh session.
|
|
1628
|
+
*
|
|
1629
|
+
* `/v2` selectors refuse this field — pass {@link mailboxContinuation} or
|
|
1630
|
+
* a structured {@link claim} instead.
|
|
1598
1631
|
*/
|
|
1599
1632
|
continuationToken?: string;
|
|
1633
|
+
/**
|
|
1634
|
+
* v2 mailbox stamp from the control plane (or the pack's builtin extract
|
|
1635
|
+
* on local serve). Ignored on v1.
|
|
1636
|
+
*/
|
|
1637
|
+
mailboxContinuation?: MailboxContinuation;
|
|
1638
|
+
/**
|
|
1639
|
+
* v2 host join. Never a concatenated `pr:owner/repo#N` string — the
|
|
1640
|
+
* registry mints `cont:` bytes from this claim.
|
|
1641
|
+
*/
|
|
1642
|
+
claim?: ContinuationClaim;
|
|
1600
1643
|
/** Initial channel state for newly created sessions. */
|
|
1601
1644
|
state?: JsonValue;
|
|
1602
1645
|
/**
|
|
@@ -2057,6 +2100,12 @@ export type ChannelDefinition<TState = JsonValue> = ChannelConfig<TState> &
|
|
|
2057
2100
|
export interface HttpChannelConfig {
|
|
2058
2101
|
/** Route auth chain. Defaults to `[localDevStrict()]`. */
|
|
2059
2102
|
auth?: AuthPolicy[];
|
|
2103
|
+
/**
|
|
2104
|
+
* Continuation selector. Omitted inherits {@link AgentConfig.architecture}:
|
|
2105
|
+
* `"none/v1"` unless the agent set `architecture: "v2"` (then `"none/v2"`
|
|
2106
|
+
* → `evt:`). Override with an explicit `"none/v1"` or `"none/v2"`.
|
|
2107
|
+
*/
|
|
2108
|
+
continuation?: ContinuationIdentity;
|
|
2060
2109
|
/**
|
|
2061
2110
|
* Transform the inbound message before the agent sees it (e.g. prepend
|
|
2062
2111
|
* request-specific context).
|
|
@@ -2549,6 +2598,12 @@ export interface ResolvedAgent {
|
|
|
2549
2598
|
hosting?: AgentHostingOptions;
|
|
2550
2599
|
/** Validated turn admission limits from {@link AgentConfig.concurrency}. */
|
|
2551
2600
|
concurrency?: AgentConcurrencyOptions;
|
|
2601
|
+
/**
|
|
2602
|
+
* Validated architecture from {@link AgentConfig.architecture}.
|
|
2603
|
+
* `"v2"` deploys onto the v2 control plane and stamps kind `/v2`
|
|
2604
|
+
* continuation defaults onto channels that omitted a selector.
|
|
2605
|
+
*/
|
|
2606
|
+
architecture?: AgentArchitecture;
|
|
2552
2607
|
tools: DiscoveredTool[];
|
|
2553
2608
|
skills: DiscoveredSkill[];
|
|
2554
2609
|
connections: DiscoveredConnection[];
|
|
@@ -2714,6 +2769,11 @@ export interface RunnerTurnRequest {
|
|
|
2714
2769
|
runtime: AgentRuntime;
|
|
2715
2770
|
/** Cloud options when {@link runtime} is `"cloud"`. */
|
|
2716
2771
|
cloud?: AgentCloudOptions;
|
|
2772
|
+
/**
|
|
2773
|
+
* defineAgent directory slug for personal-key cloud creates. Injected
|
|
2774
|
+
* by the engine — not part of authored {@link AgentCloudOptions}.
|
|
2775
|
+
*/
|
|
2776
|
+
agentServeAgent?: string;
|
|
2717
2777
|
/** In-process tools, already bound to the session's tool context. */
|
|
2718
2778
|
customTools: Record<string, SDKCustomTool>;
|
|
2719
2779
|
/** MCP servers from `agent/mcp-connections/`. */
|