@perstack/core 0.0.46 → 0.0.48
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/src/index.d.ts +2 -693
- package/dist/src/index.js +4 -169
- package/dist/src/index.js.map +1 -1
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -508,72 +508,12 @@ var editTextFileActivitySchema = baseActivitySchema.extend({
|
|
|
508
508
|
oldText: z.string(),
|
|
509
509
|
error: z.string().optional()
|
|
510
510
|
});
|
|
511
|
-
var appendTextFileActivitySchema = baseActivitySchema.extend({
|
|
512
|
-
type: z.literal("appendTextFile"),
|
|
513
|
-
path: z.string(),
|
|
514
|
-
text: z.string(),
|
|
515
|
-
error: z.string().optional()
|
|
516
|
-
});
|
|
517
511
|
var writeTextFileActivitySchema = baseActivitySchema.extend({
|
|
518
512
|
type: z.literal("writeTextFile"),
|
|
519
513
|
path: z.string(),
|
|
520
514
|
text: z.string(),
|
|
521
515
|
error: z.string().optional()
|
|
522
516
|
});
|
|
523
|
-
var deleteFileActivitySchema = baseActivitySchema.extend({
|
|
524
|
-
type: z.literal("deleteFile"),
|
|
525
|
-
path: z.string(),
|
|
526
|
-
error: z.string().optional()
|
|
527
|
-
});
|
|
528
|
-
var deleteDirectoryActivitySchema = baseActivitySchema.extend({
|
|
529
|
-
type: z.literal("deleteDirectory"),
|
|
530
|
-
path: z.string(),
|
|
531
|
-
recursive: z.boolean().optional(),
|
|
532
|
-
error: z.string().optional()
|
|
533
|
-
});
|
|
534
|
-
var moveFileActivitySchema = baseActivitySchema.extend({
|
|
535
|
-
type: z.literal("moveFile"),
|
|
536
|
-
source: z.string(),
|
|
537
|
-
destination: z.string(),
|
|
538
|
-
error: z.string().optional()
|
|
539
|
-
});
|
|
540
|
-
var getFileInfoActivitySchema = baseActivitySchema.extend({
|
|
541
|
-
type: z.literal("getFileInfo"),
|
|
542
|
-
path: z.string(),
|
|
543
|
-
info: z.object({
|
|
544
|
-
exists: z.boolean(),
|
|
545
|
-
name: z.string(),
|
|
546
|
-
directory: z.string(),
|
|
547
|
-
extension: z.string().nullable(),
|
|
548
|
-
type: z.enum(["file", "directory"]),
|
|
549
|
-
mimeType: z.string().nullable(),
|
|
550
|
-
size: z.number(),
|
|
551
|
-
sizeFormatted: z.string(),
|
|
552
|
-
created: z.string(),
|
|
553
|
-
modified: z.string(),
|
|
554
|
-
accessed: z.string()
|
|
555
|
-
}).optional(),
|
|
556
|
-
error: z.string().optional()
|
|
557
|
-
});
|
|
558
|
-
var createDirectoryActivitySchema = baseActivitySchema.extend({
|
|
559
|
-
type: z.literal("createDirectory"),
|
|
560
|
-
path: z.string(),
|
|
561
|
-
error: z.string().optional()
|
|
562
|
-
});
|
|
563
|
-
var listDirectoryActivitySchema = baseActivitySchema.extend({
|
|
564
|
-
type: z.literal("listDirectory"),
|
|
565
|
-
path: z.string(),
|
|
566
|
-
items: z.array(
|
|
567
|
-
z.object({
|
|
568
|
-
name: z.string(),
|
|
569
|
-
path: z.string(),
|
|
570
|
-
type: z.enum(["file", "directory"]),
|
|
571
|
-
size: z.number(),
|
|
572
|
-
modified: z.string()
|
|
573
|
-
})
|
|
574
|
-
).optional(),
|
|
575
|
-
error: z.string().optional()
|
|
576
|
-
});
|
|
577
517
|
var execActivitySchema = baseActivitySchema.extend({
|
|
578
518
|
type: z.literal("exec"),
|
|
579
519
|
command: z.string(),
|
|
@@ -619,14 +559,7 @@ var activitySchema = z.discriminatedUnion("type", [
|
|
|
619
559
|
readPdfFileActivitySchema,
|
|
620
560
|
readTextFileActivitySchema,
|
|
621
561
|
editTextFileActivitySchema,
|
|
622
|
-
appendTextFileActivitySchema,
|
|
623
562
|
writeTextFileActivitySchema,
|
|
624
|
-
deleteFileActivitySchema,
|
|
625
|
-
deleteDirectoryActivitySchema,
|
|
626
|
-
moveFileActivitySchema,
|
|
627
|
-
getFileInfoActivitySchema,
|
|
628
|
-
createDirectoryActivitySchema,
|
|
629
|
-
listDirectoryActivitySchema,
|
|
630
563
|
execActivitySchema,
|
|
631
564
|
delegateActivitySchema,
|
|
632
565
|
delegationCompleteActivitySchema,
|
|
@@ -867,8 +800,7 @@ var mcpStdioSkillSchema = z.object({
|
|
|
867
800
|
command: z.string(),
|
|
868
801
|
packageName: z.string().optional(),
|
|
869
802
|
args: z.array(z.string()).optional().default([]),
|
|
870
|
-
requiredEnv: z.array(z.string()).optional().default([])
|
|
871
|
-
lazyInit: z.boolean().optional().default(false)
|
|
803
|
+
requiredEnv: z.array(z.string()).optional().default([])
|
|
872
804
|
});
|
|
873
805
|
var mcpSseSkillSchema = z.object({
|
|
874
806
|
type: z.literal("mcpSseSkill"),
|
|
@@ -926,8 +858,7 @@ var expertSchema = z.object({
|
|
|
926
858
|
args: ["-y", "@perstack/base"],
|
|
927
859
|
pick: [],
|
|
928
860
|
omit: [],
|
|
929
|
-
requiredEnv: []
|
|
930
|
-
lazyInit: false
|
|
861
|
+
requiredEnv: []
|
|
931
862
|
}
|
|
932
863
|
}).transform((skills) => {
|
|
933
864
|
return Object.fromEntries(
|
|
@@ -1195,8 +1126,7 @@ var perstackConfigSchema = z.object({
|
|
|
1195
1126
|
packageName: z.string().optional(),
|
|
1196
1127
|
args: z.array(z.string()).optional(),
|
|
1197
1128
|
requiredEnv: z.array(z.string()).optional(),
|
|
1198
|
-
allowedDomains: z.array(domainPatternSchema).optional()
|
|
1199
|
-
lazyInit: z.boolean().optional().default(false)
|
|
1129
|
+
allowedDomains: z.array(domainPatternSchema).optional()
|
|
1200
1130
|
}),
|
|
1201
1131
|
z.object({
|
|
1202
1132
|
type: z.literal("mcpSseSkill"),
|
|
@@ -1725,14 +1655,6 @@ function createBaseToolActivity(toolName, toolCall, toolResult, reasoning) {
|
|
|
1725
1655
|
oldText: String(args["oldText"] ?? ""),
|
|
1726
1656
|
error: errorText
|
|
1727
1657
|
};
|
|
1728
|
-
case "appendTextFile":
|
|
1729
|
-
return {
|
|
1730
|
-
type: "appendTextFile",
|
|
1731
|
-
...baseFields,
|
|
1732
|
-
path: String(args["path"] ?? ""),
|
|
1733
|
-
text: String(args["text"] ?? ""),
|
|
1734
|
-
error: errorText
|
|
1735
|
-
};
|
|
1736
1658
|
case "writeTextFile":
|
|
1737
1659
|
return {
|
|
1738
1660
|
type: "writeTextFile",
|
|
@@ -1741,52 +1663,6 @@ function createBaseToolActivity(toolName, toolCall, toolResult, reasoning) {
|
|
|
1741
1663
|
text: String(args["text"] ?? ""),
|
|
1742
1664
|
error: errorText
|
|
1743
1665
|
};
|
|
1744
|
-
case "deleteFile":
|
|
1745
|
-
return {
|
|
1746
|
-
type: "deleteFile",
|
|
1747
|
-
...baseFields,
|
|
1748
|
-
path: String(args["path"] ?? ""),
|
|
1749
|
-
error: errorText
|
|
1750
|
-
};
|
|
1751
|
-
case "deleteDirectory":
|
|
1752
|
-
return {
|
|
1753
|
-
type: "deleteDirectory",
|
|
1754
|
-
...baseFields,
|
|
1755
|
-
path: String(args["path"] ?? ""),
|
|
1756
|
-
recursive: typeof args["recursive"] === "boolean" ? args["recursive"] : void 0,
|
|
1757
|
-
error: errorText
|
|
1758
|
-
};
|
|
1759
|
-
case "moveFile":
|
|
1760
|
-
return {
|
|
1761
|
-
type: "moveFile",
|
|
1762
|
-
...baseFields,
|
|
1763
|
-
source: String(args["source"] ?? ""),
|
|
1764
|
-
destination: String(args["destination"] ?? ""),
|
|
1765
|
-
error: errorText
|
|
1766
|
-
};
|
|
1767
|
-
case "getFileInfo":
|
|
1768
|
-
return {
|
|
1769
|
-
type: "getFileInfo",
|
|
1770
|
-
...baseFields,
|
|
1771
|
-
path: String(args["path"] ?? ""),
|
|
1772
|
-
info: parseFileInfoFromResult(resultContents),
|
|
1773
|
-
error: errorText
|
|
1774
|
-
};
|
|
1775
|
-
case "createDirectory":
|
|
1776
|
-
return {
|
|
1777
|
-
type: "createDirectory",
|
|
1778
|
-
...baseFields,
|
|
1779
|
-
path: String(args["path"] ?? ""),
|
|
1780
|
-
error: errorText
|
|
1781
|
-
};
|
|
1782
|
-
case "listDirectory":
|
|
1783
|
-
return {
|
|
1784
|
-
type: "listDirectory",
|
|
1785
|
-
...baseFields,
|
|
1786
|
-
path: String(args["path"] ?? ""),
|
|
1787
|
-
items: parseListDirectoryFromResult(resultContents),
|
|
1788
|
-
error: errorText
|
|
1789
|
-
};
|
|
1790
1666
|
case "exec":
|
|
1791
1667
|
return {
|
|
1792
1668
|
type: "exec",
|
|
@@ -1896,47 +1772,6 @@ function parseTodosFromResult(result) {
|
|
|
1896
1772
|
}
|
|
1897
1773
|
return [];
|
|
1898
1774
|
}
|
|
1899
|
-
function parseFileInfoFromResult(result) {
|
|
1900
|
-
const textPart = result.find((p) => p.type === "textPart");
|
|
1901
|
-
if (!textPart?.text) return void 0;
|
|
1902
|
-
try {
|
|
1903
|
-
const parsed = JSON.parse(textPart.text);
|
|
1904
|
-
return {
|
|
1905
|
-
exists: typeof parsed.exists === "boolean" ? parsed.exists : true,
|
|
1906
|
-
name: String(parsed.name ?? ""),
|
|
1907
|
-
directory: String(parsed.directory ?? ""),
|
|
1908
|
-
extension: typeof parsed.extension === "string" ? parsed.extension : null,
|
|
1909
|
-
type: parsed.type === "directory" ? "directory" : "file",
|
|
1910
|
-
mimeType: typeof parsed.mimeType === "string" ? parsed.mimeType : null,
|
|
1911
|
-
size: typeof parsed.size === "number" ? parsed.size : 0,
|
|
1912
|
-
sizeFormatted: String(parsed.sizeFormatted ?? ""),
|
|
1913
|
-
created: String(parsed.created ?? ""),
|
|
1914
|
-
modified: String(parsed.modified ?? ""),
|
|
1915
|
-
accessed: String(parsed.accessed ?? "")
|
|
1916
|
-
};
|
|
1917
|
-
} catch {
|
|
1918
|
-
return void 0;
|
|
1919
|
-
}
|
|
1920
|
-
}
|
|
1921
|
-
function parseListDirectoryFromResult(result) {
|
|
1922
|
-
const textPart = result.find((p) => p.type === "textPart");
|
|
1923
|
-
if (!textPart?.text) return void 0;
|
|
1924
|
-
try {
|
|
1925
|
-
const parsed = JSON.parse(textPart.text);
|
|
1926
|
-
if (!Array.isArray(parsed.items)) return void 0;
|
|
1927
|
-
return parsed.items.map(
|
|
1928
|
-
(item) => ({
|
|
1929
|
-
name: String(item.name ?? ""),
|
|
1930
|
-
path: String(item.path ?? ""),
|
|
1931
|
-
type: item.type === "directory" ? "directory" : "file",
|
|
1932
|
-
size: typeof item.size === "number" ? item.size : 0,
|
|
1933
|
-
modified: String(item.modified ?? "")
|
|
1934
|
-
})
|
|
1935
|
-
);
|
|
1936
|
-
} catch {
|
|
1937
|
-
return void 0;
|
|
1938
|
-
}
|
|
1939
|
-
}
|
|
1940
1775
|
|
|
1941
1776
|
// src/utils/env-filter.ts
|
|
1942
1777
|
var SAFE_ENV_VARS = [
|
|
@@ -2024,6 +1859,6 @@ function parseWithFriendlyError(schema, data, context) {
|
|
|
2024
1859
|
throw new PerstackError(`${prefix}${formatZodError(result.error)}`);
|
|
2025
1860
|
}
|
|
2026
1861
|
|
|
2027
|
-
export { BASE_SKILL_PREFIX, PerstackError, SAFE_ENV_VARS, activityOrGroupSchema, activitySchema, amazonBedrockProviderConfigSchema, anthropicProviderConfigSchema, anthropicProviderSkillSchema, anthropicProviderToolNameSchema,
|
|
1862
|
+
export { BASE_SKILL_PREFIX, PerstackError, SAFE_ENV_VARS, activityOrGroupSchema, activitySchema, amazonBedrockProviderConfigSchema, anthropicProviderConfigSchema, anthropicProviderSkillSchema, anthropicProviderToolNameSchema, attemptCompletion, attemptCompletionActivitySchema, azureOpenAIProviderToolNameSchema, azureOpenAiProviderConfigSchema, basePartSchema, builtinAnthropicSkillSchema, callTools, checkpointSchema, checkpointStatusSchema, clearTodoActivitySchema, completeActivitySchema, completeRun, continueToNextStep, createBaseToolActivity, createCallToolsEvent, createCompleteRunEvent, createEmptyUsage, createEvent, createFilteredEventListener, createGeneralToolActivity, createNormalizedCheckpoint, createResolveToolResultsEvent, createRuntimeEvent, createRuntimeInitEvent, createStartRunEvent, createStreamingEvent, createToolMessage, customAnthropicSkillSchema, deepseekProviderConfigSchema, defaultMaxRetries, defaultMaxSteps, defaultPerstackApiBaseUrl, defaultReasoningBudget, defaultTimeout, delegateActivitySchema, delegationCompleteActivitySchema, delegationTargetSchema, domainPatternSchema, editTextFileActivitySchema, errorActivitySchema, execActivitySchema, expertKeyRegex, expertMessageSchema, expertNameRegex, expertSchema, expertVersionRegex, fileBinaryPartSchema, fileInlinePartSchema, fileSearchOptionsSchema, fileUrlPartSchema, finishMcpTools, finishToolCall, formatZodError, generalToolActivitySchema, getActivities, getFilteredEnv, googleGenerativeAiProviderConfigSchema, googleProviderToolNameSchema, googleVertexProviderConfigSchema, headersSchema, imageBinaryPartSchema, imageInlinePartSchema, imageUrlPartSchema, instructionMessageSchema, interactiveSkillSchema, interactiveToolActivitySchema, interactiveToolSchema, isPrivateOrLocalIP, isValidEventType, isValidRuntimeEventType, jobSchema, jobStatusSchema, knownModels, lockfileExpertSchema, lockfileSchema, lockfileToolDefinitionSchema, maxExpertNameLength, maxSkillNameLength, maxSkillToolNameLength, mcpSseSkillSchema, mcpStdioSkillSchema, messagePartSchema, messageSchema, ollamaProviderConfigSchema, openAiProviderConfigSchema, openaiProviderToolNameSchema, parallelActivitiesGroupSchema, parseExpertKey, parseWithFriendlyError, perstackConfigSchema, proceedToInteractiveTools, providerConfigSchema, providerNameSchema, providerTableSchema, providerToolOptionsSchema, queryActivitySchema, readImageFileActivitySchema, readPdfFileActivitySchema, readTextFileActivitySchema, reasoningBudgetSchema, resolveToolResults, resumeFromStop, resumeToolCalls, retry, retryActivitySchema, runCommandInputSchema, runParamsSchema, runSettingSchema, runtimeVersionSchema, skillSchema, skipDelegates, startCommandInputSchema, startGeneration, startRun, stepSchema, stopRunByDelegate, stopRunByError, stopRunByExceededMaxSteps, stopRunByInteractiveTool, tagNameRegex, textPartSchema, thinkingPartSchema, todoActivitySchema, toolCallPartSchema, toolCallSchema, toolMessageSchema, toolResultPartSchema, toolResultSchema, usageSchema, userMessageSchema, validateEventFilter, vertexProviderToolNameSchema, webFetchOptionsSchema, webSearchOptionsSchema, writeTextFileActivitySchema };
|
|
2028
1863
|
//# sourceMappingURL=index.js.map
|
|
2029
1864
|
//# sourceMappingURL=index.js.map
|