repoburg 1.3.318 → 1.3.319

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.
Files changed (63) hide show
  1. package/agent-pane/backend/dist/index.js +205 -35
  2. package/agent-pane/backend/dist/server.js +205 -35
  3. package/agent-pane/frontend/dist/assets/{TerminalView-DRgcCvox.js → TerminalView-D5Hg3Fzf.js} +1 -1
  4. package/agent-pane/frontend/dist/assets/index-C1m0abtH.css +1 -0
  5. package/agent-pane/frontend/dist/assets/index-Cckb2tlY.js +852 -0
  6. package/agent-pane/frontend/dist/index.html +2 -2
  7. package/backend/dist/src/application-state/application-state.service.d.ts +5 -0
  8. package/backend/dist/src/application-state/application-state.service.js +18 -0
  9. package/backend/dist/src/application-state/application-state.service.js.map +1 -1
  10. package/backend/dist/src/core-entities/enums.d.ts +1 -0
  11. package/backend/dist/src/core-entities/enums.js +1 -0
  12. package/backend/dist/src/core-entities/enums.js.map +1 -1
  13. package/backend/dist/src/global-config/global-config.service.d.ts +1 -0
  14. package/backend/dist/src/global-config/global-config.service.js +15 -1
  15. package/backend/dist/src/global-config/global-config.service.js.map +1 -1
  16. package/backend/dist/src/llm-provider/alibaba-llm.provider.d.ts +18 -2
  17. package/backend/dist/src/llm-provider/alibaba-llm.provider.js +155 -17
  18. package/backend/dist/src/llm-provider/alibaba-llm.provider.js.map +1 -1
  19. package/backend/dist/src/llm-provider/credential-check.d.ts +3 -0
  20. package/backend/dist/src/llm-provider/credential-check.js +27 -0
  21. package/backend/dist/src/llm-provider/credential-check.js.map +1 -0
  22. package/backend/dist/src/llm-provider/dto/set-inference-credentials.dto.d.ts +5 -0
  23. package/backend/dist/src/llm-provider/dto/set-inference-credentials.dto.js +46 -0
  24. package/backend/dist/src/llm-provider/dto/set-inference-credentials.dto.js.map +1 -0
  25. package/backend/dist/src/llm-provider/inference-credentials.service.d.ts +24 -0
  26. package/backend/dist/src/llm-provider/inference-credentials.service.js +120 -0
  27. package/backend/dist/src/llm-provider/inference-credentials.service.js.map +1 -0
  28. package/backend/dist/src/llm-provider/inference-registry.d.ts +15 -0
  29. package/backend/dist/src/llm-provider/inference-registry.js +68 -0
  30. package/backend/dist/src/llm-provider/inference-registry.js.map +1 -0
  31. package/backend/dist/src/llm-provider/llm-provider.controller.d.ts +15 -1
  32. package/backend/dist/src/llm-provider/llm-provider.controller.js +75 -3
  33. package/backend/dist/src/llm-provider/llm-provider.controller.js.map +1 -1
  34. package/backend/dist/src/llm-provider/llm-provider.interface.d.ts +34 -1
  35. package/backend/dist/src/llm-provider/llm-provider.interface.js +8 -1
  36. package/backend/dist/src/llm-provider/llm-provider.interface.js.map +1 -1
  37. package/backend/dist/src/llm-provider/llm-provider.module.js +5 -1
  38. package/backend/dist/src/llm-provider/llm-provider.module.js.map +1 -1
  39. package/backend/dist/src/llm-provider/ollama-llm.provider.d.ts +14 -6
  40. package/backend/dist/src/llm-provider/ollama-llm.provider.js +208 -80
  41. package/backend/dist/src/llm-provider/ollama-llm.provider.js.map +1 -1
  42. package/backend/dist/src/llm-provider/openai-llm.provider.d.ts +7 -2
  43. package/backend/dist/src/llm-provider/openai-llm.provider.js +50 -8
  44. package/backend/dist/src/llm-provider/openai-llm.provider.js.map +1 -1
  45. package/backend/dist/src/llm-provider/openrouter-llm.provider.d.ts +21 -2
  46. package/backend/dist/src/llm-provider/openrouter-llm.provider.js +124 -14
  47. package/backend/dist/src/llm-provider/openrouter-llm.provider.js.map +1 -1
  48. package/backend/dist/src/llm-provider/proxy-llm.provider.d.ts +4 -11
  49. package/backend/dist/src/llm-provider/proxy-llm.provider.js +17 -47
  50. package/backend/dist/src/llm-provider/proxy-llm.provider.js.map +1 -1
  51. package/backend/dist/src/llm-provider/reasoning.d.ts +9 -0
  52. package/backend/dist/src/llm-provider/reasoning.js +73 -0
  53. package/backend/dist/src/llm-provider/reasoning.js.map +1 -0
  54. package/backend/dist/src/llm-provider/zai-llm.provider.d.ts +24 -2
  55. package/backend/dist/src/llm-provider/zai-llm.provider.js +134 -17
  56. package/backend/dist/src/llm-provider/zai-llm.provider.js.map +1 -1
  57. package/backend/dist/tsconfig.build.tsbuildinfo +1 -1
  58. package/package.json +1 -1
  59. package/tabtape/extension/dist/build-info.json +3 -3
  60. package/tabtape/extension/dist/manifest.json +1 -1
  61. package/tabtape/ui/dist/build-info.json +3 -3
  62. package/agent-pane/frontend/dist/assets/index-CvyygQ2I.js +0 -852
  63. package/agent-pane/frontend/dist/assets/index-nEHdBY3j.css +0 -1
