@cursor/july 0.1.32 → 0.1.34
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/README.md +1 -1
- package/dist/artifacts.d.ts.map +1 -1
- package/dist/artifacts.js +0 -5
- package/dist/bin/agent-serve.d.ts +1 -0
- package/dist/bin/agent-serve.d.ts.map +1 -1
- package/dist/bin/agent-serve.js +32 -2
- package/dist/channels/github/types.d.ts +10 -7
- package/dist/channels/github/types.d.ts.map +1 -1
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +3 -3
- package/dist/docs/assets/{app.C2aVczmo.js → app.FPupl4SP.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.WoYunhnT.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.DLEzetbD.js → VPLocalSearchBox.Cd182Cu0.js} +1 -1
- package/dist/docs/assets/chunks/{theme.BkOH1oMp.js → theme.BEM3Okcd.js} +2 -2
- package/dist/docs/assets/{example-agents_weather-agent.md.Dmrcphhl.js → example-agents_weather-agent.md.BADkPqxQ.js} +6 -4
- package/dist/docs/assets/example-agents_weather-agent.md.BADkPqxQ.lean.js +1 -0
- package/dist/docs/assets/guides_cloud-runtime.md.CDJGvVC4.js +9 -0
- package/dist/docs/assets/guides_cloud-runtime.md.CDJGvVC4.lean.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 +10 -8
- package/dist/docs/guides/agent-to-agent.html +3 -3
- package/dist/docs/guides/cloud-runtime.html +5 -5
- 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/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 +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 +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 +3 -3
- package/dist/docs/troubleshooting.html +3 -3
- package/dist/files-backends/agent-store-presigned-url.d.ts.map +1 -1
- package/dist/files-backends/agent-store-presigned-url.js +19 -810
- package/dist/files.d.ts +20 -0
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +20 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/internal/artifacts-store.d.ts +14 -6
- package/dist/internal/artifacts-store.d.ts.map +1 -1
- package/dist/internal/artifacts-store.js +160 -16
- package/dist/internal/cli-convert-automation.d.ts +39 -0
- package/dist/internal/cli-convert-automation.d.ts.map +1 -0
- package/dist/internal/cli-convert-automation.js +280 -0
- package/dist/internal/cli-deploy.d.ts +2 -0
- package/dist/internal/cli-deploy.d.ts.map +1 -1
- package/dist/internal/cli-deploy.js +1 -1
- package/dist/internal/cli-mcp-oauth.d.ts +23 -0
- package/dist/internal/cli-mcp-oauth.d.ts.map +1 -1
- package/dist/internal/cli-mcp-oauth.js +57 -33
- package/dist/internal/convert-automation/convert-workflow.d.ts +10 -0
- package/dist/internal/convert-automation/convert-workflow.d.ts.map +1 -0
- package/dist/internal/convert-automation/convert-workflow.js +998 -0
- package/dist/internal/convert-automation/index.d.ts +3 -0
- package/dist/internal/convert-automation/index.d.ts.map +1 -0
- package/dist/internal/convert-automation/index.js +1 -0
- package/dist/internal/convert-automation/slug.d.ts +11 -0
- package/dist/internal/convert-automation/slug.d.ts.map +1 -0
- package/dist/internal/convert-automation/slug.js +36 -0
- package/dist/internal/convert-automation/types.d.ts +191 -0
- package/dist/internal/convert-automation/types.d.ts.map +1 -0
- package/dist/internal/convert-automation/types.js +13 -0
- package/dist/internal/cursor-relay-core.d.ts +12 -0
- package/dist/internal/cursor-relay-core.d.ts.map +1 -1
- package/dist/internal/cursor-relay-core.js +42 -8
- package/dist/internal/deploy-client.d.ts +31 -0
- package/dist/internal/deploy-client.d.ts.map +1 -1
- package/dist/internal/deploy-client.js +48 -0
- package/dist/internal/discovery.d.ts.map +1 -1
- package/dist/internal/discovery.js +3 -32
- package/dist/internal/init-project.d.ts +1 -0
- package/dist/internal/init-project.d.ts.map +1 -1
- package/dist/internal/init-project.js +1 -1
- package/dist/internal/mcp-endpoint.d.ts +6 -0
- package/dist/internal/mcp-endpoint.d.ts.map +1 -1
- package/dist/internal/mcp-endpoint.js +168 -0
- package/dist/internal/resolved-connections.d.ts +15 -0
- package/dist/internal/resolved-connections.d.ts.map +1 -1
- package/dist/internal/resolved-connections.js +12 -5
- package/dist/internal/review-comments.d.ts +9 -1
- package/dist/internal/review-comments.d.ts.map +1 -1
- package/dist/internal/review-comments.js +76 -0
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +83 -8
- package/dist/internal/session-engine.d.ts +56 -3
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +252 -83
- package/dist/internal/storage-coordinator.d.ts +0 -15
- package/dist/internal/storage-coordinator.d.ts.map +1 -1
- package/dist/internal/storage-coordinator.js +0 -52
- package/dist/internal/workspace.d.ts +10 -5
- package/dist/internal/workspace.d.ts.map +1 -1
- package/dist/internal/workspace.js +13 -0
- package/dist/memory.d.ts +22 -6
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +100 -8
- package/dist/playground/assets/index-CDDWw0YX.js +85 -0
- package/dist/playground/assets/index-MVuNTd8v.css +1 -0
- package/dist/playground/index.html +2 -2
- package/dist/storage.d.ts +0 -4
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +0 -4
- package/dist/types.d.ts +18 -0
- package/dist/types.d.ts.map +1 -1
- package/docs/example-agents/weather-agent.md +29 -11
- package/docs/guides/cloud-runtime.md +6 -4
- package/package.json +3 -22
- package/src/artifacts.ts +0 -6
- package/src/bin/agent-serve.ts +36 -2
- package/src/channels/github/types.ts +10 -7
- package/src/files-backends/agent-store-presigned-url.ts +7 -5
- package/src/files.ts +27 -0
- package/src/index.ts +6 -1
- package/src/internal/artifacts-store.ts +185 -22
- package/src/internal/cli-convert-automation.ts +352 -0
- package/src/internal/cli-deploy.ts +1 -1
- package/src/internal/cli-mcp-oauth.ts +69 -31
- package/src/internal/convert-automation/convert-workflow.ts +1422 -0
- package/src/internal/convert-automation/index.ts +10 -0
- package/src/internal/convert-automation/slug.ts +38 -0
- package/src/internal/convert-automation/types.ts +199 -0
- package/src/internal/cursor-relay-core.ts +62 -3
- package/src/internal/deploy-client.ts +78 -0
- package/src/internal/discovery.ts +3 -37
- package/src/internal/init-project.ts +1 -1
- package/src/internal/mcp-endpoint.ts +243 -0
- package/src/internal/resolved-connections.ts +32 -6
- package/src/internal/review-comments.ts +102 -2
- package/src/internal/server.ts +108 -2
- package/src/internal/session-engine.ts +329 -99
- package/src/internal/storage-coordinator.ts +0 -62
- package/src/internal/workspace.ts +19 -5
- package/src/memory.ts +126 -10
- package/src/storage.ts +0 -6
- package/src/types.ts +15 -0
- package/dist/channels/slack/post-update-delivery.d.ts +0 -85
- package/dist/channels/slack/post-update-delivery.d.ts.map +0 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.xgMnlUSO.js +0 -1
- package/dist/docs/assets/example-agents_weather-agent.md.Dmrcphhl.lean.js +0 -1
- package/dist/docs/assets/guides_cloud-runtime.md.BZ2GA7Es.js +0 -9
- package/dist/docs/assets/guides_cloud-runtime.md.BZ2GA7Es.lean.js +0 -1
- package/dist/internal/json-dir-store.d.ts +0 -32
- package/dist/internal/json-dir-store.d.ts.map +0 -1
- package/dist/internal/persistence-coordinator.d.ts +0 -127
- package/dist/internal/persistence-coordinator.d.ts.map +0 -1
- package/dist/multi-tenant.d.ts +0 -80
- package/dist/multi-tenant.d.ts.map +0 -1
- package/dist/multi-tenant.js +0 -69
- package/dist/persistence.d.ts +0 -184
- package/dist/persistence.d.ts.map +0 -1
- package/dist/playground/assets/index-50PKeJlG.css +0 -1
- package/dist/playground/assets/index-C0f2Wl1q.js +0 -85
package/dist/files.d.ts
CHANGED
|
@@ -112,6 +112,26 @@ export declare const fileKeys: {
|
|
|
112
112
|
readonly deploymentPrefix: (agent: string) => string;
|
|
113
113
|
readonly sessionPrefix: (agent: string, sessionId: string) => string;
|
|
114
114
|
};
|
|
115
|
+
/**
|
|
116
|
+
* Framework-owned keys for state that lives on the deployment's Agent Store
|
|
117
|
+
* but is not author `host.files` data: artifact rows and payloads, and the
|
|
118
|
+
* cross-session memory journal. Kept out of `files/` so author listings never
|
|
119
|
+
* see framework rows.
|
|
120
|
+
*/
|
|
121
|
+
export declare const agentStoreKeys: {
|
|
122
|
+
readonly artifactRow: (agent: string, id: string) => string;
|
|
123
|
+
readonly artifactRowPrefix: (agent: string) => string;
|
|
124
|
+
readonly artifactContent: (agent: string, id: string) => string;
|
|
125
|
+
readonly memoryDir: (agent: string) => string;
|
|
126
|
+
readonly memoryJournal: (agent: string) => string;
|
|
127
|
+
readonly memoryJournalRotated: (agent: string, stamp: string) => string;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Deployment store FUSE mount on cloud-runtime VMs. Mirrors
|
|
131
|
+
* `AGENT_STORE_MOUNT_ROOT` / `AGENT_SERVE_DEPLOYMENT_STORE_MOUNT_NAME` in
|
|
132
|
+
* `@anysphere/constants` (not a dependency of this published package).
|
|
133
|
+
*/
|
|
134
|
+
export declare const DEPLOYMENT_STORE_MOUNT_PATH = "/cursor/stores/deployment";
|
|
115
135
|
/** Errors raised by the file surface. Thrown by sinks and by the framework. */
|
|
116
136
|
export declare class FileConflictError extends Error {
|
|
117
137
|
readonly key: string;
|
package/dist/files.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../src/files.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAQH,mDAAmD;AACnD,MAAM,WAAW,aAAa;IAC5B,+DAA+D;IAC/D,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+DAA+D;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wDAAwD;AACxD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,uCAAuC;AACvC,MAAM,WAAW,iBAAiB;IAChC,6DAA6D;IAC7D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;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efix: (agent) => `${STORAGE_KEY_ROOT}/${agent}/files/deployment/`,
|
|
48
48
|
sessionPrefix: (agent, sessionId) => `${STORAGE_KEY_ROOT}/${agent}/files/sessions/${sessionId}/`,
|
|
49
49
|
};
|
|
50
|
+
/**
|
|
51
|
+
* Framework-owned keys for state that lives on the deployment's Agent Store
|
|
52
|
+
* but is not author `host.files` data: artifact rows and payloads, and the
|
|
53
|
+
* cross-session memory journal. Kept out of `files/` so author listings never
|
|
54
|
+
* see framework rows.
|
|
55
|
+
*/
|
|
56
|
+
export const agentStoreKeys = {
|
|
57
|
+
artifactRow: (agent, id) => `${STORAGE_KEY_ROOT}/${agent}/artifacts/rows/${encodeURIComponent(id)}.json`,
|
|
58
|
+
artifactRowPrefix: (agent) => `${STORAGE_KEY_ROOT}/${agent}/artifacts/rows/`,
|
|
59
|
+
artifactContent: (agent, id) => `${STORAGE_KEY_ROOT}/${agent}/artifacts/content/${encodeURIComponent(id)}`,
|
|
60
|
+
memoryDir: (agent) => `${STORAGE_KEY_ROOT}/${agent}/memory`,
|
|
61
|
+
memoryJournal: (agent) => `${STORAGE_KEY_ROOT}/${agent}/memory/journal.jsonl`,
|
|
62
|
+
memoryJournalRotated: (agent, stamp) => `${STORAGE_KEY_ROOT}/${agent}/memory/journal-${stamp}.jsonl`,
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Deployment store FUSE mount on cloud-runtime VMs. Mirrors
|
|
66
|
+
* `AGENT_STORE_MOUNT_ROOT` / `AGENT_SERVE_DEPLOYMENT_STORE_MOUNT_NAME` in
|
|
67
|
+
* `@anysphere/constants` (not a dependency of this published package).
|
|
68
|
+
*/
|
|
69
|
+
export const DEPLOYMENT_STORE_MOUNT_PATH = "/cursor/stores/deployment";
|
|
50
70
|
/** Errors raised by the file surface. Thrown by sinks and by the framework. */
|
|
51
71
|
export class FileConflictError extends Error {
|
|
52
72
|
constructor(key, options) {
|
package/dist/index.d.ts
CHANGED
|
@@ -23,12 +23,12 @@ export type { LoadAgentProjectOptions } from "./internal/discovery.js";
|
|
|
23
23
|
export { formatDiagnostics, hasErrorDiagnostics, isAgentProjectDir, loadAgentProject, loadAgentProjects, projectInfo, resolveAgentMounts, } from "./internal/discovery.js";
|
|
24
24
|
export type { AgentServeGitHubTriggerEvent, AgentServeGitHubTriggerTarget, AgentServeTriggerEvent, AgentServeTriggerResult, AgentServeTriggerTargetResult, } from "./internal/handleAgentServeTrigger.js";
|
|
25
25
|
export { collectGitHubTriggerTargets, handleAgentServeTrigger, } from "./internal/handleAgentServeTrigger.js";
|
|
26
|
-
export { MCP_CHANNEL_ID, MCP_ENDPOINT_PATH, mcpEndpointToolNames, } from "./internal/mcp-endpoint.js";
|
|
26
|
+
export { MCP_CHANNEL_ID, MCP_ENDPOINT_PATH, mcpEndpointToolNames, TOOL_MCP_ENDPOINT_PATH, } from "./internal/mcp-endpoint.js";
|
|
27
27
|
export { ReminderValidationError, UnknownReminderError, } from "./internal/reminder-runner.js";
|
|
28
28
|
export type { AgentMount } from "./internal/server.js";
|
|
29
29
|
export { SessionBusyError, ToolInputError, ToolNotDirectlyCallableError, UnknownChannelError, UnknownSessionError, UnknownToolError, } from "./internal/session-engine.js";
|
|
30
30
|
export type { MemoryBackend, TurnMemoryRecord } from "./memory.js";
|
|
31
|
-
export { fileMemoryBackend, memoryHook } from "./memory.js";
|
|
31
|
+
export { agentStoreMemoryBackend, fileMemoryBackend, memoryHook, } from "./memory.js";
|
|
32
32
|
export type { PromptTag } from "./prompt.js";
|
|
33
33
|
export { prompt } from "./prompt.js";
|
|
34
34
|
export type { ReminderBusyPolicy, ReminderCreateInput, ReminderFireContext, ReminderFireResult, ReminderHostApi, ReminderInfo, ReminderReschedule, ReminderScheduleKind, ReminderStatus, ReminderTarget, ReminderUntilContext, } from "./reminders.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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AAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CACtB,GACL,OAAO,CAAC,gBAAgB,CAAC,CAqB3B"}
|
package/dist/index.js
CHANGED
|
@@ -45,10 +45,10 @@ export { defineConnection } from "./connections.js";
|
|
|
45
45
|
export { defineHook } from "./hooks.js";
|
|
46
46
|
export { formatDiagnostics, hasErrorDiagnostics, isAgentProjectDir, loadAgentProject, loadAgentProjects, projectInfo, resolveAgentMounts, } from "./internal/discovery.js";
|
|
47
47
|
export { collectGitHubTriggerTargets, handleAgentServeTrigger, } from "./internal/handleAgentServeTrigger.js";
|
|
48
|
-
export { MCP_CHANNEL_ID, MCP_ENDPOINT_PATH, mcpEndpointToolNames, } from "./internal/mcp-endpoint.js";
|
|
48
|
+
export { MCP_CHANNEL_ID, MCP_ENDPOINT_PATH, mcpEndpointToolNames, TOOL_MCP_ENDPOINT_PATH, } from "./internal/mcp-endpoint.js";
|
|
49
49
|
export { ReminderValidationError, UnknownReminderError, } from "./internal/reminder-runner.js";
|
|
50
50
|
export { SessionBusyError, ToolInputError, ToolNotDirectlyCallableError, UnknownChannelError, UnknownSessionError, UnknownToolError, } from "./internal/session-engine.js";
|
|
51
|
-
export { fileMemoryBackend, memoryHook } from "./memory.js";
|
|
51
|
+
export { agentStoreMemoryBackend, fileMemoryBackend, memoryHook, } from "./memory.js";
|
|
52
52
|
export { prompt } from "./prompt.js";
|
|
53
53
|
export { defineSchedule } from "./schedules.js";
|
|
54
54
|
export { defineSkill } from "./skills.js";
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Durable artifact rows behind `ctx.artifacts`
|
|
2
|
+
* Durable artifact rows and payloads behind `ctx.artifacts`
|
|
3
|
+
* ({@link ArtifactsApi}).
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* On Cursor-managed hosting rows and file payloads live on the deployment's
|
|
6
|
+
* Agent Store (the same store behind `ctx.host.files`, so they survive
|
|
7
|
+
* deploys and are visible on cloud VMs under the store mount); otherwise
|
|
8
|
+
* they land under `--state-root/artifacts` on local disk.
|
|
7
9
|
*/
|
|
10
|
+
import { type FileSink } from "../files.js";
|
|
8
11
|
import type { ArtifactListFilter, ArtifactRecord, ArtifactsConfig, ArtifactTagInput } from "../types.js";
|
|
9
|
-
import type { StorageCoordinator } from "./storage-coordinator.js";
|
|
10
12
|
export interface CreateArtifactsStoreOptions {
|
|
11
13
|
stateRoot: string;
|
|
12
|
-
|
|
14
|
+
agentName: string;
|
|
13
15
|
/** `agent/artifacts.ts` config, when authored. */
|
|
14
16
|
config?: ArtifactsConfig;
|
|
17
|
+
/** Explicit sink override (tests). Omitted → hosted store or local disk. */
|
|
18
|
+
sink?: FileSink;
|
|
15
19
|
}
|
|
16
20
|
/** Kind used by freeform tags when no kinds are declared. */
|
|
17
21
|
export declare const ARTIFACT_DEFAULT_KIND = "artifact";
|
|
@@ -23,6 +27,7 @@ export declare const ARTIFACT_DEFAULT_KIND = "artifact";
|
|
|
23
27
|
*/
|
|
24
28
|
export declare class ArtifactsStore {
|
|
25
29
|
private readonly rows;
|
|
30
|
+
private readonly content;
|
|
26
31
|
private readonly config;
|
|
27
32
|
private readonly max;
|
|
28
33
|
/** Serializes tags so read-modify-write upserts and eviction don't race. */
|
|
@@ -30,6 +35,9 @@ export declare class ArtifactsStore {
|
|
|
30
35
|
constructor(options: CreateArtifactsStoreOptions);
|
|
31
36
|
tag(input: ArtifactTagInput): Promise<ArtifactRecord>;
|
|
32
37
|
private tagSerialized;
|
|
38
|
+
get(id: string): Promise<ArtifactRecord | undefined>;
|
|
39
|
+
/** Payload bytes for one artifact; undefined when it carries none. */
|
|
40
|
+
getContent(id: string): Promise<Uint8Array | undefined>;
|
|
33
41
|
list(filter?: ArtifactListFilter): Promise<ArtifactRecord[]>;
|
|
34
42
|
/**
|
|
35
43
|
* Resolve the effective kind (freeform when no kinds are declared) and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts-store.d.ts","sourceRoot":"","sources":["../../src/internal/artifacts-store.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"artifacts-store.d.ts","sourceRoot":"","sources":["../../src/internal/artifacts-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAaH,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAK5D,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,gBAAgB,EAEjB,MAAM,aAAa,CAAC;AAkBrB,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,4EAA4E;IAC5E,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED,6DAA6D;AAC7D,eAAO,MAAM,qBAAqB,aAAa,CAAC;AAEhD;;;;;GAKG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAmB;IACxC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAuB;IAC/C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA8B;IACrD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,4EAA4E;IAC5E,OAAO,CAAC,QAAQ,CAAuC;IAEvD,YAAY,OAAO,EAAE,2BAA2B,EAa/C;IAED,GAAG,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,CAIpD;YAEa,aAAa;IAkD3B,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAEnD;IAED,sEAAsE;IACtE,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAEtD;IAEK,IAAI,CAAC,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAUjE;IAED;;;;;OAKG;IACH,OAAO,CAAC,kBAAkB;YA8BZ,YAAY;CAgB3B;AAED,sEAAsE;AACtE,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKpD"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Durable artifact rows behind `ctx.artifacts`
|
|
2
|
+
* Durable artifact rows and payloads behind `ctx.artifacts`
|
|
3
|
+
* ({@link ArtifactsApi}).
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* On Cursor-managed hosting rows and file payloads live on the deployment's
|
|
6
|
+
* Agent Store (the same store behind `ctx.host.files`, so they survive
|
|
7
|
+
* deploys and are visible on cloud VMs under the store mount); otherwise
|
|
8
|
+
* they land under `--state-root/artifacts` on local disk.
|
|
7
9
|
*/
|
|
8
10
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
11
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -18,6 +20,8 @@ import { createHash, randomUUID } from "node:crypto";
|
|
|
18
20
|
import { mkdir, readdir, readFile, rename, rm, writeFile, } from "node:fs/promises";
|
|
19
21
|
import { join } from "node:path";
|
|
20
22
|
import { resolveArtifactsMax } from "../artifacts.js";
|
|
23
|
+
import { agentStoreKeys } from "../files.js";
|
|
24
|
+
import { cursorHostedFiles, isCursorHostedFilesAvailable, } from "../files-backends/cursor-hosted.js";
|
|
21
25
|
/** Kind used by freeform tags when no kinds are declared. */
|
|
22
26
|
export const ARTIFACT_DEFAULT_KIND = "artifact";
|
|
23
27
|
/**
|
|
@@ -31,10 +35,15 @@ export class ArtifactsStore {
|
|
|
31
35
|
var _a;
|
|
32
36
|
/** Serializes tags so read-modify-write upserts and eviction don't race. */
|
|
33
37
|
this.tagChain = Promise.resolve();
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
const sink = (_a = options.sink) !== null && _a !== void 0 ? _a : (isCursorHostedFilesAvailable() ? cursorHostedFiles() : undefined);
|
|
39
|
+
if (sink === undefined) {
|
|
40
|
+
this.rows = createFilesystemRowStore(options.stateRoot);
|
|
41
|
+
this.content = createFilesystemContentStore(options.stateRoot);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
this.rows = createSinkRowStore(sink, options.agentName);
|
|
45
|
+
this.content = createSinkContentStore(sink, options.agentName);
|
|
46
|
+
}
|
|
38
47
|
this.config = options.config;
|
|
39
48
|
this.max = resolveArtifactsMax(options.config);
|
|
40
49
|
}
|
|
@@ -50,7 +59,8 @@ export class ArtifactsStore {
|
|
|
50
59
|
const id = input.key === undefined
|
|
51
60
|
? `art_${randomUUID()}`
|
|
52
61
|
: artifactIdForKey(input.key);
|
|
53
|
-
|
|
62
|
+
// Fresh random ids can't collide; only keyed tags upsert.
|
|
63
|
+
const existing = input.key === undefined ? undefined : yield this.rows.get(id);
|
|
54
64
|
const now = new Date().toISOString();
|
|
55
65
|
const record = {
|
|
56
66
|
id,
|
|
@@ -64,6 +74,26 @@ export class ArtifactsStore {
|
|
|
64
74
|
createdAt: (_b = existing === null || existing === void 0 ? void 0 : existing.createdAt) !== null && _b !== void 0 ? _b : now,
|
|
65
75
|
updatedAt: now,
|
|
66
76
|
};
|
|
77
|
+
if (input.contents !== undefined) {
|
|
78
|
+
const body = typeof input.contents === "string"
|
|
79
|
+
? Buffer.from(input.contents, "utf8")
|
|
80
|
+
: input.contents;
|
|
81
|
+
yield this.content.put(id, body);
|
|
82
|
+
record.content = {
|
|
83
|
+
size: body.byteLength,
|
|
84
|
+
contentType: input.contentType,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
else if ((existing === null || existing === void 0 ? void 0 : existing.content) !== undefined) {
|
|
88
|
+
if (existing.sessionId === record.sessionId) {
|
|
89
|
+
record.content = existing.content;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
// Keys are deployment-global: rebinding a keyed row to another
|
|
93
|
+
// session must not carry the prior session's payload with it.
|
|
94
|
+
yield this.content.delete(id);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
67
97
|
yield this.rows.put(record);
|
|
68
98
|
if (existing === undefined) {
|
|
69
99
|
yield this.evictPastCap();
|
|
@@ -71,6 +101,13 @@ export class ArtifactsStore {
|
|
|
71
101
|
return record;
|
|
72
102
|
});
|
|
73
103
|
}
|
|
104
|
+
get(id) {
|
|
105
|
+
return this.rows.get(id);
|
|
106
|
+
}
|
|
107
|
+
/** Payload bytes for one artifact; undefined when it carries none. */
|
|
108
|
+
getContent(id) {
|
|
109
|
+
return this.content.get(id);
|
|
110
|
+
}
|
|
74
111
|
list(filter) {
|
|
75
112
|
return __awaiter(this, void 0, void 0, function* () {
|
|
76
113
|
const records = yield this.rows.list();
|
|
@@ -113,6 +150,9 @@ export class ArtifactsStore {
|
|
|
113
150
|
}
|
|
114
151
|
evictPastCap() {
|
|
115
152
|
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
+
if ((yield this.rows.count()) <= this.max) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
116
156
|
const records = yield this.rows.list();
|
|
117
157
|
if (records.length <= this.max) {
|
|
118
158
|
return;
|
|
@@ -120,6 +160,9 @@ export class ArtifactsStore {
|
|
|
120
160
|
const oldestFirst = records.sort((a, b) => byNewestUpdated(b, a));
|
|
121
161
|
for (const record of oldestFirst.slice(0, records.length - this.max)) {
|
|
122
162
|
yield this.rows.delete(record.id);
|
|
163
|
+
if (record.content !== undefined) {
|
|
164
|
+
yield this.content.delete(record.id);
|
|
165
|
+
}
|
|
123
166
|
}
|
|
124
167
|
});
|
|
125
168
|
}
|
|
@@ -160,28 +203,83 @@ function isArtifactRecord(value) {
|
|
|
160
203
|
}
|
|
161
204
|
return true;
|
|
162
205
|
}
|
|
163
|
-
function
|
|
206
|
+
function parseRecordBytes(bytes) {
|
|
207
|
+
if (bytes === undefined) {
|
|
208
|
+
return undefined;
|
|
209
|
+
}
|
|
210
|
+
let value;
|
|
211
|
+
try {
|
|
212
|
+
value = JSON.parse(Buffer.from(bytes).toString("utf8"));
|
|
213
|
+
}
|
|
214
|
+
catch (_a) {
|
|
215
|
+
// A corrupt row must not poison list().
|
|
216
|
+
return undefined;
|
|
217
|
+
}
|
|
218
|
+
return isArtifactRecord(value) ? value : undefined;
|
|
219
|
+
}
|
|
220
|
+
function sinkBody(found) {
|
|
221
|
+
if (found === undefined) {
|
|
222
|
+
return undefined;
|
|
223
|
+
}
|
|
224
|
+
return found instanceof Uint8Array ? found : found.body;
|
|
225
|
+
}
|
|
226
|
+
/** Rows as one JSON file each on the deployment's Agent Store. */
|
|
227
|
+
function createSinkRowStore(sink, agentName) {
|
|
228
|
+
const key = (id) => agentStoreKeys.artifactRow(agentName, id);
|
|
164
229
|
return {
|
|
165
230
|
get(id) {
|
|
166
231
|
return __awaiter(this, void 0, void 0, function* () {
|
|
167
|
-
|
|
168
|
-
return isArtifactRecord(value) ? value : undefined;
|
|
232
|
+
return parseRecordBytes(sinkBody(yield sink.get(key(id))));
|
|
169
233
|
});
|
|
170
234
|
},
|
|
171
235
|
put(record) {
|
|
172
236
|
return __awaiter(this, void 0, void 0, function* () {
|
|
173
|
-
yield
|
|
237
|
+
yield sink.put(key(record.id), Buffer.from(JSON.stringify(record), "utf8"));
|
|
174
238
|
});
|
|
175
239
|
},
|
|
176
240
|
delete(id) {
|
|
177
241
|
return __awaiter(this, void 0, void 0, function* () {
|
|
178
|
-
yield
|
|
242
|
+
yield sink.delete(key(id));
|
|
179
243
|
});
|
|
180
244
|
},
|
|
181
245
|
list() {
|
|
182
246
|
return __awaiter(this, void 0, void 0, function* () {
|
|
183
|
-
const
|
|
184
|
-
|
|
247
|
+
const entries = yield sink.list(agentStoreKeys.artifactRowPrefix(agentName));
|
|
248
|
+
const bodies = yield Promise.all(entries.map((entry) => sink.get(entry.key)));
|
|
249
|
+
const records = [];
|
|
250
|
+
for (const body of bodies) {
|
|
251
|
+
const record = parseRecordBytes(sinkBody(body));
|
|
252
|
+
if (record !== undefined) {
|
|
253
|
+
records.push(record);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return records;
|
|
257
|
+
});
|
|
258
|
+
},
|
|
259
|
+
count() {
|
|
260
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
261
|
+
const entries = yield sink.list(agentStoreKeys.artifactRowPrefix(agentName));
|
|
262
|
+
return entries.length;
|
|
263
|
+
});
|
|
264
|
+
},
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
function createSinkContentStore(sink, agentName) {
|
|
268
|
+
const key = (id) => agentStoreKeys.artifactContent(agentName, id);
|
|
269
|
+
return {
|
|
270
|
+
get(id) {
|
|
271
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
272
|
+
return sinkBody(yield sink.get(key(id)));
|
|
273
|
+
});
|
|
274
|
+
},
|
|
275
|
+
put(id, body) {
|
|
276
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
277
|
+
yield sink.put(key(id), body);
|
|
278
|
+
});
|
|
279
|
+
},
|
|
280
|
+
delete(id) {
|
|
281
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
282
|
+
yield sink.delete(key(id));
|
|
185
283
|
});
|
|
186
284
|
},
|
|
187
285
|
};
|
|
@@ -246,5 +344,51 @@ function createFilesystemRowStore(stateRoot) {
|
|
|
246
344
|
return records;
|
|
247
345
|
});
|
|
248
346
|
},
|
|
347
|
+
count() {
|
|
348
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
349
|
+
try {
|
|
350
|
+
const names = yield readdir(dir);
|
|
351
|
+
return names.filter((name) => !name.startsWith(".") && name.endsWith(".json")).length;
|
|
352
|
+
}
|
|
353
|
+
catch (error) {
|
|
354
|
+
if (error.code === "ENOENT") {
|
|
355
|
+
return 0;
|
|
356
|
+
}
|
|
357
|
+
throw error;
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
},
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
function createFilesystemContentStore(stateRoot) {
|
|
364
|
+
const dir = join(stateRoot, "artifacts", "content");
|
|
365
|
+
const filePath = (id) => join(dir, encodeURIComponent(id));
|
|
366
|
+
return {
|
|
367
|
+
get(id) {
|
|
368
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
369
|
+
try {
|
|
370
|
+
return new Uint8Array(yield readFile(filePath(id)));
|
|
371
|
+
}
|
|
372
|
+
catch (error) {
|
|
373
|
+
if (error.code === "ENOENT") {
|
|
374
|
+
return undefined;
|
|
375
|
+
}
|
|
376
|
+
throw error;
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
},
|
|
380
|
+
put(id, body) {
|
|
381
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
382
|
+
yield mkdir(dir, { recursive: true });
|
|
383
|
+
const tmp = join(dir, `.tmp-${randomUUID()}`);
|
|
384
|
+
yield writeFile(tmp, body);
|
|
385
|
+
yield rename(tmp, filePath(id));
|
|
386
|
+
});
|
|
387
|
+
},
|
|
388
|
+
delete(id) {
|
|
389
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
390
|
+
yield rm(filePath(id), { force: true });
|
|
391
|
+
});
|
|
392
|
+
},
|
|
249
393
|
};
|
|
250
394
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `agent-serve convert-automation <url>` — export a Cursor Automation into
|
|
3
|
+
* an agentkit project.
|
|
4
|
+
*
|
|
5
|
+
* Fetches the automation's workflow from the backend export endpoint
|
|
6
|
+
* (Bearer user API key, same credential chain as deploy), runs the pure
|
|
7
|
+
* converter, writes the converted files (wx — existing files are kept),
|
|
8
|
+
* fills in the init scaffold around them, and installs npm dependencies
|
|
9
|
+
* (like `init`). MCP servers convert to Cursor-account connections resolved
|
|
10
|
+
* at runtime (no URLs or credentials in the project; authorization is
|
|
11
|
+
* managed in Cursor, dashboard → MCP). The generated project is NEVER
|
|
12
|
+
* imported/executed here — it embeds server-derived data, so checking it is
|
|
13
|
+
* left to an explicit `validate` next step the user runs after review.
|
|
14
|
+
* Exit 0 even with warnings; nonzero only for bad args, auth/fetch
|
|
15
|
+
* failures, or filesystem write failures.
|
|
16
|
+
*/
|
|
17
|
+
import { installScaffoldDependencies } from "./init-project.js";
|
|
18
|
+
export interface ConvertAutomationCliOptions {
|
|
19
|
+
/** Positional: automation URL or bare uuid. */
|
|
20
|
+
url?: string;
|
|
21
|
+
/** Target directory; defaults to ./<automation-name-slug>. */
|
|
22
|
+
dir?: string;
|
|
23
|
+
json?: boolean;
|
|
24
|
+
apiKey?: string;
|
|
25
|
+
/** Test seams. */
|
|
26
|
+
fetchImpl?: typeof fetch;
|
|
27
|
+
out?: (text: string) => void;
|
|
28
|
+
err?: (text: string) => void;
|
|
29
|
+
installImpl?: typeof installScaffoldDependencies;
|
|
30
|
+
cwd?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Extract the automation uuid from a dashboard URL
|
|
34
|
+
* (`/automations/<uuid>` or `/custom-agents/<uuid>`, any origin — dev
|
|
35
|
+
* hosts included) or a bare uuid. Undefined when nothing matches.
|
|
36
|
+
*/
|
|
37
|
+
export declare function parseAutomationRef(input: string): string | undefined;
|
|
38
|
+
export declare function cmdConvertAutomation(options: ConvertAutomationCliOptions): Promise<number>;
|
|
39
|
+
//# sourceMappingURL=cli-convert-automation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-convert-automation.d.ts","sourceRoot":"","sources":["../../src/internal/cli-convert-automation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAsBH,OAAO,EAIL,2BAA2B,EAE5B,MAAM,mBAAmB,CAAC;AAG3B,MAAM,WAAW,2BAA2B;IAC1C,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kBAAkB;IAClB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,2BAA2B,CAAC;IACjD,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAKD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CA0BpE;AAED,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,MAAM,CAAC,CA8HjB"}
|