@cursor/july 0.1.76 → 0.1.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/channels/origin/origin-webhook.d.ts +23 -2
  2. package/dist/channels/origin/origin-webhook.d.ts.map +1 -1
  3. package/dist/channels/origin/origin-webhook.js +82 -20
  4. package/dist/docs/404.html +2 -2
  5. package/dist/docs/ab.html +3 -3
  6. package/dist/docs/assets/{app.b8bhB2SV.js → app.BEHVaPKt.js} +1 -1
  7. package/dist/docs/assets/chunks/@localSearchIndexroot.Vvio4stV.js +1 -0
  8. package/dist/docs/assets/chunks/{VPLocalSearchBox.lLSeIyWw.js → VPLocalSearchBox.D2-5PKih.js} +1 -1
  9. package/dist/docs/assets/chunks/{theme.C_owesa-.js → theme.uNqJ4MUO.js} +2 -2
  10. package/dist/docs/assets/{storage.md.D8NQ389l.js → storage.md.ks1u64_R.js} +3 -3
  11. package/dist/docs/assets/storage.md.ks1u64_R.lean.js +1 -0
  12. package/dist/docs/building-with-agents.html +3 -3
  13. package/dist/docs/concepts.html +3 -3
  14. package/dist/docs/deployment.html +3 -3
  15. package/dist/docs/evals.html +3 -3
  16. package/dist/docs/example-agents/approval-buddy.html +3 -3
  17. package/dist/docs/example-agents/benny.html +3 -3
  18. package/dist/docs/example-agents/bugbot.html +3 -3
  19. package/dist/docs/example-agents/codebase-wiki.html +3 -3
  20. package/dist/docs/example-agents/codeowners-review.html +3 -3
  21. package/dist/docs/example-agents/concierge.html +3 -3
  22. package/dist/docs/example-agents/fsd.html +3 -3
  23. package/dist/docs/example-agents/index.html +3 -3
  24. package/dist/docs/example-agents/knowledge-base.html +3 -3
  25. package/dist/docs/example-agents/oncall.html +3 -3
  26. package/dist/docs/example-agents/security-reviewer.html +3 -3
  27. package/dist/docs/example-agents/slack-agent.html +3 -3
  28. package/dist/docs/example-agents/weather-agent.html +3 -3
  29. package/dist/docs/guides/agent-to-agent.html +3 -3
  30. package/dist/docs/guides/cloud-runtime.html +3 -3
  31. package/dist/docs/guides/convert-automation.html +3 -3
  32. package/dist/docs/guides/github.html +3 -3
  33. package/dist/docs/guides/human-in-the-loop.html +3 -3
  34. package/dist/docs/guides/mcp-oauth.html +3 -3
  35. package/dist/docs/guides/opentelemetry.html +3 -3
  36. package/dist/docs/guides/slack.html +3 -3
  37. package/dist/docs/guides/webhooks.html +3 -3
  38. package/dist/docs/hashmap.json +1 -1
  39. package/dist/docs/hillclimbing.html +3 -3
  40. package/dist/docs/index.html +3 -3
  41. package/dist/docs/quickstart.html +3 -3
  42. package/dist/docs/reference/agent-config.html +3 -3
  43. package/dist/docs/reference/artifacts.html +3 -3
  44. package/dist/docs/reference/channels.html +3 -3
  45. package/dist/docs/reference/cli.html +3 -3
  46. package/dist/docs/reference/connections.html +3 -3
  47. package/dist/docs/reference/hooks.html +3 -3
  48. package/dist/docs/reference/http-api.html +3 -3
  49. package/dist/docs/reference/instructions.html +3 -3
  50. package/dist/docs/reference/playground.html +3 -3
  51. package/dist/docs/reference/project-layout.html +3 -3
  52. package/dist/docs/reference/prompt.html +3 -3
  53. package/dist/docs/reference/schedules.html +3 -3
  54. package/dist/docs/reference/sessions.html +3 -3
  55. package/dist/docs/reference/skills.html +3 -3
  56. package/dist/docs/reference/subagents.html +3 -3
  57. package/dist/docs/reference/tools.html +3 -3
  58. package/dist/docs/scaffolding-agents.html +3 -3
  59. package/dist/docs/storage.html +7 -7
  60. package/dist/docs/templates/agentic-owners.html +3 -3
  61. package/dist/docs/templates/demo.html +3 -3
  62. package/dist/docs/templates/pr-autofixer.html +3 -3
  63. package/dist/docs/templates/security-reviewer.html +3 -3
  64. package/dist/docs/templates/triage.html +3 -3
  65. package/dist/docs/troubleshooting.html +3 -3
  66. package/dist/index.d.ts +0 -1
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +0 -1
  69. package/dist/internal/discovery.d.ts.map +1 -1
  70. package/dist/internal/discovery.js +3 -21
  71. package/dist/internal/distribution.d.ts.map +1 -1
  72. package/dist/internal/distribution.js +0 -1
  73. package/dist/internal/session-engine.d.ts +1 -60
  74. package/dist/internal/session-engine.d.ts.map +1 -1
  75. package/dist/internal/session-engine.js +10 -109
  76. package/dist/kv/memory-kv.d.ts +1 -10
  77. package/dist/kv/memory-kv.d.ts.map +1 -1
  78. package/dist/kv/memory-kv.js +1 -10
  79. package/dist/kv.d.ts +2 -3
  80. package/dist/kv.d.ts.map +1 -1
  81. package/dist/kv.js +2 -3
  82. package/dist/playground/assets/{index-Bfwz2yLN.css → index-DJzcIeGt.css} +1 -1
  83. package/dist/playground/assets/{index-BWqjJcRo.js → index-K3Sxyx0I.js} +48 -45
  84. package/dist/playground/index.html +2 -2
  85. package/dist/storage-backends/cursor-hosted.js +3 -3
  86. package/dist/storage-protocol.d.ts +3 -8
  87. package/dist/storage-protocol.d.ts.map +1 -1
  88. package/dist/storage-protocol.js +4 -10
  89. package/dist/storage.d.ts +5 -11
  90. package/dist/storage.d.ts.map +1 -1
  91. package/dist/storage.js +3 -4
  92. package/dist/types.d.ts +5 -34
  93. package/dist/types.d.ts.map +1 -1
  94. package/docs/storage.md +11 -44
  95. package/package.json +1 -8
  96. package/src/channels/origin/origin-webhook.ts +111 -25
  97. package/src/index.ts +0 -6
  98. package/src/internal/discovery.ts +3 -27
  99. package/src/internal/distribution.ts +0 -1
  100. package/src/internal/session-engine.ts +1 -168
  101. package/src/kv/memory-kv.ts +1 -10
  102. package/src/kv.ts +2 -3
  103. package/src/storage-backends/cursor-hosted.ts +3 -3
  104. package/src/storage-protocol.ts +4 -10
  105. package/src/storage.ts +6 -12
  106. package/src/types.ts +5 -35
  107. package/templates/agentic-owners/agent/lib/owners/match.ts +64 -3
  108. package/templates/agentic-owners/agent/lib/owners/parse.ts +55 -1
  109. package/templates/agentic-owners/agent/lib/owners/types.ts +5 -0
  110. package/dist/docs/assets/chunks/@localSearchIndexroot.DGZeXVqn.js +0 -1
  111. package/dist/docs/assets/storage.md.D8NQ389l.lean.js +0 -1
  112. package/dist/internal/durable-session-store.d.ts +0 -60
  113. package/dist/internal/durable-session-store.d.ts.map +0 -1
  114. package/dist/internal/durable-session-store.js +0 -131
  115. package/dist/internal/ledger-serving.d.ts +0 -169
  116. package/dist/internal/ledger-serving.d.ts.map +0 -1
  117. package/dist/internal/ledger-serving.js +0 -393
  118. package/dist/ledger/janitor.d.ts +0 -60
  119. package/dist/ledger/janitor.d.ts.map +0 -1
  120. package/dist/ledger/janitor.js +0 -137
  121. package/dist/ledger/session-ledger.d.ts +0 -293
  122. package/dist/ledger/session-ledger.d.ts.map +0 -1
  123. package/dist/ledger/session-ledger.js +0 -614
  124. package/dist/ledger.d.ts +0 -12
  125. package/dist/ledger.d.ts.map +0 -1
  126. package/dist/ledger.js +0 -9
  127. package/src/internal/durable-session-store.ts +0 -134
  128. package/src/internal/ledger-serving.ts +0 -531
  129. package/src/ledger/janitor.ts +0 -193
  130. package/src/ledger/session-ledger.ts +0 -839
  131. package/src/ledger.ts +0 -44
