staklink 0.5.2 → 0.5.4

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.
@@ -5257,7 +5257,7 @@ var require_read = __commonJS({
5257
5257
  var stream2;
5258
5258
  req._body = true;
5259
5259
  var encoding = opts.encoding !== null ? opts.encoding : null;
5260
- var verify2 = opts.verify;
5260
+ var verify = opts.verify;
5261
5261
  try {
5262
5262
  stream2 = contentstream(req, debug, opts.inflate);
5263
5263
  length = stream2.length;
@@ -5266,7 +5266,7 @@ var require_read = __commonJS({
5266
5266
  return next(err);
5267
5267
  }
5268
5268
  opts.length = length;
5269
- opts.encoding = verify2 ? null : encoding;
5269
+ opts.encoding = verify ? null : encoding;
5270
5270
  if (opts.encoding === null && encoding !== null && !iconv.encodingExists(encoding)) {
5271
5271
  return next(createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
5272
5272
  charset: encoding.toLowerCase(),
@@ -5294,10 +5294,10 @@ var require_read = __commonJS({
5294
5294
  });
5295
5295
  return;
5296
5296
  }
5297
- if (verify2) {
5297
+ if (verify) {
5298
5298
  try {
5299
5299
  debug("verify body");
5300
- verify2(req, res, body, encoding);
5300
+ verify(req, res, body, encoding);
5301
5301
  } catch (err) {
5302
5302
  next(createError(403, err, {
5303
5303
  body,
@@ -14238,8 +14238,8 @@ var require_json = __commonJS({
14238
14238
  var reviver = opts.reviver;
14239
14239
  var strict = opts.strict !== false;
14240
14240
  var type = opts.type || "application/json";
14241
- var verify2 = opts.verify || false;
14242
- if (verify2 !== false && typeof verify2 !== "function") {
14241
+ var verify = opts.verify || false;
14242
+ if (verify !== false && typeof verify !== "function") {
14243
14243
  throw new TypeError("option verify must be function");
14244
14244
  }
14245
14245
  var shouldParse = typeof type !== "function" ? typeChecker(type) : type;
@@ -14295,7 +14295,7 @@ var require_json = __commonJS({
14295
14295
  encoding: charset,
14296
14296
  inflate,
14297
14297
  limit,
14298
- verify: verify2
14298
+ verify
14299
14299
  });
14300
14300
  };
14301
14301
  }
@@ -14365,8 +14365,8 @@ var require_raw = __commonJS({
14365
14365
  var inflate = opts.inflate !== false;
14366
14366
  var limit = typeof opts.limit !== "number" ? bytes.parse(opts.limit || "100kb") : opts.limit;
14367
14367
  var type = opts.type || "application/octet-stream";
14368
- var verify2 = opts.verify || false;
14369
- if (verify2 !== false && typeof verify2 !== "function") {
14368
+ var verify = opts.verify || false;
14369
+ if (verify !== false && typeof verify !== "function") {
14370
14370
  throw new TypeError("option verify must be function");
14371
14371
  }
14372
14372
  var shouldParse = typeof type !== "function" ? typeChecker(type) : type;
@@ -14395,7 +14395,7 @@ var require_raw = __commonJS({
14395
14395
  encoding: null,
14396
14396
  inflate,
14397
14397
  limit,
14398
- verify: verify2
14398
+ verify
14399
14399
  });
14400
14400
  };
14401
14401
  }
@@ -14423,8 +14423,8 @@ var require_text = __commonJS({
14423
14423
  var inflate = opts.inflate !== false;
14424
14424
  var limit = typeof opts.limit !== "number" ? bytes.parse(opts.limit || "100kb") : opts.limit;
14425
14425
  var type = opts.type || "text/plain";
14426
- var verify2 = opts.verify || false;
14427
- if (verify2 !== false && typeof verify2 !== "function") {
14426
+ var verify = opts.verify || false;
14427
+ if (verify !== false && typeof verify !== "function") {
14428
14428
  throw new TypeError("option verify must be function");
14429
14429
  }
14430
14430
  var shouldParse = typeof type !== "function" ? typeChecker(type) : type;
@@ -14454,7 +14454,7 @@ var require_text = __commonJS({
14454
14454
  encoding: charset,
14455
14455
  inflate,
14456
14456
  limit,
14457
- verify: verify2
14457
+ verify
14458
14458
  });
14459
14459
  };
14460
14460
  }
@@ -15232,7 +15232,7 @@ var require_sign = __commonJS({
15232
15232
  "node_modules/math-intrinsics/sign.js"(exports2, module2) {
15233
15233
  "use strict";
15234
15234
  var $isNaN = require_isNaN();
15235
- module2.exports = function sign2(number7) {
15235
+ module2.exports = function sign(number7) {
15236
15236
  if ($isNaN(number7) || number7 === 0) {
15237
15237
  return number7;
15238
15238
  }
@@ -15596,7 +15596,7 @@ var require_get_intrinsic = __commonJS({
15596
15596
  var min = require_min();
15597
15597
  var pow = require_pow();
15598
15598
  var round = require_round();
15599
- var sign2 = require_sign();
15599
+ var sign = require_sign();
15600
15600
  var $Function = Function;
15601
15601
  var getEvalledConstructor = function(expressionSyntax) {
15602
15602
  try {
@@ -15710,7 +15710,7 @@ var require_get_intrinsic = __commonJS({
15710
15710
  "%Math.min%": min,
15711
15711
  "%Math.pow%": pow,
15712
15712
  "%Math.round%": round,
15713
- "%Math.sign%": sign2,
15713
+ "%Math.sign%": sign,
15714
15714
  "%Reflect.getPrototypeOf%": $ReflectGPO
15715
15715
  };
15716
15716
  if (getProto) {
@@ -16874,9 +16874,9 @@ var require_urlencoded = __commonJS({
16874
16874
  var inflate = opts.inflate !== false;
16875
16875
  var limit = typeof opts.limit !== "number" ? bytes.parse(opts.limit || "100kb") : opts.limit;
16876
16876
  var type = opts.type || "application/x-www-form-urlencoded";
16877
- var verify2 = opts.verify || false;
16877
+ var verify = opts.verify || false;
16878
16878
  var depth = typeof opts.depth !== "number" ? Number(opts.depth || 32) : opts.depth;
16879
- if (verify2 !== false && typeof verify2 !== "function") {
16879
+ if (verify !== false && typeof verify !== "function") {
16880
16880
  throw new TypeError("option verify must be function");
16881
16881
  }
16882
16882
  var queryparse = extended ? extendedparser(opts) : simpleparser(opts);
@@ -16916,7 +16916,7 @@ var require_urlencoded = __commonJS({
16916
16916
  encoding: charset,
16917
16917
  inflate,
16918
16918
  limit,
16919
- verify: verify2,
16919
+ verify,
16920
16920
  depth
16921
16921
  });
16922
16922
  };
@@ -23029,7 +23029,7 @@ var require_response = __commonJS({
23029
23029
  var path13 = require("path");
23030
23030
  var statuses = require_statuses();
23031
23031
  var merge3 = require_utils_merge();
23032
- var sign2 = require_cookie_signature().sign;
23032
+ var sign = require_cookie_signature().sign;
23033
23033
  var normalizeType = require_utils2().normalizeType;
23034
23034
  var normalizeTypes = require_utils2().normalizeTypes;
23035
23035
  var setCharset = require_utils2().setCharset;
@@ -23384,7 +23384,7 @@ var require_response = __commonJS({
23384
23384
  }
23385
23385
  var val = typeof value === "object" ? "j:" + JSON.stringify(value) : String(value);
23386
23386
  if (signed) {
23387
- val = "s:" + sign2(val, secret);
23387
+ val = "s:" + sign(val, secret);
23388
23388
  }
23389
23389
  if (opts.maxAge != null) {
23390
23390
  var maxAge = opts.maxAge - 0;
@@ -26688,7 +26688,7 @@ var require_jwa = __commonJS({
26688
26688
  return thing;
26689
26689
  }
26690
26690
  function createHmacSigner(bits) {
26691
- return function sign2(thing, secret) {
26691
+ return function sign(thing, secret) {
26692
26692
  checkIsSecretKey(secret);
26693
26693
  thing = normalizeInput(thing);
26694
26694
  var hmac = crypto3.createHmac("sha" + bits, secret);
@@ -26709,13 +26709,13 @@ var require_jwa = __commonJS({
26709
26709
  return bufferEqual(a, b);
26710
26710
  };
26711
26711
  function createHmacVerifier(bits) {
26712
- return function verify2(thing, signature, secret) {
26712
+ return function verify(thing, signature, secret) {
26713
26713
  var computedSig = createHmacSigner(bits)(thing, secret);
26714
26714
  return timingSafeEqual(Buffer2.from(signature), Buffer2.from(computedSig));
26715
26715
  };
26716
26716
  }
26717
26717
  function createKeySigner(bits) {
26718
- return function sign2(thing, privateKey) {
26718
+ return function sign(thing, privateKey) {
26719
26719
  checkIsPrivateKey(privateKey);
26720
26720
  thing = normalizeInput(thing);
26721
26721
  var signer = crypto3.createSign("RSA-SHA" + bits);
@@ -26724,7 +26724,7 @@ var require_jwa = __commonJS({
26724
26724
  };
26725
26725
  }
26726
26726
  function createKeyVerifier(bits) {
26727
- return function verify2(thing, signature, publicKey) {
26727
+ return function verify(thing, signature, publicKey) {
26728
26728
  checkIsPublicKey(publicKey);
26729
26729
  thing = normalizeInput(thing);
26730
26730
  signature = toBase64(signature);
@@ -26734,7 +26734,7 @@ var require_jwa = __commonJS({
26734
26734
  };
26735
26735
  }
26736
26736
  function createPSSKeySigner(bits) {
26737
- return function sign2(thing, privateKey) {
26737
+ return function sign(thing, privateKey) {
26738
26738
  checkIsPrivateKey(privateKey);
26739
26739
  thing = normalizeInput(thing);
26740
26740
  var signer = crypto3.createSign("RSA-SHA" + bits);
@@ -26747,7 +26747,7 @@ var require_jwa = __commonJS({
26747
26747
  };
26748
26748
  }
26749
26749
  function createPSSKeyVerifier(bits) {
26750
- return function verify2(thing, signature, publicKey) {
26750
+ return function verify(thing, signature, publicKey) {
26751
26751
  checkIsPublicKey(publicKey);
26752
26752
  thing = normalizeInput(thing);
26753
26753
  signature = toBase64(signature);
@@ -26762,7 +26762,7 @@ var require_jwa = __commonJS({
26762
26762
  }
26763
26763
  function createECDSASigner(bits) {
26764
26764
  var inner = createKeySigner(bits);
26765
- return function sign2() {
26765
+ return function sign() {
26766
26766
  var signature = inner.apply(null, arguments);
26767
26767
  signature = formatEcdsa.derToJose(signature, "ES" + bits);
26768
26768
  return signature;
@@ -26770,19 +26770,19 @@ var require_jwa = __commonJS({
26770
26770
  }
26771
26771
  function createECDSAVerifer(bits) {
26772
26772
  var inner = createKeyVerifier(bits);
26773
- return function verify2(thing, signature, publicKey) {
26773
+ return function verify(thing, signature, publicKey) {
26774
26774
  signature = formatEcdsa.joseToDer(signature, "ES" + bits).toString("base64");
26775
26775
  var result = inner(thing, signature, publicKey);
26776
26776
  return result;
26777
26777
  };
26778
26778
  }
26779
26779
  function createNoneSigner() {
26780
- return function sign2() {
26780
+ return function sign() {
26781
26781
  return "";
26782
26782
  };
26783
26783
  }
26784
26784
  function createNoneVerifier() {
26785
- return function verify2(thing, signature) {
26785
+ return function verify(thing, signature) {
26786
26786
  return signature === "";
26787
26787
  };
26788
26788
  }
@@ -26879,7 +26879,7 @@ var require_sign_stream = __commonJS({
26879
26879
  }.bind(this));
26880
26880
  }
26881
26881
  util3.inherits(SignStream, Stream2);
26882
- SignStream.prototype.sign = function sign2() {
26882
+ SignStream.prototype.sign = function sign() {
26883
26883
  try {
26884
26884
  var signature = jwsSign({
26885
26885
  header: this.header,
@@ -26996,7 +26996,7 @@ var require_verify_stream = __commonJS({
26996
26996
  }.bind(this));
26997
26997
  }
26998
26998
  util3.inherits(VerifyStream, Stream2);
26999
- VerifyStream.prototype.verify = function verify2() {
26999
+ VerifyStream.prototype.verify = function verify() {
27000
27000
  try {
27001
27001
  var valid = jwsVerify(this.signature.buffer, this.algorithm, this.key.buffer);
27002
27002
  var obj = jwsDecode(this.signature.buffer, this.encoding);
@@ -29455,8 +29455,8 @@ var require_lodash = __commonJS({
29455
29455
  }
29456
29456
  value = toNumber(value);
29457
29457
  if (value === INFINITY || value === -INFINITY) {
29458
- var sign2 = value < 0 ? -1 : 1;
29459
- return sign2 * MAX_INTEGER;
29458
+ var sign = value < 0 ? -1 : 1;
29459
+ return sign * MAX_INTEGER;
29460
29460
  }
29461
29461
  return value === value ? value : 0;
29462
29462
  }
@@ -29541,8 +29541,8 @@ var require_lodash3 = __commonJS({
29541
29541
  }
29542
29542
  value = toNumber(value);
29543
29543
  if (value === INFINITY || value === -INFINITY) {
29544
- var sign2 = value < 0 ? -1 : 1;
29545
- return sign2 * MAX_INTEGER;
29544
+ var sign = value < 0 ? -1 : 1;
29545
+ return sign * MAX_INTEGER;
29546
29546
  }
29547
29547
  return value === value ? value : 0;
29548
29548
  }
@@ -29699,8 +29699,8 @@ var require_lodash7 = __commonJS({
29699
29699
  }
29700
29700
  value = toNumber(value);
29701
29701
  if (value === INFINITY || value === -INFINITY) {
29702
- var sign2 = value < 0 ? -1 : 1;
29703
- return sign2 * MAX_INTEGER;
29702
+ var sign = value < 0 ? -1 : 1;
29703
+ return sign * MAX_INTEGER;
29704
29704
  }
29705
29705
  return value === value ? value : 0;
29706
29706
  }
@@ -60528,10 +60528,13 @@ var Repo = class {
60528
60528
  }
60529
60529
  async checkoutMainBranchOrBaseBranch(base_branch) {
60530
60530
  if (base_branch) {
60531
- return this.execCommand(`git checkout -f ${base_branch}`);
60531
+ return this.execCommand(
60532
+ `git checkout -f -B ${base_branch} origin/${base_branch}`
60533
+ );
60532
60534
  }
60535
+ const mainBranch = (await this.printMainBranch()).trim();
60533
60536
  return this.execCommand(
60534
- `git checkout -f $(git remote show origin | sed -n '/HEAD branch/s/.*: //p')`
60537
+ `git checkout -f -B ${mainBranch} origin/${mainBranch}`
60535
60538
  );
60536
60539
  }
60537
60540
  async branchExists(branch) {
@@ -60988,7 +60991,7 @@ var SSEManager = class {
60988
60991
  var sseManager = new SSEManager();
60989
60992
 
60990
60993
  // src/proxy/version.ts
60991
- var VERSION = "0.5.2";
60994
+ var VERSION = "0.5.4";
60992
60995
 
60993
60996
  // node_modules/uuid/dist/esm/stringify.js
60994
60997
  var byteToHex = [];
@@ -145118,35 +145121,33 @@ async function streamCodexToSSE(sessionId, prompt, apiKey, res, options) {
145118
145121
  }
145119
145122
 
145120
145123
  // src/agent/goose-session-manager.ts
145121
- var jwt3 = __toESM(require_jsonwebtoken(), 1);
145124
+ var import_jsonwebtoken = __toESM(require_jsonwebtoken(), 1);
145122
145125
  var crypto2 = __toESM(require("crypto"), 1);
145123
145126
  var JWT_SECRET = process.env.JWT_SECRET || crypto2.randomBytes(32).toString("hex");
145124
145127
  var TOKEN_EXPIRY = "10m";
145125
145128
  var SESSION_INACTIVITY_TTL = 24 * 60 * 60 * 1e3;
145126
145129
  var SESSIONS = /* @__PURE__ */ new Map();
145127
145130
  function issueToken(sessionId) {
145128
- return jwt3.sign({ sessionId }, JWT_SECRET, { expiresIn: TOKEN_EXPIRY });
145131
+ return import_jsonwebtoken.default.sign({ sessionId }, JWT_SECRET, { expiresIn: TOKEN_EXPIRY });
145129
145132
  }
145130
- function createSession(sessionId, webhookUrl, apiKey, searchApiKey, model, agent) {
145133
+ function createSession(sessionId, webhookUrl, apiKey, searchApiKey, model, agent, system, temperature, jsonMode, summaryApiKey, mcpServers, baseUrl, headers, repoName) {
145131
145134
  const now2 = Date.now();
145132
145135
  const existing = SESSIONS.get(sessionId);
145133
145136
  if (existing) {
145134
145137
  existing.lastActivity = now2;
145135
- if (webhookUrl !== void 0) {
145136
- existing.webhookUrl = webhookUrl;
145137
- }
145138
- if (apiKey !== void 0) {
145139
- existing.apiKey = apiKey;
145140
- }
145141
- if (searchApiKey !== void 0) {
145142
- existing.searchApiKey = searchApiKey;
145143
- }
145144
- if (model !== void 0) {
145145
- existing.model = model;
145146
- }
145147
- if (agent !== void 0) {
145148
- existing.agent = agent;
145149
- }
145138
+ if (webhookUrl !== void 0) existing.webhookUrl = webhookUrl;
145139
+ if (apiKey !== void 0) existing.apiKey = apiKey;
145140
+ if (searchApiKey !== void 0) existing.searchApiKey = searchApiKey;
145141
+ if (model !== void 0) existing.model = model;
145142
+ if (agent !== void 0) existing.agent = agent;
145143
+ if (system !== void 0) existing.system = system;
145144
+ if (temperature !== void 0) existing.temperature = temperature;
145145
+ if (jsonMode !== void 0) existing.jsonMode = jsonMode;
145146
+ if (summaryApiKey !== void 0) existing.summaryApiKey = summaryApiKey;
145147
+ if (mcpServers !== void 0) existing.mcpServers = mcpServers;
145148
+ if (baseUrl !== void 0) existing.baseUrl = baseUrl;
145149
+ if (headers !== void 0) existing.headers = headers;
145150
+ if (repoName !== void 0) existing.repoName = repoName;
145150
145151
  return { token: issueToken(sessionId), created: false };
145151
145152
  }
145152
145153
  SESSIONS.set(sessionId, {
@@ -145157,13 +145158,21 @@ function createSession(sessionId, webhookUrl, apiKey, searchApiKey, model, agent
145157
145158
  apiKey,
145158
145159
  searchApiKey,
145159
145160
  model,
145160
- agent
145161
+ agent,
145162
+ system,
145163
+ temperature,
145164
+ jsonMode,
145165
+ summaryApiKey,
145166
+ mcpServers,
145167
+ baseUrl,
145168
+ headers,
145169
+ repoName
145161
145170
  });
145162
145171
  return { token: issueToken(sessionId), created: true };
145163
145172
  }
145164
145173
  function validateAndGetSession(sessionId, token) {
145165
145174
  try {
145166
- const decoded = jwt3.verify(token, JWT_SECRET);
145175
+ const decoded = import_jsonwebtoken.default.verify(token, JWT_SECRET);
145167
145176
  if (decoded.sessionId !== sessionId) {
145168
145177
  return null;
145169
145178
  }
@@ -147104,7 +147113,7 @@ async function handleAgentPush(req, res) {
147104
147113
  code.git_credentials
147105
147114
  );
147106
147115
  try {
147107
- const prompt = buildPushPrompt({
147116
+ const prompt = code.prompt || buildPushPrompt({
147108
147117
  repoPath,
147109
147118
  createPR,
147110
147119
  autoMerge,
@@ -147758,8 +147767,8 @@ async function startProxyServer() {
147758
147767
  log("=> LATEST: Running reset...");
147759
147768
  for (const r of code.repos) {
147760
147769
  const repo = await NewRepo(r.url);
147761
- await repo.checkoutMainBranchOrBaseBranch(r.base_branch);
147762
147770
  await repo.fetchLatestWithCredentials(code.git_credentials);
147771
+ await repo.checkoutMainBranchOrBaseBranch(r.base_branch);
147763
147772
  await repo.resetHardOriginWithCredentials(r.base_branch);
147764
147773
  await repo.clean();
147765
147774
  }
@@ -11004,7 +11004,7 @@ var glob = Object.assign(glob_, {
11004
11004
  glob.glob = glob;
11005
11005
 
11006
11006
  // src/proxy/version.ts
11007
- var VERSION = "0.5.2";
11007
+ var VERSION = "0.5.4";
11008
11008
 
11009
11009
  // src/deps.ts
11010
11010
  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.5.2",
5
+ "version": "0.5.4",
6
6
  "type": "module",
7
7
  "publisher": "stakwork",
8
8
  "engines": {