staklink 0.5.10 → 0.5.11

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.
@@ -15609,7 +15609,7 @@ var require_get_intrinsic = __commonJS({
15609
15609
  var throwTypeError = function() {
15610
15610
  throw new $TypeError();
15611
15611
  };
15612
- var ThrowTypeError = $gOPD ? function() {
15612
+ var ThrowTypeError = $gOPD ? (function() {
15613
15613
  try {
15614
15614
  arguments.callee;
15615
15615
  return throwTypeError;
@@ -15620,7 +15620,7 @@ var require_get_intrinsic = __commonJS({
15620
15620
  return throwTypeError;
15621
15621
  }
15622
15622
  }
15623
- }() : throwTypeError;
15623
+ })() : throwTypeError;
15624
15624
  var hasSymbols = require_has_symbols()();
15625
15625
  var getProto = require_get_proto();
15626
15626
  var $ObjectGPO = require_Object_getPrototypeOf();
@@ -16132,13 +16132,13 @@ var require_utils = __commonJS({
16132
16132
  var formats = require_formats();
16133
16133
  var has = Object.prototype.hasOwnProperty;
16134
16134
  var isArray = Array.isArray;
16135
- var hexTable = function() {
16135
+ var hexTable = (function() {
16136
16136
  var array4 = [];
16137
16137
  for (var i = 0; i < 256; ++i) {
16138
16138
  array4.push("%" + ((i < 16 ? "0" : "") + i.toString(16)).toUpperCase());
16139
16139
  }
16140
16140
  return array4;
16141
- }();
16141
+ })();
16142
16142
  var compactQueue = function compactQueue2(queue) {
16143
16143
  while (queue.length > 1) {
16144
16144
  var item = queue.pop();
@@ -20870,7 +20870,7 @@ var require_ipaddr = __commonJS({
20870
20870
  }
20871
20871
  return defaultName;
20872
20872
  };
20873
- ipaddr.IPv4 = function() {
20873
+ ipaddr.IPv4 = (function() {
20874
20874
  function IPv4(octets) {
20875
20875
  var k, len, octet;
20876
20876
  if (octets.length !== 4) {
@@ -20955,7 +20955,7 @@ var require_ipaddr = __commonJS({
20955
20955
  return 32 - cidr;
20956
20956
  };
20957
20957
  return IPv4;
20958
- }();
20958
+ })();
20959
20959
  ipv4Part = "(0?\\d+|0x[a-f0-9]+)";
20960
20960
  ipv4Regexes = {
20961
20961
  fourOctet: new RegExp("^" + ipv4Part + "\\." + ipv4Part + "\\." + ipv4Part + "\\." + ipv4Part + "$", "i"),
@@ -20971,7 +20971,7 @@ var require_ipaddr = __commonJS({
20971
20971
  }
20972
20972
  };
20973
20973
  if (match3 = string7.match(ipv4Regexes.fourOctet)) {
20974
- return function() {
20974
+ return (function() {
20975
20975
  var k, len, ref, results;
20976
20976
  ref = match3.slice(1, 6);
20977
20977
  results = [];
@@ -20980,25 +20980,25 @@ var require_ipaddr = __commonJS({
20980
20980
  results.push(parseIntAuto(part));
20981
20981
  }
20982
20982
  return results;
20983
- }();
20983
+ })();
20984
20984
  } else if (match3 = string7.match(ipv4Regexes.longValue)) {
20985
20985
  value = parseIntAuto(match3[1]);
20986
20986
  if (value > 4294967295 || value < 0) {
20987
20987
  throw new Error("ipaddr: address outside defined range");
20988
20988
  }
20989
- return function() {
20989
+ return (function() {
20990
20990
  var k, results;
20991
20991
  results = [];
20992
20992
  for (shift = k = 0; k <= 24; shift = k += 8) {
20993
20993
  results.push(value >> shift & 255);
20994
20994
  }
20995
20995
  return results;
20996
- }().reverse();
20996
+ })().reverse();
20997
20997
  } else {
20998
20998
  return null;
20999
20999
  }
21000
21000
  };
21001
- ipaddr.IPv6 = function() {
21001
+ ipaddr.IPv6 = (function() {
21002
21002
  function IPv6(parts, zoneId) {
21003
21003
  var i, k, l, len, part, ref;
21004
21004
  if (parts.length === 16) {
@@ -21058,7 +21058,7 @@ var require_ipaddr = __commonJS({
21058
21058
  };
21059
21059
  IPv6.prototype.toNormalizedString = function() {
21060
21060
  var addr, part, suffix;
21061
- addr = function() {
21061
+ addr = (function() {
21062
21062
  var k, len, ref, results;
21063
21063
  ref = this.parts;
21064
21064
  results = [];
@@ -21067,7 +21067,7 @@ var require_ipaddr = __commonJS({
21067
21067
  results.push(part.toString(16));
21068
21068
  }
21069
21069
  return results;
21070
- }.call(this).join(":");
21070
+ }).call(this).join(":");
21071
21071
  suffix = "";
21072
21072
  if (this.zoneId) {
21073
21073
  suffix = "%" + this.zoneId;
@@ -21076,7 +21076,7 @@ var require_ipaddr = __commonJS({
21076
21076
  };
21077
21077
  IPv6.prototype.toFixedLengthString = function() {
21078
21078
  var addr, part, suffix;
21079
- addr = function() {
21079
+ addr = (function() {
21080
21080
  var k, len, ref, results;
21081
21081
  ref = this.parts;
21082
21082
  results = [];
@@ -21085,7 +21085,7 @@ var require_ipaddr = __commonJS({
21085
21085
  results.push(part.toString(16).padStart(4, "0"));
21086
21086
  }
21087
21087
  return results;
21088
- }.call(this).join(":");
21088
+ }).call(this).join(":");
21089
21089
  suffix = "";
21090
21090
  if (this.zoneId) {
21091
21091
  suffix = "%" + this.zoneId;
@@ -21170,7 +21170,7 @@ var require_ipaddr = __commonJS({
21170
21170
  return 128 - cidr;
21171
21171
  };
21172
21172
  return IPv6;
21173
- }();
21173
+ })();
21174
21174
  ipv6Part = "(?:[0-9a-f]+::?)+";
21175
21175
  zoneIndex = "%[0-9a-z]{1,}";
21176
21176
  ipv6Regexes = {
@@ -21214,7 +21214,7 @@ var require_ipaddr = __commonJS({
21214
21214
  if (string7[string7.length - 1] === ":") {
21215
21215
  string7 = string7.slice(0, -1);
21216
21216
  }
21217
- parts = function() {
21217
+ parts = (function() {
21218
21218
  var k, len, ref, results;
21219
21219
  ref = string7.split(":");
21220
21220
  results = [];
@@ -21223,7 +21223,7 @@ var require_ipaddr = __commonJS({
21223
21223
  results.push(parseInt(part, 16));
21224
21224
  }
21225
21225
  return results;
21226
- }();
21226
+ })();
21227
21227
  return {
21228
21228
  parts,
21229
21229
  zoneId
@@ -24700,15 +24700,15 @@ var require_globalThis = __commonJS({
24700
24700
  var require_node5 = __commonJS({
24701
24701
  "node_modules/@opentelemetry/api/build/src/platform/node/index.js"(exports2) {
24702
24702
  "use strict";
24703
- var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
24703
+ var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
24704
24704
  if (k2 === void 0) k2 = k;
24705
24705
  Object.defineProperty(o, k2, { enumerable: true, get: function() {
24706
24706
  return m[k];
24707
24707
  } });
24708
- } : function(o, m, k, k2) {
24708
+ }) : (function(o, m, k, k2) {
24709
24709
  if (k2 === void 0) k2 = k;
24710
24710
  o[k2] = m[k];
24711
- });
24711
+ }));
24712
24712
  var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
24713
24713
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
24714
24714
  };
@@ -24721,15 +24721,15 @@ var require_node5 = __commonJS({
24721
24721
  var require_platform = __commonJS({
24722
24722
  "node_modules/@opentelemetry/api/build/src/platform/index.js"(exports2) {
24723
24723
  "use strict";
24724
- var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
24724
+ var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
24725
24725
  if (k2 === void 0) k2 = k;
24726
24726
  Object.defineProperty(o, k2, { enumerable: true, get: function() {
24727
24727
  return m[k];
24728
24728
  } });
24729
- } : function(o, m, k, k2) {
24729
+ }) : (function(o, m, k, k2) {
24730
24730
  if (k2 === void 0) k2 = k;
24731
24731
  o[k2] = m[k];
24732
- });
24732
+ }));
24733
24733
  var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
24734
24734
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
24735
24735
  };
@@ -48188,7 +48188,7 @@ var require_fetch = __commonJS({
48188
48188
  fetchParams.controller.terminate(e);
48189
48189
  }
48190
48190
  };
48191
- requestBody = async function* () {
48191
+ requestBody = (async function* () {
48192
48192
  try {
48193
48193
  for await (const bytes of request.body.stream) {
48194
48194
  yield* processBodyChunk(bytes);
@@ -48197,7 +48197,7 @@ var require_fetch = __commonJS({
48197
48197
  } catch (err) {
48198
48198
  processBodyError(err);
48199
48199
  }
48200
- }();
48200
+ })();
48201
48201
  }
48202
48202
  try {
48203
48203
  const { body, status, statusText, headersList, socket } = await dispatch({ body: requestBody });
@@ -60327,7 +60327,7 @@ var Semaphore = class {
60327
60327
  if (!waiters)
60328
60328
  continue;
60329
60329
  const i = waiters.findIndex((waiter) => waiter.priority <= queuedPriority);
60330
- (i === -1 ? waiters : waiters.splice(0, i)).forEach((waiter) => waiter.resolve());
60330
+ (i === -1 ? waiters : waiters.splice(0, i)).forEach(((waiter) => waiter.resolve()));
60331
60331
  }
60332
60332
  }
60333
60333
  }
@@ -61009,7 +61009,7 @@ var SSEManager = class {
61009
61009
  var sseManager = new SSEManager();
61010
61010
 
61011
61011
  // src/proxy/version.ts
61012
- var VERSION = "0.5.10";
61012
+ var VERSION = "0.5.11";
61013
61013
 
61014
61014
  // node_modules/uuid/dist/esm/stringify.js
61015
61015
  var byteToHex = [];
@@ -61213,6 +61213,9 @@ Do not commit or push code to github. That is handled by a workflow after you ar
61213
61213
  CRITICAL: You are running inside the "staklink-proxy" PM2 process. NEVER run "pm2 stop all", "pm2 delete all", "pm2 restart all", or "pm2 kill" - these commands will terminate your own process and abort your session. To restart the user's apps, use "npx -y staklink reload" or target specific processes by name (e.g. "pm2 restart frontend").
61214
61214
 
61215
61215
  `;
61216
+ function buildEffectiveSystemPrompt(system) {
61217
+ return SYSTEM_CORE + (system ? system + "\n\n" : "") + SYSTEM_SUFFIX;
61218
+ }
61216
61219
  var SYSTEM_SUFFIX = `
61217
61220
  You can ignore the .pod-config directory if you see it, its just config stuff
61218
61221
 
@@ -61224,6 +61227,8 @@ Do not make branch / PR if not specifically asked to.
61224
61227
 
61225
61228
  The repo being worked on may have extensive testing! If asked to test, try limit stdout logs and only pay attention to stderr logs. Something like this for exampe: "npm run test:unit 2>&1 > /dev/null | tail -n 20". We need to be smart about minimizing token usage during testing!
61226
61229
 
61230
+ CRITICAL \u2014 prevent hangs: ALWAYS pass a "timeout_secs" argument to the shell tool (e.g. timeout_secs: 720). Without it, a command that never exits will hang your session forever. Some commands (test runners, servers, watchers, DB connections) can block indefinitely \u2014 bound EVERY shell call with a timeout_secs appropriate to the task (short for quick commands, larger for long builds/tests). If a command is a long-running/foreground process (dev server, watcher), run it in the background or via pm2 instead of blocking on it.
61231
+
61227
61232
  `;
61228
61233
 
61229
61234
  // node_modules/aieo/node_modules/zod/v4/classic/external.js
@@ -72059,7 +72064,7 @@ function _stringbool(Classes, _params) {
72059
72064
  type: "pipe",
72060
72065
  in: stringSchema,
72061
72066
  out: booleanSchema,
72062
- transform: (input, payload) => {
72067
+ transform: ((input, payload) => {
72063
72068
  let data = input;
72064
72069
  if (params.case !== "sensitive")
72065
72070
  data = data.toLowerCase();
@@ -72078,14 +72083,14 @@ function _stringbool(Classes, _params) {
72078
72083
  });
72079
72084
  return {};
72080
72085
  }
72081
- },
72082
- reverseTransform: (input, _payload) => {
72086
+ }),
72087
+ reverseTransform: ((input, _payload) => {
72083
72088
  if (input === true) {
72084
72089
  return truthyArray[0] || "true";
72085
72090
  } else {
72086
72091
  return falsyArray[0] || "false";
72087
72092
  }
72088
- },
72093
+ }),
72089
72094
  error: params.error
72090
72095
  });
72091
72096
  return codec2;
@@ -73413,10 +73418,10 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
73413
73418
  inst.with = inst.check;
73414
73419
  inst.clone = (def2, params) => clone(inst, def2, params);
73415
73420
  inst.brand = () => inst;
73416
- inst.register = (reg, meta3) => {
73421
+ inst.register = ((reg, meta3) => {
73417
73422
  reg.add(inst, meta3);
73418
73423
  return inst;
73419
- };
73424
+ });
73420
73425
  inst.parse = (data, params) => parse2(inst, data, params, { callee: inst.parse });
73421
73426
  inst.safeParse = (data, params) => safeParse2(inst, data, params);
73422
73427
  inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
@@ -88457,28 +88462,28 @@ var $ZodFunction2 = class {
88457
88462
  if (typeof func !== "function") {
88458
88463
  throw new Error("implement() must be called with a function");
88459
88464
  }
88460
- const impl = (...args) => {
88465
+ const impl = ((...args) => {
88461
88466
  const parsedArgs = this._def.input ? parse3(this._def.input, args, void 0, { callee: impl }) : args;
88462
88467
  if (!Array.isArray(parsedArgs)) {
88463
88468
  throw new Error("Invalid arguments schema: not an array or tuple schema.");
88464
88469
  }
88465
88470
  const output = func(...parsedArgs);
88466
88471
  return this._def.output ? parse3(this._def.output, output, void 0, { callee: impl }) : output;
88467
- };
88472
+ });
88468
88473
  return impl;
88469
88474
  }
88470
88475
  implementAsync(func) {
88471
88476
  if (typeof func !== "function") {
88472
88477
  throw new Error("implement() must be called with a function");
88473
88478
  }
88474
- const impl = async (...args) => {
88479
+ const impl = (async (...args) => {
88475
88480
  const parsedArgs = this._def.input ? await parseAsync3(this._def.input, args, void 0, { callee: impl }) : args;
88476
88481
  if (!Array.isArray(parsedArgs)) {
88477
88482
  throw new Error("Invalid arguments schema: not an array or tuple schema.");
88478
88483
  }
88479
88484
  const output = await func(...parsedArgs);
88480
88485
  return this._def.output ? parseAsync3(this._def.output, output, void 0, { callee: impl }) : output;
88481
- };
88486
+ });
88482
88487
  return impl;
88483
88488
  }
88484
88489
  input(...args) {
@@ -89387,10 +89392,10 @@ var ZodType3 = /* @__PURE__ */ $constructor2("ZodType", (inst, def) => {
89387
89392
  };
89388
89393
  inst.clone = (def2, params) => clone2(inst, def2, params);
89389
89394
  inst.brand = () => inst;
89390
- inst.register = (reg, meta3) => {
89395
+ inst.register = ((reg, meta3) => {
89391
89396
  reg.add(inst, meta3);
89392
89397
  return inst;
89393
- };
89398
+ });
89394
89399
  inst.parse = (data, params) => parse4(inst, data, params, { callee: inst.parse });
89395
89400
  inst.safeParse = (data, params) => safeParse4(inst, data, params);
89396
89401
  inst.parseAsync = async (data, params) => parseAsync4(inst, data, params, { callee: inst.parseAsync });
@@ -94386,14 +94391,14 @@ var ostring = () => stringType2().optional();
94386
94391
  var onumber = () => numberType2().optional();
94387
94392
  var oboolean = () => booleanType2().optional();
94388
94393
  var coerce = {
94389
- string: (arg) => ZodString4.create({ ...arg, coerce: true }),
94390
- number: (arg) => ZodNumber4.create({ ...arg, coerce: true }),
94391
- boolean: (arg) => ZodBoolean4.create({
94394
+ string: ((arg) => ZodString4.create({ ...arg, coerce: true })),
94395
+ number: ((arg) => ZodNumber4.create({ ...arg, coerce: true })),
94396
+ boolean: ((arg) => ZodBoolean4.create({
94392
94397
  ...arg,
94393
94398
  coerce: true
94394
- }),
94395
- bigint: (arg) => ZodBigInt4.create({ ...arg, coerce: true }),
94396
- date: (arg) => ZodDate4.create({ ...arg, coerce: true })
94399
+ })),
94400
+ bigint: ((arg) => ZodBigInt4.create({ ...arg, coerce: true })),
94401
+ date: ((arg) => ZodDate4.create({ ...arg, coerce: true }))
94397
94402
  };
94398
94403
  var NEVER3 = INVALID2;
94399
94404
 
@@ -144583,12 +144588,12 @@ function createCodexCli(options = {}) {
144583
144588
  };
144584
144589
  provider.languageModel = createModel;
144585
144590
  provider.chat = createModel;
144586
- provider.embeddingModel = (modelId) => {
144591
+ provider.embeddingModel = ((modelId) => {
144587
144592
  throw new NoSuchModelError({ modelId, modelType: "embeddingModel" });
144588
- };
144589
- provider.imageModel = (modelId) => {
144593
+ });
144594
+ provider.imageModel = ((modelId) => {
144590
144595
  throw new NoSuchModelError({ modelId, modelType: "imageModel" });
144591
- };
144596
+ });
144592
144597
  return provider;
144593
144598
  }
144594
144599
  var codexCli = createCodexCli();
@@ -145265,6 +145270,15 @@ function validateAndGetSession(sessionId, token) {
145265
145270
  return null;
145266
145271
  }
145267
145272
  }
145273
+ function updateSessionSystem(sessionId, system) {
145274
+ const session = SESSIONS.get(sessionId);
145275
+ if (!session) {
145276
+ console.warn(`[goose-session-manager] updateSessionSystem: session not found in memory: ${sessionId}`);
145277
+ return;
145278
+ }
145279
+ session.system = system;
145280
+ persistConfig(session);
145281
+ }
145268
145282
  function cleanup() {
145269
145283
  const now2 = Date.now();
145270
145284
  for (const [sessionId, session] of SESSIONS.entries()) {
@@ -148020,6 +148034,9 @@ async function startProxyServer() {
148020
148034
  req.on("close", () => {
148021
148035
  clearInterval(keepAliveInterval);
148022
148036
  });
148037
+ if (system) {
148038
+ updateSessionSystem(sessionId, system);
148039
+ }
148023
148040
  const opts = { system, webhookUrl: session.webhookUrl, searchApiKey: session.searchApiKey, model: session.model };
148024
148041
  if (session.agent === "codex") {
148025
148042
  await streamCodexToSSE(
@@ -148140,7 +148157,13 @@ async function startProxyServer() {
148140
148157
  try {
148141
148158
  const messages = exportSession(sessionId, "assistant");
148142
148159
  const session = getSession(sessionId);
148143
- const { _metadata = null, ...config3 } = session ?? {};
148160
+ const { _metadata = null, system: _system, ...config3 } = session ?? {};
148161
+ if (session && messages[0]?.role !== "system") {
148162
+ messages.unshift({
148163
+ role: "system",
148164
+ content: buildEffectiveSystemPrompt(session.system)
148165
+ });
148166
+ }
148144
148167
  res.json({
148145
148168
  success: true,
148146
148169
  messages,
@@ -11022,7 +11022,7 @@ var glob = Object.assign(glob_, {
11022
11022
  glob.glob = glob;
11023
11023
 
11024
11024
  // src/proxy/version.ts
11025
- var VERSION = "0.5.10";
11025
+ var VERSION = "0.5.11";
11026
11026
 
11027
11027
  // src/deps.ts
11028
11028
  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.10",
5
+ "version": "0.5.11",
6
6
  "type": "module",
7
7
  "publisher": "stakwork",
8
8
  "engines": {