package/src/types.ts CHANGED
@@ -240,31 +240,8 @@ export interface AgentConfig {
240
240
  * it only shapes what the model can call.
241
241
  */
242
242
  tools?: ToolName[];
243
- /**
244
- * How the serve host coordinates event delivery and turn execution. See
245
- * {@link AgentServingMode}. Defaults to `"resident"`; opt in to
246
- * `"ledger"` per agent — rollback is flipping the value back.
247
- */
248
- serving?: AgentServingMode;
249
243
  }
250
244
 
251
- /**
252
- * Serving coordination mode on {@link AgentConfig.serving}.
253
- *
254
- * - `"resident"` (default): the in-process session engine owns delivery —
255
- * today's behavior, unchanged.
256
- * - `"ledger"`: every delivery coordinates through the KV session ledger
257
- * before its turn runs: session identity, a one-writer-per-session
258
- * lease with generation fencing, and a fenced commit sequence.
259
- * Requires a store with conditional writes (the `cas` group on
260
- * `defineStorage`, or an explicit CAS-capable override); startup fails
261
- * fast otherwise. This stage is coordination only — there is no
262
- * durable inbox yet, so an event arriving while the lease is held
263
- * waits in-process and a crash loses it exactly as resident serving
264
- * does. The durable mailbox lands in a follow-up.
265
- */
266
- export type AgentServingMode = "resident" | "ledger";
267
-
268
245
  /**
269
246
  * Built-in tools on {@link AgentConfig.builtinTools}. Each enabled
270
247
  * capability materializes as ordinary server tools at discovery time, so
@@ -596,14 +573,12 @@ export type KvCasResult =
596
573
  | { ok: false; current: KvVersionedEntry | undefined };
597
574
 
598
575
  /**
599
- * Conditional-write superset of {@link HostKvApi} for coordination
600
- * protocols (the upcoming session ledger). Version-token CAS was chosen
601
- * over compare-value: every candidate backend can mint a cheap opaque
602
- * token (counter, UUID, row version), while compare-value would force
603
- * deep JSON equality with key-order pitfalls on each of them. The
576
+ * Conditional-write superset of {@link HostKvApi}. Version-token CAS was
577
+ * chosen over compare-value: every candidate backend can mint a cheap
578
+ * opaque token (counter, UUID, row version), while compare-value would
579
+ * force deep JSON equality with key-order pitfalls on each of them. The
604
580
  * agent-facing `host.kv` stays plain {@link HostKvApi}; storage backends
605
- * supply CAS via the optional `cas` group on `defineStorage`, and
606
- * coordination features fail fast when the backend lacks it.
581
+ * supply CAS via the optional `cas` group on `defineStorage`.
607
582
  */
