@cursor/july 0.1.34 → 0.1.35
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/dist/docs/404.html +1 -1
- package/dist/docs/ab.html +2 -2
- package/dist/docs/assets/{app.FPupl4SP.js → app.D5Mv1T0U.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.Cu7b6o1D.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.Cd182Cu0.js → VPLocalSearchBox.CMq_BQce.js} +1 -1
- package/dist/docs/assets/chunks/{theme.BEM3Okcd.js → theme.C6D9UPLK.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/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/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/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/troubleshooting.html +2 -2
- package/dist/internal/host-kv.d.ts +6 -2
- package/dist/internal/host-kv.d.ts.map +1 -1
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +15 -6
- package/dist/internal/storage-coordinator.d.ts +9 -1
- package/dist/internal/storage-coordinator.d.ts.map +1 -1
- package/dist/internal/storage-coordinator.js +7 -0
- package/dist/internal/storage-roles.d.ts +78 -0
- package/dist/internal/storage-roles.d.ts.map +1 -0
- package/dist/internal/storage-roles.js +24 -0
- package/dist/internal/workspace.d.ts +26 -0
- package/dist/internal/workspace.d.ts.map +1 -1
- package/dist/internal/workspace.js +53 -0
- package/dist/playground/assets/{index-CDDWw0YX.js → index-D7OV8B_H.js} +40 -40
- package/dist/playground/assets/index-DOb96C0M.css +1 -0
- package/dist/playground/index.html +2 -2
- package/package.json +1 -1
- package/src/internal/host-kv.ts +6 -2
- package/src/internal/session-engine.ts +20 -8
- package/src/internal/storage-coordinator.ts +15 -1
- package/src/internal/storage-roles.ts +86 -0
- package/src/internal/workspace.ts +62 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.WoYunhnT.js +0 -1
- package/dist/playground/assets/index-MVuNTd8v.css +0 -1
|
@@ -14,6 +14,13 @@
|
|
|
14
14
|
* and A/B metrics go to their dedicated tables (`evals` / `abs`).
|
|
15
15
|
* Reminder documents live on the control plane. Everything shares one
|
|
16
16
|
* bounded, serialized queue.
|
|
17
|
+
*
|
|
18
|
+
* It does three unrelated jobs, declared separately as
|
|
19
|
+
* {@link FrameworkSessionStore}, {@link AuthorKvStore}, and
|
|
20
|
+
* {@link EvalAbStore} — see `storage-roles.ts` for why they differ and where
|
|
21
|
+
* each is headed. The queue stays shared: it is one bounded, serialized chain
|
|
22
|
+
* per agent, and splitting it would change backpressure behavior, which this
|
|
23
|
+
* seam deliberately does not touch.
|
|
17
24
|
*/
|
|
18
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
19
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The three unrelated jobs `defineStorage` currently does, named separately.
|
|
3
|
+
*
|
|
4
|
+
* {@link import("./storage-coordinator.js").StorageCoordinator} implements all
|
|
5
|
+
* three today over one sink and one delivery queue. Splitting the *types* is
|
|
6
|
+
* the seam that lets each job change independently:
|
|
7
|
+
*
|
|
8
|
+
* - {@link FrameworkSessionStore} is framework state. Session records, event
|
|
9
|
+
* chunks, and the continuation index are how a session survives the process,
|
|
10
|
+
* so they belong to Agent Serve, not to the agent. Today they persist only
|
|
11
|
+
* when the author writes `agent/storage.ts` — the defect this seam exists to
|
|
12
|
+
* let us fix, by giving the framework its own provider that is automatic and
|
|
13
|
+
* not author-configurable.
|
|
14
|
+
* - {@link AuthorKvStore} is author state: whatever `ctx.host.kv` was handed.
|
|
15
|
+
* It converges onto the author file plane, which is a different destination
|
|
16
|
+
* from the one above.
|
|
17
|
+
* - {@link EvalAbStore} is playground/experiment bookkeeping with its own
|
|
18
|
+
* dedicated tables, and follows neither.
|
|
19
|
+
*
|
|
20
|
+
* Consumers should depend on the narrowest role they use. That is what keeps a
|
|
21
|
+
* later change to framework persistence from silently reaching author KV, and
|
|
22
|
+
* it is why these are interfaces rather than a comment on one class.
|
|
23
|
+
*/
|
|
24
|
+
import type { ABMetricSample } from "../ab.js";
|
|
25
|
+
import type { StorageContext } from "../storage.js";
|
|
26
|
+
import type { JsonValue, SessionEvent, SessionRecord } from "../types.js";
|
|
27
|
+
import type { ABSnapshot } from "./ab-snapshot.js";
|
|
28
|
+
import type { EvalRunStorage } from "./eval-run-store.js";
|
|
29
|
+
/**
|
|
30
|
+
* Framework-owned session durability: what has to be true for a session to
|
|
31
|
+
* outlive the process that served it.
|
|
32
|
+
*
|
|
33
|
+
* Writes are fire-and-forget by design — a throwing backend is logged and its
|
|
34
|
+
* write dropped, because storage must never stall or fail a turn. That is
|
|
35
|
+
* at-most-once, and it is the property Track F later has to tighten, since a
|
|
36
|
+
* dropped record is a session that cannot be restored.
|
|
37
|
+
*/
|
|
38
|
+
export interface FrameworkSessionStore {
|
|
39
|
+
/** Durable session-record update; coalesced until the next flush. */
|
|
40
|
+
sessionRecord(record: SessionRecord): void;
|
|
41
|
+
/** One appended session event; batched per turn or debounce window. */
|
|
42
|
+
event(event: SessionEvent): void;
|
|
43
|
+
/** Marks an event delivered, for backends that track dispatch. */
|
|
44
|
+
eventDispatched(event: SessionEvent): void;
|
|
45
|
+
/** Flush everything buffered for one session (ordered: events, record). */
|
|
46
|
+
flushSession(sessionId: string, reason?: StorageContext["reason"]): void;
|
|
47
|
+
/** True when the backend can list every session in one bulk read. */
|
|
48
|
+
readonly canBulkRestore: boolean;
|
|
49
|
+
/** True when the backend is the Cursor-hosted one rather than an authored sink. */
|
|
50
|
+
readonly isCursorHosted: boolean;
|
|
51
|
+
listSessions(): Promise<SessionRecord[]>;
|
|
52
|
+
listSessionsFromSink(): Promise<SessionRecord[]>;
|
|
53
|
+
listSessionEvents(sessionId: string): Promise<SessionEvent[]>;
|
|
54
|
+
getSessionById(sessionId: string): Promise<SessionRecord | undefined>;
|
|
55
|
+
getSessionByContinuation(channelId: string, continuationKey: string): Promise<SessionRecord | undefined>;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Author-facing durable JSON behind `ctx.host.kv`.
|
|
59
|
+
*
|
|
60
|
+
* Deployment-wide on purpose: the point is state an author saves in one
|
|
61
|
+
* session and reads back in a later one, so unlike `ctx.host.files` there is
|
|
62
|
+
* no session scope to default to.
|
|
63
|
+
*/
|
|
64
|
+
export interface AuthorKvStore {
|
|
65
|
+
/** False when no backend is configured; callers fall back to local disk. */
|
|
66
|
+
readonly supportsAuthorKv: boolean;
|
|
67
|
+
kvGet(authorKey: string): Promise<JsonValue | undefined>;
|
|
68
|
+
kvPut(authorKey: string, value: JsonValue): Promise<void>;
|
|
69
|
+
kvDelete(authorKey: string): Promise<void>;
|
|
70
|
+
}
|
|
71
|
+
/** Playground eval batches and live A/B metrics, on their own tables. */
|
|
72
|
+
export interface EvalAbStore {
|
|
73
|
+
evalRuns(): EvalRunStorage | undefined;
|
|
74
|
+
abSample(sample: ABMetricSample): void;
|
|
75
|
+
abSnapshot(snapshot: ABSnapshot): void;
|
|
76
|
+
getLatestAbSnapshot(): Promise<ABSnapshot | undefined>;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=storage-roles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-roles.d.ts","sourceRoot":"","sources":["../../src/internal/storage-roles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;;;;;;;GAQG;AACH,MAAM,WAA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,MAAM,WAAW,WAAW;IAC1B,QAAQ,IAAI,cAAc,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IACvC,UAAU,CAAC,QAAQ,EAAE,UAAU,GAAG,IAAI,CAAC;IACvC,mBAAmB,IAAI,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;CACxD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The three unrelated jobs `defineStorage` currently does, named separately.
|
|
3
|
+
*
|
|
4
|
+
* {@link import("./storage-coordinator.js").StorageCoordinator} implements all
|
|
5
|
+
* three today over one sink and one delivery queue. Splitting the *types* is
|
|
6
|
+
* the seam that lets each job change independently:
|
|
7
|
+
*
|
|
8
|
+
* - {@link FrameworkSessionStore} is framework state. Session records, event
|
|
9
|
+
* chunks, and the continuation index are how a session survives the process,
|
|
10
|
+
* so they belong to Agent Serve, not to the agent. Today they persist only
|
|
11
|
+
* when the author writes `agent/storage.ts` — the defect this seam exists to
|
|
12
|
+
* let us fix, by giving the framework its own provider that is automatic and
|
|
13
|
+
* not author-configurable.
|
|
14
|
+
* - {@link AuthorKvStore} is author state: whatever `ctx.host.kv` was handed.
|
|
15
|
+
* It converges onto the author file plane, which is a different destination
|
|
16
|
+
* from the one above.
|
|
17
|
+
* - {@link EvalAbStore} is playground/experiment bookkeeping with its own
|
|
18
|
+
* dedicated tables, and follows neither.
|
|
19
|
+
*
|
|
20
|
+
* Consumers should depend on the narrowest role they use. That is what keeps a
|
|
21
|
+
* later change to framework persistence from silently reaching author KV, and
|
|
22
|
+
* it is why these are interfaces rather than a comment on one class.
|
|
23
|
+
*/
|
|
24
|
+
export {};
|
|
@@ -32,6 +32,13 @@ export interface MaterializeWorkspaceOptions {
|
|
|
32
32
|
export declare function buildCloudMemorySection(agentName: string): string;
|
|
33
33
|
/** Relative path of an agent-side tool script inside the session workspace. */
|
|
34
34
|
export declare function agentToolScriptPath(toolName: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Reserved MCP connection name under which authored server tools are served
|
|
37
|
+
* to cloud turns (the session-bound tool MCP endpoint). Shared between the
|
|
38
|
+
* turn's MCP config and the first-prompt server-tool catalog so the model is
|
|
39
|
+
* told exactly where those tools live.
|
|
40
|
+
*/
|
|
41
|
+
export declare const SERVER_TOOLS_MCP_SERVER_NAME = "agentsdk-tools";
|
|
35
42
|
/**
|
|
36
43
|
* Always-on identity line prepended when composing instructions. Sourced from
|
|
37
44
|
* {@link ResolvedAgent.name} (`defineAgent({ name })`, else package/dir name)
|
|
@@ -52,15 +59,34 @@ export declare function withIdentityPreamble(name: string, instructions: string
|
|
|
52
59
|
export declare function buildAgentToolsCatalog(tools: DiscoveredTool[], options?: {
|
|
53
60
|
includeScripts: boolean;
|
|
54
61
|
}): string;
|
|
62
|
+
/**
|
|
63
|
+
* Markdown catalog of authored server tools for the cloud first prompt.
|
|
64
|
+
*
|
|
65
|
+
* Server tools execute on the serve host and reach cloud turns only as MCP
|
|
66
|
+
* tools on {@link SERVER_TOOLS_MCP_SERVER_NAME}. Instructions reference them
|
|
67
|
+
* by bare name, and the agent-tool catalog teaches a "recreate the script if
|
|
68
|
+
* missing" pattern — without this section a cloud model that cannot find a
|
|
69
|
+
* script for a server tool improvises a local substitute instead of calling
|
|
70
|
+
* the real tool, so its host-side effects silently never happen.
|
|
71
|
+
*/
|
|
72
|
+
export declare function buildServerToolsCatalog(tools: DiscoveredTool[], options: {
|
|
73
|
+
mcpServerName: string;
|
|
74
|
+
}): string;
|
|
55
75
|
/**
|
|
56
76
|
* The full AGENTS.md-equivalent context for an agent: instructions, identity
|
|
57
77
|
* section, and the agent-side tool catalog. Written to the session workspace
|
|
58
78
|
* as `AGENTS.md`, and inlined into the first turn's prompt when the harness
|
|
59
79
|
* cannot discover that file (cloud runtime, or a local workspace the harness
|
|
60
80
|
* will not treat as the project root — see {@link isNestedInGitRepo}).
|
|
81
|
+
*
|
|
82
|
+
* `serverToolsMcpName` is cloud-only: when the turn's MCP config carries the
|
|
83
|
+
* session-bound server-tool endpoint, the catalog names that server so the
|
|
84
|
+
* model calls the real tools instead of inventing local stand-ins. Local
|
|
85
|
+
* runtimes omit it — there the harness exposes server tools natively.
|
|
61
86
|
*/
|
|
62
87
|
export declare function buildAgentsMdContent(agent: ResolvedAgent, options: {
|
|
63
88
|
includeScripts: boolean;
|
|
89
|
+
serverToolsMcpName?: string;
|
|
64
90
|
}): string;
|
|
65
91
|
/**
|
|
66
92
|
* True when `dir` sits strictly inside a git repository (a `.git` exists in
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/internal/workspace.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAgBH,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,aAAa,EACd,MAAM,aAAa,CAAC;AAIrB,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,aAAa,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,IAAI,EAAE,OAAO,CAAC;IACd;;;;;;;OAOG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAOjE;AAED,+EAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM1D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,GAAG,SAAS,GAC/B,MAAM,GAAG,SAAS,CAapB;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,cAAc,EAAE,EACvB,OAAO,GAAE;IAAE,cAAc,EAAE,OAAO,CAAA;CAA8B,GAC/D,MAA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AM,CAAA;CAAE,GAChE,MAAM,CAeR;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAcrE;AAED,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,IAAI,CAAC,CAkCf;AAqGD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAO3D;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC5B,OAAO,CAAC,IAAI,CAAC,CAMf"}
|
|
@@ -37,6 +37,13 @@ export function buildCloudMemorySection(agentName) {
|
|
|
37
37
|
export function agentToolScriptPath(toolName) {
|
|
38
38
|
return `.agent-serve/tools/${toolName}.sh`;
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Reserved MCP connection name under which authored server tools are served
|
|
42
|
+
* to cloud turns (the session-bound tool MCP endpoint). Shared between the
|
|
43
|
+
* turn's MCP config and the first-prompt server-tool catalog so the model is
|
|
44
|
+
* told exactly where those tools live.
|
|
45
|
+
*/
|
|
46
|
+
export const SERVER_TOOLS_MCP_SERVER_NAME = "agentsdk-tools";
|
|
40
47
|
/**
|
|
41
48
|
* Always-on identity line prepended when composing instructions. Sourced from
|
|
42
49
|
* {@link ResolvedAgent.name} (`defineAgent({ name })`, else package/dir name)
|
|
@@ -117,12 +124,53 @@ export function buildAgentToolsCatalog(tools, options = { includeScripts: false
|
|
|
117
124
|
}
|
|
118
125
|
return `${parts.join("\n").trimEnd()}\n`;
|
|
119
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Markdown catalog of authored server tools for the cloud first prompt.
|
|
129
|
+
*
|
|
130
|
+
* Server tools execute on the serve host and reach cloud turns only as MCP
|
|
131
|
+
* tools on {@link SERVER_TOOLS_MCP_SERVER_NAME}. Instructions reference them
|
|
132
|
+
* by bare name, and the agent-tool catalog teaches a "recreate the script if
|
|
133
|
+
* missing" pattern — without this section a cloud model that cannot find a
|
|
134
|
+
* script for a server tool improvises a local substitute instead of calling
|
|
135
|
+
* the real tool, so its host-side effects silently never happen.
|
|
136
|
+
*/
|
|
137
|
+
export function buildServerToolsCatalog(tools, options) {
|
|
138
|
+
const serverTools = tools.filter((tool) => tool.execution === "server");
|
|
139
|
+
if (serverTools.length === 0) {
|
|
140
|
+
return "";
|
|
141
|
+
}
|
|
142
|
+
const parts = [
|
|
143
|
+
"## Server tools",
|
|
144
|
+
"",
|
|
145
|
+
`These tools execute on the agent-serve host, not in this environment. They are available ONLY as MCP tools on the \`${options.mcpServerName}\` MCP server — list that server's tools and call them by name through your MCP tooling.`,
|
|
146
|
+
"There are no local scripts for these tools. NEVER create, edit, or run a local script or other substitute for them: a local re-implementation cannot produce their real effects on the host.",
|
|
147
|
+
"",
|
|
148
|
+
];
|
|
149
|
+
for (const tool of serverTools) {
|
|
150
|
+
parts.push(`### \`${tool.name}\``);
|
|
151
|
+
parts.push("");
|
|
152
|
+
parts.push(tool.description.trim());
|
|
153
|
+
parts.push("");
|
|
154
|
+
parts.push("Input schema:");
|
|
155
|
+
parts.push("");
|
|
156
|
+
parts.push("```json");
|
|
157
|
+
parts.push(JSON.stringify(tool.inputSchema, null, 2));
|
|
158
|
+
parts.push("```");
|
|
159
|
+
parts.push("");
|
|
160
|
+
}
|
|
161
|
+
return `${parts.join("\n").trimEnd()}\n`;
|
|
162
|
+
}
|
|
120
163
|
/**
|
|
121
164
|
* The full AGENTS.md-equivalent context for an agent: instructions, identity
|
|
122
165
|
* section, and the agent-side tool catalog. Written to the session workspace
|
|
123
166
|
* as `AGENTS.md`, and inlined into the first turn's prompt when the harness
|
|
124
167
|
* cannot discover that file (cloud runtime, or a local workspace the harness
|
|
125
168
|
* will not treat as the project root — see {@link isNestedInGitRepo}).
|
|
169
|
+
*
|
|
170
|
+
* `serverToolsMcpName` is cloud-only: when the turn's MCP config carries the
|
|
171
|
+
* session-bound server-tool endpoint, the catalog names that server so the
|
|
172
|
+
* model calls the real tools instead of inventing local stand-ins. Local
|
|
173
|
+
* runtimes omit it — there the harness exposes server tools natively.
|
|
126
174
|
*/
|
|
127
175
|
export function buildAgentsMdContent(agent, options) {
|
|
128
176
|
var _a;
|
|
@@ -133,6 +181,11 @@ export function buildAgentsMdContent(agent, options) {
|
|
|
133
181
|
buildAgentToolsCatalog(agent.tools, {
|
|
134
182
|
includeScripts: options.includeScripts,
|
|
135
183
|
}),
|
|
184
|
+
options.serverToolsMcpName === undefined
|
|
185
|
+
? ""
|
|
186
|
+
: buildServerToolsCatalog(agent.tools, {
|
|
187
|
+
mcpServerName: options.serverToolsMcpName,
|
|
188
|
+
}),
|
|
136
189
|
]
|
|
137
190
|
.filter((part) => part !== "")
|
|
138
191
|
.join("\n\n");
|