@perstack/runtime 0.0.81 → 0.0.82
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 +1 -1
- package/dist/{chunk-QYGCPFHL.js → chunk-HBGKTPEA.js} +8 -40
- package/dist/chunk-HBGKTPEA.js.map +1 -0
- package/dist/resolve-expert-G6O7UMYS.js +99 -0
- package/dist/resolve-expert-G6O7UMYS.js.map +1 -0
- package/dist/src/index.js +2 -2
- package/package.json +7 -7
- package/dist/chunk-QYGCPFHL.js.map +0 -1
package/dist/bin/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { package_default, findLockfile, loadLockfile, run } from '../chunk-
|
|
2
|
+
import { package_default, findLockfile, loadLockfile, run } from '../chunk-HBGKTPEA.js';
|
|
3
3
|
import '../chunk-RG4QHAGG.js';
|
|
4
4
|
import { parseWithFriendlyError, runCommandInputSchema, validateEventFilter, createFilteredEventListener, perstackConfigSchema } from '@perstack/core';
|
|
5
5
|
import { Command } from 'commander';
|
|
@@ -13,7 +13,6 @@ import { createOpenAI } from '@ai-sdk/openai';
|
|
|
13
13
|
import { createOllama } from 'ollama-ai-provider-v2';
|
|
14
14
|
import { ProxyAgent, fetch } from 'undici';
|
|
15
15
|
import { createId } from '@paralleldrive/cuid2';
|
|
16
|
-
import { createApiClient } from '@perstack/api-client';
|
|
17
16
|
import { setup, assign, createActor } from 'xstate';
|
|
18
17
|
import { readFile } from 'fs/promises';
|
|
19
18
|
import { dedent } from 'ts-dedent';
|
|
@@ -22,7 +21,7 @@ import { APICallError, generateText, streamText } from 'ai';
|
|
|
22
21
|
// package.json
|
|
23
22
|
var package_default = {
|
|
24
23
|
name: "@perstack/runtime",
|
|
25
|
-
version: "0.0.
|
|
24
|
+
version: "0.0.82",
|
|
26
25
|
description: "Perstack Runtime",
|
|
27
26
|
author: "Wintermute Technologies, Inc.",
|
|
28
27
|
license: "Apache-2.0",
|
|
@@ -63,7 +62,7 @@ var package_default = {
|
|
|
63
62
|
"@ai-sdk/openai": "^2.0.0",
|
|
64
63
|
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
65
64
|
"@paralleldrive/cuid2": "^3.0.4",
|
|
66
|
-
"@perstack/api-client": "
|
|
65
|
+
"@perstack/api-client": "^0.0.51",
|
|
67
66
|
"@perstack/base": "workspace:*",
|
|
68
67
|
"@perstack/core": "workspace:*",
|
|
69
68
|
ai: "^5.0.115",
|
|
@@ -345,51 +344,20 @@ function buildDelegationReturnState(currentSetting, resultCheckpoint, parentChec
|
|
|
345
344
|
}
|
|
346
345
|
};
|
|
347
346
|
}
|
|
348
|
-
async function resolveExpertToRun(expertKey, experts, clientOptions) {
|
|
349
|
-
if (experts[expertKey]) {
|
|
350
|
-
return experts[expertKey];
|
|
351
|
-
}
|
|
352
|
-
const client = createApiClient({
|
|
353
|
-
baseUrl: clientOptions.perstackApiBaseUrl,
|
|
354
|
-
apiKey: clientOptions.perstackApiKey
|
|
355
|
-
});
|
|
356
|
-
const result = await client.registry.experts.get(expertKey);
|
|
357
|
-
if (!result.ok) {
|
|
358
|
-
throw new Error(`Failed to resolve expert "${expertKey}": ${result.error.message}`);
|
|
359
|
-
}
|
|
360
|
-
return toRuntimeExpert(result.data);
|
|
361
|
-
}
|
|
362
|
-
function toRuntimeExpert(expert) {
|
|
363
|
-
const skills = Object.fromEntries(
|
|
364
|
-
Object.entries(expert.skills).map(([name, skill]) => {
|
|
365
|
-
switch (skill.type) {
|
|
366
|
-
case "mcpStdioSkill":
|
|
367
|
-
return [name, { ...skill, name }];
|
|
368
|
-
case "mcpSseSkill":
|
|
369
|
-
return [name, { ...skill, name }];
|
|
370
|
-
case "interactiveSkill":
|
|
371
|
-
return [name, { ...skill, name }];
|
|
372
|
-
default: {
|
|
373
|
-
throw new Error(`Unknown skill type: ${skill.type}`);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
})
|
|
377
|
-
);
|
|
378
|
-
return { ...expert, skills };
|
|
379
|
-
}
|
|
380
347
|
|
|
381
348
|
// src/helpers/setup-experts.ts
|
|
382
|
-
async function setupExperts(setting,
|
|
349
|
+
async function setupExperts(setting, resolveExpertToRun) {
|
|
350
|
+
const resolveFn = resolveExpertToRun ?? (await import('./resolve-expert-G6O7UMYS.js')).resolveExpertToRun;
|
|
383
351
|
const { expertKey } = setting;
|
|
384
352
|
const experts = { ...setting.experts };
|
|
385
353
|
const clientOptions = {
|
|
386
354
|
perstackApiBaseUrl: setting.perstackApiBaseUrl,
|
|
387
355
|
perstackApiKey: setting.perstackApiKey
|
|
388
356
|
};
|
|
389
|
-
const expertToRun = await
|
|
357
|
+
const expertToRun = await resolveFn(expertKey, experts, clientOptions);
|
|
390
358
|
experts[expertKey] = expertToRun;
|
|
391
359
|
for (const delegateName of expertToRun.delegates) {
|
|
392
|
-
const delegate = await
|
|
360
|
+
const delegate = await resolveFn(delegateName, experts, clientOptions);
|
|
393
361
|
if (!delegate) {
|
|
394
362
|
throw new Error(`Delegate ${delegateName} not found`);
|
|
395
363
|
}
|
|
@@ -3723,5 +3691,5 @@ async function run(runInput, options) {
|
|
|
3723
3691
|
}
|
|
3724
3692
|
|
|
3725
3693
|
export { findLockfile, getLockfileExpertToolDefinitions, getModel, loadLockfile, package_default, run, runtimeStateMachine };
|
|
3726
|
-
//# sourceMappingURL=chunk-
|
|
3727
|
-
//# sourceMappingURL=chunk-
|
|
3694
|
+
//# sourceMappingURL=chunk-HBGKTPEA.js.map
|
|
3695
|
+
//# sourceMappingURL=chunk-HBGKTPEA.js.map
|