@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.mjs
CHANGED
|
@@ -1668,6 +1668,175 @@ var PromptsNamespace = class {
|
|
|
1668
1668
|
}
|
|
1669
1669
|
};
|
|
1670
1670
|
|
|
1671
|
+
// src/skills-namespace.ts
|
|
1672
|
+
var SkillProposalsNamespace = class {
|
|
1673
|
+
constructor(getClient) {
|
|
1674
|
+
this.getClient = getClient;
|
|
1675
|
+
}
|
|
1676
|
+
/**
|
|
1677
|
+
* List pending skill proposals for the authenticated owner.
|
|
1678
|
+
*
|
|
1679
|
+
* @example
|
|
1680
|
+
* ```typescript
|
|
1681
|
+
* const pending = await Runtype.skills.proposals.list()
|
|
1682
|
+
* ```
|
|
1683
|
+
*/
|
|
1684
|
+
async list() {
|
|
1685
|
+
const client = this.getClient();
|
|
1686
|
+
const res = await client.get("/skill-proposals");
|
|
1687
|
+
return res.data;
|
|
1688
|
+
}
|
|
1689
|
+
/**
|
|
1690
|
+
* Approve a pending proposal — publishes the proposed skill version.
|
|
1691
|
+
*
|
|
1692
|
+
* @example
|
|
1693
|
+
* ```typescript
|
|
1694
|
+
* const proposal = await Runtype.skills.proposals.approve('skprop_123')
|
|
1695
|
+
* ```
|
|
1696
|
+
*/
|
|
1697
|
+
async approve(proposalId) {
|
|
1698
|
+
const client = this.getClient();
|
|
1699
|
+
const res = await client.post(
|
|
1700
|
+
`/skill-proposals/${proposalId}/approve`
|
|
1701
|
+
);
|
|
1702
|
+
return res.proposal;
|
|
1703
|
+
}
|
|
1704
|
+
/**
|
|
1705
|
+
* Reject a pending proposal with an optional reason.
|
|
1706
|
+
*
|
|
1707
|
+
* @example
|
|
1708
|
+
* ```typescript
|
|
1709
|
+
* await Runtype.skills.proposals.reject('skprop_123', 'Capabilities too broad')
|
|
1710
|
+
* ```
|
|
1711
|
+
*/
|
|
1712
|
+
async reject(proposalId, reason) {
|
|
1713
|
+
const client = this.getClient();
|
|
1714
|
+
const res = await client.post(
|
|
1715
|
+
`/skill-proposals/${proposalId}/reject`,
|
|
1716
|
+
reason !== void 0 ? { reason } : {}
|
|
1717
|
+
);
|
|
1718
|
+
return res.proposal;
|
|
1719
|
+
}
|
|
1720
|
+
};
|
|
1721
|
+
var SkillsNamespace = class {
|
|
1722
|
+
constructor(getClient) {
|
|
1723
|
+
this.getClient = getClient;
|
|
1724
|
+
this.proposals = new SkillProposalsNamespace(getClient);
|
|
1725
|
+
}
|
|
1726
|
+
/**
|
|
1727
|
+
* Create a skill from a SKILL.md string (`markdown`) or a structured manifest
|
|
1728
|
+
* (`frontmatter` + `body`). Pass `publish: true` to publish the first version
|
|
1729
|
+
* immediately; otherwise it lands as a draft.
|
|
1730
|
+
*/
|
|
1731
|
+
async create(input) {
|
|
1732
|
+
const client = this.getClient();
|
|
1733
|
+
return client.post("/skills", input);
|
|
1734
|
+
}
|
|
1735
|
+
/**
|
|
1736
|
+
* List skills for the authenticated owner, optionally filtered by status.
|
|
1737
|
+
*
|
|
1738
|
+
* @example
|
|
1739
|
+
* ```typescript
|
|
1740
|
+
* const active = await Runtype.skills.list({ status: 'active' })
|
|
1741
|
+
* ```
|
|
1742
|
+
*/
|
|
1743
|
+
async list(params) {
|
|
1744
|
+
const client = this.getClient();
|
|
1745
|
+
const res = await client.get("/skills", params);
|
|
1746
|
+
return res.data;
|
|
1747
|
+
}
|
|
1748
|
+
/**
|
|
1749
|
+
* Get a skill and its full version history.
|
|
1750
|
+
*
|
|
1751
|
+
* @example
|
|
1752
|
+
* ```typescript
|
|
1753
|
+
* const { skill, versions } = await Runtype.skills.get('skill_123')
|
|
1754
|
+
* ```
|
|
1755
|
+
*/
|
|
1756
|
+
async get(skillId) {
|
|
1757
|
+
const client = this.getClient();
|
|
1758
|
+
return client.get(`/skills/${skillId}`);
|
|
1759
|
+
}
|
|
1760
|
+
/**
|
|
1761
|
+
* Append a new version to an existing skill from an updated manifest. Pass
|
|
1762
|
+
* `publish: true` to publish the new version immediately.
|
|
1763
|
+
*/
|
|
1764
|
+
async update(skillId, input) {
|
|
1765
|
+
const client = this.getClient();
|
|
1766
|
+
const res = await client.put(`/skills/${skillId}`, input);
|
|
1767
|
+
return res.version;
|
|
1768
|
+
}
|
|
1769
|
+
/**
|
|
1770
|
+
* Delete a skill (and its versions + bindings, via cascade).
|
|
1771
|
+
*/
|
|
1772
|
+
async delete(skillId) {
|
|
1773
|
+
const client = this.getClient();
|
|
1774
|
+
await client.delete(`/skills/${skillId}`);
|
|
1775
|
+
}
|
|
1776
|
+
/**
|
|
1777
|
+
* List a skill's versions, newest first.
|
|
1778
|
+
*/
|
|
1779
|
+
async listVersions(skillId) {
|
|
1780
|
+
const client = this.getClient();
|
|
1781
|
+
const res = await client.get(`/skills/${skillId}/versions`);
|
|
1782
|
+
return res.data;
|
|
1783
|
+
}
|
|
1784
|
+
/**
|
|
1785
|
+
* Publish a specific version of a skill.
|
|
1786
|
+
*
|
|
1787
|
+
* @example
|
|
1788
|
+
* ```typescript
|
|
1789
|
+
* await Runtype.skills.publishVersion('skill_123', 'skillver_456')
|
|
1790
|
+
* ```
|
|
1791
|
+
*/
|
|
1792
|
+
async publishVersion(skillId, versionId) {
|
|
1793
|
+
const client = this.getClient();
|
|
1794
|
+
await client.post(`/skills/${skillId}/versions/${versionId}/publish`);
|
|
1795
|
+
}
|
|
1796
|
+
/**
|
|
1797
|
+
* Import a single SKILL.md document. The imported skill lands with
|
|
1798
|
+
* `trustLevel: 'imported'` and a draft version.
|
|
1799
|
+
*
|
|
1800
|
+
* @example
|
|
1801
|
+
* ```typescript
|
|
1802
|
+
* const { skill } = await Runtype.skills.import(skillMarkdown)
|
|
1803
|
+
* ```
|
|
1804
|
+
*/
|
|
1805
|
+
async import(markdown) {
|
|
1806
|
+
const client = this.getClient();
|
|
1807
|
+
return client.post("/skills/import", { markdown });
|
|
1808
|
+
}
|
|
1809
|
+
/**
|
|
1810
|
+
* Bind a skill to an agent. Both the agent and the skill must be owned by the
|
|
1811
|
+
* caller.
|
|
1812
|
+
*/
|
|
1813
|
+
async bind(input) {
|
|
1814
|
+
const client = this.getClient();
|
|
1815
|
+
const res = await client.post("/skills/bind", input);
|
|
1816
|
+
return res.binding;
|
|
1817
|
+
}
|
|
1818
|
+
/**
|
|
1819
|
+
* Remove a skill binding by its binding id.
|
|
1820
|
+
*/
|
|
1821
|
+
async unbind(bindingId) {
|
|
1822
|
+
const client = this.getClient();
|
|
1823
|
+
await client.delete(`/skills/bindings/${bindingId}`);
|
|
1824
|
+
}
|
|
1825
|
+
/**
|
|
1826
|
+
* List an agent's skill bindings.
|
|
1827
|
+
*
|
|
1828
|
+
* @example
|
|
1829
|
+
* ```typescript
|
|
1830
|
+
* const bindings = await Runtype.skills.listBindings('agent_123')
|
|
1831
|
+
* ```
|
|
1832
|
+
*/
|
|
1833
|
+
async listBindings(agentId) {
|
|
1834
|
+
const client = this.getClient();
|
|
1835
|
+
const res = await client.get("/skills/bindings", { agentId });
|
|
1836
|
+
return res.data;
|
|
1837
|
+
}
|
|
1838
|
+
};
|
|
1839
|
+
|
|
1671
1840
|
// src/transform.ts
|
|
1672
1841
|
function transformResponse(data) {
|
|
1673
1842
|
return data;
|
|
@@ -1715,6 +1884,7 @@ var RuntypeClient = class {
|
|
|
1715
1884
|
/**
|
|
1716
1885
|
* Generic GET request
|
|
1717
1886
|
*/
|
|
1887
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- accepts typed list-param interfaces (no index signature); `unknown` would reject them
|
|
1718
1888
|
async get(path, params) {
|
|
1719
1889
|
const url = this.buildUrl(path, params);
|
|
1720
1890
|
const response = await this.makeRequest(url, {
|
|
@@ -1735,6 +1905,29 @@ var RuntypeClient = class {
|
|
|
1735
1905
|
});
|
|
1736
1906
|
return this.transformResponse(response);
|
|
1737
1907
|
}
|
|
1908
|
+
/**
|
|
1909
|
+
* Generic PUT request
|
|
1910
|
+
*/
|
|
1911
|
+
async put(path, data) {
|
|
1912
|
+
const url = this.buildUrl(path);
|
|
1913
|
+
const response = await this.makeRequest(url, {
|
|
1914
|
+
method: "PUT",
|
|
1915
|
+
headers: this.headers,
|
|
1916
|
+
body: data ? JSON.stringify(data) : void 0
|
|
1917
|
+
});
|
|
1918
|
+
return this.transformResponse(response);
|
|
1919
|
+
}
|
|
1920
|
+
/**
|
|
1921
|
+
* Generic DELETE request
|
|
1922
|
+
*/
|
|
1923
|
+
async delete(path) {
|
|
1924
|
+
const url = this.buildUrl(path);
|
|
1925
|
+
const response = await this.makeRequest(url, {
|
|
1926
|
+
method: "DELETE",
|
|
1927
|
+
headers: this.headers
|
|
1928
|
+
});
|
|
1929
|
+
return this.transformResponse(response);
|
|
1930
|
+
}
|
|
1738
1931
|
/**
|
|
1739
1932
|
* Generic request that returns raw Response for streaming
|
|
1740
1933
|
*/
|
|
@@ -1761,6 +1954,7 @@ var RuntypeClient = class {
|
|
|
1761
1954
|
/**
|
|
1762
1955
|
* Build full URL with query parameters
|
|
1763
1956
|
*/
|
|
1957
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mirrors get()'s permissive params type
|
|
1764
1958
|
buildUrl(path, params) {
|
|
1765
1959
|
const base = this.baseUrl.endsWith("/") ? this.baseUrl : `${this.baseUrl}/`;
|
|
1766
1960
|
const relPath = path.startsWith("/") ? path.slice(1) : path;
|
|
@@ -1986,6 +2180,25 @@ var Runtype = class {
|
|
|
1986
2180
|
static get prompts() {
|
|
1987
2181
|
return new PromptsNamespace(() => this.getClient());
|
|
1988
2182
|
}
|
|
2183
|
+
/**
|
|
2184
|
+
* Skills namespace - Manage Agent Skills (admin/control plane)
|
|
2185
|
+
*
|
|
2186
|
+
* @example
|
|
2187
|
+
* ```typescript
|
|
2188
|
+
* // Create a published skill from a SKILL.md document
|
|
2189
|
+
* const { skill } = await Runtype.skills.create({ markdown: skillMd, publish: true })
|
|
2190
|
+
*
|
|
2191
|
+
* // Bind it to an agent
|
|
2192
|
+
* await Runtype.skills.bind({ agentId: 'agent_123', skillId: skill.id })
|
|
2193
|
+
*
|
|
2194
|
+
* // Review agent-authored proposals
|
|
2195
|
+
* const pending = await Runtype.skills.proposals.list()
|
|
2196
|
+
* await Runtype.skills.proposals.approve(pending[0].id)
|
|
2197
|
+
* ```
|
|
2198
|
+
*/
|
|
2199
|
+
static get skills() {
|
|
2200
|
+
return new SkillsNamespace(() => this.getClient());
|
|
2201
|
+
}
|
|
1989
2202
|
};
|
|
1990
2203
|
|
|
1991
2204
|
// src/generated-tool-gate.ts
|
|
@@ -4178,12 +4391,6 @@ var ToolsEndpoint = class {
|
|
|
4178
4391
|
async test(id, data) {
|
|
4179
4392
|
return this.client.post(`/tools/${id}/test`, data);
|
|
4180
4393
|
}
|
|
4181
|
-
/**
|
|
4182
|
-
* Get tool executions for a specific tool
|
|
4183
|
-
*/
|
|
4184
|
-
async getExecutions(toolId, params) {
|
|
4185
|
-
return this.client.get(`/tools/${toolId}/executions`, params);
|
|
4186
|
-
}
|
|
4187
4394
|
/**
|
|
4188
4395
|
* Get AI SDK compatible tool schemas
|
|
4189
4396
|
*/
|
|
@@ -9132,6 +9339,8 @@ export {
|
|
|
9132
9339
|
STEP_TYPE_TO_METHOD,
|
|
9133
9340
|
SchedulesEndpoint,
|
|
9134
9341
|
SecretsEndpoint,
|
|
9342
|
+
SkillProposalsNamespace,
|
|
9343
|
+
SkillsNamespace,
|
|
9135
9344
|
SurfacesEndpoint,
|
|
9136
9345
|
ToolsEndpoint,
|
|
9137
9346
|
UsersEndpoint,
|
package/package.json
CHANGED