staklink 0.3.84 → 0.3.85
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/proxy-server.cjs +131 -88
- package/dist/staklink-cli.cjs +1 -1
- package/package.json +2 -2
package/dist/proxy-server.cjs
CHANGED
|
@@ -61213,7 +61213,7 @@ var SSEManager = class {
|
|
|
61213
61213
|
var sseManager = new SSEManager();
|
|
61214
61214
|
|
|
61215
61215
|
// src/proxy/version.ts
|
|
61216
|
-
var VERSION = "0.3.
|
|
61216
|
+
var VERSION = "0.3.85";
|
|
61217
61217
|
|
|
61218
61218
|
// node_modules/uuid/dist/esm/stringify.js
|
|
61219
61219
|
var byteToHex = [];
|
|
@@ -120878,21 +120878,6 @@ var schemaSymbol3 = Symbol.for("vercel.ai.schema");
|
|
|
120878
120878
|
|
|
120879
120879
|
// node_modules/ai-sdk-provider-goose/dist/index.js
|
|
120880
120880
|
var import_child_process2 = require("child_process");
|
|
120881
|
-
var PROVIDERS = {
|
|
120882
|
-
anthropic: "anthropic",
|
|
120883
|
-
openai: "openai",
|
|
120884
|
-
google: "google",
|
|
120885
|
-
xai: "xai",
|
|
120886
|
-
ollama: "ollama"
|
|
120887
|
-
};
|
|
120888
|
-
var API_KEY_ENV_VARS = {
|
|
120889
|
-
anthropic: "ANTHROPIC_API_KEY",
|
|
120890
|
-
openai: "OPENAI_API_KEY",
|
|
120891
|
-
google: "GOOGLE_API_KEY",
|
|
120892
|
-
xai: "XAI_API_KEY",
|
|
120893
|
-
ollama: null
|
|
120894
|
-
// Ollama doesn't require an API key
|
|
120895
|
-
};
|
|
120896
120881
|
function createAPICallError(message, metadata) {
|
|
120897
120882
|
return new APICallError5({
|
|
120898
120883
|
message,
|
|
@@ -121089,6 +121074,64 @@ function convertGooseMessages(messages, audience) {
|
|
|
121089
121074
|
return [];
|
|
121090
121075
|
}
|
|
121091
121076
|
}
|
|
121077
|
+
var PROVIDERS = {
|
|
121078
|
+
anthropic: "anthropic",
|
|
121079
|
+
openai: "openai",
|
|
121080
|
+
google: "google",
|
|
121081
|
+
xai: "xai",
|
|
121082
|
+
ollama: "ollama",
|
|
121083
|
+
openrouter: "openrouter"
|
|
121084
|
+
};
|
|
121085
|
+
var GooseModels = {
|
|
121086
|
+
// Anthropic Claude
|
|
121087
|
+
"claude-sonnet-4-5": "anthropic/claude-sonnet-4-5",
|
|
121088
|
+
"claude-haiku-4-5": "anthropic/claude-haiku-4-5",
|
|
121089
|
+
"claude-opus-4-5": "anthropic/claude-opus-4-5",
|
|
121090
|
+
"claude-sonnet-4-0": "anthropic/claude-sonnet-4-0",
|
|
121091
|
+
"claude-opus-4-0": "anthropic/claude-opus-4-0",
|
|
121092
|
+
// OpenAI GPT
|
|
121093
|
+
"gpt-4o": "openai/gpt-4o",
|
|
121094
|
+
"gpt-4o-mini": "openai/gpt-4o-mini",
|
|
121095
|
+
"gpt-4.1": "openai/gpt-4.1",
|
|
121096
|
+
"gpt-4.1-mini": "openai/gpt-4.1-mini",
|
|
121097
|
+
o1: "openai/o1",
|
|
121098
|
+
o3: "openai/o3",
|
|
121099
|
+
"o4-mini": "openai/o4-mini",
|
|
121100
|
+
"gpt-4-turbo": "openai/gpt-4-turbo",
|
|
121101
|
+
"gpt-3.5-turbo": "openai/gpt-3.5-turbo",
|
|
121102
|
+
"gpt-5.1-codex": "openai/gpt-5.1-codex",
|
|
121103
|
+
// Google Gemini
|
|
121104
|
+
"gemini-2.5-pro": "google/gemini-2.5-pro",
|
|
121105
|
+
"gemini-2.5-flash": "google/gemini-2.5-flash",
|
|
121106
|
+
"gemini-2.5-flash-lite": "google/gemini-2.5-flash-lite",
|
|
121107
|
+
"gemini-2.0-flash": "google/gemini-2.0-flash",
|
|
121108
|
+
"gemini-2.0-flash-lite": "google/gemini-2.0-flash-lite",
|
|
121109
|
+
"gemini-3-pro-preview": "google/gemini-3-pro-preview",
|
|
121110
|
+
// xAI Grok
|
|
121111
|
+
"grok-3": "xai/grok-3",
|
|
121112
|
+
"grok-3-fast": "xai/grok-3-fast",
|
|
121113
|
+
"grok-3-mini": "xai/grok-3-mini",
|
|
121114
|
+
"grok-3-mini-fast": "xai/grok-3-mini-fast",
|
|
121115
|
+
"grok-2": "xai/grok-2",
|
|
121116
|
+
"grok-2-vision": "xai/grok-2-vision",
|
|
121117
|
+
// Ollama (local models)
|
|
121118
|
+
qwen3: "ollama/qwen3",
|
|
121119
|
+
"qwen3-coder:30b": "ollama/qwen3-coder:30b",
|
|
121120
|
+
"llama3.2": "ollama/llama3.2",
|
|
121121
|
+
mistral: "ollama/mistral",
|
|
121122
|
+
codellama: "ollama/codellama",
|
|
121123
|
+
// OpenRouter
|
|
121124
|
+
"kimi-k2.5": "openrouter/moonshotai/kimi-k2.5"
|
|
121125
|
+
};
|
|
121126
|
+
var API_KEY_ENV_VARS = {
|
|
121127
|
+
anthropic: "ANTHROPIC_API_KEY",
|
|
121128
|
+
openai: "OPENAI_API_KEY",
|
|
121129
|
+
google: "GOOGLE_API_KEY",
|
|
121130
|
+
xai: "XAI_API_KEY",
|
|
121131
|
+
ollama: null,
|
|
121132
|
+
// Ollama doesn't require an API key
|
|
121133
|
+
openrouter: "OPENROUTER_API_KEY"
|
|
121134
|
+
};
|
|
121092
121135
|
function parseModelId(modelId) {
|
|
121093
121136
|
const slashIndex = modelId.indexOf("/");
|
|
121094
121137
|
if (slashIndex === -1) {
|
|
@@ -121104,6 +121147,42 @@ function parseModelId(modelId) {
|
|
|
121104
121147
|
}
|
|
121105
121148
|
return null;
|
|
121106
121149
|
}
|
|
121150
|
+
function buildProviderEnv(modelId, apiKey) {
|
|
121151
|
+
const parsed = parseModelId(modelId);
|
|
121152
|
+
if (!parsed || !parsed.provider || !parsed.model) {
|
|
121153
|
+
return null;
|
|
121154
|
+
}
|
|
121155
|
+
const { provider, model } = parsed;
|
|
121156
|
+
const env = {
|
|
121157
|
+
GOOSE_PROVIDER: provider,
|
|
121158
|
+
GOOSE_MODEL: model
|
|
121159
|
+
};
|
|
121160
|
+
if (apiKey) {
|
|
121161
|
+
const apiKeyEnvVar = API_KEY_ENV_VARS[provider];
|
|
121162
|
+
if (apiKeyEnvVar) {
|
|
121163
|
+
env[apiKeyEnvVar] = apiKey;
|
|
121164
|
+
}
|
|
121165
|
+
}
|
|
121166
|
+
return env;
|
|
121167
|
+
}
|
|
121168
|
+
function buildGooseEnv(modelId, apiKey, maxTurns) {
|
|
121169
|
+
let env = {
|
|
121170
|
+
// Skip goose configure prompt - allows using goose without setup
|
|
121171
|
+
CONFIGURE: "false",
|
|
121172
|
+
GOOSE_MODE: "auto",
|
|
121173
|
+
GOOSE_CONTEXT_STRATEGY: "summarize"
|
|
121174
|
+
};
|
|
121175
|
+
const vendorEnv = buildProviderEnv(modelId, apiKey);
|
|
121176
|
+
if (vendorEnv) {
|
|
121177
|
+
env = { ...env, ...vendorEnv };
|
|
121178
|
+
}
|
|
121179
|
+
if (maxTurns) {
|
|
121180
|
+
env.GOOSE_MAX_TURNS = String(maxTurns);
|
|
121181
|
+
} else {
|
|
121182
|
+
env.GOOSE_MAX_TURNS = "1500";
|
|
121183
|
+
}
|
|
121184
|
+
return env;
|
|
121185
|
+
}
|
|
121107
121186
|
var GooseLanguageModel = class {
|
|
121108
121187
|
specificationVersion = "v3";
|
|
121109
121188
|
provider = "goose";
|
|
@@ -121112,44 +121191,12 @@ var GooseLanguageModel = class {
|
|
|
121112
121191
|
settings;
|
|
121113
121192
|
logger;
|
|
121114
121193
|
computedEnv;
|
|
121115
|
-
parsedProvider;
|
|
121116
|
-
parsedModel;
|
|
121117
121194
|
constructor(options) {
|
|
121118
121195
|
this.modelId = options.modelId;
|
|
121119
121196
|
this.settings = options.settings;
|
|
121120
121197
|
this.logger = this.settings.logger;
|
|
121121
|
-
const
|
|
121122
|
-
|
|
121123
|
-
this.parsedProvider = parsed.provider;
|
|
121124
|
-
this.parsedModel = parsed.model;
|
|
121125
|
-
}
|
|
121126
|
-
this.computedEnv = this.buildEnv();
|
|
121127
|
-
}
|
|
121128
|
-
/**
|
|
121129
|
-
* Build environment variables from settings.
|
|
121130
|
-
* If modelId is 'goose', uses locally configured goose (no env vars set).
|
|
121131
|
-
* If modelId is 'providerID/modelID', sets GOOSE_PROVIDER and GOOSE_MODEL.
|
|
121132
|
-
*/
|
|
121133
|
-
buildEnv() {
|
|
121134
|
-
const env = {
|
|
121135
|
-
// Skip goose configure prompt - allows using goose without setup
|
|
121136
|
-
CONFIGURE: "false",
|
|
121137
|
-
GOOSE_MODE: "auto",
|
|
121138
|
-
GOOSE_CONTEXT_STRATEGY: "summarize",
|
|
121139
|
-
...this.settings.env
|
|
121140
|
-
};
|
|
121141
|
-
if (this.parsedProvider && this.parsedModel) {
|
|
121142
|
-
env.GOOSE_PROVIDER = this.parsedProvider;
|
|
121143
|
-
env.GOOSE_MODEL = this.parsedModel;
|
|
121144
|
-
if (this.settings.apiKey) {
|
|
121145
|
-
const apiKeyEnvVar = API_KEY_ENV_VARS[this.parsedProvider];
|
|
121146
|
-
if (apiKeyEnvVar) {
|
|
121147
|
-
env[apiKeyEnvVar] = this.settings.apiKey;
|
|
121148
|
-
}
|
|
121149
|
-
}
|
|
121150
|
-
}
|
|
121151
|
-
env.GOOSE_MAX_TURNS = String(this.settings.maxTurns) || "1000";
|
|
121152
|
-
return env;
|
|
121198
|
+
const env = buildGooseEnv(this.modelId, this.settings.apiKey, this.settings.maxTurns);
|
|
121199
|
+
this.computedEnv = { ...env, ...this.settings.env };
|
|
121153
121200
|
}
|
|
121154
121201
|
async doGenerate(options) {
|
|
121155
121202
|
const { system, prompt } = this.extractPromptParts(options.prompt);
|
|
@@ -121208,8 +121255,9 @@ var GooseLanguageModel = class {
|
|
|
121208
121255
|
binPath: this.settings.binPath,
|
|
121209
121256
|
args
|
|
121210
121257
|
});
|
|
121258
|
+
const env = this.computedEnv && Object.keys(this.computedEnv).length > 0 ? { ...process.env, ...this.computedEnv } : process.env;
|
|
121211
121259
|
const child = (0, import_child_process.spawn)(this.settings.binPath, args, {
|
|
121212
|
-
env
|
|
121260
|
+
env
|
|
121213
121261
|
});
|
|
121214
121262
|
const timeout = setTimeout(() => {
|
|
121215
121263
|
child.kill();
|
|
@@ -121269,12 +121317,10 @@ var GooseLanguageModel = class {
|
|
|
121269
121317
|
cleanup2();
|
|
121270
121318
|
if (code !== 0 && code !== null) {
|
|
121271
121319
|
reject(
|
|
121272
|
-
createProcessError(
|
|
121273
|
-
|
|
121274
|
-
|
|
121275
|
-
|
|
121276
|
-
{ binPath: this.settings.binPath, args }
|
|
121277
|
-
)
|
|
121320
|
+
createProcessError(`Goose CLI exited with code ${code}`, code, stderr, {
|
|
121321
|
+
binPath: this.settings.binPath,
|
|
121322
|
+
args
|
|
121323
|
+
})
|
|
121278
121324
|
);
|
|
121279
121325
|
} else {
|
|
121280
121326
|
resolve5(events);
|
|
@@ -121283,8 +121329,9 @@ var GooseLanguageModel = class {
|
|
|
121283
121329
|
});
|
|
121284
121330
|
}
|
|
121285
121331
|
async *createStreamFromProcess(args, abortSignal) {
|
|
121332
|
+
const env = this.computedEnv && Object.keys(this.computedEnv).length > 0 ? { ...process.env, ...this.computedEnv } : process.env;
|
|
121286
121333
|
const child = (0, import_child_process.spawn)(this.settings.binPath, args, {
|
|
121287
|
-
env
|
|
121334
|
+
env
|
|
121288
121335
|
});
|
|
121289
121336
|
const rl = (0, import_readline.createInterface)({ input: child.stdout });
|
|
121290
121337
|
let stderr = "";
|
|
@@ -121416,12 +121463,10 @@ var GooseLanguageModel = class {
|
|
|
121416
121463
|
abortSignal.removeEventListener("abort", onAbort);
|
|
121417
121464
|
}
|
|
121418
121465
|
if (exitCode !== 0) {
|
|
121419
|
-
throw createProcessError(
|
|
121420
|
-
|
|
121421
|
-
|
|
121422
|
-
|
|
121423
|
-
{ binPath: this.settings.binPath, args }
|
|
121424
|
-
);
|
|
121466
|
+
throw createProcessError(`Goose CLI exited with code ${exitCode}`, exitCode, stderr, {
|
|
121467
|
+
binPath: this.settings.binPath,
|
|
121468
|
+
args
|
|
121469
|
+
});
|
|
121425
121470
|
}
|
|
121426
121471
|
}
|
|
121427
121472
|
extractPromptParts(prompt) {
|
|
@@ -121502,13 +121547,7 @@ var GooseLanguageModel = class {
|
|
|
121502
121547
|
}
|
|
121503
121548
|
};
|
|
121504
121549
|
function createGoose(settings = {}) {
|
|
121505
|
-
const {
|
|
121506
|
-
binPath = "goose",
|
|
121507
|
-
timeout = 6e5,
|
|
121508
|
-
args = [],
|
|
121509
|
-
logger,
|
|
121510
|
-
...defaultModelSettings
|
|
121511
|
-
} = settings;
|
|
121550
|
+
const { binPath = "goose", timeout = 6e5, args = [], logger, ...defaultModelSettings } = settings;
|
|
121512
121551
|
const createModel = (modelId, modelSettings) => {
|
|
121513
121552
|
if (typeof modelId !== "string" || !modelId) {
|
|
121514
121553
|
throw new NoSuchModelError5({
|
|
@@ -121564,18 +121603,17 @@ function sanitizeShellArg2(arg) {
|
|
|
121564
121603
|
// src/agent/goose.ts
|
|
121565
121604
|
function goose_env(apiKey, model = "sonnet") {
|
|
121566
121605
|
const models = {
|
|
121567
|
-
sonnet: "claude-sonnet-4-5",
|
|
121568
|
-
opus: "claude-opus-4-5"
|
|
121569
|
-
|
|
121606
|
+
sonnet: GooseModels["claude-sonnet-4-5"],
|
|
121607
|
+
opus: GooseModels["claude-opus-4-5"],
|
|
121608
|
+
kimi: GooseModels["kimi-k2.5"],
|
|
121609
|
+
gemini: GooseModels["gemini-3-pro-preview"],
|
|
121610
|
+
gpt: GooseModels["gpt-5.1-codex"]
|
|
121611
|
+
};
|
|
121612
|
+
const mod = model.includes("/") ? model : models[model] || models.sonnet;
|
|
121613
|
+
const env = buildGooseEnv(mod, apiKey);
|
|
121570
121614
|
return {
|
|
121571
|
-
|
|
121572
|
-
GOOSE_MAX_TURNS: "2000",
|
|
121573
|
-
GOOSE_MODE: "auto",
|
|
121574
|
-
GOOSE_PROVIDER: "anthropic",
|
|
121575
|
-
GOOSE_MODEL: models[model] || models.sonnet,
|
|
121615
|
+
...env,
|
|
121576
121616
|
GOOSE_CLI_MIN_PRIORITY: "1.0",
|
|
121577
|
-
CONFIGURE: "false",
|
|
121578
|
-
ANTHROPIC_API_KEY: apiKey,
|
|
121579
121617
|
PATH: `${path7.join(os.homedir(), ".local", "bin")}:${process.env.PATH}`
|
|
121580
121618
|
};
|
|
121581
121619
|
}
|
|
@@ -121639,7 +121677,7 @@ function createGooseConfig(exaApiKey) {
|
|
|
121639
121677
|
type: streamable_http
|
|
121640
121678
|
name: exa
|
|
121641
121679
|
description: "Search the web and github"
|
|
121642
|
-
uri: https://mcp.exa.ai/mcp?exaApiKey
|
|
121680
|
+
uri: https://mcp.exa.ai/mcp?exaApiKey=${exaApiKey}
|
|
121643
121681
|
timeout: 300
|
|
121644
121682
|
`;
|
|
121645
121683
|
}
|
|
@@ -121685,7 +121723,7 @@ async function runAgent2({
|
|
|
121685
121723
|
cwd
|
|
121686
121724
|
}) {
|
|
121687
121725
|
if (!apiKey) {
|
|
121688
|
-
throw new Error("Missing
|
|
121726
|
+
throw new Error("Missing api key");
|
|
121689
121727
|
}
|
|
121690
121728
|
if (!cwd) {
|
|
121691
121729
|
throw new Error("Missing CWD");
|
|
@@ -133058,7 +133096,7 @@ var SESSIONS = /* @__PURE__ */ new Map();
|
|
|
133058
133096
|
function issueToken(sessionId) {
|
|
133059
133097
|
return jwt3.sign({ sessionId }, JWT_SECRET, { expiresIn: TOKEN_EXPIRY });
|
|
133060
133098
|
}
|
|
133061
|
-
function createSession(sessionId, webhookUrl, apiKey, searchApiKey) {
|
|
133099
|
+
function createSession(sessionId, webhookUrl, apiKey, searchApiKey, model) {
|
|
133062
133100
|
const now3 = Date.now();
|
|
133063
133101
|
const existing = SESSIONS.get(sessionId);
|
|
133064
133102
|
if (existing) {
|
|
@@ -133072,6 +133110,9 @@ function createSession(sessionId, webhookUrl, apiKey, searchApiKey) {
|
|
|
133072
133110
|
if (searchApiKey !== void 0) {
|
|
133073
133111
|
existing.searchApiKey = searchApiKey;
|
|
133074
133112
|
}
|
|
133113
|
+
if (model !== void 0) {
|
|
133114
|
+
existing.model = model;
|
|
133115
|
+
}
|
|
133075
133116
|
return { token: issueToken(sessionId), created: false };
|
|
133076
133117
|
}
|
|
133077
133118
|
SESSIONS.set(sessionId, {
|
|
@@ -133080,7 +133121,8 @@ function createSession(sessionId, webhookUrl, apiKey, searchApiKey) {
|
|
|
133080
133121
|
lastActivity: now3,
|
|
133081
133122
|
webhookUrl,
|
|
133082
133123
|
apiKey,
|
|
133083
|
-
searchApiKey
|
|
133124
|
+
searchApiKey,
|
|
133125
|
+
model
|
|
133084
133126
|
});
|
|
133085
133127
|
return { token: issueToken(sessionId), created: true };
|
|
133086
133128
|
}
|
|
@@ -135371,25 +135413,26 @@ async function startProxyServer() {
|
|
|
135371
135413
|
req.on("close", () => {
|
|
135372
135414
|
clearInterval(keepAliveInterval);
|
|
135373
135415
|
});
|
|
135416
|
+
const opts = { system, webhookUrl: session.webhookUrl, searchApiKey: session.searchApiKey, model: session.model };
|
|
135374
135417
|
await streamGooseToSSE(
|
|
135375
135418
|
sessionId,
|
|
135376
135419
|
prompt,
|
|
135377
135420
|
session.apiKey || process.env.ANTHROPIC_API_KEY || "",
|
|
135378
135421
|
res,
|
|
135379
|
-
|
|
135422
|
+
opts
|
|
135380
135423
|
);
|
|
135381
135424
|
clearInterval(keepAliveInterval);
|
|
135382
135425
|
});
|
|
135383
135426
|
app.use(requireAuth);
|
|
135384
135427
|
app.post("/session", async (req, res) => {
|
|
135385
|
-
const { sessionId, webhookUrl, apiKey, searchApiKey } = req.body;
|
|
135428
|
+
const { sessionId, webhookUrl, apiKey, searchApiKey, model } = req.body;
|
|
135386
135429
|
if (!sessionId) {
|
|
135387
135430
|
res.status(400).json({
|
|
135388
135431
|
error: "Missing required fields: sessionId, webhookUrl"
|
|
135389
135432
|
});
|
|
135390
135433
|
return;
|
|
135391
135434
|
}
|
|
135392
|
-
const { token, created } = createSession(sessionId, webhookUrl, apiKey, searchApiKey);
|
|
135435
|
+
const { token, created } = createSession(sessionId, webhookUrl, apiKey, searchApiKey, model);
|
|
135393
135436
|
res.json({
|
|
135394
135437
|
sessionId,
|
|
135395
135438
|
token,
|
package/dist/staklink-cli.cjs
CHANGED
|
@@ -10967,7 +10967,7 @@ var glob = Object.assign(glob_, {
|
|
|
10967
10967
|
glob.glob = glob;
|
|
10968
10968
|
|
|
10969
10969
|
// src/proxy/version.ts
|
|
10970
|
-
var VERSION = "0.3.
|
|
10970
|
+
var VERSION = "0.3.85";
|
|
10971
10971
|
|
|
10972
10972
|
// src/goose.ts
|
|
10973
10973
|
var import_child_process = require("child_process");
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "staklink",
|
|
3
3
|
"displayName": "staklink",
|
|
4
4
|
"description": "staklink process manager",
|
|
5
|
-
"version": "0.3.
|
|
5
|
+
"version": "0.3.85",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"publisher": "stakwork",
|
|
8
8
|
"engines": {
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"@ai-sdk/google": "^3.0.6",
|
|
119
119
|
"@types/jsonwebtoken": "^9.0.10",
|
|
120
120
|
"ai": "^6.0.26",
|
|
121
|
-
"ai-sdk-provider-goose": "^0.
|
|
121
|
+
"ai-sdk-provider-goose": "^0.2.3",
|
|
122
122
|
"aieo": "^0.1.29",
|
|
123
123
|
"async-mutex": "^0.5.0",
|
|
124
124
|
"commander": "^14.0.1",
|