Skip to content

The open-source agent harness - the runtime layer that turns an LLM into a working agent.

Resolve AgentSpec skills by version FQN on save and turn (#634)

Bhavesh Patelfc38f747ea8b
diff --git a/.changeset/20260908173000-age-2128-fqn-skills.md b/.changeset/20260908173000-age-2128-fqn-skills.md
new file mode 100644
index 000000000..7203a1346
--- /dev/null
+++ b/.changeset/20260908173000-age-2128-fqn-skills.md
@@ -0,0 +1,6 @@
+---
+"@truefoundry/trueforge": patch
+"@truefoundry/trueforge-core": patch
+---
+
+AgentSpec skills: TrueFoundry save/turn resolve via SFY; standalone git validate/resolve on the skill store.
diff --git a/packages/trueforge/src/apis/turns.ts b/packages/trueforge/src/apis/turns.ts
index 86cecde24..2968d8b58 100644
--- a/packages/trueforge/src/apis/turns.ts
+++ b/packages/trueforge/src/apis/turns.ts
@@ -53,7 +53,6 @@ import {
buildTurnSandbox,
getMcpConnection,
getModelDetails,
- resolveGitSkills,
resolveSandboxProvider,
} from '../runtime/sessionResources';
import { checkSnapshotStatus } from '../sandbox/providerUtils';
@@ -221,15 +220,18 @@ function createTurnResolver(deps: {
});
}
}
- const gitSkills = await resolveGitSkills({
- tenant_id,
- skills: spec.skills ?? [],
- store: skillStore,
- });
+ const skills = spec.skills ?? [];
+ const mountSkills =
+ skills.length === 0
+ ? []
+ : await skillStore.resolveTurnSkills({
+ tenant_id,
+ skills,
+ });
return buildTurnSandbox({
provider,
logger,
- skills: gitSkills,
+ skills: mountSkills,
fileDownloadEnabled: spec.config.sandbox.file_downloads,
existingSandboxId: carriedSandboxId,
tracing,
diff --git a/packages/trueforge/src/db/gitSkillMounts.ts b/packages/trueforge/src/db/gitSkillMounts.ts
index ef167cde7..e89220d1e 100644
--- a/packages/trueforge/src/db/gitSkillMounts.ts
+++ b/packages/trueforge/src/db/gitSkillMounts.ts
@@ -1,4 +1,6 @@
+import type { Skill as SkillMount } from '@truefoundry/trueforge-core/core';
import { HTTPException } from 'hono/http-exception';
+import { parseGitSkill } from '../schemas/skill';
import type { AgentSkillsInput, ISkillStore } from './skillStore';
/** Admit configured git skills; reject preload. */
@@ -33,3 +35,41 @@ export async function validateGitAgentSkills(
}
}
}
+
+/** Expand configured git skills to sandbox mounts. */
+export async function resolveGitTurnSkills(
+ store: Pick<ISkillStore, 'listSkills'>,
+ input: AgentSkillsInput,
+): Promise<SkillMount[]> {
+ const { tenant_id, skills } = input;
+ if (skills.length === 0) {
+ return [];
+ }
+ const names = skills.map(skill => skill.name);
+ const records = await store.listSkills({ tenant_id, names });
+ const byName = new Map(records.map(record => [record.name, record]));
+ const resolved: SkillMount[] = [];
+ for (const skill of skills) {
+ const record = byName.get(skill.name);
+ if (record === undefined) {
+ throw new HTTPException(422, {
+ message: `Unknown skill "${skill.name}" — not configured`,
+ });
+ }
+ const git = parseGitSkill(record.manifest);
+ if (git === undefined) {
+ throw new HTTPException(422, {
+ message: `Skill "${skill.name}" is not a git skill`,
+ });
+ }
+ resolved.push({
+ type: 'git',
+ name: git.name,
+ description: git.description,
+ url: git.url,
+ path: git.path ?? '',
+ ref: git.ref,
+ });
+ }
+ return resolved;
+}
diff --git a/packages/trueforge/src/db/postgres/skill-store/PostgresSkillStore.ts b/packages/trueforge/src/db/postgres/skill-store/PostgresSkillStore.ts
index cbd8b17bd..b05b72f7c 100644
--- a/packages/trueforge/src/db/postgres/skill-store/PostgresSkillStore.ts
+++ b/packages/trueforge/src/db/postgres/skill-store/PostgresSkillStore.ts
@@ -1,6 +1,7 @@
+import type { Skill as SkillMount } from '@truefoundry/trueforge-core/core';
import type { Kysely, Selectable, Transaction } from 'kysely';
import type { SkillVersion } from '../../../schemas/skill';
-import { validateGitAgentSkills } from '../../gitSkillMounts';
+import { resolveGitTurnSkills, validateGitAgentSkills } from '../../gitSkillMounts';
import {
SkillNameConflictError,
type AgentSkillsInput,
@@ -98,4 +99,8 @@ export class PostgresSkillStore implements ISkillStore<Transaction<Database>> {
void transaction;
return validateGitAgentSkills(this, input);
}
+
+ resolveTurnSkills(input: AgentSkillsInput): Promise<SkillMount[]> {
+ return resolveGitTurnSkills(this, input);
+ }
}
diff --git a/packages/trueforge/src/db/skillStore.ts b/packages/trueforge/src/db/skillStore.ts
index 22ef027fa..d236bc57d 100644
--- a/packages/trueforge/src/db/skillStore.ts
+++ b/packages/trueforge/src/db/skillStore.ts
@@ -4,6 +4,7 @@
* Implementations: PostgresSkillStore and SqliteSkillStore.
*/
import type { Skill as AgentSkillRef } from '@truefoundry/trueforge-core/agent-session';
+import type { Skill as SkillMount } from '@truefoundry/trueforge-core/core';
import type { SkillManifest, SkillVersion } from '../schemas/skill';
export interface SkillRecord {
@@ -35,7 +36,7 @@ export interface CreateSkillInput {
/** Same shape as create for now; kept as a distinct name for the upsert path. */
export type UpsertSkillInput = CreateSkillInput;
-/** AgentSpec `skills` refs for save validate. */
+/** AgentSpec `skills` refs for validate and resolve. */
export interface AgentSkillsInput {
tenant_id: string;
skills: readonly AgentSkillRef[];
@@ -63,4 +64,6 @@ export interface ISkillStore<TTransaction = never> {
listSkillVersions(input: { name: string }): Promise<SkillVersion[]>;
/** Admit AgentSpec skill refs (git store or TrueFoundry SFY resolve with caller token). */
validateAgentSkills(input: AgentSkillsInput, transaction?: TTransaction): Promise<void>;
+ /** Expand AgentSpec skill refs to sandbox mounts (git store or TrueFoundry SFY resolve with API key). */
+ resolveTurnSkills(input: AgentSkillsInput): Promise<SkillMount[]>;
}
diff --git a/packages/trueforge/src/db/sqlite/skill-store/SqliteSkillStore.ts b/packages/trueforge/src/db/sqlite/skill-store/SqliteSkillStore.ts
index c4bc2ca56..dd1d6935a 100644
--- a/packages/trueforge/src/db/sqlite/skill-store/SqliteSkillStore.ts
+++ b/packages/trueforge/src/db/sqlite/skill-store/SqliteSkillStore.ts
@@ -1,6 +1,7 @@
+import type { Skill as SkillMount } from '@truefoundry/trueforge-core/core';
import type { ExpressionBuilder, Kysely, Transaction } from 'kysely';
import type { SkillManifest, SkillVersion } from '../../../schemas/skill';
-import { validateGitAgentSkills } from '../../gitSkillMounts';
+import { resolveGitTurnSkills, validateGitAgentSkills } from '../../gitSkillMounts';
import {
SkillNameConflictError,
type AgentSkillsInput,
@@ -98,4 +99,8 @@ export class SqliteSkillStore implements ISkillStore<Transaction<Database>> {
void transaction;
return validateGitAgentSkills(this, input);
}
+
+ resolveTurnSkills(input: AgentSkillsInput): Promise<SkillMount[]> {
+ return resolveGitTurnSkills(this, input);
+ }
}
diff --git a/packages/trueforge/src/runtime/sessionResources.ts b/packages/trueforge/src/runtime/sessionResources.ts
index e391e26cf..9cd1c5450 100644
--- a/packages/trueforge/src/runtime/sessionResources.ts
+++ b/packages/trueforge/src/runtime/sessionResources.ts
@@ -4,7 +4,6 @@ import {
SkillMounter,
type AgentDefinition,
type AgentTracing,
- type GitSkill,
type ModelParams,
type RemoteMcpHeaders,
type SandboxProvider,
@@ -23,7 +22,6 @@ import { LocalSandboxProvider } from '../sandbox/local/provider/LocalSandboxProv
import { getCachedLocalSandboxSupport, isLocalSandboxFallbackEnabled } from '../sandbox/localRuntime';
import { toSandboxProviderFromRecord } from '../sandbox/providerUtils';
import type { ReasoningEffort } from '../schemas/modelProvider';
-import { parseGitSkill } from '../schemas/skill';
export interface McpConnection {
url: string;
@@ -127,52 +125,6 @@ export async function getMcpConnection({
};
}
-/**
- * Expand agent_spec skill names into git mounts from the skill store.
- * Wire url/path/ref/description on the request are ignored — the store row wins.
- * Throws HTTPException(422) if any name is missing or not a git skill.
- */
-export async function resolveGitSkills({
- tenant_id,
- skills,
- store,
-}: {
- tenant_id: string;
- skills: readonly { name: string }[];
- store: ISkillStore;
-}): Promise<GitSkill[]> {
- if (skills.length === 0) {
- return [];
- }
- const names = skills.map(skill => skill.name);
- const records = await store.listSkills({ tenant_id, names });
- const byName = new Map(records.map(record => [record.name, record]));
- const resolved: GitSkill[] = [];
- for (const skill of skills) {
- const record = byName.get(skill.name);
- if (record === undefined) {
- throw new HTTPException(422, {
- message: `Unknown skill "${skill.name}" — not configured`,
- });
- }
- const git = parseGitSkill(record.manifest);
- if (git === undefined) {
- throw new HTTPException(422, {
- message: `Skill "${skill.name}" is not a git skill`,
- });
- }
- resolved.push({
- type: 'git',
- name: git.name,
- description: git.description,
- url: git.url,
- path: git.path ?? '',
- ref: git.ref,
- });
- }
- return resolved;
-}
-
/**
* Build a runtime SandboxProvider from the configured store row, or the
* in-memory local fallback when standalone + the cached probe is supported.
diff --git a/packages/trueforge/src/truefoundry/TrueFoundryServiceFoundryServerClient.ts b/packages/trueforge/src/truefoundry/TrueFoundryServiceFoundryServerClient.ts
index 3d08728c1..596ea98ce 100644
--- a/packages/trueforge/src/truefoundry/TrueFoundryServiceFoundryServerClient.ts
+++ b/packages/trueforge/src/truefoundry/TrueFoundryServiceFoundryServerClient.ts
@@ -151,6 +151,11 @@ export class TrueFoundryServiceFoundryServerClient {
this.#apiKey = input.apiKey;
}
+ /** Service API key (`TRUEFOUNDRY_API_KEY`); callers pass it explicitly when needed. */
+ get apiKey(): string {
+ return this.#apiKey;
+ }
+
/**
* Model integrations. No limit/offset → full match set in one response.
* Pass `filter` (account + model name together) for a point lookup.
@@ -270,14 +275,39 @@ export class TrueFoundryServiceFoundryServerClient {
});
}
+ /** `GET /v1/agent-skill-versions?fqn=` (one row) or `?agent_skill_id=` (all versions). */
+ async listAgentSkillVersions(input: {
+ accessToken: string;
+ fqn?: string;
+ agent_skill_id?: string;
+ }): Promise<unknown[]> {
+ const query: Record<string, string> = {};
+ if (input.fqn !== undefined) {
+ query['fqn'] = input.fqn;
+ }
+ if (input.agent_skill_id !== undefined) {
+ query['agent_skill_id'] = input.agent_skill_id;
+ }
+ return this.#listAllPages({
+ path: AGENT_SKILL_VERSIONS_PATH,
+ accessToken: input.accessToken,
+ query,
+ limit: AGENT_SKILLS_PAGE_SIZE,
+ });
+ }
+
/**
* `POST /internal/tfg/agent-skill-versions/resolve`. Chunks to 50 FQNs.
- * Caller supplies the token (caller JWT on save validate).
+ * Caller supplies the token (caller JWT on save validate; service API key on turns).
* Failures: SFY HTTP errors from `#requestJson` (401/403/424/500); unexpected body → 500.
*/
async resolveAgentSkillVersions(input: {
accessToken: string;
- skills: readonly { fqn: string }[];
+ skills: readonly {
+ fqn: string;
+ include_skill_md_content?: boolean;
+ include_presigned_url?: boolean;
+ }[];
}): Promise<ResolvedAgentSkillVersion[]> {
if (input.skills.length === 0) {
return [];
@@ -289,7 +319,13 @@ export class TrueFoundryServiceFoundryServerClient {
url: this.#url(TFG_AGENT_SKILL_VERSIONS_RESOLVE_PATH),
accessToken: input.accessToken,
method: 'POST',
- body: { skills: chunk.map(({ fqn }) => ({ fqn })) },
+ body: {
+ skills: chunk.map(({ fqn, include_skill_md_content = false, include_presigned_url = false }) => ({
+ fqn,
+ include_skill_md_content,
+ include_presigned_url,
+ })),
+ },
});
try {
resolved.push(...mapResolvedAgentSkillVersions(payload));
@@ -306,27 +342,6 @@ export class TrueFoundryServiceFoundryServerClient {
return resolved;
}
- /** `GET /v1/agent-skill-versions?fqn=` (one row) or `?agent_skill_id=` (all versions). */
- async listAgentSkillVersions(input: {
- accessToken: string;
- fqn?: string;
- agent_skill_id?: string;
- }): Promise<unknown[]> {
- const query: Record<string, string> = {};
- if (input.fqn !== undefined) {
- query['fqn'] = input.fqn;
- }
- if (input.agent_skill_id !== undefined) {
- query['agent_skill_id'] = input.agent_skill_id;
- }
- return this.#listAllPages({
- path: AGENT_SKILL_VERSIONS_PATH,
- accessToken: input.accessToken,
- query,
- limit: AGENT_SKILLS_PAGE_SIZE,
- });
- }
-
/** Offset/limit list until empty page or `pagination.total`. */
async #listAllPages(input: {
path: string;
diff --git a/packages/trueforge/src/truefoundry/TrueFoundrySkillStore.ts b/packages/trueforge/src/truefoundry/TrueFoundrySkillStore.ts
index 1e954283d..16bdcb809 100644
--- a/packages/trueforge/src/truefoundry/TrueFoundrySkillStore.ts
+++ b/packages/trueforge/src/truefoundry/TrueFoundrySkillStore.ts
@@ -1,3 +1,4 @@
+import type { Skill as SkillMount } from '@truefoundry/trueforge-core/core';
import { HTTPException } from 'hono/http-exception';
import type { Logger } from 'winston';
import type { RequestContext } from '../auth/identity';
@@ -23,7 +24,7 @@ import type { TrueFoundryServiceFoundryServerClient } from './TrueFoundryService
export type TrueFoundrySkillApiClient = Pick<
TrueFoundryServiceFoundryServerClient,
- 'listAgentSkills' | 'listAgentSkillVersions' | 'vendToken' | 'resolveAgentSkillVersions'
+ 'listAgentSkills' | 'listAgentSkillVersions' | 'vendToken' | 'resolveAgentSkillVersions' | 'apiKey'
>;
function toRegistryRecord(tenant_id: string, skill: SfyRegistrySkill): SkillRecord {
@@ -47,6 +48,7 @@ function toRegistryRecord(tenant_id: string, skill: SfyRegistrySkill): SkillReco
/** Read-only TrueFoundry registry skill catalog; writes are managed by TrueFoundry.
* Pass `agent` on turn/cron paths so catalog reads use the same vend token as models and MCP.
+ * Save validate uses the caller JWT; turn mounts pass the service API key.
*/
export class TrueFoundrySkillStore<TTransaction = never> implements ISkillStore<TTransaction> {
readonly #client: TrueFoundrySkillApiClient;
@@ -152,4 +154,51 @@ export class TrueFoundrySkillStore<TTransaction = never> implements ISkillStore<
seenNames.add(row.name);
}
}
+
+ async resolveTurnSkills(input: AgentSkillsInput): Promise<SkillMount[]> {
+ const { skills } = input;
+ if (skills.length === 0) {
+ return [];
+ }
+
+ // Runtime resolve uses the service API key, not the caller token.
+ const resolved = await this.#client.resolveAgentSkillVersions({
+ accessToken: this.#client.apiKey,
+ skills: skills.map(skill => ({
+ fqn: skill.name,
+ include_skill_md_content: skill.preload,
+ include_presigned_url: true,
+ })),
+ });
+
+ const byFqn = new Map(resolved.map(row => [row.fqn, row]));
+ return skills.map(skill => {
+ const row = byFqn.get(skill.name);
+ if (row === undefined) {
+ throw new HTTPException(422, {
+ message: `Unknown skill "${skill.name}" — not configured`,
+ });
+ }
+ if (row.presigned_url === undefined) {
+ throw new HTTPException(422, {
+ message: `Skill "${skill.name}" did not return a presigned URL`,
+ });
+ }
+ const skillMdContent = skill.preload ? (row.skill_md_content ?? null) : null;
+ if (skill.preload && (skillMdContent === null || skillMdContent.length === 0)) {
+ throw new HTTPException(422, {
+ message: `Skill "${skill.name}" did not return SKILL.md for preload`,
+ });
+ }
+ return {
+ type: 'registry' as const,
+ name: row.name,
+ description: row.description,
+ fqn: row.fqn,
+ preload: skill.preload,
+ skillMdContent,
+ presignedUrl: row.presigned_url,
+ };
+ });
+ }
}
diff --git a/packages/trueforge/src/truefoundry/mapSfyAgentSkills.ts b/packages/trueforge/src/truefoundry/mapSfyAgentSkills.ts
index 53da7aa05..eacb0140f 100644
--- a/packages/trueforge/src/truefoundry/mapSfyAgentSkills.ts
+++ b/packages/trueforge/src/truefoundry/mapSfyAgentSkills.ts
@@ -44,6 +44,8 @@ export const ResolvedAgentSkillVersionSchema = z.object({
fqn: z.string().min(1),
name: z.string().min(1),
description: z.string().min(1),
+ skill_md_content: z.string().nullable().optional(),
+ presigned_url: z.string().min(1).optional(),
});
export type ResolvedAgentSkillVersion = z.infer<typeof ResolvedAgentSkillVersionSchema>;
diff --git a/packages/trueforge/tests/db/skillStoreContractSuite.ts b/packages/trueforge/tests/db/skillStoreContractSuite.ts
index d56c11e2d..88a15bce6 100644
--- a/packages/trueforge/tests/db/skillStoreContractSuite.ts
+++ b/packages/trueforge/tests/db/skillStoreContractSuite.ts
@@ -140,20 +140,6 @@ export function runSkillStoreContractSuite(getStore: () => ISkillStore): void {
});
});
- it('validateAgentSkills rejects preload on git skills', async () => {
- const store = getStore();
- await store.upsertSkill({ tenant_id: TENANT, name: 'algorithmic-art', manifest: manifest() });
- await expect(
- store.validateAgentSkills({
- tenant_id: TENANT,
- skills: [{ name: 'algorithmic-art', preload: true }],
- }),
- ).rejects.toMatchObject({
- status: 422,
- message: 'Skill "algorithmic-art": preload is not supported for git skills',
- });
- });
-
it('listSkills filters by names and returns empty for an empty name list', async () => {
const store = getStore();
await store.upsertSkill({ tenant_id: TENANT, name: 'algorithmic-art', manifest: manifest() });
@@ -186,4 +172,35 @@ export function runSkillStoreContractSuite(getStore: () => ISkillStore): void {
await store.upsertSkill({ tenant_id: TENANT, name: 'algorithmic-art', manifest: manifest() });
await expect(store.listSkillVersions({ name: 'algorithmic-art' })).resolves.toEqual([]);
});
+
+ it('validateAgentSkills and resolveTurnSkills round-trip git skills', async () => {
+ const store = getStore();
+ await store.upsertSkill({ tenant_id: TENANT, name: 'algorithmic-art', manifest: manifest() });
+ const skills = [{ name: 'algorithmic-art', preload: false }];
+ await expect(store.validateAgentSkills({ tenant_id: TENANT, skills })).resolves.toBeUndefined();
+ await expect(store.resolveTurnSkills({ tenant_id: TENANT, skills })).resolves.toEqual([
+ {
+ type: 'git',
+ name: 'algorithmic-art',
+ description: 'Creating algorithmic art using p5.js with seeded randomness.',
+ url: 'https://github.com/anthropics/skills',
+ path: 'skills/algorithmic-art',
+ ref: 'main',
+ },
+ ]);
+ });
+
+ it('validateAgentSkills rejects preload on git skills', async () => {
+ const store = getStore();
+ await store.upsertSkill({ tenant_id: TENANT, name: 'algorithmic-art', manifest: manifest() });
+ await expect(
+ store.validateAgentSkills({
+ tenant_id: TENANT,
+ skills: [{ name: 'algorithmic-art', preload: true }],
+ }),
+ ).rejects.toMatchObject({
+ status: 422,
+ message: 'Skill "algorithmic-art": preload is not supported for git skills',
+ });
+ });
}
diff --git a/packages/trueforge/tests/unit/apis/skills.test.ts b/packages/trueforge/tests/unit/apis/skills.test.ts
index f2257f13e..c3d37cd95 100644
--- a/packages/trueforge/tests/unit/apis/skills.test.ts
+++ b/packages/trueforge/tests/unit/apis/skills.test.ts
@@ -143,6 +143,7 @@ describe('skills routers', () => {
upsertSkill: jest.fn(),
listSkillVersions: jest.fn(),
validateAgentSkills: jest.fn(),
+ resolveTurnSkills: jest.fn(),
};
const router = createAvailableSkillsRouter({
resolveSkillStore: () => skillStore,
@@ -189,6 +190,7 @@ describe('skills routers', () => {
upsertSkill: jest.fn().mockResolvedValue(record),
listSkillVersions: jest.fn(),
validateAgentSkills: jest.fn(),
+ resolveTurnSkills: jest.fn(),
};
const router = createSkillsRouter({
resolveSkillStore: () => managedStore,
@@ -227,6 +229,7 @@ describe('skills routers', () => {
upsertSkill: jest.fn(() => trueFoundryManaged()),
listSkillVersions: jest.fn(),
validateAgentSkills: jest.fn(),
+ resolveTurnSkills: jest.fn(),
};
const router = createSkillsRouter({
resolveSkillStore: () => managedStore,
diff --git a/packages/trueforge/tests/unit/runtime/sessionResources.test.ts b/packages/trueforge/tests/unit/runtime/sessionResources.test.ts
index c6d9d52d0..7c2997a0d 100644
--- a/packages/trueforge/tests/unit/runtime/sessionResources.test.ts
+++ b/packages/trueforge/tests/unit/runtime/sessionResources.test.ts
@@ -1,6 +1,8 @@
import { AgentSpecSchema } from '@truefoundry/trueforge-core/agent-session';
import { HTTPException } from 'hono/http-exception';
+import { validateGitAgentSkills } from '../../../src/db/gitSkillMounts';
import { migrateSqliteToLatest } from '../../../src/db/migrateSqlite';
+import type { ISkillStore } from '../../../src/db/skillStore';
import { createSqliteDb } from '../../../src/db/sqlite/client';
import { SqliteMcpServerStore } from '../../../src/db/sqlite/mcp-server-store/SqliteMcpServerStore';
import { SqliteModelProviderStore } from '../../../src/db/sqlite/model-provider-store/SqliteModelProviderStore';
@@ -284,7 +286,7 @@ describe('validateAgentSpec', () => {
expect(await stores.sandboxProviderStore.getSandboxProvider('default')).toBeUndefined();
});
- it('allows registry skills referenced by version FQN', async () => {
+ it('rejects registry catalog rows as git mounts (standalone)', async () => {
const stores = await setup();
setCachedLocalSandboxSupport({
supported: true,
@@ -294,7 +296,7 @@ describe('validateAgentSpec', () => {
});
const fqn = 'agent-skill:acme/team-a/echo:1';
const now = '2026-01-01T00:00:00.000Z';
- const skillStore = {
+ const skillStore: ISkillStore = {
listSkills: async () => [
{
tenant_id: 'default',
@@ -311,7 +313,6 @@ describe('validateAgentSpec', () => {
updated_at: now,
},
],
- validateAgentSkills: async () => undefined,
createSkill: async () => {
throw new Error('unused');
},
@@ -319,6 +320,12 @@ describe('validateAgentSpec', () => {
throw new Error('unused');
},
listSkillVersions: async () => [],
+ async validateAgentSkills(input) {
+ return validateGitAgentSkills(this, input);
+ },
+ resolveTurnSkills: async () => {
+ throw new Error('unused');
+ },
};
await expect(
validateAgentSpec({
@@ -331,6 +338,70 @@ describe('validateAgentSpec', () => {
...stores,
skillStore,
}),
+ ).rejects.toMatchObject({
+ status: 422,
+ message: `Skill "${fqn}" is not a git skill`,
+ });
+ });
+
+ it('validates skills via skillStore.validateAgentSkills', async () => {
+ const stores = await setup();
+ setCachedLocalSandboxSupport({
+ supported: true,
+ platform: 'darwin',
+ shell: '/bin/bash',
+ python: '/usr/bin/python3',
+ });
+ const validateAgentSkills = jest.spyOn(stores.skillStore, 'validateAgentSkills').mockResolvedValue(undefined);
+ await expect(
+ validateAgentSpec({
+ spec: AgentSpecSchema.parse({
+ model: { name: 'test-provider/test-model' },
+ instructions: 'test',
+ skills: [{ name: 'agent-skill:acme/team-a/echo:3', preload: false }],
+ }),
+ tenant_id: 'default',
+ ...stores,
+ }),
).resolves.toBeUndefined();
+ expect(validateAgentSkills).toHaveBeenCalledWith({
+ tenant_id: 'default',
+ skills: [{ name: 'agent-skill:acme/team-a/echo:3', preload: false }],
+ });
+ });
+
+ it('rejects preload on git skills', async () => {
+ const stores = await setup();
+ setCachedLocalSandboxSupport({
+ supported: true,
+ platform: 'darwin',
+ shell: '/bin/bash',
+ python: '/usr/bin/python3',
+ });
+ await stores.skillStore.upsertSkill({
+ tenant_id: 'default',
+ name: 'echo',
+ manifest: {
+ type: 'git',
+ name: 'echo',
+ description: 'Echo',
+ url: 'https://github.com/acme/skills',
+ ref: 'main',
+ },
+ });
+ await expect(
+ validateAgentSpec({
+ spec: AgentSpecSchema.parse({
+ model: { name: 'test-provider/test-model' },
+ instructions: 'test',
+ skills: [{ name: 'echo', preload: true }],
+ }),
+ tenant_id: 'default',
+ ...stores,
+ }),
+ ).rejects.toMatchObject({
+ status: 422,
+ message: 'Skill "echo": preload is not supported for git skills',
+ });
});
});
diff --git a/packages/trueforge/tests/unit/truefoundry/TrueFoundrySkillStore.test.ts b/packages/trueforge/tests/unit/truefoundry/TrueFoundrySkillStore.test.ts
index d6b12fa10..106d6b7af 100644
--- a/packages/trueforge/tests/unit/truefoundry/TrueFoundrySkillStore.test.ts
+++ b/packages/trueforge/tests/unit/truefoundry/TrueFoundrySkillStore.test.ts
@@ -68,6 +68,7 @@ function createStore(
},
]),
vendToken: jest.fn().mockResolvedValue(AGENT_TOKEN),
+ apiKey: 'tfy-api-key',
};
const store = new TrueFoundrySkillStore({
client,
@@ -317,4 +318,43 @@ describe('TrueFoundrySkillStore', () => {
skills: [{ fqn: 'agent-skill:acme/team-a/echo:3' }],
});
});
+
+ it('resolveTurnSkills passes the service API key', async () => {
+ const { store, client } = createStore();
+ client.resolveAgentSkillVersions.mockResolvedValue([
+ {
+ fqn: 'agent-skill:acme/team-a/echo:3',
+ name: 'echo',
+ description: 'Echo skill',
+ skill_md_content: '# Echo',
+ presigned_url: 'https://example.com/echo.tgz',
+ },
+ ]);
+ await expect(
+ store.resolveTurnSkills({
+ tenant_id: TENANT,
+ skills: [{ name: 'agent-skill:acme/team-a/echo:3', preload: true }],
+ }),
+ ).resolves.toEqual([
+ {
+ type: 'registry',
+ name: 'echo',
+ description: 'Echo skill',
+ fqn: 'agent-skill:acme/team-a/echo:3',
+ preload: true,
+ skillMdContent: '# Echo',
+ presignedUrl: 'https://example.com/echo.tgz',
+ },
+ ]);
+ expect(client.resolveAgentSkillVersions).toHaveBeenCalledWith({
+ accessToken: 'tfy-api-key',
+ skills: [
+ {
+ fqn: 'agent-skill:acme/team-a/echo:3',
+ include_skill_md_content: true,
+ include_presigned_url: true,
+ },
+ ],
+ });
+ });
});
diff --git a/packages/trueforge/tests/unit/truefoundry/mapSfyAgentSkills.test.ts b/packages/trueforge/tests/unit/truefoundry/mapSfyAgentSkills.test.ts
index 4d0c0f899..4b034a8ad 100644
--- a/packages/trueforge/tests/unit/truefoundry/mapSfyAgentSkills.test.ts
+++ b/packages/trueforge/tests/unit/truefoundry/mapSfyAgentSkills.test.ts
@@ -92,6 +92,7 @@ describe('mapSfyRegistrySkills', () => {
fqn: 'agent-skill:acme/team-a/echo:3',
name: 'echo',
description: 'Echo skill',
+ skill_md_content: null,
},
],
}),
@@ -100,6 +101,7 @@ describe('mapSfyRegistrySkills', () => {
fqn: 'agent-skill:acme/team-a/echo:3',
name: 'echo',
description: 'Echo skill',
+ skill_md_content: null,
},
]);
});