@perstack/core 0.0.33 → 0.0.35
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 +955 -970
- package/dist/src/index.js +2 -56
- package/dist/src/index.js.map +1 -1
- package/package.json +5 -5
package/dist/src/index.js
CHANGED
|
@@ -1,61 +1,7 @@
|
|
|
1
|
-
import { spawn } from 'child_process';
|
|
2
1
|
import { createId } from '@paralleldrive/cuid2';
|
|
3
2
|
import { z } from 'zod';
|
|
4
3
|
|
|
5
|
-
// src/adapters/
|
|
6
|
-
var BaseAdapter = class {
|
|
7
|
-
convertExpert(expert) {
|
|
8
|
-
return { instruction: expert.instruction };
|
|
9
|
-
}
|
|
10
|
-
execCommand(args) {
|
|
11
|
-
return new Promise((resolve) => {
|
|
12
|
-
const [cmd, ...cmdArgs] = args;
|
|
13
|
-
if (!cmd) {
|
|
14
|
-
resolve({ stdout: "", stderr: "", exitCode: 127 });
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const proc = spawn(cmd, cmdArgs, { cwd: process.cwd(), stdio: ["pipe", "pipe", "pipe"] });
|
|
18
|
-
let stdout = "";
|
|
19
|
-
let stderr = "";
|
|
20
|
-
proc.stdout.on("data", (data) => {
|
|
21
|
-
stdout += data.toString();
|
|
22
|
-
});
|
|
23
|
-
proc.stderr.on("data", (data) => {
|
|
24
|
-
stderr += data.toString();
|
|
25
|
-
});
|
|
26
|
-
proc.on("close", (code) => {
|
|
27
|
-
resolve({ stdout, stderr, exitCode: code ?? 127 });
|
|
28
|
-
});
|
|
29
|
-
proc.on("error", () => {
|
|
30
|
-
resolve({ stdout: "", stderr: "", exitCode: 127 });
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
executeWithTimeout(proc, timeout) {
|
|
35
|
-
return new Promise((resolve, reject) => {
|
|
36
|
-
let stdout = "";
|
|
37
|
-
let stderr = "";
|
|
38
|
-
const timer = setTimeout(() => {
|
|
39
|
-
proc.kill("SIGTERM");
|
|
40
|
-
reject(new Error(`${this.name} timed out after ${timeout}ms`));
|
|
41
|
-
}, timeout);
|
|
42
|
-
proc.stdout?.on("data", (data) => {
|
|
43
|
-
stdout += data.toString();
|
|
44
|
-
});
|
|
45
|
-
proc.stderr?.on("data", (data) => {
|
|
46
|
-
stderr += data.toString();
|
|
47
|
-
});
|
|
48
|
-
proc.on("close", (code) => {
|
|
49
|
-
clearTimeout(timer);
|
|
50
|
-
resolve({ stdout, stderr, exitCode: code ?? 127 });
|
|
51
|
-
});
|
|
52
|
-
proc.on("error", (err) => {
|
|
53
|
-
clearTimeout(timer);
|
|
54
|
-
reject(err);
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
};
|
|
4
|
+
// src/adapters/event-creators.ts
|
|
59
5
|
function createEmptyUsage() {
|
|
60
6
|
return {
|
|
61
7
|
inputTokens: 0,
|
|
@@ -2096,6 +2042,6 @@ function parseWithFriendlyError(schema, data, context) {
|
|
|
2096
2042
|
throw new Error(`${prefix}${formatZodError(result.error)}`);
|
|
2097
2043
|
}
|
|
2098
2044
|
|
|
2099
|
-
export { BASE_SKILL_PREFIX,
|
|
2045
|
+
export { BASE_SKILL_PREFIX, SAFE_ENV_VARS, activityOrGroupSchema, activitySchema, amazonBedrockProviderConfigSchema, anthropicProviderConfigSchema, anthropicProviderSkillSchema, anthropicProviderToolNameSchema, appendTextFileActivitySchema, attemptCompletion, attemptCompletionActivitySchema, azureOpenAIProviderToolNameSchema, azureOpenAiProviderConfigSchema, basePartSchema, builtinAnthropicSkillSchema, callTools, checkpointSchema, checkpointStatusSchema, clearTodoActivitySchema, completeActivitySchema, completeRun, continueToNextStep, createBaseToolActivity, createCallToolsEvent, createCompleteRunEvent, createDirectoryActivitySchema, createEmptyUsage, createEvent, createFilteredEventListener, createGeneralToolActivity, createNormalizedCheckpoint, createResolveToolResultsEvent, createRuntimeEvent, createRuntimeInitEvent, createStartRunEvent, createStreamingEvent, createToolMessage, customAnthropicSkillSchema, deepseekProviderConfigSchema, defaultMaxRetries, defaultMaxSteps, defaultPerstackApiBaseUrl, defaultReasoningBudget, defaultTimeout, delegateActivitySchema, delegationCompleteActivitySchema, delegationTargetSchema, deleteDirectoryActivitySchema, deleteFileActivitySchema, domainPatternSchema, editTextFileActivitySchema, envNameRegex, errorActivitySchema, execActivitySchema, expertKeyRegex, expertMessageSchema, expertNameRegex, expertSchema, expertVersionRegex, fileBinaryPartSchema, fileInlinePartSchema, fileSearchOptionsSchema, fileUrlPartSchema, finishMcpTools, finishToolCall, formatZodError, generalToolActivitySchema, getActivities, getAdapter, getFileInfoActivitySchema, getFilteredEnv, getRegisteredRuntimes, googleGenerativeAiProviderConfigSchema, googleProviderToolNameSchema, googleVertexProviderConfigSchema, hasCustomProviderSkills, headersSchema, imageBinaryPartSchema, imageInlinePartSchema, imageUrlPartSchema, instructionMessageSchema, interactiveSkillSchema, interactiveToolActivitySchema, interactiveToolSchema, isAdapterAvailable, isValidEventType, isValidRuntimeEventType, jobSchema, jobStatusSchema, knownModels, listDirectoryActivitySchema, lockfileExpertSchema, lockfileSchema, lockfileToolDefinitionSchema, maxApplicationNameLength, maxCheckpointToolCallIdLength, maxEnvNameLength, maxExpertDelegateItems, maxExpertDescriptionLength, maxExpertInstructionLength, maxExpertJobFileNameLength, maxExpertJobQueryLength, maxExpertKeyLength, maxExpertNameLength, maxExpertSkillItems, maxExpertTagItems, maxExpertVersionTagLength, maxOrganizationNameLength, maxSkillDescriptionLength, maxSkillEndpointLength, maxSkillInputJsonSchemaLength, maxSkillNameLength, maxSkillPickOmitItems, maxSkillRequiredEnvItems, maxSkillRuleLength, maxSkillToolItems, maxSkillToolNameLength, mcpSseSkillSchema, mcpStdioSkillSchema, messagePartSchema, messageSchema, moveFileActivitySchema, ollamaProviderConfigSchema, openAiProviderConfigSchema, openaiProviderToolNameSchema, organizationNameRegex, packageWithVersionRegex, parallelActivitiesGroupSchema, parseExpertKey, parseWithFriendlyError, perstackConfigSchema, proceedToInteractiveTools, providerConfigSchema, providerNameSchema, providerTableSchema, providerToolOptionsSchema, queryActivitySchema, readImageFileActivitySchema, readPdfFileActivitySchema, readTextFileActivitySchema, reasoningBudgetSchema, registerAdapter, resolveToolResults, resumeFromStop, resumeToolCalls, retry, retryActivitySchema, runCommandInputSchema, runParamsSchema, runSettingSchema, runtimeNameSchema, skillSchema, skipDelegates, startCommandInputSchema, startGeneration, startRun, stepSchema, stopRunByDelegate, stopRunByError, stopRunByExceededMaxSteps, stopRunByInteractiveTool, tagNameRegex, textPartSchema, thinkingPartSchema, todoActivitySchema, toolCallPartSchema, toolCallSchema, toolMessageSchema, toolResultPartSchema, toolResultSchema, urlSafeRegex, usageSchema, userMessageSchema, validateEventFilter, vertexProviderToolNameSchema, webFetchOptionsSchema, webSearchOptionsSchema, writeTextFileActivitySchema };
|
|
2100
2046
|
//# sourceMappingURL=index.js.map
|
|
2101
2047
|
//# sourceMappingURL=index.js.map
|