perstack 0.0.88 → 0.0.90
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/bin/cli.js +111467 -48574
- package/dist/bin/cli.js.map +1 -1
- package/dist/{chunk-FVVK5V2C.js → chunk-OF74MEG2.js} +2234 -796
- package/dist/chunk-OF74MEG2.js.map +1 -0
- package/dist/devtools-XTCZXK74.js +3674 -0
- package/dist/devtools-XTCZXK74.js.map +1 -0
- package/dist/{resolve-expert-X775EKPT.js → resolve-expert-HLJ22XTR.js} +11 -12
- package/dist/resolve-expert-HLJ22XTR.js.map +1 -0
- package/package.json +7 -9
- package/dist/chunk-FVVK5V2C.js.map +0 -1
- package/dist/chunk-HNOP6GUQ.js +0 -1571
- package/dist/chunk-HNOP6GUQ.js.map +0 -1
- package/dist/chunk-MCZYLWXM.js +0 -41683
- package/dist/chunk-MCZYLWXM.js.map +0 -1
- package/dist/lockfile-skill-manager-5DS6SE2M.js +0 -6
- package/dist/lockfile-skill-manager-5DS6SE2M.js.map +0 -1
- package/dist/resolve-expert-X775EKPT.js.map +0 -1
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { __export } from './chunk-E5EEIGMK.js';
|
|
2
2
|
|
|
3
|
+
// ../../packages/core/src/errors.ts
|
|
4
|
+
var PerstackError = class extends Error {
|
|
5
|
+
constructor(message) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = "PerstackError";
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
|
|
3
11
|
// ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/_u64.js
|
|
4
12
|
var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
5
13
|
var _32n = /* @__PURE__ */ BigInt(32);
|
|
@@ -1720,6 +1728,223 @@ var defaultTimeout = 5 * 1e3 * 60;
|
|
|
1720
1728
|
var maxSkillNameLength = 255;
|
|
1721
1729
|
var maxSkillToolNameLength = 255;
|
|
1722
1730
|
|
|
1731
|
+
// ../../packages/core/src/known-models/index.ts
|
|
1732
|
+
var knownModels = [
|
|
1733
|
+
{
|
|
1734
|
+
provider: "anthropic",
|
|
1735
|
+
models: [
|
|
1736
|
+
// https://docs.claude.com/en/docs/about-claude/models/overview#model-comparison-table
|
|
1737
|
+
{
|
|
1738
|
+
name: "claude-opus-4-6",
|
|
1739
|
+
contextWindow: 2e5,
|
|
1740
|
+
maxOutputTokens: 128e3
|
|
1741
|
+
},
|
|
1742
|
+
{
|
|
1743
|
+
name: "claude-opus-4-5",
|
|
1744
|
+
contextWindow: 2e5,
|
|
1745
|
+
maxOutputTokens: 32e3
|
|
1746
|
+
},
|
|
1747
|
+
{
|
|
1748
|
+
name: "claude-opus-4-1",
|
|
1749
|
+
contextWindow: 2e5,
|
|
1750
|
+
maxOutputTokens: 32e3
|
|
1751
|
+
},
|
|
1752
|
+
{
|
|
1753
|
+
name: "claude-opus-4-20250514",
|
|
1754
|
+
contextWindow: 2e5,
|
|
1755
|
+
maxOutputTokens: 32e3
|
|
1756
|
+
},
|
|
1757
|
+
{
|
|
1758
|
+
name: "claude-sonnet-4-5",
|
|
1759
|
+
contextWindow: 2e5,
|
|
1760
|
+
maxOutputTokens: 64e3
|
|
1761
|
+
},
|
|
1762
|
+
{
|
|
1763
|
+
name: "claude-sonnet-4-20250514",
|
|
1764
|
+
contextWindow: 2e5,
|
|
1765
|
+
maxOutputTokens: 64e3
|
|
1766
|
+
},
|
|
1767
|
+
{
|
|
1768
|
+
name: "claude-3-7-sonnet-20250219",
|
|
1769
|
+
contextWindow: 2e5,
|
|
1770
|
+
maxOutputTokens: 64e3
|
|
1771
|
+
},
|
|
1772
|
+
{
|
|
1773
|
+
name: "claude-haiku-4-5",
|
|
1774
|
+
contextWindow: 2e5,
|
|
1775
|
+
maxOutputTokens: 8192
|
|
1776
|
+
},
|
|
1777
|
+
{
|
|
1778
|
+
name: "claude-3-5-haiku-latest",
|
|
1779
|
+
contextWindow: 2e5,
|
|
1780
|
+
maxOutputTokens: 8192
|
|
1781
|
+
}
|
|
1782
|
+
]
|
|
1783
|
+
},
|
|
1784
|
+
{
|
|
1785
|
+
provider: "google",
|
|
1786
|
+
models: [
|
|
1787
|
+
// https://ai.google.dev/gemini-api/docs/models#gemini-3-flash
|
|
1788
|
+
{
|
|
1789
|
+
name: "gemini-3-flash-preview",
|
|
1790
|
+
contextWindow: 1048576,
|
|
1791
|
+
maxOutputTokens: 65536
|
|
1792
|
+
},
|
|
1793
|
+
// https://ai.google.dev/gemini-api/docs/models#gemini-3-pro
|
|
1794
|
+
{
|
|
1795
|
+
name: "gemini-3-pro-preview",
|
|
1796
|
+
contextWindow: 1048576,
|
|
1797
|
+
maxOutputTokens: 65536
|
|
1798
|
+
},
|
|
1799
|
+
// https://ai.google.dev/gemini-api/docs/models#gemini-2.5-pro
|
|
1800
|
+
{
|
|
1801
|
+
name: "gemini-2.5-pro",
|
|
1802
|
+
contextWindow: 1048576,
|
|
1803
|
+
maxOutputTokens: 65536
|
|
1804
|
+
},
|
|
1805
|
+
// https://ai.google.dev/gemini-api/docs/models#gemini-2.5-flash
|
|
1806
|
+
{
|
|
1807
|
+
name: "gemini-2.5-flash",
|
|
1808
|
+
contextWindow: 1048576,
|
|
1809
|
+
maxOutputTokens: 65536
|
|
1810
|
+
},
|
|
1811
|
+
// https://ai.google.dev/gemini-api/docs/models#gemini-2.5-flash-lite
|
|
1812
|
+
{
|
|
1813
|
+
name: "gemini-2.5-flash-lite",
|
|
1814
|
+
contextWindow: 1048576,
|
|
1815
|
+
maxOutputTokens: 65536
|
|
1816
|
+
}
|
|
1817
|
+
]
|
|
1818
|
+
},
|
|
1819
|
+
{
|
|
1820
|
+
provider: "openai",
|
|
1821
|
+
models: [
|
|
1822
|
+
// https://platform.openai.com/docs/models/gpt-5
|
|
1823
|
+
{
|
|
1824
|
+
name: "gpt-5",
|
|
1825
|
+
contextWindow: 4e5,
|
|
1826
|
+
maxOutputTokens: 128e3
|
|
1827
|
+
},
|
|
1828
|
+
// https://platform.openai.com/docs/models/gpt-5-mini
|
|
1829
|
+
{
|
|
1830
|
+
name: "gpt-5-mini",
|
|
1831
|
+
contextWindow: 4e5,
|
|
1832
|
+
maxOutputTokens: 128e3
|
|
1833
|
+
},
|
|
1834
|
+
// https://platform.openai.com/docs/models/gpt-5-nano
|
|
1835
|
+
{
|
|
1836
|
+
name: "gpt-5-nano",
|
|
1837
|
+
contextWindow: 4e5,
|
|
1838
|
+
maxOutputTokens: 128e3
|
|
1839
|
+
},
|
|
1840
|
+
// https://platform.openai.com/docs/models/gpt-5.2
|
|
1841
|
+
{
|
|
1842
|
+
name: "gpt-5.2",
|
|
1843
|
+
contextWindow: 4e5,
|
|
1844
|
+
maxOutputTokens: 128e3
|
|
1845
|
+
},
|
|
1846
|
+
// https://platform.openai.com/docs/models/gpt-5.2-pro
|
|
1847
|
+
{
|
|
1848
|
+
name: "gpt-5.2-pro",
|
|
1849
|
+
contextWindow: 4e5,
|
|
1850
|
+
maxOutputTokens: 128e3
|
|
1851
|
+
},
|
|
1852
|
+
// https://platform.openai.com/docs/models/gpt-5.1
|
|
1853
|
+
{
|
|
1854
|
+
name: "gpt-5.1",
|
|
1855
|
+
contextWindow: 4e5,
|
|
1856
|
+
maxOutputTokens: 128e3
|
|
1857
|
+
},
|
|
1858
|
+
// https://platform.openai.com/docs/models/gpt-5-chat-latest
|
|
1859
|
+
{
|
|
1860
|
+
name: "gpt-5-chat-latest",
|
|
1861
|
+
contextWindow: 128e3,
|
|
1862
|
+
maxOutputTokens: 16384
|
|
1863
|
+
},
|
|
1864
|
+
// https://platform.openai.com/docs/models/o4-mini
|
|
1865
|
+
{
|
|
1866
|
+
name: "o4-mini",
|
|
1867
|
+
contextWindow: 2e5,
|
|
1868
|
+
maxOutputTokens: 1e5
|
|
1869
|
+
},
|
|
1870
|
+
// https://platform.openai.com/docs/models/o3
|
|
1871
|
+
{
|
|
1872
|
+
name: "o3",
|
|
1873
|
+
contextWindow: 2e5,
|
|
1874
|
+
maxOutputTokens: 1e4
|
|
1875
|
+
},
|
|
1876
|
+
// https://platform.openai.com/docs/models/o3-mini
|
|
1877
|
+
{
|
|
1878
|
+
name: "o3-mini",
|
|
1879
|
+
contextWindow: 2e5,
|
|
1880
|
+
maxOutputTokens: 1e4
|
|
1881
|
+
},
|
|
1882
|
+
// https://platform.openai.com/docs/models/gpt-4.1
|
|
1883
|
+
{
|
|
1884
|
+
name: "gpt-4.1",
|
|
1885
|
+
contextWindow: 1047576,
|
|
1886
|
+
maxOutputTokens: 32768
|
|
1887
|
+
}
|
|
1888
|
+
]
|
|
1889
|
+
},
|
|
1890
|
+
{
|
|
1891
|
+
provider: "deepseek",
|
|
1892
|
+
models: [
|
|
1893
|
+
{
|
|
1894
|
+
name: "deepseek-chat",
|
|
1895
|
+
contextWindow: 128e3,
|
|
1896
|
+
maxOutputTokens: 8192
|
|
1897
|
+
},
|
|
1898
|
+
{
|
|
1899
|
+
name: "deepseek-reasoner",
|
|
1900
|
+
contextWindow: 128e3,
|
|
1901
|
+
maxOutputTokens: 64e3
|
|
1902
|
+
}
|
|
1903
|
+
]
|
|
1904
|
+
},
|
|
1905
|
+
{
|
|
1906
|
+
provider: "ollama",
|
|
1907
|
+
models: [
|
|
1908
|
+
// https://platform.openai.com/docs/models/gpt-oss-20b
|
|
1909
|
+
{
|
|
1910
|
+
name: "gpt-oss:20b",
|
|
1911
|
+
contextWindow: 131072,
|
|
1912
|
+
maxOutputTokens: 131072
|
|
1913
|
+
},
|
|
1914
|
+
// https://platform.openai.com/docs/models/gpt-oss-120b
|
|
1915
|
+
{
|
|
1916
|
+
name: "gpt-oss:120b",
|
|
1917
|
+
contextWindow: 131072,
|
|
1918
|
+
maxOutputTokens: 131072
|
|
1919
|
+
},
|
|
1920
|
+
// https://ai.google.dev/gemma/docs/core/model_card_3
|
|
1921
|
+
{
|
|
1922
|
+
name: "gemma3:1b",
|
|
1923
|
+
contextWindow: 32e3,
|
|
1924
|
+
maxOutputTokens: 32e3
|
|
1925
|
+
},
|
|
1926
|
+
// https://ai.google.dev/gemma/docs/core/model_card_3
|
|
1927
|
+
{
|
|
1928
|
+
name: "gemma3:4b",
|
|
1929
|
+
contextWindow: 128e3,
|
|
1930
|
+
maxOutputTokens: 128e3
|
|
1931
|
+
},
|
|
1932
|
+
// https://ai.google.dev/gemma/docs/core/model_card_3
|
|
1933
|
+
{
|
|
1934
|
+
name: "gemma3:12b",
|
|
1935
|
+
contextWindow: 128e3,
|
|
1936
|
+
maxOutputTokens: 128e3
|
|
1937
|
+
},
|
|
1938
|
+
// https://ai.google.dev/gemma/docs/core/model_card_3
|
|
1939
|
+
{
|
|
1940
|
+
name: "gemma3:27b",
|
|
1941
|
+
contextWindow: 128e3,
|
|
1942
|
+
maxOutputTokens: 128e3
|
|
1943
|
+
}
|
|
1944
|
+
]
|
|
1945
|
+
}
|
|
1946
|
+
];
|
|
1947
|
+
|
|
1723
1948
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/external.js
|
|
1724
1949
|
var external_exports = {};
|
|
1725
1950
|
__export(external_exports, {
|
|
@@ -15626,72 +15851,12 @@ var editTextFileActivitySchema = baseActivitySchema.extend({
|
|
|
15626
15851
|
oldText: external_exports.string(),
|
|
15627
15852
|
error: external_exports.string().optional()
|
|
15628
15853
|
});
|
|
15629
|
-
var appendTextFileActivitySchema = baseActivitySchema.extend({
|
|
15630
|
-
type: external_exports.literal("appendTextFile"),
|
|
15631
|
-
path: external_exports.string(),
|
|
15632
|
-
text: external_exports.string(),
|
|
15633
|
-
error: external_exports.string().optional()
|
|
15634
|
-
});
|
|
15635
15854
|
var writeTextFileActivitySchema = baseActivitySchema.extend({
|
|
15636
15855
|
type: external_exports.literal("writeTextFile"),
|
|
15637
15856
|
path: external_exports.string(),
|
|
15638
15857
|
text: external_exports.string(),
|
|
15639
15858
|
error: external_exports.string().optional()
|
|
15640
15859
|
});
|
|
15641
|
-
var deleteFileActivitySchema = baseActivitySchema.extend({
|
|
15642
|
-
type: external_exports.literal("deleteFile"),
|
|
15643
|
-
path: external_exports.string(),
|
|
15644
|
-
error: external_exports.string().optional()
|
|
15645
|
-
});
|
|
15646
|
-
var deleteDirectoryActivitySchema = baseActivitySchema.extend({
|
|
15647
|
-
type: external_exports.literal("deleteDirectory"),
|
|
15648
|
-
path: external_exports.string(),
|
|
15649
|
-
recursive: external_exports.boolean().optional(),
|
|
15650
|
-
error: external_exports.string().optional()
|
|
15651
|
-
});
|
|
15652
|
-
var moveFileActivitySchema = baseActivitySchema.extend({
|
|
15653
|
-
type: external_exports.literal("moveFile"),
|
|
15654
|
-
source: external_exports.string(),
|
|
15655
|
-
destination: external_exports.string(),
|
|
15656
|
-
error: external_exports.string().optional()
|
|
15657
|
-
});
|
|
15658
|
-
var getFileInfoActivitySchema = baseActivitySchema.extend({
|
|
15659
|
-
type: external_exports.literal("getFileInfo"),
|
|
15660
|
-
path: external_exports.string(),
|
|
15661
|
-
info: external_exports.object({
|
|
15662
|
-
exists: external_exports.boolean(),
|
|
15663
|
-
name: external_exports.string(),
|
|
15664
|
-
directory: external_exports.string(),
|
|
15665
|
-
extension: external_exports.string().nullable(),
|
|
15666
|
-
type: external_exports.enum(["file", "directory"]),
|
|
15667
|
-
mimeType: external_exports.string().nullable(),
|
|
15668
|
-
size: external_exports.number(),
|
|
15669
|
-
sizeFormatted: external_exports.string(),
|
|
15670
|
-
created: external_exports.string(),
|
|
15671
|
-
modified: external_exports.string(),
|
|
15672
|
-
accessed: external_exports.string()
|
|
15673
|
-
}).optional(),
|
|
15674
|
-
error: external_exports.string().optional()
|
|
15675
|
-
});
|
|
15676
|
-
var createDirectoryActivitySchema = baseActivitySchema.extend({
|
|
15677
|
-
type: external_exports.literal("createDirectory"),
|
|
15678
|
-
path: external_exports.string(),
|
|
15679
|
-
error: external_exports.string().optional()
|
|
15680
|
-
});
|
|
15681
|
-
var listDirectoryActivitySchema = baseActivitySchema.extend({
|
|
15682
|
-
type: external_exports.literal("listDirectory"),
|
|
15683
|
-
path: external_exports.string(),
|
|
15684
|
-
items: external_exports.array(
|
|
15685
|
-
external_exports.object({
|
|
15686
|
-
name: external_exports.string(),
|
|
15687
|
-
path: external_exports.string(),
|
|
15688
|
-
type: external_exports.enum(["file", "directory"]),
|
|
15689
|
-
size: external_exports.number(),
|
|
15690
|
-
modified: external_exports.string()
|
|
15691
|
-
})
|
|
15692
|
-
).optional(),
|
|
15693
|
-
error: external_exports.string().optional()
|
|
15694
|
-
});
|
|
15695
15860
|
var execActivitySchema = baseActivitySchema.extend({
|
|
15696
15861
|
type: external_exports.literal("exec"),
|
|
15697
15862
|
command: external_exports.string(),
|
|
@@ -15737,14 +15902,7 @@ var activitySchema = external_exports.discriminatedUnion("type", [
|
|
|
15737
15902
|
readPdfFileActivitySchema,
|
|
15738
15903
|
readTextFileActivitySchema,
|
|
15739
15904
|
editTextFileActivitySchema,
|
|
15740
|
-
appendTextFileActivitySchema,
|
|
15741
15905
|
writeTextFileActivitySchema,
|
|
15742
|
-
deleteFileActivitySchema,
|
|
15743
|
-
deleteDirectoryActivitySchema,
|
|
15744
|
-
moveFileActivitySchema,
|
|
15745
|
-
getFileInfoActivitySchema,
|
|
15746
|
-
createDirectoryActivitySchema,
|
|
15747
|
-
listDirectoryActivitySchema,
|
|
15748
15906
|
execActivitySchema,
|
|
15749
15907
|
delegateActivitySchema,
|
|
15750
15908
|
delegationCompleteActivitySchema,
|
|
@@ -15827,24 +15985,145 @@ var usageSchema = external_exports.object({
|
|
|
15827
15985
|
cachedInputTokens: external_exports.number()
|
|
15828
15986
|
});
|
|
15829
15987
|
|
|
15830
|
-
// ../../packages/core/src/schemas/
|
|
15831
|
-
|
|
15832
|
-
|
|
15833
|
-
|
|
15834
|
-
|
|
15835
|
-
|
|
15836
|
-
|
|
15837
|
-
|
|
15838
|
-
|
|
15839
|
-
|
|
15840
|
-
|
|
15841
|
-
|
|
15842
|
-
|
|
15843
|
-
|
|
15844
|
-
|
|
15845
|
-
|
|
15846
|
-
|
|
15847
|
-
|
|
15988
|
+
// ../../packages/core/src/schemas/checkpoint.ts
|
|
15989
|
+
var checkpointStatusSchema = external_exports.enum([
|
|
15990
|
+
"init",
|
|
15991
|
+
"proceeding",
|
|
15992
|
+
"completed",
|
|
15993
|
+
"stoppedByInteractiveTool",
|
|
15994
|
+
"stoppedByDelegate",
|
|
15995
|
+
"stoppedByExceededMaxSteps",
|
|
15996
|
+
"stoppedByError",
|
|
15997
|
+
"stoppedByCancellation"
|
|
15998
|
+
]);
|
|
15999
|
+
var delegationTargetSchema = external_exports.object({
|
|
16000
|
+
expert: external_exports.object({
|
|
16001
|
+
key: external_exports.string(),
|
|
16002
|
+
name: external_exports.string(),
|
|
16003
|
+
version: external_exports.string()
|
|
16004
|
+
}),
|
|
16005
|
+
toolCallId: external_exports.string(),
|
|
16006
|
+
toolName: external_exports.string(),
|
|
16007
|
+
query: external_exports.string()
|
|
16008
|
+
});
|
|
16009
|
+
var checkpointSchema = external_exports.object({
|
|
16010
|
+
id: external_exports.string(),
|
|
16011
|
+
jobId: external_exports.string(),
|
|
16012
|
+
runId: external_exports.string(),
|
|
16013
|
+
status: checkpointStatusSchema,
|
|
16014
|
+
stepNumber: external_exports.number(),
|
|
16015
|
+
messages: external_exports.array(messageSchema),
|
|
16016
|
+
expert: external_exports.object({
|
|
16017
|
+
key: external_exports.string(),
|
|
16018
|
+
name: external_exports.string(),
|
|
16019
|
+
version: external_exports.string()
|
|
16020
|
+
}),
|
|
16021
|
+
delegateTo: external_exports.array(delegationTargetSchema).optional(),
|
|
16022
|
+
delegatedBy: external_exports.object({
|
|
16023
|
+
expert: external_exports.object({
|
|
16024
|
+
key: external_exports.string(),
|
|
16025
|
+
name: external_exports.string(),
|
|
16026
|
+
version: external_exports.string()
|
|
16027
|
+
}),
|
|
16028
|
+
toolCallId: external_exports.string(),
|
|
16029
|
+
toolName: external_exports.string(),
|
|
16030
|
+
checkpointId: external_exports.string(),
|
|
16031
|
+
runId: external_exports.string()
|
|
16032
|
+
}).optional(),
|
|
16033
|
+
usage: usageSchema,
|
|
16034
|
+
contextWindow: external_exports.number().optional(),
|
|
16035
|
+
contextWindowUsage: external_exports.number().optional(),
|
|
16036
|
+
pendingToolCalls: external_exports.array(toolCallSchema).optional(),
|
|
16037
|
+
partialToolResults: external_exports.array(toolResultSchema).optional(),
|
|
16038
|
+
metadata: external_exports.object({}).passthrough().optional(),
|
|
16039
|
+
error: external_exports.object({
|
|
16040
|
+
name: external_exports.string(),
|
|
16041
|
+
message: external_exports.string(),
|
|
16042
|
+
statusCode: external_exports.number().optional(),
|
|
16043
|
+
isRetryable: external_exports.boolean()
|
|
16044
|
+
}).optional(),
|
|
16045
|
+
retryCount: external_exports.number().optional()
|
|
16046
|
+
});
|
|
16047
|
+
|
|
16048
|
+
// ../../packages/core/src/schemas/provider-tools.ts
|
|
16049
|
+
external_exports.enum(["webSearch", "webFetch", "codeExecution"]);
|
|
16050
|
+
var builtinAnthropicSkillSchema = external_exports.object({
|
|
16051
|
+
type: external_exports.literal("builtin"),
|
|
16052
|
+
skillId: external_exports.enum(["pdf", "docx", "pptx", "xlsx"])
|
|
16053
|
+
});
|
|
16054
|
+
var customAnthropicSkillSchema = external_exports.object({
|
|
16055
|
+
type: external_exports.literal("custom"),
|
|
16056
|
+
name: external_exports.string().min(1),
|
|
16057
|
+
definition: external_exports.string().min(1)
|
|
16058
|
+
});
|
|
16059
|
+
var anthropicProviderSkillSchema = external_exports.discriminatedUnion("type", [
|
|
16060
|
+
builtinAnthropicSkillSchema,
|
|
16061
|
+
customAnthropicSkillSchema
|
|
16062
|
+
]);
|
|
16063
|
+
external_exports.enum([
|
|
16064
|
+
"webSearch",
|
|
16065
|
+
"fileSearch",
|
|
16066
|
+
"codeInterpreter",
|
|
16067
|
+
"imageGeneration"
|
|
16068
|
+
]);
|
|
16069
|
+
external_exports.enum([
|
|
16070
|
+
"googleSearch",
|
|
16071
|
+
"codeExecution",
|
|
16072
|
+
"urlContext",
|
|
16073
|
+
"fileSearch",
|
|
16074
|
+
"googleMaps"
|
|
16075
|
+
]);
|
|
16076
|
+
external_exports.enum([
|
|
16077
|
+
"webSearchPreview",
|
|
16078
|
+
"fileSearch",
|
|
16079
|
+
"codeInterpreter",
|
|
16080
|
+
"imageGeneration"
|
|
16081
|
+
]);
|
|
16082
|
+
external_exports.enum([
|
|
16083
|
+
"codeExecution",
|
|
16084
|
+
"urlContext",
|
|
16085
|
+
"googleSearch",
|
|
16086
|
+
"enterpriseWebSearch",
|
|
16087
|
+
"googleMaps"
|
|
16088
|
+
]);
|
|
16089
|
+
var webSearchOptionsSchema = external_exports.object({
|
|
16090
|
+
maxUses: external_exports.number().int().positive().optional(),
|
|
16091
|
+
allowedDomains: external_exports.array(external_exports.string()).optional()
|
|
16092
|
+
});
|
|
16093
|
+
var webFetchOptionsSchema = external_exports.object({
|
|
16094
|
+
maxUses: external_exports.number().int().positive().optional()
|
|
16095
|
+
});
|
|
16096
|
+
var fileSearchOptionsSchema = external_exports.object({
|
|
16097
|
+
vectorStoreIds: external_exports.array(external_exports.string()).optional(),
|
|
16098
|
+
maxNumResults: external_exports.number().int().positive().optional()
|
|
16099
|
+
});
|
|
16100
|
+
var providerToolOptionsSchema = external_exports.object({
|
|
16101
|
+
webSearch: webSearchOptionsSchema.optional(),
|
|
16102
|
+
webFetch: webFetchOptionsSchema.optional(),
|
|
16103
|
+
fileSearch: fileSearchOptionsSchema.optional()
|
|
16104
|
+
}).optional();
|
|
16105
|
+
|
|
16106
|
+
// ../../packages/core/src/schemas/runtime-version.ts
|
|
16107
|
+
var runtimeVersionSchema = external_exports.string().regex(/^v\d+\.\d+$/, 'Runtime version must be in format "vX.Y" (e.g., "v1.0")').transform((v) => v);
|
|
16108
|
+
|
|
16109
|
+
// ../../packages/core/src/schemas/skill.ts
|
|
16110
|
+
function isPrivateOrLocalIP(hostname3) {
|
|
16111
|
+
if (hostname3 === "localhost" || hostname3 === "127.0.0.1" || hostname3 === "::1" || hostname3 === "0.0.0.0") {
|
|
16112
|
+
return true;
|
|
16113
|
+
}
|
|
16114
|
+
const ipv4Match = hostname3.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/);
|
|
16115
|
+
if (ipv4Match) {
|
|
16116
|
+
const a = Number(ipv4Match[1]);
|
|
16117
|
+
const b = Number(ipv4Match[2]);
|
|
16118
|
+
if (a === 10) return true;
|
|
16119
|
+
if (a === 172 && b >= 16 && b <= 31) return true;
|
|
16120
|
+
if (a === 192 && b === 168) return true;
|
|
16121
|
+
if (a === 169 && b === 254) return true;
|
|
16122
|
+
if (a === 127) return true;
|
|
16123
|
+
}
|
|
16124
|
+
if (hostname3.includes(":")) {
|
|
16125
|
+
if (hostname3.startsWith("fe80:") || hostname3.startsWith("fc") || hostname3.startsWith("fd")) {
|
|
16126
|
+
return true;
|
|
15848
16127
|
}
|
|
15849
16128
|
}
|
|
15850
16129
|
if (hostname3.startsWith("::ffff:")) {
|
|
@@ -15878,8 +16157,7 @@ var mcpStdioSkillSchema = external_exports.object({
|
|
|
15878
16157
|
command: external_exports.string(),
|
|
15879
16158
|
packageName: external_exports.string().optional(),
|
|
15880
16159
|
args: external_exports.array(external_exports.string()).optional().default([]),
|
|
15881
|
-
requiredEnv: external_exports.array(external_exports.string()).optional().default([])
|
|
15882
|
-
lazyInit: external_exports.boolean().optional().default(false)
|
|
16160
|
+
requiredEnv: external_exports.array(external_exports.string()).optional().default([])
|
|
15883
16161
|
});
|
|
15884
16162
|
var mcpSseSkillSchema = external_exports.object({
|
|
15885
16163
|
type: external_exports.literal("mcpSseSkill"),
|
|
@@ -15915,6 +16193,71 @@ var skillSchema = external_exports.discriminatedUnion("type", [
|
|
|
15915
16193
|
interactiveSkillSchema
|
|
15916
16194
|
]);
|
|
15917
16195
|
|
|
16196
|
+
// ../../packages/core/src/schemas/expert.ts
|
|
16197
|
+
var expertSchema = external_exports.object({
|
|
16198
|
+
key: external_exports.string().regex(expertKeyRegex).min(1),
|
|
16199
|
+
name: external_exports.string().regex(expertNameRegex).min(1).max(maxExpertNameLength),
|
|
16200
|
+
version: external_exports.string().regex(expertVersionRegex),
|
|
16201
|
+
description: external_exports.string().max(1024 * 2).optional(),
|
|
16202
|
+
instruction: external_exports.string().min(1).max(1024 * 20),
|
|
16203
|
+
skills: external_exports.record(
|
|
16204
|
+
external_exports.string(),
|
|
16205
|
+
external_exports.discriminatedUnion("type", [
|
|
16206
|
+
mcpStdioSkillSchema.omit({ name: true }),
|
|
16207
|
+
mcpSseSkillSchema.omit({ name: true }),
|
|
16208
|
+
interactiveSkillSchema.omit({ name: true })
|
|
16209
|
+
])
|
|
16210
|
+
).optional().default({
|
|
16211
|
+
"@perstack/base": {
|
|
16212
|
+
type: "mcpStdioSkill",
|
|
16213
|
+
description: "Base skill",
|
|
16214
|
+
command: "npx",
|
|
16215
|
+
args: ["-y", "@perstack/base"],
|
|
16216
|
+
pick: [],
|
|
16217
|
+
omit: [],
|
|
16218
|
+
requiredEnv: []
|
|
16219
|
+
}
|
|
16220
|
+
}).transform((skills) => {
|
|
16221
|
+
return Object.fromEntries(
|
|
16222
|
+
Object.entries(skills).map(([key, skillWithoutName]) => [
|
|
16223
|
+
key,
|
|
16224
|
+
external_exports.discriminatedUnion("type", [
|
|
16225
|
+
mcpStdioSkillSchema,
|
|
16226
|
+
mcpSseSkillSchema,
|
|
16227
|
+
interactiveSkillSchema
|
|
16228
|
+
]).parse({ ...skillWithoutName, name: key })
|
|
16229
|
+
])
|
|
16230
|
+
);
|
|
16231
|
+
}),
|
|
16232
|
+
delegates: external_exports.array(external_exports.string().regex(expertKeyRegex).min(1)).optional().default([]),
|
|
16233
|
+
tags: external_exports.array(external_exports.string().regex(tagNameRegex).min(1)).optional().default([]),
|
|
16234
|
+
minRuntimeVersion: runtimeVersionSchema.default("v1.0"),
|
|
16235
|
+
providerTools: external_exports.array(external_exports.string()).optional(),
|
|
16236
|
+
providerSkills: external_exports.array(anthropicProviderSkillSchema).optional(),
|
|
16237
|
+
providerToolOptions: providerToolOptionsSchema
|
|
16238
|
+
});
|
|
16239
|
+
|
|
16240
|
+
// ../../packages/core/src/schemas/job.ts
|
|
16241
|
+
var jobStatusSchema = external_exports.enum([
|
|
16242
|
+
"running",
|
|
16243
|
+
"completed",
|
|
16244
|
+
"stoppedByMaxSteps",
|
|
16245
|
+
"stoppedByInteractiveTool",
|
|
16246
|
+
"stoppedByError",
|
|
16247
|
+
"stoppedByCancellation"
|
|
16248
|
+
]);
|
|
16249
|
+
var jobSchema = external_exports.object({
|
|
16250
|
+
id: external_exports.string(),
|
|
16251
|
+
status: jobStatusSchema,
|
|
16252
|
+
coordinatorExpertKey: external_exports.string(),
|
|
16253
|
+
runtimeVersion: runtimeVersionSchema,
|
|
16254
|
+
totalSteps: external_exports.number(),
|
|
16255
|
+
maxSteps: external_exports.number().optional(),
|
|
16256
|
+
usage: usageSchema,
|
|
16257
|
+
startedAt: external_exports.number(),
|
|
16258
|
+
finishedAt: external_exports.number().optional()
|
|
16259
|
+
});
|
|
16260
|
+
|
|
15918
16261
|
// ../../packages/core/src/schemas/lockfile.ts
|
|
15919
16262
|
var lockfileToolDefinitionSchema = external_exports.object({
|
|
15920
16263
|
skillName: external_exports.string(),
|
|
@@ -16018,98 +16361,37 @@ var providerConfigSchema = external_exports.discriminatedUnion("providerName", [
|
|
|
16018
16361
|
deepseekProviderConfigSchema
|
|
16019
16362
|
]);
|
|
16020
16363
|
|
|
16021
|
-
// ../../packages/core/src/schemas/
|
|
16022
|
-
|
|
16023
|
-
var
|
|
16024
|
-
|
|
16025
|
-
|
|
16364
|
+
// ../../packages/core/src/schemas/perstack-toml.ts
|
|
16365
|
+
var defaultReasoningBudget = "low";
|
|
16366
|
+
var reasoningBudgetSchema = external_exports.union([
|
|
16367
|
+
external_exports.enum(["none", "minimal", "low", "medium", "high"]),
|
|
16368
|
+
external_exports.number().int().nonnegative()
|
|
16369
|
+
// 0 disables reasoning (same as "none")
|
|
16370
|
+
]);
|
|
16371
|
+
var domainPatternRegex = /^(\*\.)?[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*$/;
|
|
16372
|
+
var punycodeRegex = /(?:^|\.)(xn--)/i;
|
|
16373
|
+
var domainPatternSchema = external_exports.string().regex(domainPatternRegex, {
|
|
16374
|
+
message: "Invalid domain pattern. Use exact domain (example.com) or wildcard prefix (*.example.com)"
|
|
16375
|
+
}).refine((domain2) => !punycodeRegex.test(domain2), {
|
|
16376
|
+
message: "Punycode domains (xn--) are not allowed to prevent homograph attacks. Use ASCII domains only."
|
|
16026
16377
|
});
|
|
16027
|
-
var
|
|
16028
|
-
|
|
16029
|
-
|
|
16030
|
-
|
|
16031
|
-
|
|
16032
|
-
|
|
16033
|
-
|
|
16034
|
-
|
|
16035
|
-
|
|
16036
|
-
|
|
16037
|
-
|
|
16038
|
-
"
|
|
16039
|
-
|
|
16040
|
-
|
|
16041
|
-
|
|
16042
|
-
|
|
16043
|
-
|
|
16044
|
-
"codeExecution",
|
|
16045
|
-
"urlContext",
|
|
16046
|
-
"fileSearch",
|
|
16047
|
-
"googleMaps"
|
|
16048
|
-
]);
|
|
16049
|
-
external_exports.enum([
|
|
16050
|
-
"webSearchPreview",
|
|
16051
|
-
"fileSearch",
|
|
16052
|
-
"codeInterpreter",
|
|
16053
|
-
"imageGeneration"
|
|
16054
|
-
]);
|
|
16055
|
-
external_exports.enum([
|
|
16056
|
-
"codeExecution",
|
|
16057
|
-
"urlContext",
|
|
16058
|
-
"googleSearch",
|
|
16059
|
-
"enterpriseWebSearch",
|
|
16060
|
-
"googleMaps"
|
|
16061
|
-
]);
|
|
16062
|
-
var webSearchOptionsSchema = external_exports.object({
|
|
16063
|
-
maxUses: external_exports.number().int().positive().optional(),
|
|
16064
|
-
allowedDomains: external_exports.array(external_exports.string()).optional()
|
|
16065
|
-
});
|
|
16066
|
-
var webFetchOptionsSchema = external_exports.object({
|
|
16067
|
-
maxUses: external_exports.number().int().positive().optional()
|
|
16068
|
-
});
|
|
16069
|
-
var fileSearchOptionsSchema = external_exports.object({
|
|
16070
|
-
vectorStoreIds: external_exports.array(external_exports.string()).optional(),
|
|
16071
|
-
maxNumResults: external_exports.number().int().positive().optional()
|
|
16072
|
-
});
|
|
16073
|
-
var providerToolOptionsSchema = external_exports.object({
|
|
16074
|
-
webSearch: webSearchOptionsSchema.optional(),
|
|
16075
|
-
webFetch: webFetchOptionsSchema.optional(),
|
|
16076
|
-
fileSearch: fileSearchOptionsSchema.optional()
|
|
16077
|
-
}).optional();
|
|
16078
|
-
|
|
16079
|
-
// ../../packages/core/src/schemas/runtime-version.ts
|
|
16080
|
-
var runtimeVersionSchema = external_exports.string().regex(/^v\d+\.\d+$/, 'Runtime version must be in format "vX.Y" (e.g., "v1.0")').transform((v) => v);
|
|
16081
|
-
|
|
16082
|
-
// ../../packages/core/src/schemas/perstack-toml.ts
|
|
16083
|
-
var defaultReasoningBudget = "low";
|
|
16084
|
-
var reasoningBudgetSchema = external_exports.union([
|
|
16085
|
-
external_exports.enum(["none", "minimal", "low", "medium", "high"]),
|
|
16086
|
-
external_exports.number().int().nonnegative()
|
|
16087
|
-
// 0 disables reasoning (same as "none")
|
|
16088
|
-
]);
|
|
16089
|
-
var domainPatternRegex = /^(\*\.)?[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*$/;
|
|
16090
|
-
var punycodeRegex = /(?:^|\.)(xn--)/i;
|
|
16091
|
-
var domainPatternSchema = external_exports.string().regex(domainPatternRegex, {
|
|
16092
|
-
message: "Invalid domain pattern. Use exact domain (example.com) or wildcard prefix (*.example.com)"
|
|
16093
|
-
}).refine((domain2) => !punycodeRegex.test(domain2), {
|
|
16094
|
-
message: "Punycode domains (xn--) are not allowed to prevent homograph attacks. Use ASCII domains only."
|
|
16095
|
-
});
|
|
16096
|
-
var sseEndpointSchema2 = external_exports.string().url().refine(
|
|
16097
|
-
(url2) => {
|
|
16098
|
-
try {
|
|
16099
|
-
const parsed = new URL(url2);
|
|
16100
|
-
if (parsed.protocol !== "https:") return false;
|
|
16101
|
-
if (isPrivateOrLocalIP(parsed.hostname)) return false;
|
|
16102
|
-
return true;
|
|
16103
|
-
} catch {
|
|
16104
|
-
return false;
|
|
16105
|
-
}
|
|
16106
|
-
},
|
|
16107
|
-
{ message: "SSE endpoint must be a public HTTPS URL" }
|
|
16108
|
-
);
|
|
16109
|
-
var httpsUrlSchema = external_exports.string().url().refine((url2) => url2.startsWith("https://"), { message: "URL must use HTTPS" });
|
|
16110
|
-
var anthropicSettingSchema = external_exports.object({
|
|
16111
|
-
baseUrl: httpsUrlSchema.optional(),
|
|
16112
|
-
headers: headersSchema
|
|
16378
|
+
var sseEndpointSchema2 = external_exports.string().url().refine(
|
|
16379
|
+
(url2) => {
|
|
16380
|
+
try {
|
|
16381
|
+
const parsed = new URL(url2);
|
|
16382
|
+
if (parsed.protocol !== "https:") return false;
|
|
16383
|
+
if (isPrivateOrLocalIP(parsed.hostname)) return false;
|
|
16384
|
+
return true;
|
|
16385
|
+
} catch {
|
|
16386
|
+
return false;
|
|
16387
|
+
}
|
|
16388
|
+
},
|
|
16389
|
+
{ message: "SSE endpoint must be a public HTTPS URL" }
|
|
16390
|
+
);
|
|
16391
|
+
var httpsUrlSchema = external_exports.string().url().refine((url2) => url2.startsWith("https://"), { message: "URL must use HTTPS" });
|
|
16392
|
+
var anthropicSettingSchema = external_exports.object({
|
|
16393
|
+
baseUrl: httpsUrlSchema.optional(),
|
|
16394
|
+
headers: headersSchema
|
|
16113
16395
|
});
|
|
16114
16396
|
var googleSettingSchema = external_exports.object({
|
|
16115
16397
|
baseUrl: httpsUrlSchema.optional(),
|
|
@@ -16207,8 +16489,7 @@ var perstackConfigSchema = external_exports.object({
|
|
|
16207
16489
|
packageName: external_exports.string().optional(),
|
|
16208
16490
|
args: external_exports.array(external_exports.string()).optional(),
|
|
16209
16491
|
requiredEnv: external_exports.array(external_exports.string()).optional(),
|
|
16210
|
-
allowedDomains: external_exports.array(domainPatternSchema).optional()
|
|
16211
|
-
lazyInit: external_exports.boolean().optional().default(false)
|
|
16492
|
+
allowedDomains: external_exports.array(domainPatternSchema).optional()
|
|
16212
16493
|
}),
|
|
16213
16494
|
external_exports.object({
|
|
16214
16495
|
type: external_exports.literal("mcpSseSkill"),
|
|
@@ -16301,111 +16582,6 @@ var startCommandInputSchema = external_exports.object({
|
|
|
16301
16582
|
options: commandOptionsSchema
|
|
16302
16583
|
});
|
|
16303
16584
|
|
|
16304
|
-
// ../../packages/core/src/schemas/checkpoint.ts
|
|
16305
|
-
var checkpointStatusSchema = external_exports.enum([
|
|
16306
|
-
"init",
|
|
16307
|
-
"proceeding",
|
|
16308
|
-
"completed",
|
|
16309
|
-
"stoppedByInteractiveTool",
|
|
16310
|
-
"stoppedByDelegate",
|
|
16311
|
-
"stoppedByExceededMaxSteps",
|
|
16312
|
-
"stoppedByError",
|
|
16313
|
-
"stoppedByCancellation"
|
|
16314
|
-
]);
|
|
16315
|
-
var delegationTargetSchema = external_exports.object({
|
|
16316
|
-
expert: external_exports.object({
|
|
16317
|
-
key: external_exports.string(),
|
|
16318
|
-
name: external_exports.string(),
|
|
16319
|
-
version: external_exports.string()
|
|
16320
|
-
}),
|
|
16321
|
-
toolCallId: external_exports.string(),
|
|
16322
|
-
toolName: external_exports.string(),
|
|
16323
|
-
query: external_exports.string()
|
|
16324
|
-
});
|
|
16325
|
-
var checkpointSchema = external_exports.object({
|
|
16326
|
-
id: external_exports.string(),
|
|
16327
|
-
jobId: external_exports.string(),
|
|
16328
|
-
runId: external_exports.string(),
|
|
16329
|
-
status: checkpointStatusSchema,
|
|
16330
|
-
stepNumber: external_exports.number(),
|
|
16331
|
-
messages: external_exports.array(messageSchema),
|
|
16332
|
-
expert: external_exports.object({
|
|
16333
|
-
key: external_exports.string(),
|
|
16334
|
-
name: external_exports.string(),
|
|
16335
|
-
version: external_exports.string()
|
|
16336
|
-
}),
|
|
16337
|
-
delegateTo: external_exports.array(delegationTargetSchema).optional(),
|
|
16338
|
-
delegatedBy: external_exports.object({
|
|
16339
|
-
expert: external_exports.object({
|
|
16340
|
-
key: external_exports.string(),
|
|
16341
|
-
name: external_exports.string(),
|
|
16342
|
-
version: external_exports.string()
|
|
16343
|
-
}),
|
|
16344
|
-
toolCallId: external_exports.string(),
|
|
16345
|
-
toolName: external_exports.string(),
|
|
16346
|
-
checkpointId: external_exports.string(),
|
|
16347
|
-
runId: external_exports.string()
|
|
16348
|
-
}).optional(),
|
|
16349
|
-
usage: usageSchema,
|
|
16350
|
-
contextWindow: external_exports.number().optional(),
|
|
16351
|
-
contextWindowUsage: external_exports.number().optional(),
|
|
16352
|
-
pendingToolCalls: external_exports.array(toolCallSchema).optional(),
|
|
16353
|
-
partialToolResults: external_exports.array(toolResultSchema).optional(),
|
|
16354
|
-
metadata: external_exports.object({}).passthrough().optional(),
|
|
16355
|
-
error: external_exports.object({
|
|
16356
|
-
name: external_exports.string(),
|
|
16357
|
-
message: external_exports.string(),
|
|
16358
|
-
statusCode: external_exports.number().optional(),
|
|
16359
|
-
isRetryable: external_exports.boolean()
|
|
16360
|
-
}).optional(),
|
|
16361
|
-
retryCount: external_exports.number().optional()
|
|
16362
|
-
});
|
|
16363
|
-
|
|
16364
|
-
// ../../packages/core/src/schemas/expert.ts
|
|
16365
|
-
var expertSchema = external_exports.object({
|
|
16366
|
-
key: external_exports.string().regex(expertKeyRegex).min(1),
|
|
16367
|
-
name: external_exports.string().regex(expertNameRegex).min(1).max(maxExpertNameLength),
|
|
16368
|
-
version: external_exports.string().regex(expertVersionRegex),
|
|
16369
|
-
description: external_exports.string().max(1024 * 2).optional(),
|
|
16370
|
-
instruction: external_exports.string().min(1).max(1024 * 20),
|
|
16371
|
-
skills: external_exports.record(
|
|
16372
|
-
external_exports.string(),
|
|
16373
|
-
external_exports.discriminatedUnion("type", [
|
|
16374
|
-
mcpStdioSkillSchema.omit({ name: true }),
|
|
16375
|
-
mcpSseSkillSchema.omit({ name: true }),
|
|
16376
|
-
interactiveSkillSchema.omit({ name: true })
|
|
16377
|
-
])
|
|
16378
|
-
).optional().default({
|
|
16379
|
-
"@perstack/base": {
|
|
16380
|
-
type: "mcpStdioSkill",
|
|
16381
|
-
description: "Base skill",
|
|
16382
|
-
command: "npx",
|
|
16383
|
-
args: ["-y", "@perstack/base"],
|
|
16384
|
-
pick: [],
|
|
16385
|
-
omit: [],
|
|
16386
|
-
requiredEnv: [],
|
|
16387
|
-
lazyInit: false
|
|
16388
|
-
}
|
|
16389
|
-
}).transform((skills) => {
|
|
16390
|
-
return Object.fromEntries(
|
|
16391
|
-
Object.entries(skills).map(([key, skillWithoutName]) => [
|
|
16392
|
-
key,
|
|
16393
|
-
external_exports.discriminatedUnion("type", [
|
|
16394
|
-
mcpStdioSkillSchema,
|
|
16395
|
-
mcpSseSkillSchema,
|
|
16396
|
-
interactiveSkillSchema
|
|
16397
|
-
]).parse({ ...skillWithoutName, name: key })
|
|
16398
|
-
])
|
|
16399
|
-
);
|
|
16400
|
-
}),
|
|
16401
|
-
delegates: external_exports.array(external_exports.string().regex(expertKeyRegex).min(1)).optional().default([]),
|
|
16402
|
-
tags: external_exports.array(external_exports.string().regex(tagNameRegex).min(1)).optional().default([]),
|
|
16403
|
-
minRuntimeVersion: runtimeVersionSchema.default("v1.0"),
|
|
16404
|
-
providerTools: external_exports.array(external_exports.string()).optional(),
|
|
16405
|
-
providerSkills: external_exports.array(anthropicProviderSkillSchema).optional(),
|
|
16406
|
-
providerToolOptions: providerToolOptionsSchema
|
|
16407
|
-
});
|
|
16408
|
-
|
|
16409
16585
|
// ../../packages/core/src/schemas/runtime.ts
|
|
16410
16586
|
var runSettingSchema = external_exports.object({
|
|
16411
16587
|
model: external_exports.string(),
|
|
@@ -16573,51 +16749,254 @@ function isValidRuntimeEventType(type) {
|
|
|
16573
16749
|
return RUNTIME_EVENT_TYPES.has(type);
|
|
16574
16750
|
}
|
|
16575
16751
|
|
|
16576
|
-
// ../../packages/core/src/
|
|
16577
|
-
|
|
16578
|
-
|
|
16579
|
-
|
|
16580
|
-
|
|
16581
|
-
|
|
16582
|
-
|
|
16583
|
-
|
|
16584
|
-
|
|
16585
|
-
|
|
16586
|
-
|
|
16587
|
-
|
|
16588
|
-
|
|
16589
|
-
|
|
16590
|
-
|
|
16591
|
-
|
|
16592
|
-
|
|
16593
|
-
|
|
16594
|
-
|
|
16595
|
-
|
|
16596
|
-
"
|
|
16597
|
-
|
|
16598
|
-
|
|
16599
|
-
|
|
16600
|
-
|
|
16601
|
-
|
|
16602
|
-
|
|
16603
|
-
|
|
16604
|
-
|
|
16605
|
-
|
|
16606
|
-
"PERL5LIB",
|
|
16607
|
-
"RUBYLIB"
|
|
16608
|
-
]);
|
|
16609
|
-
function getFilteredEnv(additional) {
|
|
16610
|
-
const filtered = {};
|
|
16611
|
-
for (const key of SAFE_ENV_VARS) {
|
|
16612
|
-
if (process.env[key]) {
|
|
16613
|
-
filtered[key] = process.env[key];
|
|
16752
|
+
// ../../packages/core/src/schemas/step.ts
|
|
16753
|
+
external_exports.object({
|
|
16754
|
+
stepNumber: external_exports.number(),
|
|
16755
|
+
inputMessages: external_exports.array(external_exports.union([instructionMessageSchema, userMessageSchema, toolMessageSchema])).optional(),
|
|
16756
|
+
newMessages: external_exports.array(messageSchema),
|
|
16757
|
+
toolCalls: external_exports.array(toolCallSchema).optional(),
|
|
16758
|
+
toolResults: external_exports.array(toolResultSchema).optional(),
|
|
16759
|
+
pendingToolCalls: external_exports.array(toolCallSchema).optional(),
|
|
16760
|
+
partialToolResults: external_exports.array(toolResultSchema).optional(),
|
|
16761
|
+
usage: usageSchema,
|
|
16762
|
+
startedAt: external_exports.number(),
|
|
16763
|
+
finishedAt: external_exports.number().optional()
|
|
16764
|
+
});
|
|
16765
|
+
|
|
16766
|
+
// ../../packages/core/src/utils/activity.ts
|
|
16767
|
+
var BASE_SKILL_PREFIX = "@perstack/base";
|
|
16768
|
+
function createBaseToolActivity(toolName, toolCall, toolResult, reasoning) {
|
|
16769
|
+
const args = toolCall.args;
|
|
16770
|
+
const resultContents = toolResult.result;
|
|
16771
|
+
const errorText = getErrorFromResult(resultContents);
|
|
16772
|
+
const baseFields = { id: "", expertKey: "", runId: "", reasoning };
|
|
16773
|
+
switch (toolName) {
|
|
16774
|
+
case "attemptCompletion": {
|
|
16775
|
+
const remainingTodos = parseRemainingTodosFromResult(resultContents);
|
|
16776
|
+
return {
|
|
16777
|
+
type: "attemptCompletion",
|
|
16778
|
+
...baseFields,
|
|
16779
|
+
remainingTodos,
|
|
16780
|
+
error: errorText
|
|
16781
|
+
};
|
|
16614
16782
|
}
|
|
16615
|
-
|
|
16616
|
-
|
|
16617
|
-
|
|
16618
|
-
|
|
16619
|
-
|
|
16620
|
-
|
|
16783
|
+
case "todo": {
|
|
16784
|
+
const todos = parseTodosFromResult(resultContents);
|
|
16785
|
+
return {
|
|
16786
|
+
type: "todo",
|
|
16787
|
+
...baseFields,
|
|
16788
|
+
newTodos: Array.isArray(args["newTodos"]) ? args["newTodos"].map(String) : void 0,
|
|
16789
|
+
completedTodos: Array.isArray(args["completedTodos"]) ? args["completedTodos"].map(Number) : void 0,
|
|
16790
|
+
todos,
|
|
16791
|
+
error: errorText
|
|
16792
|
+
};
|
|
16793
|
+
}
|
|
16794
|
+
case "clearTodo":
|
|
16795
|
+
return {
|
|
16796
|
+
type: "clearTodo",
|
|
16797
|
+
...baseFields,
|
|
16798
|
+
error: errorText
|
|
16799
|
+
};
|
|
16800
|
+
case "readImageFile":
|
|
16801
|
+
return {
|
|
16802
|
+
type: "readImageFile",
|
|
16803
|
+
...baseFields,
|
|
16804
|
+
path: String(args["path"] ?? ""),
|
|
16805
|
+
mimeType: parseStringField(resultContents, "mimeType"),
|
|
16806
|
+
size: parseNumberField(resultContents, "size"),
|
|
16807
|
+
error: errorText
|
|
16808
|
+
};
|
|
16809
|
+
case "readPdfFile":
|
|
16810
|
+
return {
|
|
16811
|
+
type: "readPdfFile",
|
|
16812
|
+
...baseFields,
|
|
16813
|
+
path: String(args["path"] ?? ""),
|
|
16814
|
+
mimeType: parseStringField(resultContents, "mimeType"),
|
|
16815
|
+
size: parseNumberField(resultContents, "size"),
|
|
16816
|
+
error: errorText
|
|
16817
|
+
};
|
|
16818
|
+
case "readTextFile":
|
|
16819
|
+
return {
|
|
16820
|
+
type: "readTextFile",
|
|
16821
|
+
...baseFields,
|
|
16822
|
+
path: String(args["path"] ?? ""),
|
|
16823
|
+
content: parseStringField(resultContents, "content"),
|
|
16824
|
+
from: typeof args["from"] === "number" ? args["from"] : void 0,
|
|
16825
|
+
to: typeof args["to"] === "number" ? args["to"] : void 0,
|
|
16826
|
+
error: errorText
|
|
16827
|
+
};
|
|
16828
|
+
case "editTextFile":
|
|
16829
|
+
return {
|
|
16830
|
+
type: "editTextFile",
|
|
16831
|
+
...baseFields,
|
|
16832
|
+
path: String(args["path"] ?? ""),
|
|
16833
|
+
newText: String(args["newText"] ?? ""),
|
|
16834
|
+
oldText: String(args["oldText"] ?? ""),
|
|
16835
|
+
error: errorText
|
|
16836
|
+
};
|
|
16837
|
+
case "writeTextFile":
|
|
16838
|
+
return {
|
|
16839
|
+
type: "writeTextFile",
|
|
16840
|
+
...baseFields,
|
|
16841
|
+
path: String(args["path"] ?? ""),
|
|
16842
|
+
text: String(args["text"] ?? ""),
|
|
16843
|
+
error: errorText
|
|
16844
|
+
};
|
|
16845
|
+
case "exec":
|
|
16846
|
+
return {
|
|
16847
|
+
type: "exec",
|
|
16848
|
+
...baseFields,
|
|
16849
|
+
command: String(args["command"] ?? ""),
|
|
16850
|
+
args: Array.isArray(args["args"]) ? args["args"].map(String) : [],
|
|
16851
|
+
cwd: String(args["cwd"] ?? ""),
|
|
16852
|
+
output: parseStringField(resultContents, "output"),
|
|
16853
|
+
error: errorText,
|
|
16854
|
+
stdout: parseStringField(resultContents, "stdout"),
|
|
16855
|
+
stderr: parseStringField(resultContents, "stderr")
|
|
16856
|
+
};
|
|
16857
|
+
default:
|
|
16858
|
+
return createGeneralToolActivity(
|
|
16859
|
+
toolCall.skillName,
|
|
16860
|
+
toolName,
|
|
16861
|
+
toolCall,
|
|
16862
|
+
toolResult,
|
|
16863
|
+
reasoning
|
|
16864
|
+
);
|
|
16865
|
+
}
|
|
16866
|
+
}
|
|
16867
|
+
function createGeneralToolActivity(skillName, toolName, toolCall, toolResult, reasoning) {
|
|
16868
|
+
const errorText = getErrorFromResult(toolResult.result);
|
|
16869
|
+
return {
|
|
16870
|
+
type: "generalTool",
|
|
16871
|
+
id: "",
|
|
16872
|
+
expertKey: "",
|
|
16873
|
+
runId: "",
|
|
16874
|
+
reasoning,
|
|
16875
|
+
skillName,
|
|
16876
|
+
toolName,
|
|
16877
|
+
args: toolCall.args,
|
|
16878
|
+
result: toolResult.result,
|
|
16879
|
+
error: errorText
|
|
16880
|
+
};
|
|
16881
|
+
}
|
|
16882
|
+
function getErrorFromResult(result) {
|
|
16883
|
+
const textPart = result.find((p) => p.type === "textPart");
|
|
16884
|
+
if (!textPart?.text) return void 0;
|
|
16885
|
+
try {
|
|
16886
|
+
const parsed = JSON.parse(textPart.text);
|
|
16887
|
+
if (typeof parsed.error === "string") {
|
|
16888
|
+
return parsed.error;
|
|
16889
|
+
}
|
|
16890
|
+
} catch {
|
|
16891
|
+
const trimmed = textPart.text.trim();
|
|
16892
|
+
if (trimmed.toLowerCase().startsWith("error:") || trimmed.toLowerCase().startsWith("error ")) {
|
|
16893
|
+
return textPart.text;
|
|
16894
|
+
}
|
|
16895
|
+
}
|
|
16896
|
+
return void 0;
|
|
16897
|
+
}
|
|
16898
|
+
function parseStringField(result, field) {
|
|
16899
|
+
const textPart = result.find((p) => p.type === "textPart");
|
|
16900
|
+
if (!textPart?.text) return void 0;
|
|
16901
|
+
try {
|
|
16902
|
+
const parsed = JSON.parse(textPart.text);
|
|
16903
|
+
return typeof parsed[field] === "string" ? parsed[field] : void 0;
|
|
16904
|
+
} catch {
|
|
16905
|
+
return void 0;
|
|
16906
|
+
}
|
|
16907
|
+
}
|
|
16908
|
+
function parseNumberField(result, field) {
|
|
16909
|
+
const textPart = result.find((p) => p.type === "textPart");
|
|
16910
|
+
if (!textPart?.text) return void 0;
|
|
16911
|
+
try {
|
|
16912
|
+
const parsed = JSON.parse(textPart.text);
|
|
16913
|
+
return typeof parsed[field] === "number" ? parsed[field] : void 0;
|
|
16914
|
+
} catch {
|
|
16915
|
+
return void 0;
|
|
16916
|
+
}
|
|
16917
|
+
}
|
|
16918
|
+
function parseRemainingTodosFromResult(result) {
|
|
16919
|
+
const textPart = result.find((p) => p.type === "textPart");
|
|
16920
|
+
if (!textPart?.text) return void 0;
|
|
16921
|
+
try {
|
|
16922
|
+
const parsed = JSON.parse(textPart.text);
|
|
16923
|
+
if (Array.isArray(parsed.remainingTodos)) {
|
|
16924
|
+
return parsed.remainingTodos.map(
|
|
16925
|
+
(t, i) => ({
|
|
16926
|
+
id: typeof t.id === "number" ? t.id : i,
|
|
16927
|
+
title: typeof t.title === "string" ? t.title : "",
|
|
16928
|
+
completed: typeof t.completed === "boolean" ? t.completed : false
|
|
16929
|
+
})
|
|
16930
|
+
);
|
|
16931
|
+
}
|
|
16932
|
+
} catch {
|
|
16933
|
+
}
|
|
16934
|
+
return void 0;
|
|
16935
|
+
}
|
|
16936
|
+
function parseTodosFromResult(result) {
|
|
16937
|
+
const textPart = result.find((p) => p.type === "textPart");
|
|
16938
|
+
if (!textPart?.text) return [];
|
|
16939
|
+
try {
|
|
16940
|
+
const parsed = JSON.parse(textPart.text);
|
|
16941
|
+
if (Array.isArray(parsed.todos)) {
|
|
16942
|
+
return parsed.todos.map(
|
|
16943
|
+
(t, i) => ({
|
|
16944
|
+
id: typeof t.id === "number" ? t.id : i,
|
|
16945
|
+
title: typeof t.title === "string" ? t.title : "",
|
|
16946
|
+
completed: typeof t.completed === "boolean" ? t.completed : false
|
|
16947
|
+
})
|
|
16948
|
+
);
|
|
16949
|
+
}
|
|
16950
|
+
} catch {
|
|
16951
|
+
}
|
|
16952
|
+
return [];
|
|
16953
|
+
}
|
|
16954
|
+
|
|
16955
|
+
// ../../packages/core/src/utils/env-filter.ts
|
|
16956
|
+
var SAFE_ENV_VARS = [
|
|
16957
|
+
// System
|
|
16958
|
+
"PATH",
|
|
16959
|
+
"HOME",
|
|
16960
|
+
"SHELL",
|
|
16961
|
+
"TERM",
|
|
16962
|
+
"NODE_PATH",
|
|
16963
|
+
// Proxy
|
|
16964
|
+
"HTTP_PROXY",
|
|
16965
|
+
"HTTPS_PROXY",
|
|
16966
|
+
"http_proxy",
|
|
16967
|
+
"https_proxy",
|
|
16968
|
+
"NO_PROXY",
|
|
16969
|
+
"no_proxy",
|
|
16970
|
+
"PERSTACK_PROXY_URL",
|
|
16971
|
+
"NPM_CONFIG_PROXY",
|
|
16972
|
+
"NPM_CONFIG_HTTPS_PROXY"
|
|
16973
|
+
];
|
|
16974
|
+
var PROTECTED_ENV_VARS = /* @__PURE__ */ new Set([
|
|
16975
|
+
"PATH",
|
|
16976
|
+
"HOME",
|
|
16977
|
+
"SHELL",
|
|
16978
|
+
"NODE_PATH",
|
|
16979
|
+
"LD_PRELOAD",
|
|
16980
|
+
"LD_LIBRARY_PATH",
|
|
16981
|
+
"DYLD_INSERT_LIBRARIES",
|
|
16982
|
+
"DYLD_LIBRARY_PATH",
|
|
16983
|
+
"NODE_OPTIONS",
|
|
16984
|
+
"PYTHONPATH",
|
|
16985
|
+
"PERL5LIB",
|
|
16986
|
+
"RUBYLIB"
|
|
16987
|
+
]);
|
|
16988
|
+
function getFilteredEnv(additional) {
|
|
16989
|
+
const filtered = {};
|
|
16990
|
+
for (const key of SAFE_ENV_VARS) {
|
|
16991
|
+
if (process.env[key]) {
|
|
16992
|
+
filtered[key] = process.env[key];
|
|
16993
|
+
}
|
|
16994
|
+
}
|
|
16995
|
+
if (additional) {
|
|
16996
|
+
for (const [key, value] of Object.entries(additional)) {
|
|
16997
|
+
if (!PROTECTED_ENV_VARS.has(key.toUpperCase())) {
|
|
16998
|
+
filtered[key] = value;
|
|
16999
|
+
}
|
|
16621
17000
|
}
|
|
16622
17001
|
}
|
|
16623
17002
|
return filtered;
|
|
@@ -16627,7 +17006,7 @@ function getFilteredEnv(additional) {
|
|
|
16627
17006
|
function validateEventFilter(filter) {
|
|
16628
17007
|
const invalid = filter.filter((type) => !isValidEventType(type) && !isValidRuntimeEventType(type));
|
|
16629
17008
|
if (invalid.length > 0) {
|
|
16630
|
-
throw new
|
|
17009
|
+
throw new PerstackError(
|
|
16631
17010
|
`Invalid event type(s): ${invalid.join(", ")}. Valid event types are: startRun, completeRun, stopRunByError, callTools, etc. See documentation for full list.`
|
|
16632
17011
|
);
|
|
16633
17012
|
}
|
|
@@ -16656,514 +17035,1573 @@ function parseWithFriendlyError(schema, data, context) {
|
|
|
16656
17035
|
return result.data;
|
|
16657
17036
|
}
|
|
16658
17037
|
const prefix = context ? `${context}: ` : "";
|
|
16659
|
-
throw new
|
|
17038
|
+
throw new PerstackError(`${prefix}${formatZodError(result.error)}`);
|
|
16660
17039
|
}
|
|
16661
17040
|
|
|
16662
|
-
// ../../packages/
|
|
16663
|
-
|
|
16664
|
-
{
|
|
16665
|
-
|
|
16666
|
-
|
|
16667
|
-
|
|
16668
|
-
|
|
16669
|
-
|
|
16670
|
-
|
|
16671
|
-
|
|
16672
|
-
|
|
16673
|
-
|
|
16674
|
-
|
|
16675
|
-
|
|
16676
|
-
|
|
17041
|
+
// ../../node_modules/.pnpm/@perstack+api-client@0.0.55_@perstack+core@packages+core_zod@4.3.6/node_modules/@perstack/api-client/dist/index.mjs
|
|
17042
|
+
function createValidationError(error48) {
|
|
17043
|
+
return {
|
|
17044
|
+
errorType: "validation",
|
|
17045
|
+
code: 400,
|
|
17046
|
+
message: `Validation failed: ${error48.issues.map((issue2) => `${issue2.path.join(".")}: ${issue2.message}`).join("; ")}`,
|
|
17047
|
+
reason: error48.issues
|
|
17048
|
+
};
|
|
17049
|
+
}
|
|
17050
|
+
function createAbortError() {
|
|
17051
|
+
return {
|
|
17052
|
+
errorType: "abort",
|
|
17053
|
+
code: 0,
|
|
17054
|
+
message: "Request aborted",
|
|
17055
|
+
aborted: true
|
|
17056
|
+
};
|
|
17057
|
+
}
|
|
17058
|
+
function createTimeoutError() {
|
|
17059
|
+
return {
|
|
17060
|
+
errorType: "timeout",
|
|
17061
|
+
code: 0,
|
|
17062
|
+
message: "Request timed out"
|
|
17063
|
+
};
|
|
17064
|
+
}
|
|
17065
|
+
function createNetworkError(error48) {
|
|
17066
|
+
return {
|
|
17067
|
+
errorType: "network",
|
|
17068
|
+
code: 0,
|
|
17069
|
+
message: error48 instanceof Error ? error48.message : "Network error",
|
|
17070
|
+
reason: error48,
|
|
17071
|
+
cause: error48 instanceof Error ? error48 : void 0
|
|
17072
|
+
};
|
|
17073
|
+
}
|
|
17074
|
+
async function handleHttpError(response2) {
|
|
17075
|
+
let errorBody;
|
|
17076
|
+
try {
|
|
17077
|
+
errorBody = await response2.json();
|
|
17078
|
+
} catch {
|
|
17079
|
+
errorBody = void 0;
|
|
17080
|
+
}
|
|
17081
|
+
return {
|
|
17082
|
+
ok: false,
|
|
17083
|
+
error: createHttpError(response2.status, response2.statusText, errorBody)
|
|
17084
|
+
};
|
|
17085
|
+
}
|
|
17086
|
+
function createHttpError(status, statusText, body) {
|
|
17087
|
+
if (typeof body === "object" && body !== null) {
|
|
17088
|
+
const hasReason = "reason" in body;
|
|
17089
|
+
if ("error" in body && typeof body.error === "string") return {
|
|
17090
|
+
errorType: "http",
|
|
17091
|
+
code: status,
|
|
17092
|
+
message: body.error,
|
|
17093
|
+
reason: hasReason ? body.reason : void 0
|
|
17094
|
+
};
|
|
17095
|
+
if (hasReason) return {
|
|
17096
|
+
errorType: "http",
|
|
17097
|
+
code: status,
|
|
17098
|
+
message: statusText,
|
|
17099
|
+
reason: body.reason
|
|
17100
|
+
};
|
|
17101
|
+
}
|
|
17102
|
+
return {
|
|
17103
|
+
errorType: "http",
|
|
17104
|
+
code: status,
|
|
17105
|
+
message: statusText
|
|
17106
|
+
};
|
|
17107
|
+
}
|
|
17108
|
+
var DEFAULT_BASE_URL = "https://api.perstack.ai";
|
|
17109
|
+
var DEFAULT_TIMEOUT = 3e4;
|
|
17110
|
+
function createFetcher(config2) {
|
|
17111
|
+
const baseUrl = config2.baseUrl ?? DEFAULT_BASE_URL;
|
|
17112
|
+
const timeout = config2.timeout ?? DEFAULT_TIMEOUT;
|
|
17113
|
+
const useCredentials = "credentials" in config2 && config2.credentials === "include";
|
|
17114
|
+
const apiKey = "apiKey" in config2 ? config2.apiKey : void 0;
|
|
17115
|
+
function buildUrl(path) {
|
|
17116
|
+
return `${baseUrl}${path}`;
|
|
17117
|
+
}
|
|
17118
|
+
function buildHeaders(options) {
|
|
17119
|
+
const headers = {};
|
|
17120
|
+
if (options?.hasBody) headers["Content-Type"] = "application/json";
|
|
17121
|
+
if (apiKey) headers.Authorization = `Bearer ${apiKey}`;
|
|
17122
|
+
return headers;
|
|
17123
|
+
}
|
|
17124
|
+
function getCredentials() {
|
|
17125
|
+
return useCredentials ? "include" : void 0;
|
|
17126
|
+
}
|
|
17127
|
+
function createTimeoutSignal(externalSignal) {
|
|
17128
|
+
const controller = new AbortController();
|
|
17129
|
+
let timedOut = false;
|
|
17130
|
+
const timeoutId = setTimeout(() => {
|
|
17131
|
+
timedOut = true;
|
|
17132
|
+
controller.abort();
|
|
17133
|
+
}, timeout);
|
|
17134
|
+
let abortHandler;
|
|
17135
|
+
if (externalSignal) if (externalSignal.aborted) controller.abort();
|
|
17136
|
+
else {
|
|
17137
|
+
abortHandler = () => controller.abort();
|
|
17138
|
+
externalSignal.addEventListener("abort", abortHandler);
|
|
17139
|
+
}
|
|
17140
|
+
return {
|
|
17141
|
+
signal: controller.signal,
|
|
17142
|
+
cleanup: () => {
|
|
17143
|
+
clearTimeout(timeoutId);
|
|
17144
|
+
if (abortHandler && externalSignal) externalSignal.removeEventListener("abort", abortHandler);
|
|
16677
17145
|
},
|
|
16678
|
-
|
|
16679
|
-
|
|
16680
|
-
|
|
16681
|
-
|
|
17146
|
+
isTimeout: () => timedOut
|
|
17147
|
+
};
|
|
17148
|
+
}
|
|
17149
|
+
function wrapStreamWithIdleTimeout(stream, idleTimeoutMs, externalSignal) {
|
|
17150
|
+
const reader = stream.getReader();
|
|
17151
|
+
const controller = new AbortController();
|
|
17152
|
+
let timeoutId;
|
|
17153
|
+
let abortHandler;
|
|
17154
|
+
if (externalSignal) if (externalSignal.aborted) controller.abort();
|
|
17155
|
+
else {
|
|
17156
|
+
abortHandler = () => controller.abort();
|
|
17157
|
+
externalSignal.addEventListener("abort", abortHandler);
|
|
17158
|
+
}
|
|
17159
|
+
function resetTimeout() {
|
|
17160
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
17161
|
+
timeoutId = setTimeout(() => controller.abort(), idleTimeoutMs);
|
|
17162
|
+
}
|
|
17163
|
+
function cleanup() {
|
|
17164
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
17165
|
+
if (abortHandler && externalSignal) externalSignal.removeEventListener("abort", abortHandler);
|
|
17166
|
+
}
|
|
17167
|
+
return new ReadableStream({
|
|
17168
|
+
start() {
|
|
17169
|
+
resetTimeout();
|
|
16682
17170
|
},
|
|
16683
|
-
{
|
|
16684
|
-
|
|
16685
|
-
|
|
16686
|
-
|
|
16687
|
-
|
|
16688
|
-
|
|
16689
|
-
|
|
16690
|
-
|
|
16691
|
-
|
|
16692
|
-
|
|
16693
|
-
|
|
16694
|
-
|
|
16695
|
-
|
|
16696
|
-
|
|
16697
|
-
|
|
16698
|
-
|
|
16699
|
-
|
|
16700
|
-
|
|
16701
|
-
|
|
17171
|
+
async pull(streamController) {
|
|
17172
|
+
try {
|
|
17173
|
+
const result = await Promise.race([reader.read(), new Promise((_, reject) => {
|
|
17174
|
+
if (controller.signal.aborted) reject(new DOMException("Stream idle timeout", "AbortError"));
|
|
17175
|
+
controller.signal.addEventListener("abort", () => {
|
|
17176
|
+
reject(new DOMException("Stream idle timeout", "AbortError"));
|
|
17177
|
+
});
|
|
17178
|
+
})]);
|
|
17179
|
+
if (result.done) {
|
|
17180
|
+
cleanup();
|
|
17181
|
+
streamController.close();
|
|
17182
|
+
return;
|
|
17183
|
+
}
|
|
17184
|
+
resetTimeout();
|
|
17185
|
+
streamController.enqueue(result.value);
|
|
17186
|
+
} catch (error48) {
|
|
17187
|
+
cleanup();
|
|
17188
|
+
reader.cancel().catch(() => {
|
|
17189
|
+
});
|
|
17190
|
+
if (error48 instanceof DOMException && error48.name === "AbortError") streamController.error(new DOMException("Stream idle timeout", "AbortError"));
|
|
17191
|
+
else streamController.error(error48);
|
|
17192
|
+
}
|
|
16702
17193
|
},
|
|
16703
|
-
{
|
|
16704
|
-
|
|
16705
|
-
|
|
16706
|
-
|
|
17194
|
+
cancel(reason) {
|
|
17195
|
+
cleanup();
|
|
17196
|
+
reader.cancel(reason).catch(() => {
|
|
17197
|
+
});
|
|
16707
17198
|
}
|
|
16708
|
-
|
|
17199
|
+
});
|
|
17200
|
+
}
|
|
17201
|
+
async function request2(method, path, body, options) {
|
|
17202
|
+
const { signal, cleanup, isTimeout } = createTimeoutSignal(options?.signal);
|
|
17203
|
+
try {
|
|
17204
|
+
const response2 = await fetch(buildUrl(path), {
|
|
17205
|
+
method,
|
|
17206
|
+
headers: buildHeaders(body ? { hasBody: true } : void 0),
|
|
17207
|
+
body: body ? JSON.stringify(body) : void 0,
|
|
17208
|
+
signal,
|
|
17209
|
+
credentials: getCredentials()
|
|
17210
|
+
});
|
|
17211
|
+
if (!response2.ok) return handleHttpError(response2);
|
|
17212
|
+
return {
|
|
17213
|
+
ok: true,
|
|
17214
|
+
data: await response2.json()
|
|
17215
|
+
};
|
|
17216
|
+
} catch (error48) {
|
|
17217
|
+
if (error48 instanceof Error && error48.name === "AbortError") {
|
|
17218
|
+
if (isTimeout()) return {
|
|
17219
|
+
ok: false,
|
|
17220
|
+
error: createTimeoutError()
|
|
17221
|
+
};
|
|
17222
|
+
return {
|
|
17223
|
+
ok: false,
|
|
17224
|
+
error: createAbortError()
|
|
17225
|
+
};
|
|
17226
|
+
}
|
|
17227
|
+
return {
|
|
17228
|
+
ok: false,
|
|
17229
|
+
error: createNetworkError(error48)
|
|
17230
|
+
};
|
|
17231
|
+
} finally {
|
|
17232
|
+
cleanup();
|
|
17233
|
+
}
|
|
17234
|
+
}
|
|
17235
|
+
async function requestBlob(path, options) {
|
|
17236
|
+
const { signal, cleanup, isTimeout } = createTimeoutSignal(options?.signal);
|
|
17237
|
+
try {
|
|
17238
|
+
const response2 = await fetch(buildUrl(path), {
|
|
17239
|
+
method: "GET",
|
|
17240
|
+
headers: buildHeaders(),
|
|
17241
|
+
signal,
|
|
17242
|
+
credentials: getCredentials()
|
|
17243
|
+
});
|
|
17244
|
+
if (!response2.ok) return handleHttpError(response2);
|
|
17245
|
+
return {
|
|
17246
|
+
ok: true,
|
|
17247
|
+
data: await response2.blob()
|
|
17248
|
+
};
|
|
17249
|
+
} catch (error48) {
|
|
17250
|
+
if (error48 instanceof Error && error48.name === "AbortError") {
|
|
17251
|
+
if (isTimeout()) return {
|
|
17252
|
+
ok: false,
|
|
17253
|
+
error: createTimeoutError()
|
|
17254
|
+
};
|
|
17255
|
+
return {
|
|
17256
|
+
ok: false,
|
|
17257
|
+
error: createAbortError()
|
|
17258
|
+
};
|
|
17259
|
+
}
|
|
17260
|
+
return {
|
|
17261
|
+
ok: false,
|
|
17262
|
+
error: createNetworkError(error48)
|
|
17263
|
+
};
|
|
17264
|
+
} finally {
|
|
17265
|
+
cleanup();
|
|
17266
|
+
}
|
|
17267
|
+
}
|
|
17268
|
+
async function requestStream(path, options) {
|
|
17269
|
+
const { signal, cleanup, isTimeout } = createTimeoutSignal(options?.signal);
|
|
17270
|
+
try {
|
|
17271
|
+
const response2 = await fetch(buildUrl(path), {
|
|
17272
|
+
method: "GET",
|
|
17273
|
+
headers: buildHeaders(),
|
|
17274
|
+
signal,
|
|
17275
|
+
credentials: getCredentials()
|
|
17276
|
+
});
|
|
17277
|
+
if (!response2.ok) {
|
|
17278
|
+
cleanup();
|
|
17279
|
+
return handleHttpError(response2);
|
|
17280
|
+
}
|
|
17281
|
+
if (!response2.body) {
|
|
17282
|
+
cleanup();
|
|
17283
|
+
return {
|
|
17284
|
+
ok: false,
|
|
17285
|
+
error: createNetworkError(/* @__PURE__ */ new Error("Response body is null"))
|
|
17286
|
+
};
|
|
17287
|
+
}
|
|
17288
|
+
cleanup();
|
|
17289
|
+
const idleTimeout = options?.streamIdleTimeout ?? timeout;
|
|
17290
|
+
return {
|
|
17291
|
+
ok: true,
|
|
17292
|
+
data: wrapStreamWithIdleTimeout(response2.body, idleTimeout, options?.signal)
|
|
17293
|
+
};
|
|
17294
|
+
} catch (error48) {
|
|
17295
|
+
cleanup();
|
|
17296
|
+
if (error48 instanceof Error && error48.name === "AbortError") {
|
|
17297
|
+
if (isTimeout()) return {
|
|
17298
|
+
ok: false,
|
|
17299
|
+
error: createTimeoutError()
|
|
17300
|
+
};
|
|
17301
|
+
return {
|
|
17302
|
+
ok: false,
|
|
17303
|
+
error: createAbortError()
|
|
17304
|
+
};
|
|
17305
|
+
}
|
|
17306
|
+
return {
|
|
17307
|
+
ok: false,
|
|
17308
|
+
error: createNetworkError(error48)
|
|
17309
|
+
};
|
|
17310
|
+
}
|
|
17311
|
+
}
|
|
17312
|
+
async function requestNoContent(method, path, options) {
|
|
17313
|
+
const { signal, cleanup, isTimeout } = createTimeoutSignal(options?.signal);
|
|
17314
|
+
try {
|
|
17315
|
+
const response2 = await fetch(buildUrl(path), {
|
|
17316
|
+
method,
|
|
17317
|
+
headers: buildHeaders(),
|
|
17318
|
+
signal,
|
|
17319
|
+
credentials: getCredentials()
|
|
17320
|
+
});
|
|
17321
|
+
if (!response2.ok) return handleHttpError(response2);
|
|
17322
|
+
return {
|
|
17323
|
+
ok: true,
|
|
17324
|
+
data: void 0
|
|
17325
|
+
};
|
|
17326
|
+
} catch (error48) {
|
|
17327
|
+
if (error48 instanceof Error && error48.name === "AbortError") {
|
|
17328
|
+
if (isTimeout()) return {
|
|
17329
|
+
ok: false,
|
|
17330
|
+
error: createTimeoutError()
|
|
17331
|
+
};
|
|
17332
|
+
return {
|
|
17333
|
+
ok: false,
|
|
17334
|
+
error: createAbortError()
|
|
17335
|
+
};
|
|
17336
|
+
}
|
|
17337
|
+
return {
|
|
17338
|
+
ok: false,
|
|
17339
|
+
error: createNetworkError(error48)
|
|
17340
|
+
};
|
|
17341
|
+
} finally {
|
|
17342
|
+
cleanup();
|
|
17343
|
+
}
|
|
17344
|
+
}
|
|
17345
|
+
return {
|
|
17346
|
+
get: (path, options) => request2("GET", path, void 0, options),
|
|
17347
|
+
post: (path, body, options) => request2("POST", path, body, options),
|
|
17348
|
+
put: (path, body, options) => request2("PUT", path, body, options),
|
|
17349
|
+
delete: (path, options) => request2("DELETE", path, void 0, options),
|
|
17350
|
+
deleteNoContent: (path, options) => requestNoContent("DELETE", path, options),
|
|
17351
|
+
getBlob: (path, options) => requestBlob(path, options),
|
|
17352
|
+
getStream: (path, options) => requestStream(path, options)
|
|
17353
|
+
};
|
|
17354
|
+
}
|
|
17355
|
+
function buildQueryString(params) {
|
|
17356
|
+
if (!params) return "";
|
|
17357
|
+
const searchParams = new URLSearchParams();
|
|
17358
|
+
for (const [key, value] of Object.entries(params)) if (value !== void 0) searchParams.set(key, String(value));
|
|
17359
|
+
const queryString = searchParams.toString();
|
|
17360
|
+
return queryString ? `?${queryString}` : "";
|
|
17361
|
+
}
|
|
17362
|
+
async function* parseSSEEvents(reader) {
|
|
17363
|
+
const decoder = new TextDecoder();
|
|
17364
|
+
let buffer = "";
|
|
17365
|
+
while (true) {
|
|
17366
|
+
const { value, done } = await reader.read();
|
|
17367
|
+
if (done) break;
|
|
17368
|
+
buffer += decoder.decode(value, { stream: true });
|
|
17369
|
+
const events = buffer.split("\n\n");
|
|
17370
|
+
buffer = events.pop() || "";
|
|
17371
|
+
for (const event of events) {
|
|
17372
|
+
if (event.trim() === "") continue;
|
|
17373
|
+
const lines = event.split("\n");
|
|
17374
|
+
const eventType = lines.find((line) => line.startsWith("event:"))?.slice(6).trim();
|
|
17375
|
+
const data = lines.find((line) => line.startsWith("data:"))?.slice(5).trim();
|
|
17376
|
+
if (!eventType || !data) continue;
|
|
17377
|
+
if (eventType !== "message" && eventType !== "error" && eventType !== "complete") continue;
|
|
17378
|
+
try {
|
|
17379
|
+
yield {
|
|
17380
|
+
event: eventType,
|
|
17381
|
+
data: JSON.parse(data)
|
|
17382
|
+
};
|
|
17383
|
+
} catch {
|
|
17384
|
+
}
|
|
17385
|
+
}
|
|
17386
|
+
}
|
|
17387
|
+
}
|
|
17388
|
+
var organizationNameRegex = /^[a-z0-9][a-z0-9_.-]*$/;
|
|
17389
|
+
var maxOrganizationNameLength = 128;
|
|
17390
|
+
var applicationNameRegex = /^[a-z0-9][a-z0-9_.-]*$/;
|
|
17391
|
+
var maxApplicationNameLength = 255;
|
|
17392
|
+
var maxVariableValueLength = 65536;
|
|
17393
|
+
var maxSecretValueLength = 65536;
|
|
17394
|
+
var expertKeyRegex2 = /^((?:@[a-z0-9][a-z0-9_.-]*\/)?[a-z0-9][a-z0-9_.-]*)(?:@((?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\w.-]+)?(?:\+[\w.-]+)?)|@([a-z0-9][a-z0-9_.-]*))?$/;
|
|
17395
|
+
var expertNameRegex2 = /^(@[a-z0-9][a-z0-9_-]*\/)?[a-z0-9][a-z0-9_-]*$/;
|
|
17396
|
+
var scopeNameRegex = /^[a-z0-9][a-z0-9_-]*$/;
|
|
17397
|
+
var scopeNameRefRegex = /^[a-z0-9][a-z0-9_-]*(?:@(?:(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\w.-]+)?(?:\+[\w.-]+)?|[a-z0-9][a-z0-9_-]*))?$/;
|
|
17398
|
+
var expertVersionRegex2 = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\w.-]+)?(?:\+[\w.-]+)?$/;
|
|
17399
|
+
var tagNameRegex2 = /^[a-z0-9][a-z0-9_-]*$/;
|
|
17400
|
+
var maxExpertNameLength2 = 255;
|
|
17401
|
+
var maxExpertVersionTagLength = 255;
|
|
17402
|
+
var maxExpertKeyLength = 511;
|
|
17403
|
+
var maxExpertDescriptionLength = 1024 * 2;
|
|
17404
|
+
var maxExpertInstructionLength = 1024 * 20;
|
|
17405
|
+
var maxExpertDelegateItems = 255;
|
|
17406
|
+
var maxExpertTagItems = 8;
|
|
17407
|
+
var maxExpertJobQueryLength = 1024 * 20;
|
|
17408
|
+
var packageWithVersionRegex = /^(?:@[a-z0-9][a-z0-9_.-]*\/)?[a-z0-9][a-z0-9_.-]*(?:@(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\w.-]+)?(?:\+[\w.-]+)?|@[a-z0-9][a-z0-9_.-]*)?$/;
|
|
17409
|
+
var urlSafeRegex = /^[a-z0-9][a-z0-9_-]*$/;
|
|
17410
|
+
var maxSkillNameLength2 = 255;
|
|
17411
|
+
var maxSkillDescriptionLength = 1024 * 2;
|
|
17412
|
+
var maxSkillRuleLength = 1024 * 2;
|
|
17413
|
+
var maxSkillPickOmitItems = 255;
|
|
17414
|
+
var maxSkillRequiredEnvItems = 255;
|
|
17415
|
+
var maxSkillToolNameLength2 = 255;
|
|
17416
|
+
var maxSkillEndpointLength = 1024 * 2;
|
|
17417
|
+
var maxSkillInputJsonSchemaLength = 1024 * 20;
|
|
17418
|
+
var maxCheckpointToolCallIdLength = 255;
|
|
17419
|
+
var envNameRegex = /^[a-zA-Z0-9][a-zA-Z0-9_-]*$/;
|
|
17420
|
+
var maxEnvNameLength = 255;
|
|
17421
|
+
var maxProviderBaseUrlLength = 2048;
|
|
17422
|
+
var maxProviderHeaderKeyLength = 255;
|
|
17423
|
+
var maxProviderHeaderValueLength = 2048;
|
|
17424
|
+
var maxProviderHeadersCount = 50;
|
|
17425
|
+
var cuidSchema = external_exports.string().cuid2();
|
|
17426
|
+
external_exports.string().min(24).cuid2();
|
|
17427
|
+
var runtimeVersionSchema2 = external_exports.enum(["v1.0"]);
|
|
17428
|
+
var providerSchema = external_exports.enum([
|
|
17429
|
+
"anthropic",
|
|
17430
|
+
"google",
|
|
17431
|
+
"openai",
|
|
17432
|
+
"deepseek",
|
|
17433
|
+
"azure-openai",
|
|
17434
|
+
"amazon-bedrock",
|
|
17435
|
+
"google-vertex"
|
|
17436
|
+
]);
|
|
17437
|
+
var datetimeSchema = external_exports.string().datetime({ offset: true });
|
|
17438
|
+
var expertKeyFieldSchema = external_exports.string().min(1).max(maxExpertKeyLength).regex(expertKeyRegex2);
|
|
17439
|
+
var expertNameFieldSchema = external_exports.string().min(1).max(maxExpertNameLength2).regex(expertNameRegex2);
|
|
17440
|
+
var expertVersionFieldSchema = external_exports.string().min(1).max(maxExpertVersionTagLength).regex(expertVersionRegex2);
|
|
17441
|
+
var expertTagFieldSchema = external_exports.string().min(1).max(maxExpertVersionTagLength).regex(tagNameRegex2);
|
|
17442
|
+
var expertCategoryFieldSchema = external_exports.enum([
|
|
17443
|
+
"general",
|
|
17444
|
+
"coding",
|
|
17445
|
+
"research",
|
|
17446
|
+
"writing",
|
|
17447
|
+
"data",
|
|
17448
|
+
"automation"
|
|
17449
|
+
]);
|
|
17450
|
+
var scopeNameSchema = external_exports.string().min(1).max(maxExpertNameLength2).regex(scopeNameRegex);
|
|
17451
|
+
external_exports.string().min(1).max(maxExpertNameLength2 + maxExpertVersionTagLength + 1).regex(scopeNameRefRegex);
|
|
17452
|
+
external_exports.string().min(1).max(30);
|
|
17453
|
+
var organizationStatusSchema = external_exports.enum([
|
|
17454
|
+
"active",
|
|
17455
|
+
"inactive",
|
|
17456
|
+
"deleted"
|
|
17457
|
+
]);
|
|
17458
|
+
var organizationTypeSchema = external_exports.enum([
|
|
17459
|
+
"personal",
|
|
17460
|
+
"personalPlus",
|
|
17461
|
+
"team",
|
|
17462
|
+
"serviceAdmin"
|
|
17463
|
+
]);
|
|
17464
|
+
var organizationSchema = external_exports.object({
|
|
17465
|
+
type: external_exports.literal("organization"),
|
|
17466
|
+
id: cuidSchema,
|
|
17467
|
+
createdAt: datetimeSchema,
|
|
17468
|
+
updatedAt: datetimeSchema,
|
|
17469
|
+
name: external_exports.string().min(1).max(maxOrganizationNameLength).regex(organizationNameRegex).optional(),
|
|
17470
|
+
nameChangedAt: datetimeSchema.optional(),
|
|
17471
|
+
status: organizationStatusSchema,
|
|
17472
|
+
organizationType: organizationTypeSchema,
|
|
17473
|
+
maxApplications: external_exports.number().int().min(0),
|
|
17474
|
+
maxApiKeys: external_exports.number().int().min(0),
|
|
17475
|
+
maxExperts: external_exports.number().int().min(0)
|
|
17476
|
+
});
|
|
17477
|
+
function dedent(templ, ...values) {
|
|
17478
|
+
let strings = Array.from(typeof templ === "string" ? [templ] : templ);
|
|
17479
|
+
const lastIndex = strings.length - 1;
|
|
17480
|
+
strings[lastIndex] = (strings[lastIndex] ?? "").replace(/\r?\n([\t ]*)$/, "");
|
|
17481
|
+
const indentLengths = strings.reduce((arr, str) => {
|
|
17482
|
+
const matches = str.match(/\n([\t ]+|(?!\s).)/g);
|
|
17483
|
+
if (matches) return arr.concat(matches.map((match) => match.match(/[\t ]/g)?.length ?? 0));
|
|
17484
|
+
return arr;
|
|
17485
|
+
}, []);
|
|
17486
|
+
if (indentLengths.length) {
|
|
17487
|
+
const pattern = new RegExp(`
|
|
17488
|
+
[ ]{${Math.min(...indentLengths)}}`, "g");
|
|
17489
|
+
strings = strings.map((str) => str.replace(pattern, "\n"));
|
|
17490
|
+
}
|
|
17491
|
+
strings[0] = (strings[0] ?? "").replace(/^\r?\n/, "");
|
|
17492
|
+
let string4 = strings[0] ?? "";
|
|
17493
|
+
values.forEach((value, i) => {
|
|
17494
|
+
const endentation = string4.match(/(?:^|\n)( *)$/)?.[1] ?? "";
|
|
17495
|
+
let indentedValue = value;
|
|
17496
|
+
if (typeof value === "string" && value.includes("\n")) indentedValue = String(value).split("\n").map((str, j) => {
|
|
17497
|
+
return j === 0 ? str : `${endentation}${str}`;
|
|
17498
|
+
}).join("\n");
|
|
17499
|
+
string4 += String(indentedValue) + (strings[i + 1] ?? "");
|
|
17500
|
+
});
|
|
17501
|
+
return string4;
|
|
17502
|
+
}
|
|
17503
|
+
external_exports.object({
|
|
17504
|
+
code: external_exports.literal(400),
|
|
17505
|
+
error: external_exports.literal("Bad Request"),
|
|
17506
|
+
reason: external_exports.string()
|
|
17507
|
+
}).describe("Bad Request");
|
|
17508
|
+
external_exports.object({
|
|
17509
|
+
code: external_exports.literal(401),
|
|
17510
|
+
error: external_exports.literal("Unauthorized"),
|
|
17511
|
+
reason: external_exports.literal("Failed to authenticate")
|
|
17512
|
+
}).describe(dedent`
|
|
17513
|
+
Authentication failed. Possible reasons:
|
|
17514
|
+
- Authorization header is not provided
|
|
17515
|
+
- Invalid API key
|
|
17516
|
+
- Session expired
|
|
17517
|
+
`);
|
|
17518
|
+
external_exports.object({
|
|
17519
|
+
code: external_exports.literal(403),
|
|
17520
|
+
error: external_exports.literal("Forbidden"),
|
|
17521
|
+
reason: external_exports.string()
|
|
17522
|
+
}).describe("Access denied. The authenticated user does not have permission to perform this action.");
|
|
17523
|
+
external_exports.object({
|
|
17524
|
+
code: external_exports.literal(403),
|
|
17525
|
+
error: external_exports.literal("Forbidden"),
|
|
17526
|
+
reason: external_exports.string(),
|
|
17527
|
+
details: external_exports.object({
|
|
17528
|
+
minutesUsed: external_exports.number(),
|
|
17529
|
+
limitMinutes: external_exports.number(),
|
|
17530
|
+
upgradeUrl: external_exports.string()
|
|
17531
|
+
})
|
|
17532
|
+
}).describe("Usage limit exceeded. Upgrade your plan to continue.");
|
|
17533
|
+
external_exports.object({
|
|
17534
|
+
code: external_exports.literal(404),
|
|
17535
|
+
error: external_exports.literal("Not Found"),
|
|
17536
|
+
reason: external_exports.string()
|
|
17537
|
+
}).describe("Resource not found.");
|
|
17538
|
+
external_exports.object({
|
|
17539
|
+
code: external_exports.literal(409),
|
|
17540
|
+
error: external_exports.literal("Conflict"),
|
|
17541
|
+
reason: external_exports.string()
|
|
17542
|
+
}).describe("Request conflicts with current state of the resource.");
|
|
17543
|
+
external_exports.object({
|
|
17544
|
+
code: external_exports.literal(503),
|
|
17545
|
+
error: external_exports.literal("Service Unavailable"),
|
|
17546
|
+
reason: external_exports.string()
|
|
17547
|
+
}).describe("Service temporarily unavailable. Retry with exponential backoff.");
|
|
17548
|
+
external_exports.object({
|
|
17549
|
+
code: external_exports.literal(422),
|
|
17550
|
+
error: external_exports.literal("Validation Failed"),
|
|
17551
|
+
reason: external_exports.unknown()
|
|
17552
|
+
}).describe("Request validation failed. Check the request body, query parameters, or path parameters.");
|
|
17553
|
+
var paginationMeta = external_exports.object({
|
|
17554
|
+
total: external_exports.number().int().min(0),
|
|
17555
|
+
take: external_exports.number().int().min(1),
|
|
17556
|
+
skip: external_exports.number().int().min(0)
|
|
17557
|
+
});
|
|
17558
|
+
external_exports.object({
|
|
17559
|
+
code: external_exports.literal(401),
|
|
17560
|
+
error: external_exports.literal("Unauthorized"),
|
|
17561
|
+
reason: external_exports.string()
|
|
17562
|
+
}).describe("Unauthorized");
|
|
17563
|
+
var applicationNameSchema = external_exports.string().min(1).max(maxApplicationNameLength).regex(applicationNameRegex);
|
|
17564
|
+
var applicationStatusSchema = external_exports.enum([
|
|
17565
|
+
"active",
|
|
17566
|
+
"inactive",
|
|
17567
|
+
"deleted"
|
|
17568
|
+
]);
|
|
17569
|
+
var applicationSchema = external_exports.object({
|
|
17570
|
+
type: external_exports.literal("application"),
|
|
17571
|
+
id: cuidSchema,
|
|
17572
|
+
organizationId: cuidSchema,
|
|
17573
|
+
organization: organizationSchema,
|
|
17574
|
+
createdAt: datetimeSchema,
|
|
17575
|
+
updatedAt: datetimeSchema,
|
|
17576
|
+
name: applicationNameSchema,
|
|
17577
|
+
status: applicationStatusSchema,
|
|
17578
|
+
expertCount: external_exports.number().describe("Number of expert draft scopes associated with this application").optional(),
|
|
17579
|
+
providers: external_exports.array(providerSchema).describe("List of configured providers for this application").optional(),
|
|
17580
|
+
totalJobs: external_exports.number().describe("Total number of jobs executed for this application").optional(),
|
|
17581
|
+
lastJobExecutionAt: external_exports.string().datetime({ offset: true }).nullable().describe("Timestamp of the most recent job execution").optional()
|
|
17582
|
+
});
|
|
17583
|
+
var request$17 = { body: external_exports.object({
|
|
17584
|
+
name: applicationNameSchema,
|
|
17585
|
+
applicationGroupId: cuidSchema.optional()
|
|
17586
|
+
}) };
|
|
17587
|
+
external_exports.object({ data: external_exports.object({ application: applicationSchema }) });
|
|
17588
|
+
var request$16 = { query: external_exports.object({
|
|
17589
|
+
name: external_exports.preprocess((val) => Array.isArray(val) ? val.join(",") : val, external_exports.string().optional()),
|
|
17590
|
+
sort: external_exports.enum([
|
|
17591
|
+
"name",
|
|
17592
|
+
"createdAt",
|
|
17593
|
+
"updatedAt"
|
|
17594
|
+
]).optional(),
|
|
17595
|
+
order: external_exports.enum(["asc", "desc"]).optional(),
|
|
17596
|
+
take: external_exports.coerce.number().min(1).max(100).default(20),
|
|
17597
|
+
skip: external_exports.coerce.number().min(0).default(0)
|
|
17598
|
+
}) };
|
|
17599
|
+
external_exports.object({
|
|
17600
|
+
data: external_exports.object({ applications: external_exports.array(applicationSchema) }),
|
|
17601
|
+
meta: paginationMeta
|
|
17602
|
+
});
|
|
17603
|
+
var request$15 = {
|
|
17604
|
+
params: external_exports.object({ applicationId: cuidSchema }),
|
|
17605
|
+
body: external_exports.object({
|
|
17606
|
+
name: applicationNameSchema.optional(),
|
|
17607
|
+
status: applicationStatusSchema.exclude(["deleted"]).optional()
|
|
17608
|
+
}).refine((data) => data.name !== void 0 || data.status !== void 0, { message: "At least one field must be provided" })
|
|
17609
|
+
};
|
|
17610
|
+
external_exports.object({ data: external_exports.object({ application: applicationSchema }) });
|
|
17611
|
+
var secretNameSchema = external_exports.string().min(1, "Secret name is required").max(255, "Secret name must be 255 characters or less").regex(/^[A-Z][A-Z0-9_]*$/, "Secret name must start with uppercase letter and contain only uppercase letters, numbers, and underscores");
|
|
17612
|
+
var secretValueSchema = external_exports.string().min(1, "Secret value is required").max(maxSecretValueLength);
|
|
17613
|
+
var secretMetadataSchema = external_exports.object({
|
|
17614
|
+
name: external_exports.string(),
|
|
17615
|
+
createdAt: datetimeSchema,
|
|
17616
|
+
updatedAt: datetimeSchema
|
|
17617
|
+
});
|
|
17618
|
+
external_exports.object({
|
|
17619
|
+
type: external_exports.literal("secret"),
|
|
17620
|
+
id: cuidSchema,
|
|
17621
|
+
name: secretNameSchema,
|
|
17622
|
+
applicationId: cuidSchema,
|
|
17623
|
+
createdAt: datetimeSchema,
|
|
17624
|
+
updatedAt: datetimeSchema
|
|
17625
|
+
});
|
|
17626
|
+
var request$14 = { body: external_exports.object({
|
|
17627
|
+
applicationId: cuidSchema,
|
|
17628
|
+
name: secretNameSchema,
|
|
17629
|
+
value: secretValueSchema
|
|
17630
|
+
}) };
|
|
17631
|
+
external_exports.object({ data: external_exports.object({ secret: secretMetadataSchema }) });
|
|
17632
|
+
var request$13 = { query: external_exports.object({ applicationId: cuidSchema.optional() }) };
|
|
17633
|
+
external_exports.object({ data: external_exports.object({ secrets: external_exports.array(secretMetadataSchema) }) });
|
|
17634
|
+
var request$12 = {
|
|
17635
|
+
params: external_exports.object({ name: external_exports.string().min(1) }),
|
|
17636
|
+
body: external_exports.object({
|
|
17637
|
+
applicationId: cuidSchema,
|
|
17638
|
+
value: secretValueSchema
|
|
17639
|
+
})
|
|
17640
|
+
};
|
|
17641
|
+
external_exports.object({ data: external_exports.object({ secret: secretMetadataSchema }) });
|
|
17642
|
+
var variableNameSchema = external_exports.string().min(1).max(255).regex(/^[A-Z][A-Z0-9_]*$/, "Variable name must start with uppercase letter and contain only uppercase letters, digits, and underscores");
|
|
17643
|
+
var variableValueSchema = external_exports.string().max(maxVariableValueLength);
|
|
17644
|
+
external_exports.object({
|
|
17645
|
+
type: external_exports.literal("variable"),
|
|
17646
|
+
id: cuidSchema,
|
|
17647
|
+
applicationId: cuidSchema,
|
|
17648
|
+
createdAt: datetimeSchema,
|
|
17649
|
+
updatedAt: datetimeSchema,
|
|
17650
|
+
name: variableNameSchema,
|
|
17651
|
+
value: variableValueSchema
|
|
17652
|
+
});
|
|
17653
|
+
var variableResponseSchema = external_exports.object({
|
|
17654
|
+
name: variableNameSchema,
|
|
17655
|
+
value: variableValueSchema,
|
|
17656
|
+
createdAt: datetimeSchema,
|
|
17657
|
+
updatedAt: datetimeSchema
|
|
17658
|
+
});
|
|
17659
|
+
var request$11 = { body: external_exports.object({
|
|
17660
|
+
applicationId: cuidSchema,
|
|
17661
|
+
name: variableNameSchema,
|
|
17662
|
+
value: variableValueSchema
|
|
17663
|
+
}) };
|
|
17664
|
+
external_exports.object({ data: external_exports.object({ variable: variableResponseSchema }) });
|
|
17665
|
+
var request$10 = { query: external_exports.object({ applicationId: cuidSchema }) };
|
|
17666
|
+
external_exports.object({ data: external_exports.object({ variables: external_exports.array(variableResponseSchema) }) });
|
|
17667
|
+
var request$9 = {
|
|
17668
|
+
params: external_exports.object({ name: external_exports.string().min(1) }),
|
|
17669
|
+
body: external_exports.object({
|
|
17670
|
+
applicationId: cuidSchema,
|
|
17671
|
+
value: variableValueSchema
|
|
17672
|
+
})
|
|
17673
|
+
};
|
|
17674
|
+
external_exports.object({ data: external_exports.object({ variable: variableResponseSchema }) });
|
|
17675
|
+
var expertScopeSchema = external_exports.object({
|
|
17676
|
+
id: cuidSchema,
|
|
17677
|
+
name: scopeNameSchema,
|
|
17678
|
+
organizationId: cuidSchema,
|
|
17679
|
+
expertDraftScopeId: cuidSchema,
|
|
17680
|
+
published: external_exports.boolean(),
|
|
17681
|
+
publishedAt: datetimeSchema.nullable(),
|
|
17682
|
+
category: expertCategoryFieldSchema,
|
|
17683
|
+
totalRuns: external_exports.number().int().min(0),
|
|
17684
|
+
totalJobs: external_exports.number().int().min(0),
|
|
17685
|
+
totalStars: external_exports.number().int().min(0),
|
|
17686
|
+
createdAt: datetimeSchema,
|
|
17687
|
+
updatedAt: datetimeSchema,
|
|
17688
|
+
createdBy: cuidSchema,
|
|
17689
|
+
updatedBy: cuidSchema
|
|
17690
|
+
});
|
|
17691
|
+
var expertVersionSchema = external_exports.object({
|
|
17692
|
+
id: cuidSchema,
|
|
17693
|
+
expertScopeId: cuidSchema,
|
|
17694
|
+
version: expertVersionFieldSchema,
|
|
17695
|
+
public: external_exports.boolean(),
|
|
17696
|
+
yanked: external_exports.boolean(),
|
|
17697
|
+
totalRuns: external_exports.number().int().min(0),
|
|
17698
|
+
totalJobs: external_exports.number().int().min(0),
|
|
17699
|
+
createdAt: datetimeSchema,
|
|
17700
|
+
updatedAt: datetimeSchema,
|
|
17701
|
+
createdBy: cuidSchema,
|
|
17702
|
+
updatedBy: cuidSchema,
|
|
17703
|
+
tags: external_exports.array(expertTagFieldSchema),
|
|
17704
|
+
readmeUrl: external_exports.string().optional()
|
|
17705
|
+
});
|
|
17706
|
+
expertScopeSchema.extend({ versions: external_exports.array(expertVersionSchema) });
|
|
17707
|
+
function isPrivateOrLocalIP2(hostname3) {
|
|
17708
|
+
if (hostname3 === "localhost" || hostname3 === "127.0.0.1" || hostname3 === "::1" || hostname3 === "0.0.0.0") return true;
|
|
17709
|
+
const ipv4Match = hostname3.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/);
|
|
17710
|
+
if (ipv4Match) {
|
|
17711
|
+
const a = Number(ipv4Match[1]);
|
|
17712
|
+
const b = Number(ipv4Match[2]);
|
|
17713
|
+
if (a === 10) return true;
|
|
17714
|
+
if (a === 172 && b >= 16 && b <= 31) return true;
|
|
17715
|
+
if (a === 192 && b === 168) return true;
|
|
17716
|
+
if (a === 169 && b === 254) return true;
|
|
17717
|
+
if (a === 127) return true;
|
|
17718
|
+
}
|
|
17719
|
+
if (hostname3.includes(":")) {
|
|
17720
|
+
if (hostname3.startsWith("fe80:") || hostname3.startsWith("fc") || hostname3.startsWith("fd")) return true;
|
|
17721
|
+
}
|
|
17722
|
+
if (hostname3.startsWith("::ffff:")) {
|
|
17723
|
+
if (isPrivateOrLocalIP2(hostname3.slice(7))) return true;
|
|
17724
|
+
}
|
|
17725
|
+
return false;
|
|
17726
|
+
}
|
|
17727
|
+
var sseEndpointSchema3 = external_exports.string().max(maxSkillEndpointLength).url().refine((url2) => {
|
|
17728
|
+
try {
|
|
17729
|
+
const parsed = new URL(url2);
|
|
17730
|
+
if (parsed.protocol !== "https:") return false;
|
|
17731
|
+
if (isPrivateOrLocalIP2(parsed.hostname)) return false;
|
|
17732
|
+
return true;
|
|
17733
|
+
} catch {
|
|
17734
|
+
return false;
|
|
17735
|
+
}
|
|
17736
|
+
}, { message: "Endpoint must be a public HTTPS URL" });
|
|
17737
|
+
var skillNameSchema = external_exports.string().min(1).max(maxSkillNameLength2).regex(packageWithVersionRegex);
|
|
17738
|
+
var mcpStdioSkillCommandSchema = external_exports.enum(["npx", "uvx"]);
|
|
17739
|
+
var mcpStdioSkillSchema2 = external_exports.object({
|
|
17740
|
+
type: external_exports.literal("mcpStdioSkill"),
|
|
17741
|
+
name: external_exports.string().min(1),
|
|
17742
|
+
description: external_exports.string().min(1).max(maxSkillDescriptionLength),
|
|
17743
|
+
rule: external_exports.string().min(1).max(maxSkillRuleLength).optional(),
|
|
17744
|
+
pick: external_exports.array(external_exports.string().min(1).max(maxSkillToolNameLength2)).max(maxSkillPickOmitItems).optional().default([]),
|
|
17745
|
+
omit: external_exports.array(external_exports.string().min(1).max(maxSkillToolNameLength2)).max(maxSkillPickOmitItems).optional().default([]),
|
|
17746
|
+
command: mcpStdioSkillCommandSchema,
|
|
17747
|
+
packageName: external_exports.string().min(1).max(maxSkillNameLength2).regex(packageWithVersionRegex),
|
|
17748
|
+
requiredEnv: external_exports.array(external_exports.string().min(1).max(maxEnvNameLength).regex(envNameRegex)).max(maxSkillRequiredEnvItems).optional().default([])
|
|
17749
|
+
});
|
|
17750
|
+
var mcpSseSkillSchema2 = external_exports.object({
|
|
17751
|
+
type: external_exports.literal("mcpSseSkill"),
|
|
17752
|
+
name: external_exports.string().min(1),
|
|
17753
|
+
description: external_exports.string().min(1).max(maxSkillDescriptionLength),
|
|
17754
|
+
rule: external_exports.string().min(1).max(maxSkillRuleLength).optional(),
|
|
17755
|
+
pick: external_exports.array(external_exports.string().min(1).max(maxSkillToolNameLength2)).max(maxSkillPickOmitItems).optional().default([]),
|
|
17756
|
+
omit: external_exports.array(external_exports.string().min(1).max(maxSkillToolNameLength2)).max(maxSkillPickOmitItems).optional().default([]),
|
|
17757
|
+
endpoint: sseEndpointSchema3
|
|
17758
|
+
});
|
|
17759
|
+
var interactiveSkillSchema2 = external_exports.object({
|
|
17760
|
+
type: external_exports.literal("interactiveSkill"),
|
|
17761
|
+
name: external_exports.string().min(1),
|
|
17762
|
+
description: external_exports.string().min(1).max(maxSkillDescriptionLength),
|
|
17763
|
+
rule: external_exports.string().min(1).max(maxSkillRuleLength).optional(),
|
|
17764
|
+
tools: external_exports.record(external_exports.string().min(1).max(maxSkillToolNameLength2).regex(urlSafeRegex), external_exports.object({
|
|
17765
|
+
description: external_exports.string().min(1).max(maxSkillDescriptionLength),
|
|
17766
|
+
inputJsonSchema: external_exports.string().min(1).max(maxSkillInputJsonSchemaLength)
|
|
17767
|
+
}))
|
|
17768
|
+
});
|
|
17769
|
+
var skillSchema2 = external_exports.discriminatedUnion("type", [
|
|
17770
|
+
mcpStdioSkillSchema2,
|
|
17771
|
+
mcpSseSkillSchema2,
|
|
17772
|
+
interactiveSkillSchema2
|
|
17773
|
+
]);
|
|
17774
|
+
var expertSchema2 = external_exports.object({
|
|
17775
|
+
key: expertKeyFieldSchema,
|
|
17776
|
+
name: expertNameFieldSchema,
|
|
17777
|
+
version: expertVersionFieldSchema,
|
|
17778
|
+
description: external_exports.string().max(maxExpertDescriptionLength).optional(),
|
|
17779
|
+
instruction: external_exports.string().min(1).max(maxExpertInstructionLength),
|
|
17780
|
+
skills: external_exports.record(skillNameSchema, skillSchema2).optional().default({}),
|
|
17781
|
+
delegates: external_exports.array(expertKeyFieldSchema).min(0).max(maxExpertDelegateItems).optional().default([]),
|
|
17782
|
+
tags: external_exports.array(expertTagFieldSchema).min(0).max(maxExpertTagItems).optional().default([]),
|
|
17783
|
+
minRuntimeVersion: runtimeVersionSchema2.optional()
|
|
17784
|
+
});
|
|
17785
|
+
external_exports.object({
|
|
17786
|
+
scope: expertScopeSchema,
|
|
17787
|
+
version: expertVersionSchema
|
|
17788
|
+
});
|
|
17789
|
+
var expertWithMetadataSchema = expertSchema2.extend({
|
|
17790
|
+
scope: expertScopeSchema,
|
|
17791
|
+
version: expertVersionSchema
|
|
17792
|
+
});
|
|
17793
|
+
var request$8 = { query: external_exports.object({
|
|
17794
|
+
filter: external_exports.string().describe("Filter by scope name (partial match)").optional(),
|
|
17795
|
+
category: external_exports.enum([
|
|
17796
|
+
"general",
|
|
17797
|
+
"coding",
|
|
17798
|
+
"research",
|
|
17799
|
+
"writing",
|
|
17800
|
+
"data",
|
|
17801
|
+
"automation"
|
|
17802
|
+
]).describe("Filter by category").optional(),
|
|
17803
|
+
includeDrafts: external_exports.coerce.boolean().default(false).describe("Include unpublished scopes (owner only)").optional(),
|
|
17804
|
+
take: external_exports.coerce.number().min(1).max(100).default(20),
|
|
17805
|
+
skip: external_exports.coerce.number().min(0).default(0)
|
|
17806
|
+
}) };
|
|
17807
|
+
external_exports.object({
|
|
17808
|
+
data: external_exports.object({ experts: external_exports.array(expertScopeSchema.extend({ currentVersion: expertVersionSchema.nullable() })) }),
|
|
17809
|
+
meta: paginationMeta
|
|
17810
|
+
});
|
|
17811
|
+
var anthropicSupportModels = [
|
|
17812
|
+
{
|
|
17813
|
+
modelId: "claude-opus-4-5",
|
|
17814
|
+
default: false,
|
|
17815
|
+
provider: "anthropic",
|
|
17816
|
+
contextWindow: 2e5
|
|
17817
|
+
},
|
|
17818
|
+
{
|
|
17819
|
+
modelId: "claude-opus-4-1",
|
|
17820
|
+
default: false,
|
|
17821
|
+
provider: "anthropic",
|
|
17822
|
+
contextWindow: 2e5
|
|
17823
|
+
},
|
|
17824
|
+
{
|
|
17825
|
+
modelId: "claude-opus-4-20250514",
|
|
17826
|
+
default: false,
|
|
17827
|
+
provider: "anthropic",
|
|
17828
|
+
contextWindow: 2e5
|
|
16709
17829
|
},
|
|
16710
17830
|
{
|
|
17831
|
+
modelId: "claude-sonnet-4-5",
|
|
17832
|
+
default: true,
|
|
17833
|
+
provider: "anthropic",
|
|
17834
|
+
contextWindow: 2e5
|
|
17835
|
+
},
|
|
17836
|
+
{
|
|
17837
|
+
modelId: "claude-sonnet-4-20250514",
|
|
17838
|
+
default: false,
|
|
17839
|
+
provider: "anthropic",
|
|
17840
|
+
contextWindow: 2e5
|
|
17841
|
+
},
|
|
17842
|
+
{
|
|
17843
|
+
modelId: "claude-3-7-sonnet-20250219",
|
|
17844
|
+
default: false,
|
|
17845
|
+
provider: "anthropic",
|
|
17846
|
+
contextWindow: 2e5
|
|
17847
|
+
},
|
|
17848
|
+
{
|
|
17849
|
+
modelId: "claude-haiku-4-5",
|
|
17850
|
+
default: false,
|
|
17851
|
+
provider: "anthropic",
|
|
17852
|
+
contextWindow: 2e5
|
|
17853
|
+
},
|
|
17854
|
+
{
|
|
17855
|
+
modelId: "claude-3-5-haiku-latest",
|
|
17856
|
+
default: false,
|
|
17857
|
+
provider: "anthropic",
|
|
17858
|
+
contextWindow: 2e5
|
|
17859
|
+
}
|
|
17860
|
+
];
|
|
17861
|
+
var googleSupportModels = [
|
|
17862
|
+
{
|
|
17863
|
+
modelId: "gemini-3-pro-preview",
|
|
17864
|
+
default: false,
|
|
16711
17865
|
provider: "google",
|
|
16712
|
-
|
|
16713
|
-
// https://ai.google.dev/gemini-api/docs/models#gemini-3-pro
|
|
16714
|
-
{
|
|
16715
|
-
name: "gemini-3-pro-preview",
|
|
16716
|
-
contextWindow: 1048576,
|
|
16717
|
-
maxOutputTokens: 65536
|
|
16718
|
-
},
|
|
16719
|
-
// https://ai.google.dev/gemini-api/docs/models#gemini-2.5-pro
|
|
16720
|
-
{
|
|
16721
|
-
name: "gemini-2.5-pro",
|
|
16722
|
-
contextWindow: 1048576,
|
|
16723
|
-
maxOutputTokens: 65536
|
|
16724
|
-
},
|
|
16725
|
-
// https://ai.google.dev/gemini-api/docs/models#gemini-2.5-flash
|
|
16726
|
-
{
|
|
16727
|
-
name: "gemini-2.5-flash",
|
|
16728
|
-
contextWindow: 1048576,
|
|
16729
|
-
maxOutputTokens: 65536
|
|
16730
|
-
},
|
|
16731
|
-
// https://ai.google.dev/gemini-api/docs/models#gemini-2.5-flash-lite
|
|
16732
|
-
{
|
|
16733
|
-
name: "gemini-2.5-flash-lite",
|
|
16734
|
-
contextWindow: 1048576,
|
|
16735
|
-
maxOutputTokens: 65536
|
|
16736
|
-
}
|
|
16737
|
-
]
|
|
17866
|
+
contextWindow: 1e6
|
|
16738
17867
|
},
|
|
16739
17868
|
{
|
|
17869
|
+
modelId: "gemini-2.5-pro",
|
|
17870
|
+
default: true,
|
|
17871
|
+
provider: "google",
|
|
17872
|
+
contextWindow: 1e6
|
|
17873
|
+
},
|
|
17874
|
+
{
|
|
17875
|
+
modelId: "gemini-2.5-flash",
|
|
17876
|
+
default: false,
|
|
17877
|
+
provider: "google",
|
|
17878
|
+
contextWindow: 1e6
|
|
17879
|
+
},
|
|
17880
|
+
{
|
|
17881
|
+
modelId: "gemini-2.5-flash-lite",
|
|
17882
|
+
default: false,
|
|
17883
|
+
provider: "google",
|
|
17884
|
+
contextWindow: 1e6
|
|
17885
|
+
}
|
|
17886
|
+
];
|
|
17887
|
+
var openAiSupportModels = [
|
|
17888
|
+
{
|
|
17889
|
+
modelId: "gpt-5",
|
|
17890
|
+
default: true,
|
|
16740
17891
|
provider: "openai",
|
|
16741
|
-
|
|
16742
|
-
// https://platform.openai.com/docs/models/gpt-5
|
|
16743
|
-
{
|
|
16744
|
-
name: "gpt-5",
|
|
16745
|
-
contextWindow: 4e5,
|
|
16746
|
-
maxOutputTokens: 128e3
|
|
16747
|
-
},
|
|
16748
|
-
// https://platform.openai.com/docs/models/gpt-5-mini
|
|
16749
|
-
{
|
|
16750
|
-
name: "gpt-5-mini",
|
|
16751
|
-
contextWindow: 4e5,
|
|
16752
|
-
maxOutputTokens: 128e3
|
|
16753
|
-
},
|
|
16754
|
-
// https://platform.openai.com/docs/models/gpt-5-nano
|
|
16755
|
-
{
|
|
16756
|
-
name: "gpt-5-nano",
|
|
16757
|
-
contextWindow: 4e5,
|
|
16758
|
-
maxOutputTokens: 128e3
|
|
16759
|
-
},
|
|
16760
|
-
// https://platform.openai.com/docs/models/gpt-5-chat-latest
|
|
16761
|
-
{
|
|
16762
|
-
name: "gpt-5-chat-latest",
|
|
16763
|
-
contextWindow: 128e3,
|
|
16764
|
-
maxOutputTokens: 16384
|
|
16765
|
-
},
|
|
16766
|
-
// https://platform.openai.com/docs/models/o4-mini
|
|
16767
|
-
{
|
|
16768
|
-
name: "o4-mini",
|
|
16769
|
-
contextWindow: 2e5,
|
|
16770
|
-
maxOutputTokens: 1e5
|
|
16771
|
-
},
|
|
16772
|
-
// https://platform.openai.com/docs/models/o3
|
|
16773
|
-
{
|
|
16774
|
-
name: "o3",
|
|
16775
|
-
contextWindow: 2e5,
|
|
16776
|
-
maxOutputTokens: 1e4
|
|
16777
|
-
},
|
|
16778
|
-
// https://platform.openai.com/docs/models/o3-mini
|
|
16779
|
-
{
|
|
16780
|
-
name: "o3-mini",
|
|
16781
|
-
contextWindow: 2e5,
|
|
16782
|
-
maxOutputTokens: 1e4
|
|
16783
|
-
},
|
|
16784
|
-
// https://platform.openai.com/docs/models/gpt-4.1
|
|
16785
|
-
{
|
|
16786
|
-
name: "gpt-4.1",
|
|
16787
|
-
contextWindow: 1047576,
|
|
16788
|
-
maxOutputTokens: 32768
|
|
16789
|
-
}
|
|
16790
|
-
]
|
|
17892
|
+
contextWindow: 4e5
|
|
16791
17893
|
},
|
|
16792
17894
|
{
|
|
16793
|
-
|
|
16794
|
-
|
|
16795
|
-
|
|
16796
|
-
|
|
16797
|
-
contextWindow: 128e3,
|
|
16798
|
-
maxOutputTokens: 8192
|
|
16799
|
-
},
|
|
16800
|
-
{
|
|
16801
|
-
name: "deepseek-reasoner",
|
|
16802
|
-
contextWindow: 128e3,
|
|
16803
|
-
maxOutputTokens: 64e3
|
|
16804
|
-
}
|
|
16805
|
-
]
|
|
17895
|
+
modelId: "gpt-5-mini",
|
|
17896
|
+
default: false,
|
|
17897
|
+
provider: "openai",
|
|
17898
|
+
contextWindow: 4e5
|
|
16806
17899
|
},
|
|
16807
17900
|
{
|
|
16808
|
-
|
|
16809
|
-
|
|
16810
|
-
|
|
16811
|
-
|
|
16812
|
-
|
|
16813
|
-
|
|
16814
|
-
|
|
16815
|
-
|
|
16816
|
-
|
|
16817
|
-
|
|
16818
|
-
|
|
16819
|
-
|
|
16820
|
-
|
|
16821
|
-
|
|
16822
|
-
|
|
16823
|
-
|
|
16824
|
-
|
|
16825
|
-
|
|
16826
|
-
|
|
16827
|
-
|
|
16828
|
-
|
|
16829
|
-
|
|
16830
|
-
|
|
16831
|
-
|
|
16832
|
-
|
|
16833
|
-
|
|
16834
|
-
|
|
16835
|
-
|
|
16836
|
-
|
|
16837
|
-
|
|
16838
|
-
|
|
16839
|
-
|
|
16840
|
-
|
|
16841
|
-
|
|
16842
|
-
name: "gemma3:27b",
|
|
16843
|
-
contextWindow: 128e3,
|
|
16844
|
-
maxOutputTokens: 128e3
|
|
16845
|
-
}
|
|
16846
|
-
]
|
|
17901
|
+
modelId: "gpt-5-nano",
|
|
17902
|
+
default: false,
|
|
17903
|
+
provider: "openai",
|
|
17904
|
+
contextWindow: 4e5
|
|
17905
|
+
},
|
|
17906
|
+
{
|
|
17907
|
+
modelId: "gpt-5-chat-latest",
|
|
17908
|
+
default: false,
|
|
17909
|
+
provider: "openai",
|
|
17910
|
+
contextWindow: 128e3
|
|
17911
|
+
},
|
|
17912
|
+
{
|
|
17913
|
+
modelId: "o4-mini",
|
|
17914
|
+
default: false,
|
|
17915
|
+
provider: "openai",
|
|
17916
|
+
contextWindow: 2e5
|
|
17917
|
+
},
|
|
17918
|
+
{
|
|
17919
|
+
modelId: "o3",
|
|
17920
|
+
default: false,
|
|
17921
|
+
provider: "openai",
|
|
17922
|
+
contextWindow: 2e5
|
|
17923
|
+
},
|
|
17924
|
+
{
|
|
17925
|
+
modelId: "o3-mini",
|
|
17926
|
+
default: false,
|
|
17927
|
+
provider: "openai",
|
|
17928
|
+
contextWindow: 2e5
|
|
17929
|
+
},
|
|
17930
|
+
{
|
|
17931
|
+
modelId: "gpt-4.1",
|
|
17932
|
+
default: false,
|
|
17933
|
+
provider: "openai",
|
|
17934
|
+
contextWindow: 1e6
|
|
16847
17935
|
}
|
|
16848
17936
|
];
|
|
16849
|
-
|
|
16850
|
-
|
|
16851
|
-
|
|
16852
|
-
"
|
|
17937
|
+
var deepseekSupportModels = [{
|
|
17938
|
+
modelId: "deepseek-chat",
|
|
17939
|
+
default: true,
|
|
17940
|
+
provider: "deepseek",
|
|
17941
|
+
contextWindow: 128e3
|
|
17942
|
+
}, {
|
|
17943
|
+
modelId: "deepseek-reasoner",
|
|
17944
|
+
default: false,
|
|
17945
|
+
provider: "deepseek",
|
|
17946
|
+
contextWindow: 128e3
|
|
17947
|
+
}];
|
|
17948
|
+
var allSupportModels = [
|
|
17949
|
+
...anthropicSupportModels,
|
|
17950
|
+
...googleSupportModels,
|
|
17951
|
+
...openAiSupportModels,
|
|
17952
|
+
...deepseekSupportModels
|
|
17953
|
+
];
|
|
17954
|
+
var supportModels = Object.fromEntries(allSupportModels.map((model) => [model.modelId, model]));
|
|
17955
|
+
function getSupportModelNames() {
|
|
17956
|
+
return Object.keys(supportModels);
|
|
17957
|
+
}
|
|
17958
|
+
var reasoningBudgetSchema2 = external_exports.union([external_exports.enum([
|
|
17959
|
+
"none",
|
|
17960
|
+
"minimal",
|
|
17961
|
+
"low",
|
|
17962
|
+
"medium",
|
|
17963
|
+
"high"
|
|
17964
|
+
]), external_exports.number().int().min(0)]);
|
|
17965
|
+
var jobStatusSchema2 = external_exports.enum([
|
|
17966
|
+
"queued",
|
|
17967
|
+
"processing",
|
|
16853
17968
|
"completed",
|
|
16854
|
-
"
|
|
16855
|
-
"
|
|
16856
|
-
"
|
|
16857
|
-
"
|
|
17969
|
+
"requestInteractiveToolResult",
|
|
17970
|
+
"requestDelegateResult",
|
|
17971
|
+
"exceededMaxSteps",
|
|
17972
|
+
"failed",
|
|
17973
|
+
"canceling",
|
|
17974
|
+
"canceled",
|
|
17975
|
+
"expired"
|
|
16858
17976
|
]);
|
|
16859
|
-
var
|
|
16860
|
-
|
|
16861
|
-
|
|
16862
|
-
|
|
16863
|
-
|
|
16864
|
-
|
|
16865
|
-
|
|
17977
|
+
var modelNames = getSupportModelNames();
|
|
17978
|
+
var firstModel = modelNames[0];
|
|
17979
|
+
if (firstModel === void 0) throw new Error("No support models available");
|
|
17980
|
+
var jobModelSchema = external_exports.enum([firstModel, ...modelNames.slice(1)]);
|
|
17981
|
+
var jobBaseSchema = external_exports.object({
|
|
17982
|
+
type: external_exports.literal("job"),
|
|
17983
|
+
id: cuidSchema,
|
|
17984
|
+
organizationId: cuidSchema,
|
|
17985
|
+
applicationId: cuidSchema,
|
|
17986
|
+
createdAt: datetimeSchema,
|
|
17987
|
+
updatedAt: datetimeSchema,
|
|
17988
|
+
status: jobStatusSchema2,
|
|
17989
|
+
currentExecutionId: cuidSchema.optional(),
|
|
17990
|
+
coordinatorExpertKey: expertKeyFieldSchema,
|
|
17991
|
+
query: external_exports.string().min(1).max(maxExpertJobQueryLength).optional(),
|
|
17992
|
+
expert: expertWithMetadataSchema,
|
|
17993
|
+
provider: providerSchema,
|
|
17994
|
+
model: jobModelSchema,
|
|
17995
|
+
reasoningBudget: reasoningBudgetSchema2,
|
|
17996
|
+
runtimeVersion: runtimeVersionSchema2,
|
|
17997
|
+
maxSteps: external_exports.number().int().min(1),
|
|
17998
|
+
maxRetries: external_exports.number().int().min(0),
|
|
17999
|
+
currentStep: external_exports.number().int().min(0),
|
|
18000
|
+
totalSteps: external_exports.number().int().min(0),
|
|
18001
|
+
totalDuration: external_exports.number().int().min(0),
|
|
16866
18002
|
usage: usageSchema,
|
|
16867
|
-
|
|
16868
|
-
|
|
16869
|
-
|
|
16870
|
-
|
|
16871
|
-
|
|
18003
|
+
lastActivity: activityOrGroupSchema.nullable().optional()
|
|
18004
|
+
});
|
|
18005
|
+
var publishedJobSchema = jobBaseSchema.extend({
|
|
18006
|
+
expertVersionId: cuidSchema,
|
|
18007
|
+
expertDraftRefId: external_exports.undefined()
|
|
18008
|
+
});
|
|
18009
|
+
var draftJobSchema = jobBaseSchema.extend({
|
|
18010
|
+
expertVersionId: external_exports.undefined(),
|
|
18011
|
+
expertDraftRefId: cuidSchema
|
|
18012
|
+
});
|
|
18013
|
+
var jobSchema2 = external_exports.union([publishedJobSchema, draftJobSchema]);
|
|
18014
|
+
var request$7 = {
|
|
18015
|
+
params: external_exports.object({ jobId: cuidSchema }),
|
|
18016
|
+
body: external_exports.object({
|
|
18017
|
+
query: external_exports.string().min(1).max(maxExpertJobQueryLength),
|
|
18018
|
+
provider: providerSchema.optional(),
|
|
18019
|
+
model: jobModelSchema.optional(),
|
|
18020
|
+
reasoningBudget: reasoningBudgetSchema2.optional(),
|
|
18021
|
+
maxSteps: external_exports.coerce.number().optional(),
|
|
18022
|
+
maxRetries: external_exports.coerce.number().optional()
|
|
18023
|
+
})
|
|
18024
|
+
};
|
|
18025
|
+
external_exports.object({ data: external_exports.object({ job: jobSchema2 }) });
|
|
18026
|
+
var baseBodySchema = external_exports.object({
|
|
18027
|
+
applicationId: cuidSchema.describe("Application ID to create the job in"),
|
|
18028
|
+
query: external_exports.string().min(1).max(maxExpertJobQueryLength),
|
|
18029
|
+
provider: providerSchema,
|
|
18030
|
+
model: jobModelSchema.optional(),
|
|
18031
|
+
reasoningBudget: reasoningBudgetSchema2.optional(),
|
|
18032
|
+
maxSteps: external_exports.coerce.number().optional(),
|
|
18033
|
+
maxRetries: external_exports.coerce.number().optional()
|
|
18034
|
+
});
|
|
18035
|
+
var request$6 = { body: baseBodySchema.extend({
|
|
18036
|
+
expertKey: expertKeyFieldSchema.optional(),
|
|
18037
|
+
draftRefId: cuidSchema.describe("Draft ref ID to run the job with").optional()
|
|
18038
|
+
}).refine((data) => {
|
|
18039
|
+
const hasExpertKey = data.expertKey !== void 0;
|
|
18040
|
+
const hasDraftRefId = data.draftRefId !== void 0;
|
|
18041
|
+
return hasExpertKey && !hasDraftRefId || !hasExpertKey && hasDraftRefId;
|
|
18042
|
+
}, { message: "Either expertKey or draftRefId must be provided, but not both" }) };
|
|
18043
|
+
external_exports.object({ data: external_exports.object({ job: jobSchema2 }) });
|
|
18044
|
+
var request$5 = { query: external_exports.object({
|
|
18045
|
+
sort: external_exports.enum(["createdAt", "updatedAt"]).optional(),
|
|
18046
|
+
order: external_exports.enum(["asc", "desc"]).optional(),
|
|
18047
|
+
take: external_exports.coerce.number().min(1).max(100).default(20),
|
|
18048
|
+
skip: external_exports.coerce.number().min(0).default(0),
|
|
18049
|
+
expertScopeId: cuidSchema.optional(),
|
|
18050
|
+
expertDraftScopeId: cuidSchema.optional(),
|
|
18051
|
+
applicationId: cuidSchema.optional(),
|
|
18052
|
+
statuses: external_exports.preprocess((val) => typeof val === "string" ? val.split(",") : val, external_exports.array(jobStatusSchema2).optional()),
|
|
18053
|
+
expertKeyFilter: external_exports.string().max(100).optional()
|
|
18054
|
+
}) };
|
|
16872
18055
|
external_exports.object({
|
|
16873
|
-
|
|
16874
|
-
|
|
18056
|
+
data: external_exports.object({ jobs: external_exports.array(jobSchema2) }),
|
|
18057
|
+
meta: paginationMeta
|
|
18058
|
+
});
|
|
18059
|
+
var delegationTargetSchema2 = external_exports.object({
|
|
18060
|
+
expert: expertSchema2,
|
|
18061
|
+
toolCallId: external_exports.string().min(1).max(maxCheckpointToolCallIdLength),
|
|
18062
|
+
toolName: external_exports.string().min(1).max(maxSkillToolNameLength2),
|
|
18063
|
+
query: external_exports.string().min(1)
|
|
18064
|
+
});
|
|
18065
|
+
var apiCheckpointSchema = external_exports.object({
|
|
18066
|
+
type: external_exports.literal("checkpoint"),
|
|
18067
|
+
id: cuidSchema,
|
|
18068
|
+
jobId: cuidSchema,
|
|
18069
|
+
runId: cuidSchema,
|
|
18070
|
+
activities: external_exports.array(activityOrGroupSchema),
|
|
18071
|
+
stepNumber: external_exports.number().int().min(1),
|
|
18072
|
+
status: external_exports.enum([
|
|
18073
|
+
"init",
|
|
18074
|
+
"proceeding",
|
|
18075
|
+
"completed",
|
|
18076
|
+
"stoppedByInteractiveTool",
|
|
18077
|
+
"stoppedByDelegate",
|
|
18078
|
+
"stoppedByExceededMaxSteps",
|
|
18079
|
+
"stoppedByError"
|
|
18080
|
+
]),
|
|
18081
|
+
expert: expertSchema2,
|
|
18082
|
+
delegateTo: external_exports.array(delegationTargetSchema2).optional(),
|
|
18083
|
+
delegatedBy: external_exports.object({
|
|
18084
|
+
expert: expertSchema2,
|
|
18085
|
+
toolCallId: external_exports.string().min(1).max(maxCheckpointToolCallIdLength),
|
|
18086
|
+
toolName: external_exports.string().min(1).max(maxSkillToolNameLength2),
|
|
18087
|
+
checkpointId: cuidSchema,
|
|
18088
|
+
runId: cuidSchema
|
|
18089
|
+
}).optional(),
|
|
18090
|
+
inputMessages: external_exports.array(external_exports.union([
|
|
18091
|
+
instructionMessageSchema,
|
|
18092
|
+
userMessageSchema,
|
|
18093
|
+
toolMessageSchema
|
|
18094
|
+
])).optional(),
|
|
18095
|
+
messages: external_exports.array(messageSchema),
|
|
16875
18096
|
newMessages: external_exports.array(messageSchema),
|
|
16876
18097
|
toolCalls: external_exports.array(toolCallSchema).optional(),
|
|
16877
18098
|
toolResults: external_exports.array(toolResultSchema).optional(),
|
|
16878
18099
|
pendingToolCalls: external_exports.array(toolCallSchema).optional(),
|
|
16879
18100
|
partialToolResults: external_exports.array(toolResultSchema).optional(),
|
|
16880
18101
|
usage: usageSchema,
|
|
16881
|
-
|
|
16882
|
-
|
|
16883
|
-
|
|
16884
|
-
|
|
16885
|
-
|
|
16886
|
-
|
|
16887
|
-
|
|
16888
|
-
|
|
16889
|
-
|
|
16890
|
-
|
|
16891
|
-
|
|
16892
|
-
|
|
16893
|
-
|
|
16894
|
-
|
|
16895
|
-
|
|
16896
|
-
|
|
16897
|
-
|
|
16898
|
-
|
|
16899
|
-
|
|
16900
|
-
|
|
16901
|
-
|
|
16902
|
-
|
|
16903
|
-
|
|
16904
|
-
|
|
16905
|
-
|
|
16906
|
-
|
|
16907
|
-
|
|
16908
|
-
|
|
16909
|
-
|
|
16910
|
-
|
|
16911
|
-
|
|
16912
|
-
|
|
16913
|
-
|
|
16914
|
-
|
|
16915
|
-
|
|
16916
|
-
|
|
16917
|
-
|
|
16918
|
-
|
|
16919
|
-
|
|
16920
|
-
|
|
16921
|
-
|
|
16922
|
-
|
|
16923
|
-
|
|
16924
|
-
|
|
16925
|
-
|
|
16926
|
-
|
|
16927
|
-
|
|
16928
|
-
|
|
16929
|
-
|
|
16930
|
-
|
|
16931
|
-
|
|
16932
|
-
|
|
16933
|
-
|
|
16934
|
-
|
|
16935
|
-
|
|
16936
|
-
|
|
16937
|
-
|
|
16938
|
-
|
|
16939
|
-
|
|
16940
|
-
|
|
16941
|
-
|
|
16942
|
-
|
|
16943
|
-
|
|
16944
|
-
|
|
16945
|
-
|
|
16946
|
-
|
|
16947
|
-
|
|
16948
|
-
|
|
16949
|
-
|
|
16950
|
-
|
|
16951
|
-
|
|
16952
|
-
|
|
16953
|
-
|
|
16954
|
-
|
|
16955
|
-
|
|
16956
|
-
|
|
16957
|
-
|
|
16958
|
-
|
|
16959
|
-
|
|
16960
|
-
|
|
16961
|
-
|
|
16962
|
-
|
|
18102
|
+
contextWindow: external_exports.number().int().min(0).optional(),
|
|
18103
|
+
contextWindowUsage: external_exports.number().int().min(0).optional(),
|
|
18104
|
+
error: external_exports.object({
|
|
18105
|
+
name: external_exports.string().min(1),
|
|
18106
|
+
message: external_exports.string().min(1),
|
|
18107
|
+
statusCode: external_exports.number().int().min(100).max(599).optional(),
|
|
18108
|
+
isRetryable: external_exports.boolean()
|
|
18109
|
+
}).optional(),
|
|
18110
|
+
retryCount: external_exports.number().int().min(0).optional(),
|
|
18111
|
+
startedAt: datetimeSchema,
|
|
18112
|
+
finishedAt: datetimeSchema.optional()
|
|
18113
|
+
});
|
|
18114
|
+
var request$4 = {
|
|
18115
|
+
params: external_exports.object({
|
|
18116
|
+
jobId: cuidSchema,
|
|
18117
|
+
runId: cuidSchema
|
|
18118
|
+
}),
|
|
18119
|
+
query: external_exports.object({
|
|
18120
|
+
filter: external_exports.string().min(1).max(256).optional(),
|
|
18121
|
+
sort: external_exports.enum(["createdAt", "updatedAt"]).optional(),
|
|
18122
|
+
order: external_exports.enum(["asc", "desc"]).optional(),
|
|
18123
|
+
take: external_exports.coerce.number().min(1).max(100).default(20),
|
|
18124
|
+
skip: external_exports.coerce.number().min(0).default(0)
|
|
18125
|
+
})
|
|
18126
|
+
};
|
|
18127
|
+
external_exports.object({
|
|
18128
|
+
data: external_exports.object({ checkpoints: external_exports.array(apiCheckpointSchema) }),
|
|
18129
|
+
meta: paginationMeta
|
|
18130
|
+
});
|
|
18131
|
+
var runStatusSchema = external_exports.enum([
|
|
18132
|
+
"queued",
|
|
18133
|
+
"processing",
|
|
18134
|
+
"completed",
|
|
18135
|
+
"stoppedByInteractiveTool",
|
|
18136
|
+
"stoppedByDelegate",
|
|
18137
|
+
"stoppedByExceededMaxSteps",
|
|
18138
|
+
"stoppedByError"
|
|
18139
|
+
]);
|
|
18140
|
+
var runSchema = external_exports.object({
|
|
18141
|
+
type: external_exports.literal("run"),
|
|
18142
|
+
id: cuidSchema,
|
|
18143
|
+
jobId: cuidSchema,
|
|
18144
|
+
executionId: cuidSchema.optional(),
|
|
18145
|
+
parentRunId: cuidSchema.optional(),
|
|
18146
|
+
organizationId: cuidSchema,
|
|
18147
|
+
createdAt: datetimeSchema,
|
|
18148
|
+
updatedAt: datetimeSchema,
|
|
18149
|
+
status: runStatusSchema,
|
|
18150
|
+
expertKey: expertKeyFieldSchema,
|
|
18151
|
+
expert: expertWithMetadataSchema,
|
|
18152
|
+
stepNumber: external_exports.number().int().min(0),
|
|
18153
|
+
usage: usageSchema
|
|
18154
|
+
});
|
|
18155
|
+
var request$3 = {
|
|
18156
|
+
params: external_exports.object({ jobId: cuidSchema }),
|
|
18157
|
+
query: external_exports.object({
|
|
18158
|
+
sort: external_exports.enum(["createdAt", "updatedAt"]).optional(),
|
|
18159
|
+
order: external_exports.enum(["asc", "desc"]).optional(),
|
|
18160
|
+
take: external_exports.coerce.number().min(1).max(100).default(20),
|
|
18161
|
+
skip: external_exports.coerce.number().min(0).default(0)
|
|
18162
|
+
})
|
|
18163
|
+
};
|
|
18164
|
+
external_exports.object({
|
|
18165
|
+
data: external_exports.object({ runs: external_exports.array(runSchema) }),
|
|
18166
|
+
meta: paginationMeta
|
|
18167
|
+
});
|
|
18168
|
+
var baseUrlSchema = external_exports.string().url().max(maxProviderBaseUrlLength).optional();
|
|
18169
|
+
var headersSchema2 = external_exports.record(external_exports.string().min(1).max(maxProviderHeaderKeyLength), external_exports.string().max(maxProviderHeaderValueLength)).refine((headers) => Object.keys(headers).length <= maxProviderHeadersCount, { message: `Headers must have at most ${maxProviderHeadersCount} entries` }).optional();
|
|
18170
|
+
var anthropicProviderSettingsSchema = external_exports.object({
|
|
18171
|
+
baseUrl: baseUrlSchema,
|
|
18172
|
+
headers: headersSchema2
|
|
18173
|
+
});
|
|
18174
|
+
var googleProviderSettingsSchema = external_exports.object({
|
|
18175
|
+
baseUrl: baseUrlSchema,
|
|
18176
|
+
headers: headersSchema2
|
|
18177
|
+
});
|
|
18178
|
+
var openaiProviderSettingsSchema = external_exports.object({
|
|
18179
|
+
baseUrl: baseUrlSchema,
|
|
18180
|
+
headers: headersSchema2,
|
|
18181
|
+
organization: external_exports.string().min(1).optional(),
|
|
18182
|
+
project: external_exports.string().min(1).optional(),
|
|
18183
|
+
name: external_exports.string().min(1).optional()
|
|
18184
|
+
});
|
|
18185
|
+
var deepseekProviderSettingsSchema = external_exports.object({
|
|
18186
|
+
baseUrl: baseUrlSchema,
|
|
18187
|
+
headers: headersSchema2
|
|
18188
|
+
});
|
|
18189
|
+
var azureOpenaiProviderSettingsSchema = external_exports.object({
|
|
18190
|
+
baseUrl: baseUrlSchema,
|
|
18191
|
+
headers: headersSchema2,
|
|
18192
|
+
resourceName: external_exports.string().min(1).optional(),
|
|
18193
|
+
apiVersion: external_exports.string().min(1).optional(),
|
|
18194
|
+
useDeploymentBasedUrls: external_exports.boolean().optional()
|
|
18195
|
+
});
|
|
18196
|
+
var amazonBedrockProviderSettingsSchema = external_exports.object({ region: external_exports.string().min(1).optional() });
|
|
18197
|
+
var googleVertexProviderSettingsSchema = external_exports.object({
|
|
18198
|
+
baseUrl: baseUrlSchema,
|
|
18199
|
+
headers: headersSchema2,
|
|
18200
|
+
project: external_exports.string().min(1).optional(),
|
|
18201
|
+
location: external_exports.string().min(1).optional()
|
|
18202
|
+
});
|
|
18203
|
+
var providerSettingsSchema = external_exports.union([
|
|
18204
|
+
anthropicProviderSettingsSchema,
|
|
18205
|
+
googleProviderSettingsSchema,
|
|
18206
|
+
openaiProviderSettingsSchema,
|
|
18207
|
+
deepseekProviderSettingsSchema,
|
|
18208
|
+
azureOpenaiProviderSettingsSchema,
|
|
18209
|
+
amazonBedrockProviderSettingsSchema,
|
|
18210
|
+
googleVertexProviderSettingsSchema
|
|
18211
|
+
]);
|
|
18212
|
+
external_exports.object({
|
|
18213
|
+
type: external_exports.literal("providerSetting"),
|
|
18214
|
+
id: cuidSchema,
|
|
18215
|
+
applicationId: cuidSchema,
|
|
18216
|
+
provider: providerSchema,
|
|
18217
|
+
settings: providerSettingsSchema.optional(),
|
|
18218
|
+
application: applicationSchema,
|
|
18219
|
+
createdAt: datetimeSchema,
|
|
18220
|
+
updatedAt: datetimeSchema
|
|
18221
|
+
});
|
|
18222
|
+
var providerSettingResponseSchema = external_exports.object({
|
|
18223
|
+
type: external_exports.literal("providerSetting"),
|
|
18224
|
+
id: cuidSchema,
|
|
18225
|
+
provider: providerSchema,
|
|
18226
|
+
settings: providerSettingsSchema.optional(),
|
|
18227
|
+
createdAt: datetimeSchema,
|
|
18228
|
+
updatedAt: datetimeSchema
|
|
18229
|
+
});
|
|
18230
|
+
var providerApiKeyMetadataSchema = external_exports.object({
|
|
18231
|
+
id: cuidSchema,
|
|
18232
|
+
name: external_exports.string(),
|
|
18233
|
+
createdAt: datetimeSchema,
|
|
18234
|
+
updatedAt: datetimeSchema,
|
|
18235
|
+
lastUsedAt: datetimeSchema.nullable(),
|
|
18236
|
+
expiresAt: datetimeSchema.nullable()
|
|
18237
|
+
});
|
|
18238
|
+
var request$2 = {
|
|
18239
|
+
params: external_exports.object({
|
|
18240
|
+
applicationId: cuidSchema,
|
|
18241
|
+
provider: providerSchema
|
|
18242
|
+
}),
|
|
18243
|
+
body: external_exports.object({
|
|
18244
|
+
name: external_exports.string().min(1).max(255),
|
|
18245
|
+
value: external_exports.string().min(1)
|
|
18246
|
+
})
|
|
18247
|
+
};
|
|
18248
|
+
external_exports.object({ data: external_exports.object({ apiKey: providerApiKeyMetadataSchema }) });
|
|
18249
|
+
var request$1 = {
|
|
18250
|
+
params: external_exports.object({ applicationId: cuidSchema }),
|
|
18251
|
+
body: external_exports.object({
|
|
18252
|
+
provider: providerSchema,
|
|
18253
|
+
settings: providerSettingsSchema.optional()
|
|
18254
|
+
})
|
|
18255
|
+
};
|
|
18256
|
+
external_exports.object({ data: external_exports.object({ providerSetting: providerSettingResponseSchema }) });
|
|
18257
|
+
var request = {
|
|
18258
|
+
params: external_exports.object({
|
|
18259
|
+
applicationId: cuidSchema,
|
|
18260
|
+
provider: providerSchema
|
|
18261
|
+
}),
|
|
18262
|
+
body: external_exports.object({ settings: providerSettingsSchema.optional() })
|
|
18263
|
+
};
|
|
18264
|
+
external_exports.object({ data: external_exports.object({ providerSetting: providerSettingResponseSchema }) });
|
|
18265
|
+
function createRunCheckpointsApi(fetcher, basePath) {
|
|
18266
|
+
return {
|
|
18267
|
+
async list(jobId, runId, params, options) {
|
|
18268
|
+
if (params) {
|
|
18269
|
+
const result = request$4.query.safeParse(params);
|
|
18270
|
+
if (!result.success) return {
|
|
18271
|
+
ok: false,
|
|
18272
|
+
error: createValidationError(result.error)
|
|
18273
|
+
};
|
|
18274
|
+
}
|
|
18275
|
+
const queryString = buildQueryString(params);
|
|
18276
|
+
return fetcher.get(`${basePath}/${jobId}/runs/${runId}/checkpoints${queryString}`, options);
|
|
18277
|
+
},
|
|
18278
|
+
async get(jobId, runId, checkpointId, options) {
|
|
18279
|
+
return fetcher.get(`${basePath}/${jobId}/runs/${runId}/checkpoints/${checkpointId}`, options);
|
|
18280
|
+
}
|
|
18281
|
+
};
|
|
18282
|
+
}
|
|
18283
|
+
function createRunsApi(fetcher, basePath) {
|
|
18284
|
+
return {
|
|
18285
|
+
async list(jobId, params, options) {
|
|
18286
|
+
if (params) {
|
|
18287
|
+
const result = request$3.query.safeParse(params);
|
|
18288
|
+
if (!result.success) return {
|
|
18289
|
+
ok: false,
|
|
18290
|
+
error: createValidationError(result.error)
|
|
18291
|
+
};
|
|
18292
|
+
}
|
|
18293
|
+
const queryString = buildQueryString(params);
|
|
18294
|
+
return fetcher.get(`${basePath}/${jobId}/runs${queryString}`, options);
|
|
18295
|
+
},
|
|
18296
|
+
async get(jobId, runId, options) {
|
|
18297
|
+
return fetcher.get(`${basePath}/${jobId}/runs/${runId}`, options);
|
|
18298
|
+
},
|
|
18299
|
+
checkpoints: createRunCheckpointsApi(fetcher, basePath)
|
|
18300
|
+
};
|
|
18301
|
+
}
|
|
18302
|
+
var BASE_PATH$5 = "/api/v1/jobs";
|
|
18303
|
+
var StreamError = class extends Error {
|
|
18304
|
+
constructor(type, jobId, message) {
|
|
18305
|
+
super(message ?? `Stream error: ${type}`);
|
|
18306
|
+
this.type = type;
|
|
18307
|
+
this.jobId = jobId;
|
|
18308
|
+
this.name = "StreamError";
|
|
18309
|
+
}
|
|
18310
|
+
};
|
|
18311
|
+
var StreamConnectionError = class extends Error {
|
|
18312
|
+
constructor(message) {
|
|
18313
|
+
super(message);
|
|
18314
|
+
this.name = "StreamConnectionError";
|
|
18315
|
+
}
|
|
18316
|
+
};
|
|
18317
|
+
function isErrorEventData(data) {
|
|
18318
|
+
return typeof data === "object" && data !== null && "type" in data && typeof data.type === "string" && "jobId" in data && typeof data.jobId === "string";
|
|
18319
|
+
}
|
|
18320
|
+
function isCompleteEventData(data) {
|
|
18321
|
+
return typeof data === "object" && data !== null && "status" in data && typeof data.status === "string" && "jobId" in data && typeof data.jobId === "string";
|
|
18322
|
+
}
|
|
18323
|
+
function createJobsApi(fetcher) {
|
|
18324
|
+
return {
|
|
18325
|
+
async list(params, options) {
|
|
18326
|
+
if (params) {
|
|
18327
|
+
const result = request$5.query.safeParse(params);
|
|
18328
|
+
if (!result.success) return {
|
|
18329
|
+
ok: false,
|
|
18330
|
+
error: createValidationError(result.error)
|
|
18331
|
+
};
|
|
18332
|
+
}
|
|
18333
|
+
const queryString = buildQueryString(params);
|
|
18334
|
+
return fetcher.get(`${BASE_PATH$5}${queryString}`, options);
|
|
18335
|
+
},
|
|
18336
|
+
async get(id, options) {
|
|
18337
|
+
return fetcher.get(`${BASE_PATH$5}/${id}`, options);
|
|
18338
|
+
},
|
|
18339
|
+
async start(input, options) {
|
|
18340
|
+
const result = request$6.body.safeParse(input);
|
|
18341
|
+
if (!result.success) return {
|
|
18342
|
+
ok: false,
|
|
18343
|
+
error: createValidationError(result.error)
|
|
16963
18344
|
};
|
|
16964
|
-
|
|
16965
|
-
|
|
16966
|
-
|
|
16967
|
-
|
|
16968
|
-
|
|
16969
|
-
|
|
16970
|
-
error:
|
|
18345
|
+
return fetcher.post(BASE_PATH$5, input, options);
|
|
18346
|
+
},
|
|
18347
|
+
async continue(id, input, options) {
|
|
18348
|
+
const result = request$7.body.safeParse(input);
|
|
18349
|
+
if (!result.success) return {
|
|
18350
|
+
ok: false,
|
|
18351
|
+
error: createValidationError(result.error)
|
|
16971
18352
|
};
|
|
16972
|
-
|
|
16973
|
-
|
|
16974
|
-
|
|
16975
|
-
|
|
16976
|
-
|
|
16977
|
-
|
|
18353
|
+
return fetcher.post(`${BASE_PATH$5}/${id}/continue`, input, options);
|
|
18354
|
+
},
|
|
18355
|
+
async cancel(id, options) {
|
|
18356
|
+
return fetcher.post(`${BASE_PATH$5}/${id}/cancel`, {}, options);
|
|
18357
|
+
},
|
|
18358
|
+
async *stream(id, options) {
|
|
18359
|
+
const result = await fetcher.getStream(`${BASE_PATH$5}/${id}/stream`, options);
|
|
18360
|
+
if (!result.ok) throw new StreamConnectionError(result.error.message);
|
|
18361
|
+
const reader = result.data.getReader();
|
|
18362
|
+
try {
|
|
18363
|
+
for await (const sseEvent of parseSSEEvents(reader)) if (sseEvent.event === "message") yield sseEvent.data;
|
|
18364
|
+
else if (sseEvent.event === "error" && isErrorEventData(sseEvent.data)) throw new StreamError(sseEvent.data.type, sseEvent.data.jobId, sseEvent.data.message);
|
|
18365
|
+
else if (sseEvent.event === "complete" && isCompleteEventData(sseEvent.data)) return;
|
|
18366
|
+
} catch (error48) {
|
|
18367
|
+
if (error48 instanceof StreamError || error48 instanceof StreamConnectionError) throw error48;
|
|
18368
|
+
if (error48 instanceof DOMException && error48.name === "AbortError") throw error48;
|
|
18369
|
+
throw new StreamConnectionError(error48 instanceof Error ? error48.message : "Stream read error");
|
|
18370
|
+
}
|
|
18371
|
+
},
|
|
18372
|
+
runs: createRunsApi(fetcher, BASE_PATH$5)
|
|
18373
|
+
};
|
|
18374
|
+
}
|
|
18375
|
+
var BASE_PATH$4 = "/api/v1/applications";
|
|
18376
|
+
function createApplicationsApi(fetcher) {
|
|
18377
|
+
return {
|
|
18378
|
+
async list(params, options) {
|
|
18379
|
+
if (params) {
|
|
18380
|
+
const result = request$16.query.safeParse(params);
|
|
18381
|
+
if (!result.success) return {
|
|
18382
|
+
ok: false,
|
|
18383
|
+
error: createValidationError(result.error)
|
|
18384
|
+
};
|
|
18385
|
+
}
|
|
18386
|
+
const queryString = buildQueryString(params);
|
|
18387
|
+
return fetcher.get(`${BASE_PATH$4}${queryString}`, options);
|
|
18388
|
+
},
|
|
18389
|
+
async get(id, options) {
|
|
18390
|
+
return fetcher.get(`${BASE_PATH$4}/${id}`, options);
|
|
18391
|
+
},
|
|
18392
|
+
async create(input, options) {
|
|
18393
|
+
const result = request$17.body.safeParse(input);
|
|
18394
|
+
if (!result.success) return {
|
|
18395
|
+
ok: false,
|
|
18396
|
+
error: createValidationError(result.error)
|
|
16978
18397
|
};
|
|
16979
|
-
|
|
16980
|
-
|
|
16981
|
-
|
|
16982
|
-
|
|
16983
|
-
|
|
16984
|
-
|
|
16985
|
-
error:
|
|
18398
|
+
return fetcher.post(BASE_PATH$4, input, options);
|
|
18399
|
+
},
|
|
18400
|
+
async update(id, input, options) {
|
|
18401
|
+
const result = request$15.body.safeParse(input);
|
|
18402
|
+
if (!result.success) return {
|
|
18403
|
+
ok: false,
|
|
18404
|
+
error: createValidationError(result.error)
|
|
16986
18405
|
};
|
|
16987
|
-
|
|
16988
|
-
|
|
16989
|
-
|
|
16990
|
-
|
|
16991
|
-
|
|
16992
|
-
|
|
16993
|
-
|
|
18406
|
+
return fetcher.post(`${BASE_PATH$4}/${id}`, input, options);
|
|
18407
|
+
},
|
|
18408
|
+
async delete(id, options) {
|
|
18409
|
+
return fetcher.delete(`${BASE_PATH$4}/${id}`, options);
|
|
18410
|
+
}
|
|
18411
|
+
};
|
|
18412
|
+
}
|
|
18413
|
+
var BASE_PATH$3 = "/api/v1/env/secrets";
|
|
18414
|
+
function createSecretsApi(fetcher) {
|
|
18415
|
+
return {
|
|
18416
|
+
async list(params, options) {
|
|
18417
|
+
if (params) {
|
|
18418
|
+
const result = request$13.query.safeParse(params);
|
|
18419
|
+
if (!result.success) return {
|
|
18420
|
+
ok: false,
|
|
18421
|
+
error: createValidationError(result.error)
|
|
18422
|
+
};
|
|
18423
|
+
}
|
|
18424
|
+
const queryString = buildQueryString(params);
|
|
18425
|
+
return fetcher.get(`${BASE_PATH$3}${queryString}`, options);
|
|
18426
|
+
},
|
|
18427
|
+
async get(name, options) {
|
|
18428
|
+
const encodedName = encodeURIComponent(name);
|
|
18429
|
+
return fetcher.get(`${BASE_PATH$3}/${encodedName}`, options);
|
|
18430
|
+
},
|
|
18431
|
+
async create(input, options) {
|
|
18432
|
+
const result = request$14.body.safeParse(input);
|
|
18433
|
+
if (!result.success) return {
|
|
18434
|
+
ok: false,
|
|
18435
|
+
error: createValidationError(result.error)
|
|
16994
18436
|
};
|
|
16995
|
-
|
|
16996
|
-
|
|
16997
|
-
|
|
16998
|
-
|
|
16999
|
-
|
|
17000
|
-
|
|
17001
|
-
error:
|
|
18437
|
+
return fetcher.post(BASE_PATH$3, input, options);
|
|
18438
|
+
},
|
|
18439
|
+
async update(name, input, options) {
|
|
18440
|
+
const result = request$12.body.safeParse(input);
|
|
18441
|
+
if (!result.success) return {
|
|
18442
|
+
ok: false,
|
|
18443
|
+
error: createValidationError(result.error)
|
|
17002
18444
|
};
|
|
17003
|
-
|
|
17004
|
-
return {
|
|
17005
|
-
|
|
17006
|
-
|
|
17007
|
-
|
|
17008
|
-
|
|
18445
|
+
const encodedName = encodeURIComponent(name);
|
|
18446
|
+
return fetcher.put(`${BASE_PATH$3}/${encodedName}`, input, options);
|
|
18447
|
+
},
|
|
18448
|
+
async delete(name, options) {
|
|
18449
|
+
const encodedName = encodeURIComponent(name);
|
|
18450
|
+
return fetcher.deleteNoContent(`${BASE_PATH$3}/${encodedName}`, options);
|
|
18451
|
+
}
|
|
18452
|
+
};
|
|
18453
|
+
}
|
|
18454
|
+
var BASE_PATH$2 = "/api/v1/env/variables";
|
|
18455
|
+
function createVariablesApi(fetcher) {
|
|
18456
|
+
return {
|
|
18457
|
+
async list(params, options) {
|
|
18458
|
+
const result = request$10.query.safeParse(params);
|
|
18459
|
+
if (!result.success) return {
|
|
18460
|
+
ok: false,
|
|
18461
|
+
error: createValidationError(result.error)
|
|
17009
18462
|
};
|
|
17010
|
-
|
|
17011
|
-
return {
|
|
17012
|
-
|
|
17013
|
-
|
|
17014
|
-
|
|
17015
|
-
|
|
17016
|
-
|
|
18463
|
+
const queryString = buildQueryString(params);
|
|
18464
|
+
return fetcher.get(`${BASE_PATH$2}${queryString}`, options);
|
|
18465
|
+
},
|
|
18466
|
+
async get(name, options) {
|
|
18467
|
+
const encodedName = encodeURIComponent(name);
|
|
18468
|
+
return fetcher.get(`${BASE_PATH$2}/${encodedName}`, options);
|
|
18469
|
+
},
|
|
18470
|
+
async create(input, options) {
|
|
18471
|
+
const result = request$11.body.safeParse(input);
|
|
18472
|
+
if (!result.success) return {
|
|
18473
|
+
ok: false,
|
|
18474
|
+
error: createValidationError(result.error)
|
|
17017
18475
|
};
|
|
17018
|
-
|
|
17019
|
-
|
|
17020
|
-
|
|
17021
|
-
|
|
17022
|
-
|
|
17023
|
-
|
|
17024
|
-
|
|
17025
|
-
output: parseStringField(resultContents, "output"),
|
|
17026
|
-
error: errorText,
|
|
17027
|
-
stdout: parseStringField(resultContents, "stdout"),
|
|
17028
|
-
stderr: parseStringField(resultContents, "stderr")
|
|
18476
|
+
return fetcher.post(BASE_PATH$2, input, options);
|
|
18477
|
+
},
|
|
18478
|
+
async update(name, input, options) {
|
|
18479
|
+
const result = request$9.body.safeParse(input);
|
|
18480
|
+
if (!result.success) return {
|
|
18481
|
+
ok: false,
|
|
18482
|
+
error: createValidationError(result.error)
|
|
17029
18483
|
};
|
|
17030
|
-
|
|
17031
|
-
return
|
|
17032
|
-
|
|
17033
|
-
|
|
17034
|
-
|
|
17035
|
-
|
|
17036
|
-
|
|
17037
|
-
|
|
17038
|
-
}
|
|
18484
|
+
const encodedName = encodeURIComponent(name);
|
|
18485
|
+
return fetcher.put(`${BASE_PATH$2}/${encodedName}`, input, options);
|
|
18486
|
+
},
|
|
18487
|
+
async delete(name, options) {
|
|
18488
|
+
const encodedName = encodeURIComponent(name);
|
|
18489
|
+
return fetcher.deleteNoContent(`${BASE_PATH$2}/${encodedName}`, options);
|
|
18490
|
+
}
|
|
18491
|
+
};
|
|
17039
18492
|
}
|
|
17040
|
-
function
|
|
17041
|
-
const errorText = getErrorFromResult(toolResult.result);
|
|
18493
|
+
function createEnvApi(fetcher) {
|
|
17042
18494
|
return {
|
|
17043
|
-
|
|
17044
|
-
|
|
17045
|
-
expertKey: "",
|
|
17046
|
-
runId: "",
|
|
17047
|
-
reasoning,
|
|
17048
|
-
skillName,
|
|
17049
|
-
toolName,
|
|
17050
|
-
args: toolCall.args,
|
|
17051
|
-
result: toolResult.result,
|
|
17052
|
-
error: errorText
|
|
18495
|
+
secrets: createSecretsApi(fetcher),
|
|
18496
|
+
variables: createVariablesApi(fetcher)
|
|
17053
18497
|
};
|
|
17054
18498
|
}
|
|
17055
|
-
function
|
|
17056
|
-
|
|
17057
|
-
|
|
17058
|
-
|
|
17059
|
-
|
|
17060
|
-
if (typeof parsed.error === "string") {
|
|
17061
|
-
return parsed.error;
|
|
17062
|
-
}
|
|
17063
|
-
} catch {
|
|
17064
|
-
const trimmed = textPart.text.trim();
|
|
17065
|
-
if (trimmed.toLowerCase().startsWith("error:") || trimmed.toLowerCase().startsWith("error ")) {
|
|
17066
|
-
return textPart.text;
|
|
17067
|
-
}
|
|
17068
|
-
}
|
|
17069
|
-
return void 0;
|
|
17070
|
-
}
|
|
17071
|
-
function parseStringField(result, field) {
|
|
17072
|
-
const textPart = result.find((p) => p.type === "textPart");
|
|
17073
|
-
if (!textPart?.text) return void 0;
|
|
17074
|
-
try {
|
|
17075
|
-
const parsed = JSON.parse(textPart.text);
|
|
17076
|
-
return typeof parsed[field] === "string" ? parsed[field] : void 0;
|
|
17077
|
-
} catch {
|
|
17078
|
-
return void 0;
|
|
17079
|
-
}
|
|
17080
|
-
}
|
|
17081
|
-
function parseNumberField(result, field) {
|
|
17082
|
-
const textPart = result.find((p) => p.type === "textPart");
|
|
17083
|
-
if (!textPart?.text) return void 0;
|
|
17084
|
-
try {
|
|
17085
|
-
const parsed = JSON.parse(textPart.text);
|
|
17086
|
-
return typeof parsed[field] === "number" ? parsed[field] : void 0;
|
|
17087
|
-
} catch {
|
|
17088
|
-
return void 0;
|
|
17089
|
-
}
|
|
18499
|
+
function createVersionsApi(fetcher, basePath) {
|
|
18500
|
+
return { async list(scopeName, options) {
|
|
18501
|
+
const encodedScopeName = encodeURIComponent(scopeName);
|
|
18502
|
+
return fetcher.get(`${basePath}/${encodedScopeName}/versions`, options);
|
|
18503
|
+
} };
|
|
17090
18504
|
}
|
|
17091
|
-
|
|
17092
|
-
|
|
17093
|
-
|
|
17094
|
-
|
|
17095
|
-
|
|
17096
|
-
|
|
17097
|
-
|
|
17098
|
-
|
|
17099
|
-
|
|
17100
|
-
|
|
17101
|
-
|
|
17102
|
-
|
|
17103
|
-
);
|
|
17104
|
-
}
|
|
17105
|
-
|
|
17106
|
-
|
|
17107
|
-
|
|
18505
|
+
var BASE_PATH$1 = "/api/v1/experts";
|
|
18506
|
+
function createExpertsApi(fetcher) {
|
|
18507
|
+
return {
|
|
18508
|
+
async list(params, options) {
|
|
18509
|
+
if (params) {
|
|
18510
|
+
const result = request$8.query.safeParse(params);
|
|
18511
|
+
if (!result.success) return {
|
|
18512
|
+
ok: false,
|
|
18513
|
+
error: createValidationError(result.error)
|
|
18514
|
+
};
|
|
18515
|
+
}
|
|
18516
|
+
const queryString = buildQueryString(params);
|
|
18517
|
+
return fetcher.get(`${BASE_PATH$1}${queryString}`, options);
|
|
18518
|
+
},
|
|
18519
|
+
async get(key, options) {
|
|
18520
|
+
const encodedKey = encodeURIComponent(key);
|
|
18521
|
+
return fetcher.get(`${BASE_PATH$1}/${encodedKey}`, options);
|
|
18522
|
+
},
|
|
18523
|
+
async getFeatured(options) {
|
|
18524
|
+
return fetcher.get(`${BASE_PATH$1}/featured`, options);
|
|
18525
|
+
},
|
|
18526
|
+
async getMeta(key, options) {
|
|
18527
|
+
const encodedKey = encodeURIComponent(key);
|
|
18528
|
+
return fetcher.get(`${BASE_PATH$1}/${encodedKey}/meta`, options);
|
|
18529
|
+
},
|
|
18530
|
+
async publish(scopeName, options) {
|
|
18531
|
+
const encodedScopeName = encodeURIComponent(scopeName);
|
|
18532
|
+
return fetcher.post(`${BASE_PATH$1}/${encodedScopeName}/publish`, {}, options);
|
|
18533
|
+
},
|
|
18534
|
+
async unpublish(scopeName, options) {
|
|
18535
|
+
const encodedScopeName = encodeURIComponent(scopeName);
|
|
18536
|
+
return fetcher.post(`${BASE_PATH$1}/${encodedScopeName}/unpublish`, {}, options);
|
|
18537
|
+
},
|
|
18538
|
+
async yank(key, options) {
|
|
18539
|
+
const encodedKey = encodeURIComponent(key);
|
|
18540
|
+
return fetcher.delete(`${BASE_PATH$1}/${encodedKey}`, options);
|
|
18541
|
+
},
|
|
18542
|
+
versions: createVersionsApi(fetcher, BASE_PATH$1)
|
|
18543
|
+
};
|
|
17108
18544
|
}
|
|
17109
|
-
|
|
17110
|
-
|
|
17111
|
-
|
|
17112
|
-
|
|
17113
|
-
|
|
17114
|
-
|
|
17115
|
-
|
|
17116
|
-
|
|
17117
|
-
|
|
17118
|
-
|
|
17119
|
-
|
|
17120
|
-
|
|
17121
|
-
)
|
|
18545
|
+
var BASE_PATH = "/api/v1/applications";
|
|
18546
|
+
function createProviderSettingsApi(fetcher) {
|
|
18547
|
+
return {
|
|
18548
|
+
async list(applicationId, options) {
|
|
18549
|
+
return fetcher.get(`${BASE_PATH}/${applicationId}/provider_settings`, options);
|
|
18550
|
+
},
|
|
18551
|
+
async get(applicationId, provider, options) {
|
|
18552
|
+
const encodedProvider = encodeURIComponent(provider);
|
|
18553
|
+
return fetcher.get(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}`, options);
|
|
18554
|
+
},
|
|
18555
|
+
async create(applicationId, input, options) {
|
|
18556
|
+
const result = request$1.body.safeParse(input);
|
|
18557
|
+
if (!result.success) return {
|
|
18558
|
+
ok: false,
|
|
18559
|
+
error: createValidationError(result.error)
|
|
18560
|
+
};
|
|
18561
|
+
return fetcher.post(`${BASE_PATH}/${applicationId}/provider_settings`, input, options);
|
|
18562
|
+
},
|
|
18563
|
+
async update(applicationId, provider, input, options) {
|
|
18564
|
+
const result = request.body.safeParse(input);
|
|
18565
|
+
if (!result.success) return {
|
|
18566
|
+
ok: false,
|
|
18567
|
+
error: createValidationError(result.error)
|
|
18568
|
+
};
|
|
18569
|
+
const encodedProvider = encodeURIComponent(provider);
|
|
18570
|
+
return fetcher.post(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}`, input, options);
|
|
18571
|
+
},
|
|
18572
|
+
async delete(applicationId, provider, options) {
|
|
18573
|
+
const encodedProvider = encodeURIComponent(provider);
|
|
18574
|
+
return fetcher.deleteNoContent(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}`, options);
|
|
18575
|
+
},
|
|
18576
|
+
async listApiKeys(applicationId, provider, options) {
|
|
18577
|
+
const encodedProvider = encodeURIComponent(provider);
|
|
18578
|
+
return fetcher.get(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}/api_keys`, options);
|
|
18579
|
+
},
|
|
18580
|
+
async createApiKey(applicationId, provider, input, options) {
|
|
18581
|
+
const result = request$2.body.safeParse(input);
|
|
18582
|
+
if (!result.success) return {
|
|
18583
|
+
ok: false,
|
|
18584
|
+
error: createValidationError(result.error)
|
|
18585
|
+
};
|
|
18586
|
+
const encodedProvider = encodeURIComponent(provider);
|
|
18587
|
+
return fetcher.post(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}/api_keys`, input, options);
|
|
18588
|
+
},
|
|
18589
|
+
async deleteApiKey(applicationId, provider, apiKeyId, options) {
|
|
18590
|
+
const encodedProvider = encodeURIComponent(provider);
|
|
18591
|
+
const encodedApiKeyId = encodeURIComponent(apiKeyId);
|
|
18592
|
+
return fetcher.deleteNoContent(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}/api_keys/${encodedApiKeyId}`, options);
|
|
17122
18593
|
}
|
|
17123
|
-
}
|
|
17124
|
-
}
|
|
17125
|
-
return [];
|
|
17126
|
-
}
|
|
17127
|
-
function parseFileInfoFromResult(result) {
|
|
17128
|
-
const textPart = result.find((p) => p.type === "textPart");
|
|
17129
|
-
if (!textPart?.text) return void 0;
|
|
17130
|
-
try {
|
|
17131
|
-
const parsed = JSON.parse(textPart.text);
|
|
17132
|
-
return {
|
|
17133
|
-
exists: typeof parsed.exists === "boolean" ? parsed.exists : true,
|
|
17134
|
-
name: String(parsed.name ?? ""),
|
|
17135
|
-
directory: String(parsed.directory ?? ""),
|
|
17136
|
-
extension: typeof parsed.extension === "string" ? parsed.extension : null,
|
|
17137
|
-
type: parsed.type === "directory" ? "directory" : "file",
|
|
17138
|
-
mimeType: typeof parsed.mimeType === "string" ? parsed.mimeType : null,
|
|
17139
|
-
size: typeof parsed.size === "number" ? parsed.size : 0,
|
|
17140
|
-
sizeFormatted: String(parsed.sizeFormatted ?? ""),
|
|
17141
|
-
created: String(parsed.created ?? ""),
|
|
17142
|
-
modified: String(parsed.modified ?? ""),
|
|
17143
|
-
accessed: String(parsed.accessed ?? "")
|
|
17144
|
-
};
|
|
17145
|
-
} catch {
|
|
17146
|
-
return void 0;
|
|
17147
|
-
}
|
|
18594
|
+
};
|
|
17148
18595
|
}
|
|
17149
|
-
function
|
|
17150
|
-
const
|
|
17151
|
-
|
|
17152
|
-
|
|
17153
|
-
|
|
17154
|
-
|
|
17155
|
-
|
|
17156
|
-
|
|
17157
|
-
|
|
17158
|
-
path: String(item.path ?? ""),
|
|
17159
|
-
type: item.type === "directory" ? "directory" : "file",
|
|
17160
|
-
size: typeof item.size === "number" ? item.size : 0,
|
|
17161
|
-
modified: String(item.modified ?? "")
|
|
17162
|
-
})
|
|
17163
|
-
);
|
|
17164
|
-
} catch {
|
|
17165
|
-
return void 0;
|
|
17166
|
-
}
|
|
18596
|
+
function createApiClient(config2) {
|
|
18597
|
+
const fetcher = createFetcher(config2);
|
|
18598
|
+
return {
|
|
18599
|
+
applications: createApplicationsApi(fetcher),
|
|
18600
|
+
env: createEnvApi(fetcher),
|
|
18601
|
+
jobs: createJobsApi(fetcher),
|
|
18602
|
+
experts: createExpertsApi(fetcher),
|
|
18603
|
+
providerSettings: createProviderSettingsApi(fetcher)
|
|
18604
|
+
};
|
|
17167
18605
|
}
|
|
17168
18606
|
/*! Bundled license information:
|
|
17169
18607
|
|
|
@@ -17171,6 +18609,6 @@ function parseListDirectoryFromResult(result) {
|
|
|
17171
18609
|
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
17172
18610
|
*/
|
|
17173
18611
|
|
|
17174
|
-
export { $ZodObject, $ZodType, $constructor, BASE_SKILL_PREFIX, NEVER, ZodIssueCode, ZodOptional, _enum2 as _enum, _null3 as _null,
|
|
17175
|
-
//# sourceMappingURL=chunk-
|
|
17176
|
-
//# sourceMappingURL=chunk-
|
|
18612
|
+
export { $ZodObject, $ZodType, $constructor, BASE_SKILL_PREFIX, NEVER, PerstackError, ZodIssueCode, ZodOptional, _enum2 as _enum, _null3 as _null, any, array, attemptCompletion, boolean2 as boolean, callTools, checkpointSchema, clone2 as clone, coerce_exports, completeRun, continueToNextStep, createApiClient, createBaseToolActivity, createFilteredEventListener, createGeneralToolActivity, createId, createRuntimeEvent, createStreamingEvent, custom, defaultMaxRetries, defaultPerstackApiBaseUrl, defaultTimeout, defineLazy, discriminatedUnion, expertSchema, external_exports, finishMcpTools, finishToolCall, getFilteredEnv, intersection, iso_exports, jobSchema, knownModels, literal, lockfileSchema, looseObject, normalizeParams, number2 as number, object, optional, parse, parseAsync, parseWithFriendlyError, perstackConfigSchema, preprocess, proceedToInteractiveTools, record, resolveToolResults, resumeFromStop, retry, runCommandInputSchema, runParamsSchema, runSettingSchema, safeParse, safeParseAsync, safeParseAsync2, skipDelegates, startCommandInputSchema, startGeneration, startRun, stopRunByDelegate, stopRunByError, stopRunByExceededMaxSteps, stopRunByInteractiveTool, string2 as string, toJSONSchema, union, unknown, url, validateEventFilter };
|
|
18613
|
+
//# sourceMappingURL=chunk-OF74MEG2.js.map
|
|
18614
|
+
//# sourceMappingURL=chunk-OF74MEG2.js.map
|