@cursor/july 0.1.45 → 0.1.46
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 +4 -2
- package/README.md +3 -1
- package/dist/channels/github/api.d.ts +25 -0
- package/dist/channels/github/api.d.ts.map +1 -1
- package/dist/channels/github/api.js +48 -0
- package/dist/channels/github/cursor-account.d.ts +7 -0
- package/dist/channels/github/cursor-account.d.ts.map +1 -1
- package/dist/channels/github/cursor-account.js +18 -0
- package/dist/channels/github/defaults.d.ts +1 -1
- package/dist/channels/github/defaults.js +1 -1
- package/dist/channels/github/github-channel.d.ts.map +1 -1
- package/dist/channels/github/github-channel.js +2 -2
- package/dist/channels/github/progress.d.ts +6 -5
- package/dist/channels/github/progress.d.ts.map +1 -1
- package/dist/channels/github/progress.js +58 -16
- package/dist/channels/github/state.d.ts +11 -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 +3 -3
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +3 -3
- package/dist/docs/assets/{app.fHnNXEJ6.js → app.C2NFTb-h.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.B-FxvuoI.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.Cf6ghfFY.js → VPLocalSearchBox.o1_FJGip.js} +1 -1
- package/dist/docs/assets/chunks/{theme.B_5-VLe8.js → theme.BcGduE7g.js} +2 -2
- package/dist/docs/assets/{guides_github.md.DSg0j9qj.js → guides_github.md.B8QKtIpw.js} +7 -6
- package/dist/docs/assets/{guides_github.md.DSg0j9qj.lean.js → guides_github.md.B8QKtIpw.lean.js} +1 -1
- package/dist/docs/assets/{reference_agent-config.md.XRpxctsA.js → reference_agent-config.md.DHkkvcEZ.js} +4 -4
- package/dist/docs/assets/{reference_agent-config.md.XRpxctsA.lean.js → reference_agent-config.md.DHkkvcEZ.lean.js} +1 -1
- package/dist/docs/assets/{reference_hooks.md.4cbRRIIu.js → reference_hooks.md.DJE5DXcT.js} +1 -1
- package/dist/docs/assets/{storage.md.DcGSnIxX.js → storage.md.CJYd5YmN.js} +2 -2
- package/dist/docs/assets/{storage.md.DcGSnIxX.lean.js → storage.md.CJYd5YmN.lean.js} +1 -1
- 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 +3 -3
- package/dist/docs/guides/github.html +10 -9
- 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 +6 -6
- 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 +5 -5
- 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 +3 -3
- 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 +5 -5
- package/dist/docs/templates/triage.html +3 -3
- package/dist/docs/troubleshooting.html +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/auth.d.ts +4 -0
- package/dist/internal/auth.d.ts.map +1 -1
- package/dist/internal/auth.js +7 -0
- package/dist/internal/durable-session-store.d.ts +35 -23
- package/dist/internal/durable-session-store.d.ts.map +1 -1
- package/dist/internal/durable-session-store.js +71 -26
- package/dist/internal/ledger-serving.d.ts +135 -67
- package/dist/internal/ledger-serving.d.ts.map +1 -1
- package/dist/internal/ledger-serving.js +326 -107
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +2 -2
- package/dist/internal/session-engine.d.ts +18 -17
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +60 -27
- package/dist/kv/memory-kv.d.ts +8 -0
- package/dist/kv/memory-kv.d.ts.map +1 -1
- package/dist/kv/memory-kv.js +8 -0
- package/dist/ledger/janitor.d.ts +60 -0
- package/dist/ledger/janitor.d.ts.map +1 -0
- package/dist/ledger/janitor.js +137 -0
- package/dist/ledger/session-ledger.d.ts +132 -43
- package/dist/ledger/session-ledger.d.ts.map +1 -1
- package/dist/ledger/session-ledger.js +282 -50
- package/dist/ledger.d.ts +9 -8
- package/dist/ledger.d.ts.map +1 -1
- package/dist/ledger.js +7 -7
- package/dist/playground/assets/{index-Dces8BDp.js → index-6wW6SAc4.js} +32 -32
- package/dist/playground/assets/index-CSRYDAFw.css +1 -0
- package/dist/playground/index.html +2 -2
- package/dist/storage-backends/cursor-hosted.d.ts +5 -0
- package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
- package/dist/storage-backends/cursor-hosted.js +6 -0
- package/dist/types.d.ts +19 -8
- package/dist/types.d.ts.map +1 -1
- package/docs/guides/github.md +23 -18
- package/docs/reference/agent-config.md +31 -36
- package/docs/reference/hooks.md +1 -1
- package/docs/storage.md +26 -9
- package/package.json +1 -1
- package/src/channels/github/api.ts +122 -0
- package/src/channels/github/cursor-account.ts +23 -0
- package/src/channels/github/defaults.ts +1 -1
- package/src/channels/github/github-channel.ts +5 -1
- package/src/channels/github/progress.ts +84 -19
- package/src/channels/github/state.ts +14 -0
- package/src/channels/github/types.ts +3 -3
- package/src/index.ts +1 -0
- package/src/internal/auth.ts +10 -0
- package/src/internal/durable-session-store.ts +66 -27
- package/src/internal/ledger-serving.ts +439 -148
- package/src/internal/server.ts +6 -2
- package/src/internal/session-engine.ts +95 -37
- package/src/kv/memory-kv.ts +8 -0
- package/src/ledger/janitor.ts +193 -0
- package/src/ledger/session-ledger.ts +372 -68
- package/src/ledger.ts +21 -6
- package/src/storage-backends/cursor-hosted.ts +17 -2
- package/src/types.ts +19 -8
- package/dist/docs/assets/chunks/@localSearchIndexroot.BMT0xM4I.js +0 -1
- package/dist/playground/assets/index-CZH9EFvO.css +0 -1
- /package/dist/docs/assets/{reference_hooks.md.4cbRRIIu.lean.js → reference_hooks.md.DJE5DXcT.lean.js} +0 -0
package/src/ledger.ts
CHANGED
|
@@ -1,25 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Session ledger — coordination
|
|
3
|
-
* the `session
|
|
4
|
-
* identity creation,
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `src/ledger/session-ledger.ts` for the trade-off this stage accepts.
|
|
2
|
+
* Session ledger — KV coordination with a durable inbox. The protocol
|
|
3
|
+
* library that drives the `session/`, `ledger/`, and `mailbox/` key
|
|
4
|
+
* families over a CAS-capable KV: identity creation, event append,
|
|
5
|
+
* lease claim/heartbeat/release, fenced commit, drain, the janitor
|
|
6
|
+
* loop, and the orphan sweep.
|
|
8
7
|
*/
|
|
9
8
|
|
|
9
|
+
export type {
|
|
10
|
+
JanitorClaimedSession,
|
|
11
|
+
JanitorRunResult,
|
|
12
|
+
LedgerJanitor,
|
|
13
|
+
LedgerJanitorOptions,
|
|
14
|
+
} from "./ledger/janitor.js";
|
|
15
|
+
export {
|
|
16
|
+
createLedgerJanitor,
|
|
17
|
+
DEFAULT_JANITOR_INTERVAL_MS,
|
|
18
|
+
} from "./ledger/janitor.js";
|
|
10
19
|
export type {
|
|
11
20
|
ClaimResult,
|
|
12
21
|
CommitArgs,
|
|
13
22
|
CommitResult,
|
|
23
|
+
DrainResult,
|
|
14
24
|
EnsureSessionResult,
|
|
15
25
|
HeartbeatResult,
|
|
26
|
+
LedgerEvent,
|
|
27
|
+
LedgerEventInput,
|
|
16
28
|
LedgerLease,
|
|
17
29
|
LedgerSnapshot,
|
|
18
30
|
SessionIdentity,
|
|
19
31
|
SessionLedgerKv,
|
|
20
32
|
SessionLedgerOptions,
|
|
33
|
+
SweepOrphansArgs,
|
|
34
|
+
SweepOrphansResult,
|
|
21
35
|
} from "./ledger/session-ledger.js";
|
|
22
36
|
export {
|
|
37
|
+
DEFAULT_ORPHAN_TTL_MS,
|
|
23
38
|
HEARTBEAT_INTERVAL_MS,
|
|
24
39
|
LEASE_TTL_MS,
|
|
25
40
|
LedgerCasExhaustedError,
|
|
@@ -129,8 +129,10 @@ type CursorHostedStorageMethods = Required<
|
|
|
129
129
|
// AND version = expected`, conflict returns the current row (or
|
|
130
130
|
// `current: null` when the row is gone).
|
|
131
131
|
// - `POST /internal/agent-serve/storage/kv/list-keys`
|
|
132
|
-
// `{ prefix }` → `{ keys }` ({@link KvListKeysResponse}) in
|
|
133
|
-
// key order (prefix scan on the `(deployment_id, key)`
|
|
132
|
+
// `{ prefix }` → `{ keys, truncated }` ({@link KvListKeysResponse}) in
|
|
133
|
+
// ascending key order (prefix scan on the `(deployment_id, key)`
|
|
134
|
+
// primary key). `truncated: true` means the scan hit the server's row
|
|
135
|
+
// cap and the list is incomplete; this client throws on it.
|
|
134
136
|
|
|
135
137
|
/** Wire shape of the `get-with-version` route. `null` ⇒ JSON `undefined`. */
|
|
136
138
|
export interface KvGetWithVersionResponse {
|
|
@@ -151,6 +153,11 @@ export interface KvCasResponse {
|
|
|
151
153
|
/** Wire shape of the `list-keys` route. */
|
|
152
154
|
export interface KvListKeysResponse {
|
|
153
155
|
keys: string[];
|
|
156
|
+
/**
|
|
157
|
+
* Set when the scan hit the server's row cap and `keys` is incomplete.
|
|
158
|
+
* Additive: older servers omit it (treated as `false`).
|
|
159
|
+
*/
|
|
160
|
+
truncated?: boolean;
|
|
154
161
|
}
|
|
155
162
|
|
|
156
163
|
function toCasResult(response: KvCasResponse): KvCasResult {
|
|
@@ -305,6 +312,14 @@ export function cursorHostedStorage(
|
|
|
305
312
|
"/internal/agent-serve/storage/kv/list-keys",
|
|
306
313
|
{ prefix }
|
|
307
314
|
);
|
|
315
|
+
if (result.truncated === true) {
|
|
316
|
+
// Callers (the ledger janitor above all) treat the result as
|
|
317
|
+
// the complete key set; a silently capped scan means silently
|
|
318
|
+
// unrecovered sessions. Fail loudly until pagination lands.
|
|
319
|
+
throw new Error(
|
|
320
|
+
`cursorHostedStorage: listKeys("${prefix}") exceeded the server's row cap and was truncated; the result is incomplete`
|
|
321
|
+
);
|
|
322
|
+
}
|
|
308
323
|
return result.keys;
|
|
309
324
|
},
|
|
310
325
|
},
|
package/src/types.ts
CHANGED
|
@@ -254,14 +254,15 @@ export interface AgentConfig {
|
|
|
254
254
|
* - `"resident"` (default): the in-process session engine owns delivery —
|
|
255
255
|
* today's behavior, unchanged.
|
|
256
256
|
* - `"ledger"`: every delivery coordinates through the KV session ledger
|
|
257
|
-
* before its turn runs:
|
|
258
|
-
*
|
|
259
|
-
*
|
|
257
|
+
* before its turn runs: the event parks durably in the session mailbox
|
|
258
|
+
* (the source ack point moves after that write), a one-writer-per-session
|
|
259
|
+
* lease with generation fencing serializes turns, and drained batches
|
|
260
|
+
* commit through a fenced sequence. A delivery that finds the lease
|
|
261
|
+
* held walks away; the holder drains the parked event, and the janitor
|
|
262
|
+
* recovers sessions whose holder died. Requires a store with
|
|
263
|
+
* conditional writes and prefix listing (the `cas` group on
|
|
260
264
|
* `defineStorage`, or an explicit CAS-capable override); startup fails
|
|
261
|
-
* fast otherwise.
|
|
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
|
+
* fast otherwise.
|
|
265
266
|
*/
|
|
266
267
|
export type AgentServingMode = "resident" | "ledger";
|
|
267
268
|
|
|
@@ -816,6 +817,12 @@ export interface ToolContext {
|
|
|
816
817
|
* `sessionId` (and `turnId` when known).
|
|
817
818
|
*/
|
|
818
819
|
artifacts: ArtifactsApi;
|
|
820
|
+
/**
|
|
821
|
+
* Append a session event onto this call's in-flight turn. Same shape as a
|
|
822
|
+
* Task subagent stream (`parentCallId`, `subagent.called` /
|
|
823
|
+
* `subagent.completed`). Omitted for scratch `callTool` with no session.
|
|
824
|
+
*/
|
|
825
|
+
emit?: (payload: SessionEventPayload) => void;
|
|
819
826
|
}
|
|
820
827
|
|
|
821
828
|
/**
|
|
@@ -1471,7 +1478,11 @@ export interface ChannelSession {
|
|
|
1471
1478
|
*/
|
|
1472
1479
|
readonly coalesced?: boolean;
|
|
1473
1480
|
readonly info: SessionInfo;
|
|
1474
|
-
/**
|
|
1481
|
+
/**
|
|
1482
|
+
* Replay recorded events from `startIndex`, then follow live (NDJSON).
|
|
1483
|
+
* A handle from `send()` defaults `startIndex` to this admission so a
|
|
1484
|
+
* resumed continuation does not replay earlier turns.
|
|
1485
|
+
*/
|
|
1475
1486
|
getEventStream(options?: {
|
|
1476
1487
|
startIndex?: number;
|
|
1477
1488
|
}): Promise<ReadableStream<Uint8Array>>;
|