@runtypelabs/sdk 3.0.0 → 4.0.1
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/index.cjs +217 -6
- package/dist/index.d.cts +2013 -679
- package/dist/index.d.ts +2013 -679
- package/dist/index.mjs +215 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -329,6 +329,8 @@ __export(index_exports, {
|
|
|
329
329
|
STEP_TYPE_TO_METHOD: () => STEP_TYPE_TO_METHOD,
|
|
330
330
|
SchedulesEndpoint: () => SchedulesEndpoint,
|
|
331
331
|
SecretsEndpoint: () => SecretsEndpoint,
|
|
332
|
+
SkillProposalsNamespace: () => SkillProposalsNamespace,
|
|
333
|
+
SkillsNamespace: () => SkillsNamespace,
|
|
332
334
|
SurfacesEndpoint: () => SurfacesEndpoint,
|
|
333
335
|
ToolsEndpoint: () => ToolsEndpoint,
|
|
334
336
|
UsersEndpoint: () => UsersEndpoint,
|
|
@@ -1749,6 +1751,175 @@ var PromptsNamespace = class {
|
|
|
1749
1751
|
}
|
|
1750
1752
|
};
|
|
1751
1753
|
|
|
1754
|
+
// src/skills-namespace.ts
|
|
1755
|
+
var SkillProposalsNamespace = class {
|
|
1756
|
+
constructor(getClient) {
|
|
1757
|
+
this.getClient = getClient;
|
|
1758
|
+
}
|
|
1759
|
+
/**
|
|
1760
|
+
* List pending skill proposals for the authenticated owner.
|
|
1761
|
+
*
|
|
1762
|
+
* @example
|
|
1763
|
+
* ```typescript
|
|
1764
|
+
* const pending = await Runtype.skills.proposals.list()
|
|
1765
|
+
* ```
|
|
1766
|
+
*/
|
|
1767
|
+
async list() {
|
|
1768
|
+
const client = this.getClient();
|
|
1769
|
+
const res = await client.get("/skill-proposals");
|
|
1770
|
+
return res.data;
|
|
1771
|
+
}
|
|
1772
|
+
/**
|
|
1773
|
+
* Approve a pending proposal — publishes the proposed skill version.
|
|
1774
|
+
*
|
|
1775
|
+
* @example
|
|
1776
|
+
* ```typescript
|
|
1777
|
+
* const proposal = await Runtype.skills.proposals.approve('skprop_123')
|
|
1778
|
+
* ```
|
|
1779
|
+
*/
|
|
1780
|
+
async approve(proposalId) {
|
|
1781
|
+
const client = this.getClient();
|
|
1782
|
+
const res = await client.post(
|
|
1783
|
+
`/skill-proposals/${proposalId}/approve`
|
|
1784
|
+
);
|
|
1785
|
+
return res.proposal;
|
|
1786
|
+
}
|
|
1787
|
+
/**
|
|
1788
|
+
* Reject a pending proposal with an optional reason.
|
|
1789
|
+
*
|
|
1790
|
+
* @example
|
|
1791
|
+
* ```typescript
|
|
1792
|
+
* await Runtype.skills.proposals.reject('skprop_123', 'Capabilities too broad')
|
|
1793
|
+
* ```
|
|
1794
|
+
*/
|
|
1795
|
+
async reject(proposalId, reason) {
|
|
1796
|
+
const client = this.getClient();
|
|
1797
|
+
const res = await client.post(
|
|
1798
|
+
`/skill-proposals/${proposalId}/reject`,
|
|
1799
|
+
reason !== void 0 ? { reason } : {}
|
|
1800
|
+
);
|
|
1801
|
+
return res.proposal;
|
|
1802
|
+
}
|
|
1803
|
+
};
|
|
1804
|
+
var SkillsNamespace = class {
|
|
1805
|
+
constructor(getClient) {
|
|
1806
|
+
this.getClient = getClient;
|
|
1807
|
+
this.proposals = new SkillProposalsNamespace(getClient);
|
|
1808
|
+
}
|
|
1809
|
+
/**
|
|
1810
|
+
* Create a skill from a SKILL.md string (`markdown`) or a structured manifest
|
|
1811
|
+
* (`frontmatter` + `body`). Pass `publish: true` to publish the first version
|
|
1812
|
+
* immediately; otherwise it lands as a draft.
|
|
1813
|
+
*/
|
|
1814
|
+
async create(input) {
|
|
1815
|
+
const client = this.getClient();
|
|
1816
|
+
return client.post("/skills", input);
|
|
1817
|
+
}
|
|
1818
|
+
/**
|
|
1819
|
+
* List skills for the authenticated owner, optionally filtered by status.
|
|
1820
|
+
*
|
|
1821
|
+
* @example
|
|
1822
|
+
* ```typescript
|
|
1823
|
+
* const active = await Runtype.skills.list({ status: 'active' })
|
|
1824
|
+
* ```
|
|
1825
|
+
*/
|
|
1826
|
+
async list(params) {
|
|
1827
|
+
const client = this.getClient();
|
|
1828
|
+
const res = await client.get("/skills", params);
|
|
1829
|
+
return res.data;
|
|
1830
|
+
}
|
|
1831
|
+
/**
|
|
1832
|
+
* Get a skill and its full version history.
|
|
1833
|
+
*
|
|
1834
|
+
* @example
|
|
1835
|
+
* ```typescript
|
|
1836
|
+
* const { skill, versions } = await Runtype.skills.get('skill_123')
|
|
1837
|
+
* ```
|
|
1838
|
+
*/
|
|
1839
|
+
async get(skillId) {
|
|
1840
|
+
const client = this.getClient();
|
|
1841
|
+
return client.get(`/skills/${skillId}`);
|
|
1842
|
+
}
|
|
1843
|
+
/**
|
|
1844
|
+
* Append a new version to an existing skill from an updated manifest. Pass
|
|
1845
|
+
* `publish: true` to publish the new version immediately.
|
|
1846
|
+
*/
|
|
1847
|
+
async update(skillId, input) {
|
|
1848
|
+
const client = this.getClient();
|
|
1849
|
+
const res = await client.put(`/skills/${skillId}`, input);
|
|
1850
|
+
return res.version;
|
|
1851
|
+
}
|
|
1852
|
+
/**
|
|
1853
|
+
* Delete a skill (and its versions + bindings, via cascade).
|
|
1854
|
+
*/
|
|
1855
|
+
async delete(skillId) {
|
|
1856
|
+
const client = this.getClient();
|
|
1857
|
+
await client.delete(`/skills/${skillId}`);
|
|
1858
|
+
}
|
|
1859
|
+
/**
|
|
1860
|
+
* List a skill's versions, newest first.
|
|
1861
|
+
*/
|
|
1862
|
+
async listVersions(skillId) {
|
|
1863
|
+
const client = this.getClient();
|
|
1864
|
+
const res = await client.get(`/skills/${skillId}/versions`);
|
|
1865
|
+
return res.data;
|
|
1866
|
+
}
|
|
1867
|
+
/**
|
|
1868
|
+
* Publish a specific version of a skill.
|
|
1869
|
+
*
|
|
1870
|
+
* @example
|
|
1871
|
+
* ```typescript
|
|
1872
|
+
* await Runtype.skills.publishVersion('skill_123', 'skillver_456')
|
|
1873
|
+
* ```
|
|
1874
|
+
*/
|
|
1875
|
+
async publishVersion(skillId, versionId) {
|
|
1876
|
+
const client = this.getClient();
|
|
1877
|
+
await client.post(`/skills/${skillId}/versions/${versionId}/publish`);
|
|
1878
|
+
}
|
|
1879
|
+
/**
|
|
1880
|
+
* Import a single SKILL.md document. The imported skill lands with
|
|
1881
|
+
* `trustLevel: 'imported'` and a draft version.
|
|
1882
|
+
*
|
|
1883
|
+
* @example
|
|
1884
|
+
* ```typescript
|
|
1885
|
+
* const { skill } = await Runtype.skills.import(skillMarkdown)
|
|
1886
|
+
* ```
|
|
1887
|
+
*/
|
|
1888
|
+
async import(markdown) {
|
|
1889
|
+
const client = this.getClient();
|
|
1890
|
+
return client.post("/skills/import", { markdown });
|
|
1891
|
+
}
|
|
1892
|
+
/**
|
|
1893
|
+
* Bind a skill to an agent. Both the agent and the skill must be owned by the
|
|
1894
|
+
* caller.
|
|
1895
|
+
*/
|
|
1896
|
+
async bind(input) {
|
|
1897
|
+
const client = this.getClient();
|
|
1898
|
+
const res = await client.post("/skills/bind", input);
|
|
1899
|
+
return res.binding;
|
|
1900
|
+
}
|
|
1901
|
+
/**
|
|
1902
|
+
* Remove a skill binding by its binding id.
|
|
1903
|
+
*/
|
|
1904
|
+
async unbind(bindingId) {
|
|
1905
|
+
const client = this.getClient();
|
|
1906
|
+
await client.delete(`/skills/bindings/${bindingId}`);
|
|
1907
|
+
}
|
|
1908
|
+
/**
|
|
1909
|
+
* List an agent's skill bindings.
|
|
1910
|
+
*
|
|
1911
|
+
* @example
|
|
1912
|
+
* ```typescript
|
|
1913
|
+
* const bindings = await Runtype.skills.listBindings('agent_123')
|
|
1914
|
+
* ```
|
|
1915
|
+
*/
|
|
1916
|
+
async listBindings(agentId) {
|
|
1917
|
+
const client = this.getClient();
|
|
1918
|
+
const res = await client.get("/skills/bindings", { agentId });
|
|
1919
|
+
return res.data;
|
|
1920
|
+
}
|
|
1921
|
+
};
|
|
1922
|
+
|
|
1752
1923
|
// src/transform.ts
|
|
1753
1924
|
function transformResponse(data) {
|
|
1754
1925
|
return data;
|
|
@@ -1796,6 +1967,7 @@ var RuntypeClient = class {
|
|
|
1796
1967
|
/**
|
|
1797
1968
|
* Generic GET request
|
|
1798
1969
|
*/
|
|
1970
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- accepts typed list-param interfaces (no index signature); `unknown` would reject them
|
|
1799
1971
|
async get(path, params) {
|
|
1800
1972
|
const url = this.buildUrl(path, params);
|
|
1801
1973
|
const response = await this.makeRequest(url, {
|
|
@@ -1816,6 +1988,29 @@ var RuntypeClient = class {
|
|
|
1816
1988
|
});
|
|
1817
1989
|
return this.transformResponse(response);
|
|
1818
1990
|
}
|
|
1991
|
+
/**
|
|
1992
|
+
* Generic PUT request
|
|
1993
|
+
*/
|
|
1994
|
+
async put(path, data) {
|
|
1995
|
+
const url = this.buildUrl(path);
|
|
1996
|
+
const response = await this.makeRequest(url, {
|
|
1997
|
+
method: "PUT",
|
|
1998
|
+
headers: this.headers,
|
|
1999
|
+
body: data ? JSON.stringify(data) : void 0
|
|
2000
|
+
});
|
|
2001
|
+
return this.transformResponse(response);
|
|
2002
|
+
}
|
|
2003
|
+
/**
|
|
2004
|
+
* Generic DELETE request
|
|
2005
|
+
*/
|
|
2006
|
+
async delete(path) {
|
|
2007
|
+
const url = this.buildUrl(path);
|
|
2008
|
+
const response = await this.makeRequest(url, {
|
|
2009
|
+
method: "DELETE",
|
|
2010
|
+
headers: this.headers
|
|
2011
|
+
});
|
|
2012
|
+
return this.transformResponse(response);
|
|
2013
|
+
}
|
|
1819
2014
|
/**
|
|
1820
2015
|
* Generic request that returns raw Response for streaming
|
|
1821
2016
|
*/
|
|
@@ -1842,6 +2037,7 @@ var RuntypeClient = class {
|
|
|
1842
2037
|
/**
|
|
1843
2038
|
* Build full URL with query parameters
|
|
1844
2039
|
*/
|
|
2040
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mirrors get()'s permissive params type
|
|
1845
2041
|
buildUrl(path, params) {
|
|
1846
2042
|
const base = this.baseUrl.endsWith("/") ? this.baseUrl : `${this.baseUrl}/`;
|
|
1847
2043
|
const relPath = path.startsWith("/") ? path.slice(1) : path;
|
|
@@ -2067,6 +2263,25 @@ var Runtype = class {
|
|
|
2067
2263
|
static get prompts() {
|
|
2068
2264
|
return new PromptsNamespace(() => this.getClient());
|
|
2069
2265
|
}
|
|
2266
|
+
/**
|
|
2267
|
+
* Skills namespace - Manage Agent Skills (admin/control plane)
|
|
2268
|
+
*
|
|
2269
|
+
* @example
|
|
2270
|
+
* ```typescript
|
|
2271
|
+
* // Create a published skill from a SKILL.md document
|
|
2272
|
+
* const { skill } = await Runtype.skills.create({ markdown: skillMd, publish: true })
|
|
2273
|
+
*
|
|
2274
|
+
* // Bind it to an agent
|
|
2275
|
+
* await Runtype.skills.bind({ agentId: 'agent_123', skillId: skill.id })
|
|
2276
|
+
*
|
|
2277
|
+
* // Review agent-authored proposals
|
|
2278
|
+
* const pending = await Runtype.skills.proposals.list()
|
|
2279
|
+
* await Runtype.skills.proposals.approve(pending[0].id)
|
|
2280
|
+
* ```
|
|
2281
|
+
*/
|
|
2282
|
+
static get skills() {
|
|
2283
|
+
return new SkillsNamespace(() => this.getClient());
|
|
2284
|
+
}
|
|
2070
2285
|
};
|
|
2071
2286
|
|
|
2072
2287
|
// src/generated-tool-gate.ts
|
|
@@ -4259,12 +4474,6 @@ var ToolsEndpoint = class {
|
|
|
4259
4474
|
async test(id, data) {
|
|
4260
4475
|
return this.client.post(`/tools/${id}/test`, data);
|
|
4261
4476
|
}
|
|
4262
|
-
/**
|
|
4263
|
-
* Get tool executions for a specific tool
|
|
4264
|
-
*/
|
|
4265
|
-
async getExecutions(toolId, params) {
|
|
4266
|
-
return this.client.get(`/tools/${toolId}/executions`, params);
|
|
4267
|
-
}
|
|
4268
4477
|
/**
|
|
4269
4478
|
* Get AI SDK compatible tool schemas
|
|
4270
4479
|
*/
|
|
@@ -9214,6 +9423,8 @@ var STEP_TYPE_TO_METHOD = {
|
|
|
9214
9423
|
STEP_TYPE_TO_METHOD,
|
|
9215
9424
|
SchedulesEndpoint,
|
|
9216
9425
|
SecretsEndpoint,
|
|
9426
|
+
SkillProposalsNamespace,
|
|
9427
|
+
SkillsNamespace,
|
|
9217
9428
|
SurfacesEndpoint,
|
|
9218
9429
|
ToolsEndpoint,
|
|
9219
9430
|
UsersEndpoint,
|