@@ -11485,7 +11485,7 @@ var require_reply = __commonJS({
11485
11485
  }
11486
11486
  return serialize2;
11487
11487
  };
11488
- Reply.prototype.compileSerializationSchema = function(schema, httpStatus = null, contentType = null) {
11488
+ Reply.prototype.compileSerializationSchema = function(schema, httpStatus2 = null, contentType = null) {
11489
11489
  const { request } = this;
11490
11490
  const { method, url: url2 } = request;
11491
11491
  if (this[kRouteContext][kReplyCacheSerializeFns]?.has(schema)) {
@@ -11498,7 +11498,7 @@ var require_reply = __commonJS({
11498
11498
  schema,
11499
11499
  method,
11500
11500
  url: url2,
11501
- httpStatus,
11501
+ httpStatus: httpStatus2,
11502
11502
  contentType
11503
11503
  });
11504
11504
  if (this[kRouteContext][kReplyCacheSerializeFns] == null) {
@@ -11507,26 +11507,26 @@ var require_reply = __commonJS({
11507
11507
  this[kRouteContext][kReplyCacheSerializeFns].set(schema, serializeFn);
11508
11508
  return serializeFn;
11509
11509
  };
11510
- Reply.prototype.serializeInput = function(input, schema, httpStatus, contentType) {
11511
- const possibleContentType = httpStatus;
11510
+ Reply.prototype.serializeInput = function(input, schema, httpStatus2, contentType) {
11511
+ const possibleContentType = httpStatus2;
11512
11512
  let serialize2;
11513
- httpStatus = typeof schema === "string" || typeof schema === "number" ? schema : httpStatus;
11514
- contentType = httpStatus && possibleContentType !== httpStatus ? possibleContentType : contentType;
11515
- if (httpStatus != null) {
11513
+ httpStatus2 = typeof schema === "string" || typeof schema === "number" ? schema : httpStatus2;
11514
+ contentType = httpStatus2 && possibleContentType !== httpStatus2 ? possibleContentType : contentType;
11515
+ if (httpStatus2 != null) {
11516
11516
  if (contentType != null) {
11517
- serialize2 = this[kRouteContext][kSchemaResponse]?.[httpStatus]?.[contentType];
11517
+ serialize2 = this[kRouteContext][kSchemaResponse]?.[httpStatus2]?.[contentType];
11518
11518
  } else {
11519
- serialize2 = this[kRouteContext][kSchemaResponse]?.[httpStatus];
11519
+ serialize2 = this[kRouteContext][kSchemaResponse]?.[httpStatus2];
11520
11520
  }
11521
11521
  if (serialize2 == null) {
11522
- if (contentType) throw new FST_ERR_MISSING_CONTENTTYPE_SERIALIZATION_FN(httpStatus, contentType);
11523
- throw new FST_ERR_MISSING_SERIALIZATION_FN(httpStatus);
11522
+ if (contentType) throw new FST_ERR_MISSING_CONTENTTYPE_SERIALIZATION_FN(httpStatus2, contentType);
11523
+ throw new FST_ERR_MISSING_SERIALIZATION_FN(httpStatus2);
11524
11524
  }
11525
11525
  } else {
11526
11526
  if (this[kRouteContext][kReplyCacheSerializeFns]?.has(schema)) {
11527
11527
  serialize2 = this[kRouteContext][kReplyCacheSerializeFns].get(schema);
11528
11528
  } else {
11529
- serialize2 = this.compileSerializationSchema(schema, httpStatus, contentType);
11529
+ serialize2 = this.compileSerializationSchema(schema, httpStatus2, contentType);
11530
11530
  }
11531
11531
  }
11532
11532
  return serialize2(input);
@@ -43950,7 +43950,26 @@ async function registerProviderRoutes(fastify) {
43950
43950
  );
43951
43951
  }
43952
43952
 
43953
+ // src/providers/runtime-provider.ts
43954
+ var InferenceCredentialsError = class extends Error {
43955
+ };
43956
+
43953
43957
  // src/routes/models.ts
43958
+ function inferenceRuntime(id, reply) {
43959
+ const provider = hasProvider(id) ? getProvider(id) : void 0;
43960
+ if (!provider?.getInferenceProviders) {
43961
+ void reply.code(404).send({ error: `Provider ${id} has no inference providers` });
43962
+ return void 0;
43963
+ }
43964
+ return provider;
43965
+ }
43966
+ function sendInferenceError(reply, error51) {
43967
+ if (error51 instanceof InferenceCredentialsError) {
43968
+ return reply.code(400).send({ error: error51.message });
43969
+ }
43970
+ const message = error51 instanceof Error ? error51.message : String(error51);
43971
+ return reply.code(503).send({ error: message });
43972
+ }
43954
43973
  async function registerModelRoutes(fastify) {
43955
43974
  fastify.get(
43956
43975
  "/api/providers/:id/models",
@@ -43962,6 +43981,54 @@ async function registerModelRoutes(fastify) {
43962
43981
  return getProvider(id).getModels(request.query.cwd);
43963
43982
  }
43964
43983
  );
43984
+ fastify.get(
43985
+ "/api/providers/:id/inference",
43986
+ async (request, reply) => {
43987
+ const provider = inferenceRuntime(request.params.id, reply);
43988
+ if (!provider) return reply;
43989
+ try {
43990
+ return await provider.getInferenceProviders(request.query.cwd);
43991
+ } catch (error51) {
43992
+ return sendInferenceError(reply, error51);
43993
+ }
43994
+ }
43995
+ );
43996
+ fastify.put(
43997
+ "/api/providers/:id/inference/:inferenceId/credentials",
43998
+ async (request, reply) => {
43999
+ const provider = inferenceRuntime(request.params.id, reply);
44000
+ if (!provider) return reply;
44001
+ if (!provider.setInferenceCredentials) {
44002
+ return reply.code(404).send({ error: "This provider cannot save keys" });
44003
+ }
44004
+ const body = request.body ?? {};
44005
+ const field = (value) => typeof value === "string" ? value : void 0;
44006
+ try {
44007
+ return await provider.setInferenceCredentials(request.params.inferenceId, {
44008
+ apiKey: field(body.apiKey),
44009
+ baseUrl: field(body.baseUrl),
44010
+ cwd: field(body.cwd)
44011
+ });
44012
+ } catch (error51) {
44013
+ return sendInferenceError(reply, error51);
44014
+ }
44015
+ }
44016
+ );
44017
+ fastify.delete(
44018
+ "/api/providers/:id/inference/:inferenceId/credentials",
44019
+ async (request, reply) => {
44020
+ const provider = inferenceRuntime(request.params.id, reply);
44021
+ if (!provider) return reply;
44022
+ if (!provider.removeInferenceCredentials) {
44023
+ return reply.code(404).send({ error: "This provider cannot remove keys" });
44024
+ }
44025
+ try {
44026
+ return await provider.removeInferenceCredentials(request.params.inferenceId, request.query.cwd);
44027
+ } catch (error51) {
44028
+ return sendInferenceError(reply, error51);
44029
+ }
44030
+ }
44031
+ );
43965
44032
  }
43966
44033
 
43967
44034
  // src/routes/skills.ts
@@ -123659,6 +123726,22 @@ var claudeProvider = {
123659
123726
  };
123660
123727
 
123661
123728
  // src/repoburg/repoburg-client.ts
123729
+ var RepoburgHttpError = class extends Error {
123730
+ constructor(message, status, detail) {
123731
+ super(message);
123732
+ this.status = status;
123733
+ this.detail = detail;
123734
+ }
123735
+ };
123736
+ function errorDetail(body) {
123737
+ const parsed = body;
123738
+ const message = parsed?.error && typeof parsed.error === "object" ? parsed.error.message : parsed?.message;
123739
+ if (typeof message === "string") return message || null;
123740
+ if (Array.isArray(message)) {
123741
+ return message.filter((m) => typeof m === "string").join("; ") || null;
123742
+ }
123743
+ return null;
123744
+ }
123662
123745
  function defaultRepoburgBaseUrl() {
123663
123746
  return process.env.REPOBURG_BACKEND_URL || "http://localhost:3000";
123664
123747
  }
@@ -123686,7 +123769,12 @@ var RepoburgHttpClient = class {
123686
123769
  `${method} ${path21} failed: ${response.status} HTML response from ${this.baseUrl} \u2014 the URL points to the wrong server`
123687
123770
  );
123688
123771
  }
123689
- throw new Error(`${method} ${path21} failed: ${response.status} ${text2}`);
123772
+ let detail = null;
123773
+ try {
123774
+ detail = errorDetail(JSON.parse(text2));
123775
+ } catch {
123776
+ }
123777
+ throw new RepoburgHttpError(`${method} ${path21} failed: ${response.status} ${text2}`, response.status, detail);
123690
123778
  }
123691
123779
  if (text2.length === 0) return void 0;
123692
123780
  try {
@@ -123742,6 +123830,26 @@ var RepoburgHttpClient = class {
123742
123830
  const result = await this.request("GET", "/llm-provider/models");
123743
123831
  return result.models ?? [];
123744
123832
  }
123833
+ async getInferenceProviders() {
123834
+ const result = await this.request(
123835
+ "GET",
123836
+ "/llm-provider/inference-providers"
123837
+ );
123838
+ return result.providers ?? [];
123839
+ }
123840
+ async setInferenceCredentials(id, dto) {
123841
+ return this.request(
123842
+ "PUT",
123843
+ `/llm-provider/inference-providers/${encodeURIComponent(id)}/credentials`,
123844
+ dto
123845
+ );
123846
+ }
123847
+ async removeInferenceCredentials(id) {
123848
+ return this.request(
123849
+ "DELETE",
123850
+ `/llm-provider/inference-providers/${encodeURIComponent(id)}/credentials`
123851
+ );
123852
+ }
123745
123853
  async getSlashCommands() {
123746
123854
  return this.request("GET", "/slash-commands");
123747
123855
  }
@@ -124916,22 +125024,27 @@ function cleanTitle(raw) {
124916
125024
  }
124917
125025
 
124918
125026
  // src/repoburg/repoburg-provider.ts
124919
- var REASONING_LEVELS = [
125027
+ var FALLBACK_REASONING_LEVELS = [
124920
125028
  { effort: "low", label: "Low" },
124921
125029
  { effort: "medium", label: "Medium" },
124922
125030
  { effort: "high", label: "High" },
124923
125031
  { effort: "xhigh", label: "Extra High" }
124924
125032
  ];
124925
- var OLLAMA_REASONING_LEVELS = REASONING_LEVELS.filter((l) => l.effort !== "xhigh");
124926
- function mapReasoningEffort(modelId, effort) {
124927
- if (!effort) return void 0;
124928
- if (!["xhigh", "high", "medium", "low", "minimal", "none"].includes(effort)) return void 0;
124929
- if (modelId?.startsWith("ollama/")) {
124930
- if (effort === "xhigh") return "high";
124931
- if (effort === "low" || effort === "medium" || effort === "high") return effort;
124932
- return void 0;
124933
- }
124934
- return effort;
125033
+ var FALLBACK_OLLAMA_LEVELS = FALLBACK_REASONING_LEVELS.filter((l) => l.effort !== "xhigh");
125034
+ var RUNTIME_EFFORTS = /* @__PURE__ */ new Set(["none", "minimal", "low", "medium", "high", "xhigh", "max"]);
125035
+ function mapReasoningEffort(effort) {
125036
+ return effort && RUNTIME_EFFORTS.has(effort) ? effort : void 0;
125037
+ }
125038
+ var INFERENCE_PROVIDER_IDS = /* @__PURE__ */ new Set(["ollama", "zai", "alibaba", "openrouter", "openai"]);
125039
+ function inferenceProviderOf(modelId) {
125040
+ const slash = modelId.indexOf("/");
125041
+ if (slash <= 0) return void 0;
125042
+ const prefix = modelId.slice(0, slash);
125043
+ return INFERENCE_PROVIDER_IDS.has(prefix) ? prefix : "openrouter";
125044
+ }
125045
+ function httpStatus(error51) {
125046
+ const status = error51?.status;
125047
+ return typeof status === "number" ? status : void 0;
124935
125048
  }
124936
125049
  var sessionMap3 = /* @__PURE__ */ new Map();
124937
125050
  var STALLED_STREAM_MS = 6e4;
@@ -124965,7 +125078,7 @@ async function ensureSession(session, client, baseUrl) {
124965
125078
  sessionMap3.set(session.id, entry2);
124966
125079
  return entry2;
124967
125080
  }
124968
- const mappedEffort = mapReasoningEffort(session.model, session.model_reasoning_effort);
125081
+ const mappedEffort = mapReasoningEffort(session.model_reasoning_effort);
124969
125082
  const created = await client.createSession({
124970
125083
  session_title: session.title ?? void 0,
124971
125084
  model_id: session.model || void 0,
@@ -125004,7 +125117,7 @@ async function ensureThreadSession(session, turn, client, baseUrl) {
125004
125117
  const created = await client.createSession({
125005
125118
  session_title: session.title ? `Discussion: ${session.title}` : "Discussion",
125006
125119
  model_id: session.model || void 0,
125007
- reasoning_effort: mapReasoningEffort(session.model, session.model_reasoning_effort)
125120
+ reasoning_effort: mapReasoningEffort(session.model_reasoning_effort)
125008
125121
  });
125009
125122
  runtimeId = created.id;
125010
125123
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -125210,7 +125323,7 @@ async function startTurn4(session, turn) {
125210
125323
  entry.client = client;
125211
125324
  }
125212
125325
  const wantedModel = session.model || null;
125213
- const wantedEffort = mapReasoningEffort(session.model, session.model_reasoning_effort);
125326
+ const wantedEffort = mapReasoningEffort(session.model_reasoning_effort);
125214
125327
  if (wantedModel !== entry.modelId || wantedEffort !== entry.reasoningEffort) {
125215
125328
  try {
125216
125329
  await entry.client.patchSession(entry.repoburgSessionId, {
@@ -125490,18 +125603,72 @@ async function getModels3(cwd) {
125490
125603
  const resolved = await resolveBackendUrl(cwd ?? process.cwd(), { autoStart: false });
125491
125604
  if (!resolved) return [];
125492
125605
  const models = await new RepoburgHttpClient(resolved.baseUrl).getModels();
125493
- return models.map((m) => ({
125494
- slug: m.id,
125495
- displayName: m.name,
125496
- description: "Repoburg backend",
125497
- defaultReasoning: "medium",
125498
- // Ollama rejects xhigh/minimal/none as `think` — offer only valid levels.
125499
- reasoningLevels: m.id.startsWith("ollama/") ? OLLAMA_REASONING_LEVELS : REASONING_LEVELS
125500
- }));
125606
+ return models.map((m) => {
125607
+ const levels = m.reasoning_levels ?? (m.id.startsWith("ollama/") ? FALLBACK_OLLAMA_LEVELS : FALLBACK_REASONING_LEVELS);
125608
+ const inferenceProvider = m.provider ?? inferenceProviderOf(m.id);
125609
+ return {
125610
+ slug: m.id,
125611
+ displayName: m.name,
125612
+ description: m.description ?? "Repoburg backend",
125613
+ // '' = the model's own default, which the runtime does not name.
125614
+ defaultReasoning: m.default_reasoning ?? (m.reasoning_levels ? "" : "medium"),
125615
+ reasoningLevels: levels,
125616
+ ...inferenceProvider ? { inferenceProvider } : {},
125617
+ ...m.aliases?.length ? { aliases: m.aliases } : {},
125618
+ ...m.capabilities ? { capabilities: m.capabilities } : {},
125619
+ ...m.context_window ? { contextWindow: m.context_window } : {}
125620
+ };
125621
+ });
125501
125622
  } catch {
125502
125623
  return [];
125503
125624
  }
125504
125625
  }
125626
+ async function runtimeFor(cwd) {
125627
+ const resolved = await resolveBackendUrl(cwd ?? process.cwd(), { autoStart: Boolean(cwd) });
125628
+ if (!resolved) {
125629
+ throw new Error("Repoburg is not running for this workspace.");
125630
+ }
125631
+ return new RepoburgHttpClient(resolved.baseUrl);
125632
+ }
125633
+ async function getInferenceProviders(cwd) {
125634
+ const client = await runtimeFor(cwd);
125635
+ try {
125636
+ return await client.getInferenceProviders();
125637
+ } catch (error51) {
125638
+ if (httpStatus(error51) === 404) return [];
125639
+ throw error51;
125640
+ }
125641
+ }
125642
+ async function setInferenceCredentials(id, input) {
125643
+ const client = await runtimeFor(input.cwd);
125644
+ try {
125645
+ return await client.setInferenceCredentials(id, {
125646
+ ...input.apiKey ? { apiKey: input.apiKey } : {},
125647
+ ...input.baseUrl ? { baseUrl: input.baseUrl } : {}
125648
+ });
125649
+ } catch (error51) {
125650
+ throw credentialsError(error51);
125651
+ }
125652
+ }
125653
+ async function removeInferenceCredentials(id, cwd) {
125654
+ const client = await runtimeFor(cwd);
125655
+ try {
125656
+ return await client.removeInferenceCredentials(id);
125657
+ } catch (error51) {
125658
+ throw credentialsError(error51);
125659
+ }
125660
+ }
125661
+ function credentialsError(error51) {
125662
+ const status = httpStatus(error51);
125663
+ if (status === 400) {
125664
+ const detail = error51.detail;
125665
+ return new InferenceCredentialsError(detail || "The provider refused the key.");
125666
+ }
125667
+ if (status === 404) {
125668
+ return new InferenceCredentialsError("This Repoburg version cannot save keys here. Update Repoburg.");
125669
+ }
125670
+ return error51;
125671
+ }
125505
125672
  async function getCommands3(cwd) {
125506
125673
  try {
125507
125674
  const resolved = await resolveBackendUrl(cwd ?? process.cwd(), { autoStart: false });
@@ -125526,6 +125693,9 @@ var repoburgProvider = {
125526
125693
  clearThreadBranch: clearThreadBranch3,
125527
125694
  clearAllThreads: clearAllThreads3,
125528
125695
  getModels: getModels3,
125696
+ getInferenceProviders,
125697
+ setInferenceCredentials,
125698
+ removeInferenceCredentials,
125529
125699
  getCommands: getCommands3,
125530
125700
  rewindRuntime,
125531
125701
  forkSession: forkSession2,