608
583
  export interface HostKvCasApi extends HostKvApi {
609
584
  /** Read one value with its version token. Miss → `undefined`. */
@@ -2574,11 +2549,6 @@ export interface ResolvedAgent {
2574
2549
  hosting?: AgentHostingOptions;
2575
2550
  /** Validated turn admission limits from {@link AgentConfig.concurrency}. */
2576
2551
  concurrency?: AgentConcurrencyOptions;
2577
- /**
2578
- * Validated serving mode from {@link AgentConfig.serving}. Undefined
2579
- * means `"resident"` (the default path).
2580
- */
2581
- serving?: AgentServingMode;
2582
2552
  tools: DiscoveredTool[];
2583
2553
  skills: DiscoveredSkill[];
2584
2554
  connections: DiscoveredConnection[];
@@ -1,6 +1,8 @@
1
1
  // Vendored from the Agentic Owners policy core; see README.md in this
2
2
  // directory. Precedence must stay identical to the source's.
3
3
 
4
+ import { posix } from "node:path";
5
+ import { AGENTIC_OWNERS_DIR } from "./constants.js";
4
6
  import { patternMatchesFile, patternSpecificity } from "./matching.js";
5
7
  import type {
6
8
  AgenticOwnersMatchedConfig,
@@ -12,10 +14,63 @@ type PathScopedRule = {
12
14
  readonly scopeDepth: number;
13
15
  readonly sourcePath: string;
14
16
  readonly paths: readonly string[];
15
- /** Root-only absolute exemption, produced from `global_exclusions`. */
17
+ /** Root-only repository-wide exemption, produced from `global_exclusions`. */
16
18
  readonly globalExclusion?: boolean;
17
19
  };
18
20
 
21
+ /**
22
+ * Convert a repository-relative changed path to the path seen by a policy.
23
+ *
24
+ * `foo/.agentic-owners/policy.yml` owns the `foo/` scope, so its `paths`
25
+ * entries match against filenames relative to `foo/`. Root policies continue
26
+ * to see repository-relative paths. Explicit leading `../` segments can
27
+ * address a sibling tree.
28
+ */
29
+ function filepathRelativeToPolicyScope({
30
+ sourcePath,
31
+ filepath,
32
+ }: {
33
+ sourcePath: string;
34
+ filepath: string;
35
+ }): string {
36
+ const normalizedSourcePath = sourcePath.replace(/^\/+/, "");
37
+ const normalizedFilepath = filepath.replace(/^\/+/, "");
38
+ const marker = `/${AGENTIC_OWNERS_DIR}/`;
39
+ const markerIndex = normalizedSourcePath.lastIndexOf(marker);
40
+ if (markerIndex < 0) {
41
+ return normalizedFilepath;
42
+ }
43
+
44
+ const scope = normalizedSourcePath.slice(0, markerIndex);
45
+ return posix.relative(scope, normalizedFilepath);
46
+ }
47
+
48
+ function patternMatchesFileFromPolicy({
49
+ rule,
50
+ pattern,
51
+ filepath,
52
+ }: {
53
+ rule: PathScopedRule;
54
+ pattern: string;
55
+ filepath: string;
56
+ }): boolean {
57
+ const relativeFilepath = filepathRelativeToPolicyScope({
58
+ sourcePath: rule.sourcePath,
59
+ filepath,
60
+ });
61
+ const filepathIsOutsideScope =
62
+ relativeFilepath === ".." || relativeFilepath.startsWith("../");
63
+ if (filepathIsOutsideScope && !pattern.startsWith("../")) {
64
+ return false;
65
+ }
66
+ const slashlessPatternMatchesOnlyPolicyRoot =
67
+ pattern !== "**" && !pattern.includes("/");
68
+ if (slashlessPatternMatchesOnlyPolicyRoot && relativeFilepath.includes("/")) {
69
+ return false;
70
+ }
71
+ return patternMatchesFile(pattern, relativeFilepath);
72
+ }
73
+
19
74
  function ruleMatchesFile({
20
75
  rule,
21
76
  filepath,
@@ -23,7 +78,13 @@ function ruleMatchesFile({
23
78
  rule: PathScopedRule;
24
79
  filepath: string;
25
80
  }): boolean {
26
- return rule.paths.some((pattern) => patternMatchesFile(pattern, filepath));
81
+ return rule.paths.some((pattern) =>
82
+ patternMatchesFileFromPolicy({
83
+ rule,
84
+ pattern,
85
+ filepath,
86
+ })
87
+ );
27
88
  }
28
89
 
29
90
  function bestMatchingPatternSpecificity(
@@ -32,7 +93,7 @@ function bestMatchingPatternSpecificity(
32
93
  ): number {
33
94
  let best = 0;
34
95
  for (const pattern of rule.paths) {
35
- if (patternMatchesFile(pattern, filepath)) {
96
+ if (patternMatchesFileFromPolicy({ rule, pattern, filepath })) {
36
97
  best = Math.max(best, patternSpecificity(pattern));
37
98
  }
38
99
  }
@@ -120,6 +120,18 @@ function parsePaths(
120
120
  issues.push(`${label}: paths must not be empty`);
121
121
  return undefined;
122
122
  }
123
+ let hasInvalidPath = false;
124
+ for (const [index, path] of paths.entries()) {
125
+ if (path.startsWith("/")) {
126
+ issues.push(
127
+ `${label}[${index}]: path must be relative to the policy directory (no leading /)`
128
+ );
129
+ hasInvalidPath = true;
130
+ }
131
+ }
132
+ if (hasInvalidPath) {
133
+ return undefined;
134
+ }
123
135
  return paths;
124
136
  }
125
137
 
@@ -141,7 +153,15 @@ function parseGlobalExclusions({
141
153
  );
142
154
  return [];
143
155
  }
144
- return parsePaths(value, `${sourcePath}: global_exclusions`, issues) ?? [];
156
+ const label = `${sourcePath}: global_exclusions`;
157
+ const paths = parsePaths(value, label, issues) ?? [];
158
+ validatePathsStayWithinRepository({
159
+ paths,
160
+ sourcePath,
161
+ label,
162
+ issues,
163
+ });
164
+ return paths;
145
165
  }
146
166
 
147
167
  function parsePromptPath(
@@ -335,6 +355,34 @@ function scopeDepthForConfigPath(configPath: string): number {
335
355
  return prefix.split("/").filter((segment) => segment !== "").length;
336
356
  }
337
357
 
358
+ function validatePathsStayWithinRepository({
359
+ paths,
360
+ sourcePath,
361
+ label,
362
+ issues,
363
+ }: {
364
+ paths: readonly string[];
365
+ sourcePath: string;
366
+ label: string;
367
+ issues: string[];
368
+ }): void {
369
+ const scopeDepth = scopeDepthForConfigPath(sourcePath);
370
+ for (const [index, path] of paths.entries()) {
371
+ const segments = path.split("/");
372
+ let parentSegments = 0;
373
+ while (segments[parentSegments] === "..") {
374
+ parentSegments += 1;
375
+ }
376
+ if (segments.slice(parentSegments).includes("..")) {
377
+ issues.push(
378
+ `${label}[${index}]: .. segments must precede the path pattern`
379
+ );
380
+ } else if (parentSegments > scopeDepth) {
381
+ issues.push(`${label}[${index}]: path escapes the repository root`);
382
+ }
383
+ }
384
+ }
385
+
338
386
  function parsePolicyRecord({
339
387
  record,
340
388
  sourcePath,
@@ -417,6 +465,12 @@ function parsePolicyRecord({
417
465
  }
418
466
 
419
467
  const scopeDepth = scopeDepthForConfigPath(sourcePath);
468
+ validatePathsStayWithinRepository({
469
+ paths,
470
+ sourcePath,
471
+ label: `${label}.paths`,
472
+ issues,
473
+ });
420
474
 
421
475
  if (
422
476
  alwaysApprove &&
@@ -12,6 +12,11 @@ export type AgenticOwnersPathRule = {
12
12
  * no owners, so they never enroll a review.
13
13
  */
14
14
  readonly globalExclusion?: boolean;
15
+ /**
16
+ * Glob patterns relative to the directory containing `.agentic-owners`.
17
+ * Root-policy paths are relative to the repository root.
18
+ * Leading `../` segments may address sibling trees but cannot leave the repo.
19
+ */
15
20
  readonly paths: readonly string[];
16
21
  /**
17
22
  * Team slugs (or `org/team` handles) that own these paths. A policy may