@aspectlylabs/mikka 0.0.713 → 0.0.715

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/cli.js CHANGED
@@ -5610,17 +5610,23 @@ var setupRecipeSchema = z24.object({
5610
5610
  var REPO_ORIGIN_HEADER = "x-mikka-repo-origin-check";
5611
5611
  var PROJECT_ENVIRONMENT_HEADER = "x-mikka-project-environment";
5612
5612
  var MODEL_CREDENTIAL_HEADER = "x-mikka-model-credential";
5613
+ var MODEL_GATEWAY_LOOPBACK_HEADER = "x-mikka-model-gateway-loopback";
5613
5614
  var RUN_CREDENTIALS_HEADER = "x-mikka-run-credentials";
5614
5615
  var INITIAL_REPOSITORY_HEADER = "x-mikka-initial-repository";
5615
5616
  var credentialKey = z24.string().min(1).max(4096).refine((value) => !/[\r\n\0]/.test(value));
5616
5617
  var runGitHubCredentialSchema = z24.object({ token: credentialKey, expiresAt: isoTime.nullable() }).strip();
5617
5618
  var credentialBaseUrl = z24.url().max(500).refine((value) => {
5618
5619
  const url = new URL(value);
5619
- return url.protocol === "https:" && !url.username && !url.password && !url.search && !url.hash;
5620
+ return !url.username && !url.password && !url.search && !url.hash && (url.protocol === "https:" || url.protocol === "http:" && ["127.0.0.1", "localhost", "[::1]"].includes(url.hostname));
5620
5621
  });
5621
5622
  var runModelCredentialSchema = z24.discriminatedUnion("kind", [
5622
5623
  z24.object({ kind: z24.literal("api_key"), key: credentialKey }).strict(),
5623
- z24.object({ kind: z24.literal("provider"), protocol: z24.enum(["anthropic", "openai"]), baseUrl: credentialBaseUrl, key: credentialKey }).strict()
5624
+ z24.object({ kind: z24.literal("provider"), protocol: z24.enum(["anthropic", "openai"]), baseUrl: credentialBaseUrl, key: credentialKey }).strict().refine((value) => {
5625
+ const url = new URL(value.baseUrl);
5626
+ if (url.protocol === "https:") return true;
5627
+ const path3 = value.protocol === "anthropic" ? "/api/model-gateway/anthropic" : "/api/model-gateway/openai/v1";
5628
+ return /^mkg_[A-Za-z0-9_-]{43}$/.test(value.key) && url.pathname.endsWith(path3) && /^(?:\/[A-Za-z0-9_-]+)*$/.test(url.pathname.slice(0, -path3.length));
5629
+ })
5624
5630
  ]);
5625
5631
  var deviceRepoSchema = z24.object({
5626
5632
  repoId: id3,
@@ -6590,7 +6596,7 @@ import { join as join4 } from "node:path";
6590
6596
  // package.json
6591
6597
  var package_default = {
6592
6598
  name: "@mikka/daemon",
6593
- version: "0.0.713",
6599
+ version: "0.0.715",
6594
6600
  description: "Local Mikka daemon: runs agents through the user's own CLIs",
6595
6601
  type: "module",
6596
6602
  private: true,
@@ -6658,7 +6664,7 @@ var package_default = {
6658
6664
  engines: {
6659
6665
  node: ">=22"
6660
6666
  },
6661
- gitHead: "86a5ae6b862a4a8733add9049513a74b15513675"
6667
+ gitHead: "edfb82d33849f2fa0deb42030db1f8eca68f1eb4"
6662
6668
  };
6663
6669
 
6664
6670
  // src/paths.ts
@@ -8637,6 +8643,7 @@ var HttpServerLink = class {
8637
8643
  [PROJECT_ENVIRONMENT_HEADER]: "1",
8638
8644
  [RECOVERY_WORKTREE_HEADER]: "1",
8639
8645
  [MODEL_CREDENTIAL_HEADER]: "1",
8646
+ [MODEL_GATEWAY_LOOPBACK_HEADER]: "1",
8640
8647
  [TASK_SECRETS_HEADER]: TASK_SECRETS_VERSION,
8641
8648
  [RUN_CREDENTIALS_HEADER]: "1",
8642
8649
  [TASK_MCP_HEADER]: TASK_MCP_VERSION,
@@ -8751,11 +8758,14 @@ var HttpServerLink = class {
8751
8758
  return runIds;
8752
8759
  }
8753
8760
  async claimRun(deviceId, runId, signal, options) {
8754
- return this.call(
8761
+ const assignment = await this.call(
8755
8762
  "POST",
8756
8763
  devicePaths.claim(checkId(deviceId), checkId(runId)),
8757
8764
  { schema: runAssignmentSchema, claimOf: runId, signal, initialRepository: options?.initialRepository }
8758
8765
  );
8766
+ const model = assignment.modelCredential;
8767
+ if (model?.kind === "provider" && new URL(model.baseUrl).protocol === "http:" && new URL(model.baseUrl).origin !== new URL(this.baseUrl).origin) throw new Error("Loopback model gateway unavailable");
8768
+ return assignment;
8759
8769
  }
8760
8770
  async validateSkillReceipt(runId, receiptId) {
8761
8771
  return this.call("GET", `/v1/runs/${seg2(runId)}/skill-receipt?receiptId=${encodeURIComponent(checkId(receiptId))}`, { schema: skillReceiptRevalidationSchema });
@@ -12042,13 +12052,9 @@ var RESUME_MESSAGE = "Mikka was restarted while you were working. Continue the t
12042
12052
 
12043
12053
  // src/agents/run-credential.ts
12044
12054
  var KEY_ENV = "MIKKA_MODEL_API_KEY";
12045
- var OPENAI_BASE_URL = "https://api.openai.com/v1";
12046
12055
  function checked(credential) {
12047
- if (!credential.key || credential.key.length > 32768 || /[\r\n\0]/.test(credential.key)) throw new Error("Run credential unavailable");
12048
- if (credential.kind === "provider") {
12049
- const url = new URL(credential.baseUrl);
12050
- if (url.protocol !== "https:" || url.username || url.password) throw new Error("Run credential unavailable");
12051
- }
12056
+ if (credential.kind !== "provider") throw new Error("Run credential unavailable");
12057
+ if (!runModelCredentialSchema.safeParse(credential).success) throw new Error("Run credential unavailable");
12052
12058
  return credential;
12053
12059
  }
12054
12060
  function credentialDomain(credential) {
@@ -12057,17 +12063,16 @@ function credentialDomain(credential) {
12057
12063
  function claudeCredentialEnv(credential) {
12058
12064
  if (!credential) return {};
12059
12065
  const value = checked(credential);
12060
- if (value.kind === "provider" && value.protocol !== "anthropic") throw new Error("Claude Code takes Anthropic-compatible providers only");
12066
+ if (value.protocol !== "anthropic") throw new Error("Claude Code takes Anthropic-compatible providers only");
12061
12067
  return {
12062
12068
  ANTHROPIC_API_KEY: value.key,
12063
- ...value.kind === "provider" ? { ANTHROPIC_BASE_URL: value.baseUrl } : {}
12069
+ ANTHROPIC_BASE_URL: value.baseUrl
12064
12070
  };
12065
12071
  }
12066
12072
  function codexCredential(credential) {
12067
12073
  if (!credential) return { args: [], env: {} };
12068
12074
  const value = checked(credential);
12069
- if (value.kind === "provider" && value.protocol !== "openai") throw new Error("Codex takes OpenAI-compatible providers only");
12070
- const baseUrl = value.kind === "provider" ? value.baseUrl : OPENAI_BASE_URL;
12075
+ if (value.protocol !== "openai") throw new Error("Codex takes OpenAI-compatible providers only");
12071
12076
  return {
12072
12077
  args: [
12073
12078
  "-c",
@@ -12075,7 +12080,7 @@ function codexCredential(credential) {
12075
12080
  "-c",
12076
12081
  'model_providers.mikka.name="Mikka"',
12077
12082
  "-c",
12078
- `model_providers.mikka.base_url=${JSON.stringify(baseUrl)}`,
12083
+ `model_providers.mikka.base_url=${JSON.stringify(value.baseUrl)}`,
12079
12084
  "-c",
12080
12085
  `model_providers.mikka.env_key="${KEY_ENV}"`,
12081
12086
  "-c",
package/client.js CHANGED
@@ -4285,11 +4285,16 @@ var credentialKey = z24.string().min(1).max(4096).refine((value) => !/[\r\n\0]/.
4285
4285
  var runGitHubCredentialSchema = z24.object({ token: credentialKey, expiresAt: isoTime.nullable() }).strip();
4286
4286
  var credentialBaseUrl = z24.url().max(500).refine((value) => {
4287
4287
  const url = new URL(value);
4288
- return url.protocol === "https:" && !url.username && !url.password && !url.search && !url.hash;
4288
+ return !url.username && !url.password && !url.search && !url.hash && (url.protocol === "https:" || url.protocol === "http:" && ["127.0.0.1", "localhost", "[::1]"].includes(url.hostname));
4289
4289
  });
4290
4290
  var runModelCredentialSchema = z24.discriminatedUnion("kind", [
4291
4291
  z24.object({ kind: z24.literal("api_key"), key: credentialKey }).strict(),
4292
- z24.object({ kind: z24.literal("provider"), protocol: z24.enum(["anthropic", "openai"]), baseUrl: credentialBaseUrl, key: credentialKey }).strict()
4292
+ z24.object({ kind: z24.literal("provider"), protocol: z24.enum(["anthropic", "openai"]), baseUrl: credentialBaseUrl, key: credentialKey }).strict().refine((value) => {
4293
+ const url = new URL(value.baseUrl);
4294
+ if (url.protocol === "https:") return true;
4295
+ const path3 = value.protocol === "anthropic" ? "/api/model-gateway/anthropic" : "/api/model-gateway/openai/v1";
4296
+ return /^mkg_[A-Za-z0-9_-]{43}$/.test(value.key) && url.pathname.endsWith(path3) && /^(?:\/[A-Za-z0-9_-]+)*$/.test(url.pathname.slice(0, -path3.length));
4297
+ })
4293
4298
  ]);
4294
4299
  var deviceRepoSchema = z24.object({
4295
4300
  repoId: id3,
@@ -5097,7 +5102,7 @@ import { join } from "node:path";
5097
5102
  // package.json
5098
5103
  var package_default = {
5099
5104
  name: "@mikka/daemon",
5100
- version: "0.0.713",
5105
+ version: "0.0.715",
5101
5106
  description: "Local Mikka daemon: runs agents through the user's own CLIs",
5102
5107
  type: "module",
5103
5108
  private: true,
@@ -5165,7 +5170,7 @@ var package_default = {
5165
5170
  engines: {
5166
5171
  node: ">=22"
5167
5172
  },
5168
- gitHead: "86a5ae6b862a4a8733add9049513a74b15513675"
5173
+ gitHead: "edfb82d33849f2fa0deb42030db1f8eca68f1eb4"
5169
5174
  };
5170
5175
 
5171
5176
  // src/paths.ts
package/http-link.js CHANGED
@@ -4665,17 +4665,23 @@ var setupRecipeSchema = z26.object({
4665
4665
  var REPO_ORIGIN_HEADER = "x-mikka-repo-origin-check";
4666
4666
  var PROJECT_ENVIRONMENT_HEADER = "x-mikka-project-environment";
4667
4667
  var MODEL_CREDENTIAL_HEADER = "x-mikka-model-credential";
4668
+ var MODEL_GATEWAY_LOOPBACK_HEADER = "x-mikka-model-gateway-loopback";
4668
4669
  var RUN_CREDENTIALS_HEADER = "x-mikka-run-credentials";
4669
4670
  var INITIAL_REPOSITORY_HEADER = "x-mikka-initial-repository";
4670
4671
  var credentialKey = z26.string().min(1).max(4096).refine((value) => !/[\r\n\0]/.test(value));
4671
4672
  var runGitHubCredentialSchema = z26.object({ token: credentialKey, expiresAt: isoTime.nullable() }).strip();
4672
4673
  var credentialBaseUrl = z26.url().max(500).refine((value) => {
4673
4674
  const url = new URL(value);
4674
- return url.protocol === "https:" && !url.username && !url.password && !url.search && !url.hash;
4675
+ return !url.username && !url.password && !url.search && !url.hash && (url.protocol === "https:" || url.protocol === "http:" && ["127.0.0.1", "localhost", "[::1]"].includes(url.hostname));
4675
4676
  });
4676
4677
  var runModelCredentialSchema = z26.discriminatedUnion("kind", [
4677
4678
  z26.object({ kind: z26.literal("api_key"), key: credentialKey }).strict(),
4678
- z26.object({ kind: z26.literal("provider"), protocol: z26.enum(["anthropic", "openai"]), baseUrl: credentialBaseUrl, key: credentialKey }).strict()
4679
+ z26.object({ kind: z26.literal("provider"), protocol: z26.enum(["anthropic", "openai"]), baseUrl: credentialBaseUrl, key: credentialKey }).strict().refine((value) => {
4680
+ const url = new URL(value.baseUrl);
4681
+ if (url.protocol === "https:") return true;
4682
+ const path3 = value.protocol === "anthropic" ? "/api/model-gateway/anthropic" : "/api/model-gateway/openai/v1";
4683
+ return /^mkg_[A-Za-z0-9_-]{43}$/.test(value.key) && url.pathname.endsWith(path3) && /^(?:\/[A-Za-z0-9_-]+)*$/.test(url.pathname.slice(0, -path3.length));
4684
+ })
4679
4685
  ]);
4680
4686
  var deviceRepoSchema = z26.object({
4681
4687
  repoId: id3,
@@ -5593,7 +5599,7 @@ var InvalidIdError = class extends DaemonError {
5593
5599
  // package.json
5594
5600
  var package_default = {
5595
5601
  name: "@mikka/daemon",
5596
- version: "0.0.713",
5602
+ version: "0.0.715",
5597
5603
  description: "Local Mikka daemon: runs agents through the user's own CLIs",
5598
5604
  type: "module",
5599
5605
  private: true,
@@ -5661,7 +5667,7 @@ var package_default = {
5661
5667
  engines: {
5662
5668
  node: ">=22"
5663
5669
  },
5664
- gitHead: "86a5ae6b862a4a8733add9049513a74b15513675"
5670
+ gitHead: "edfb82d33849f2fa0deb42030db1f8eca68f1eb4"
5665
5671
  };
5666
5672
 
5667
5673
  // src/paths.ts
@@ -7192,6 +7198,7 @@ var HttpServerLink = class {
7192
7198
  [PROJECT_ENVIRONMENT_HEADER]: "1",
7193
7199
  [RECOVERY_WORKTREE_HEADER]: "1",
7194
7200
  [MODEL_CREDENTIAL_HEADER]: "1",
7201
+ [MODEL_GATEWAY_LOOPBACK_HEADER]: "1",
7195
7202
  [TASK_SECRETS_HEADER]: TASK_SECRETS_VERSION,
7196
7203
  [RUN_CREDENTIALS_HEADER]: "1",
7197
7204
  [TASK_MCP_HEADER]: TASK_MCP_VERSION,
@@ -7306,11 +7313,14 @@ var HttpServerLink = class {
7306
7313
  return runIds;
7307
7314
  }
7308
7315
  async claimRun(deviceId, runId, signal, options) {
7309
- return this.call(
7316
+ const assignment = await this.call(
7310
7317
  "POST",
7311
7318
  devicePaths.claim(checkId(deviceId), checkId(runId)),
7312
7319
  { schema: runAssignmentSchema, claimOf: runId, signal, initialRepository: options?.initialRepository }
7313
7320
  );
7321
+ const model = assignment.modelCredential;
7322
+ if (model?.kind === "provider" && new URL(model.baseUrl).protocol === "http:" && new URL(model.baseUrl).origin !== new URL(this.baseUrl).origin) throw new Error("Loopback model gateway unavailable");
7323
+ return assignment;
7314
7324
  }
7315
7325
  async validateSkillReceipt(runId, receiptId) {
7316
7326
  return this.call("GET", `/v1/runs/${seg2(runId)}/skill-receipt?receiptId=${encodeURIComponent(checkId(receiptId))}`, { schema: skillReceiptRevalidationSchema });
package/login.js CHANGED
@@ -4327,11 +4327,16 @@ var credentialKey = z24.string().min(1).max(4096).refine((value) => !/[\r\n\0]/.
4327
4327
  var runGitHubCredentialSchema = z24.object({ token: credentialKey, expiresAt: isoTime.nullable() }).strip();
4328
4328
  var credentialBaseUrl = z24.url().max(500).refine((value) => {
4329
4329
  const url = new URL(value);
4330
- return url.protocol === "https:" && !url.username && !url.password && !url.search && !url.hash;
4330
+ return !url.username && !url.password && !url.search && !url.hash && (url.protocol === "https:" || url.protocol === "http:" && ["127.0.0.1", "localhost", "[::1]"].includes(url.hostname));
4331
4331
  });
4332
4332
  var runModelCredentialSchema = z24.discriminatedUnion("kind", [
4333
4333
  z24.object({ kind: z24.literal("api_key"), key: credentialKey }).strict(),
4334
- z24.object({ kind: z24.literal("provider"), protocol: z24.enum(["anthropic", "openai"]), baseUrl: credentialBaseUrl, key: credentialKey }).strict()
4334
+ z24.object({ kind: z24.literal("provider"), protocol: z24.enum(["anthropic", "openai"]), baseUrl: credentialBaseUrl, key: credentialKey }).strict().refine((value) => {
4335
+ const url = new URL(value.baseUrl);
4336
+ if (url.protocol === "https:") return true;
4337
+ const path3 = value.protocol === "anthropic" ? "/api/model-gateway/anthropic" : "/api/model-gateway/openai/v1";
4338
+ return /^mkg_[A-Za-z0-9_-]{43}$/.test(value.key) && url.pathname.endsWith(path3) && /^(?:\/[A-Za-z0-9_-]+)*$/.test(url.pathname.slice(0, -path3.length));
4339
+ })
4335
4340
  ]);
4336
4341
  var deviceRepoSchema = z24.object({
4337
4342
  repoId: id3,
@@ -5151,7 +5156,7 @@ var ServerUnreachableError = class extends DaemonError {
5151
5156
  // package.json
5152
5157
  var package_default = {
5153
5158
  name: "@mikka/daemon",
5154
- version: "0.0.713",
5159
+ version: "0.0.715",
5155
5160
  description: "Local Mikka daemon: runs agents through the user's own CLIs",
5156
5161
  type: "module",
5157
5162
  private: true,
@@ -5219,7 +5224,7 @@ var package_default = {
5219
5224
  engines: {
5220
5225
  node: ">=22"
5221
5226
  },
5222
- gitHead: "86a5ae6b862a4a8733add9049513a74b15513675"
5227
+ gitHead: "edfb82d33849f2fa0deb42030db1f8eca68f1eb4"
5223
5228
  };
5224
5229
 
5225
5230
  // src/paths.ts
package/main.js CHANGED
@@ -5179,11 +5179,16 @@ var credentialKey = z24.string().min(1).max(4096).refine((value) => !/[\r\n\0]/.
5179
5179
  var runGitHubCredentialSchema = z24.object({ token: credentialKey, expiresAt: isoTime.nullable() }).strip();
5180
5180
  var credentialBaseUrl = z24.url().max(500).refine((value) => {
5181
5181
  const url = new URL(value);
5182
- return url.protocol === "https:" && !url.username && !url.password && !url.search && !url.hash;
5182
+ return !url.username && !url.password && !url.search && !url.hash && (url.protocol === "https:" || url.protocol === "http:" && ["127.0.0.1", "localhost", "[::1]"].includes(url.hostname));
5183
5183
  });
5184
5184
  var runModelCredentialSchema = z24.discriminatedUnion("kind", [
5185
5185
  z24.object({ kind: z24.literal("api_key"), key: credentialKey }).strict(),
5186
- z24.object({ kind: z24.literal("provider"), protocol: z24.enum(["anthropic", "openai"]), baseUrl: credentialBaseUrl, key: credentialKey }).strict()
5186
+ z24.object({ kind: z24.literal("provider"), protocol: z24.enum(["anthropic", "openai"]), baseUrl: credentialBaseUrl, key: credentialKey }).strict().refine((value) => {
5187
+ const url = new URL(value.baseUrl);
5188
+ if (url.protocol === "https:") return true;
5189
+ const path3 = value.protocol === "anthropic" ? "/api/model-gateway/anthropic" : "/api/model-gateway/openai/v1";
5190
+ return /^mkg_[A-Za-z0-9_-]{43}$/.test(value.key) && url.pathname.endsWith(path3) && /^(?:\/[A-Za-z0-9_-]+)*$/.test(url.pathname.slice(0, -path3.length));
5191
+ })
5187
5192
  ]);
5188
5193
  var deviceRepoSchema = z24.object({
5189
5194
  repoId: id3,
@@ -6059,7 +6064,7 @@ import { join } from "node:path";
6059
6064
  // package.json
6060
6065
  var package_default = {
6061
6066
  name: "@mikka/daemon",
6062
- version: "0.0.713",
6067
+ version: "0.0.715",
6063
6068
  description: "Local Mikka daemon: runs agents through the user's own CLIs",
6064
6069
  type: "module",
6065
6070
  private: true,
@@ -6127,7 +6132,7 @@ var package_default = {
6127
6132
  engines: {
6128
6133
  node: ">=22"
6129
6134
  },
6130
- gitHead: "86a5ae6b862a4a8733add9049513a74b15513675"
6135
+ gitHead: "edfb82d33849f2fa0deb42030db1f8eca68f1eb4"
6131
6136
  };
6132
6137
 
6133
6138
  // src/paths.ts
@@ -10601,13 +10606,9 @@ function requireRunToolApproval(runId, gate) {
10601
10606
 
10602
10607
  // src/agents/run-credential.ts
10603
10608
  var KEY_ENV = "MIKKA_MODEL_API_KEY";
10604
- var OPENAI_BASE_URL = "https://api.openai.com/v1";
10605
10609
  function checked(credential) {
10606
- if (!credential.key || credential.key.length > 32768 || /[\r\n\0]/.test(credential.key)) throw new Error("Run credential unavailable");
10607
- if (credential.kind === "provider") {
10608
- const url = new URL(credential.baseUrl);
10609
- if (url.protocol !== "https:" || url.username || url.password) throw new Error("Run credential unavailable");
10610
- }
10610
+ if (credential.kind !== "provider") throw new Error("Run credential unavailable");
10611
+ if (!runModelCredentialSchema.safeParse(credential).success) throw new Error("Run credential unavailable");
10611
10612
  return credential;
10612
10613
  }
10613
10614
  function credentialDomain(credential) {
@@ -10616,17 +10617,16 @@ function credentialDomain(credential) {
10616
10617
  function claudeCredentialEnv(credential) {
10617
10618
  if (!credential) return {};
10618
10619
  const value = checked(credential);
10619
- if (value.kind === "provider" && value.protocol !== "anthropic") throw new Error("Claude Code takes Anthropic-compatible providers only");
10620
+ if (value.protocol !== "anthropic") throw new Error("Claude Code takes Anthropic-compatible providers only");
10620
10621
  return {
10621
10622
  ANTHROPIC_API_KEY: value.key,
10622
- ...value.kind === "provider" ? { ANTHROPIC_BASE_URL: value.baseUrl } : {}
10623
+ ANTHROPIC_BASE_URL: value.baseUrl
10623
10624
  };
10624
10625
  }
10625
10626
  function codexCredential(credential) {
10626
10627
  if (!credential) return { args: [], env: {} };
10627
10628
  const value = checked(credential);
10628
- if (value.kind === "provider" && value.protocol !== "openai") throw new Error("Codex takes OpenAI-compatible providers only");
10629
- const baseUrl = value.kind === "provider" ? value.baseUrl : OPENAI_BASE_URL;
10629
+ if (value.protocol !== "openai") throw new Error("Codex takes OpenAI-compatible providers only");
10630
10630
  return {
10631
10631
  args: [
10632
10632
  "-c",
@@ -10634,7 +10634,7 @@ function codexCredential(credential) {
10634
10634
  "-c",
10635
10635
  'model_providers.mikka.name="Mikka"',
10636
10636
  "-c",
10637
- `model_providers.mikka.base_url=${JSON.stringify(baseUrl)}`,
10637
+ `model_providers.mikka.base_url=${JSON.stringify(value.baseUrl)}`,
10638
10638
  "-c",
10639
10639
  `model_providers.mikka.env_key="${KEY_ENV}"`,
10640
10640
  "-c",
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "version": 1,
3
- "sourceSha": "86a5ae6b862a4a8733add9049513a74b15513675",
3
+ "sourceSha": "edfb82d33849f2fa0deb42030db1f8eca68f1eb4",
4
4
  "repository": "alexj11324/Mikka",
5
- "buildRunId": "44667654283",
5
+ "buildRunId": "44733173136",
6
6
  "buildKind": "github-actions-main",
7
7
  "sourceLockSha256": "d2a25d5f34f8a1c59ba60a46560b538423a04cda426738da995b428ba87648f0",
8
- "createdAt": "2026-11-20T03:29:35.299Z",
8
+ "createdAt": "2026-11-20T12:11:32.823Z",
9
9
  "sbom": "sbom.cdx.json",
10
10
  "files": [
11
11
  {
@@ -35,13 +35,13 @@
35
35
  },
36
36
  {
37
37
  "path": "cli.js",
38
- "size": 1091507,
39
- "sha256": "95214250fb3153af3d9c2b3e483ca61cee854ee27f627536ff8fd75e6097a459"
38
+ "size": 1092027,
39
+ "sha256": "56d64e11db58d9308075cef732842218964c83717b68d7442a6cd7d14baacbeb"
40
40
  },
41
41
  {
42
42
  "path": "client.js",
43
- "size": 211251,
44
- "sha256": "ba5fc58ea1980de77afb5371348fe31c4e9b7dfd5d69ee3fb587e34c0591c227"
43
+ "size": 211730,
44
+ "sha256": "43c4892da7cac400bf2ca6020b2802f1af1bdbb1a2b3cefd74fd3239c37af7ea"
45
45
  },
46
46
  {
47
47
  "path": "computer/driver.mjs",
@@ -160,8 +160,8 @@
160
160
  },
161
161
  {
162
162
  "path": "http-link.js",
163
- "size": 307351,
164
- "sha256": "9e1c053f4b9c4e092751d6efff89766f320334530dc78ab86c8b9f56749e5e54"
163
+ "size": 308239,
164
+ "sha256": "82edcaacaf0c5da4d1dbdf5d464fcf7643ebb183c6912253644dbc2be0ae2b84"
165
165
  },
166
166
  {
167
167
  "path": "log.js",
@@ -170,13 +170,13 @@
170
170
  },
171
171
  {
172
172
  "path": "login.js",
173
- "size": 268713,
174
- "sha256": "320756d6c13491006ca88f251d81fe6a624dac0cb29a6f3d017c9c8a253254b4"
173
+ "size": 269192,
174
+ "sha256": "24bd6763479acbae19babe63a32c236c96df94d93664f0e4fe6daa583455d8f4"
175
175
  },
176
176
  {
177
177
  "path": "main.js",
178
- "size": 1031111,
179
- "sha256": "d6a7ec2fae1731d9368579a11a0ccee26958935ce30a4a55b5a9aa0db6ce0adf"
178
+ "size": 1031222,
179
+ "sha256": "6a8182efcd772c4dc181925f6d1253f1cce4d67fecfa56c3a3404d0e6be68dd6"
180
180
  },
181
181
  {
182
182
  "path": "mcp-stdio-launcher.mjs",
@@ -205,23 +205,23 @@
205
205
  },
206
206
  {
207
207
  "path": "mikka.js",
208
- "size": 1091523,
209
- "sha256": "17936ea67324b9232e39a382c1c4cb29c152bc65bbf49467829db7d064c4c694"
208
+ "size": 1092043,
209
+ "sha256": "b6cc2b834fe8bbcb9a21900b2e1c464ca02ede9738e735cdb2c8cedfbaa75886"
210
210
  },
211
211
  {
212
212
  "path": "npm-shrinkwrap.json",
213
- "size": 85378,
214
- "sha256": "378f28d19cc33029f5ca495de539159e7c706b376934e054ca829d6134030655"
213
+ "size": 85380,
214
+ "sha256": "98229148a4c8f6a9f2323f3ae73973b74859bc6039c2f47df51d962bb494132b"
215
215
  },
216
216
  {
217
217
  "path": "package.json",
218
218
  "size": 1551,
219
- "sha256": "50351324847cb992b8686b8769b323a621928f9ddfca0556c12d3d38bfa00ceb"
219
+ "sha256": "b528a04763d660aec43f828fc49f50b884cc36d4c264b7bd586c4386e6b8bf1c"
220
220
  },
221
221
  {
222
222
  "path": "paths.js",
223
223
  "size": 4585,
224
- "sha256": "7cb561446964c0dfa8db7b4a77628f82dc7b9ac3e0219c1fd9502daf735e12eb"
224
+ "sha256": "e9cb41645739891ddc4819ee5729165c65d9f75c2e975eb83e22162dfe17faac"
225
225
  },
226
226
  {
227
227
  "path": "sandbox.js",
@@ -230,8 +230,8 @@
230
230
  },
231
231
  {
232
232
  "path": "sbom.cdx.json",
233
- "size": 155695,
234
- "sha256": "93ead4301cd13e0b7bbf73dd0f242b56e5a505efc3d806d43550c847e03fb125"
233
+ "size": 155701,
234
+ "sha256": "5db647077b138013e428e359cc875170a3f0c883371f269a6d288609714154f8"
235
235
  }
236
236
  ]
237
237
  }
package/mikka.js CHANGED
@@ -5611,17 +5611,23 @@ var setupRecipeSchema = z24.object({
5611
5611
  var REPO_ORIGIN_HEADER = "x-mikka-repo-origin-check";
5612
5612
  var PROJECT_ENVIRONMENT_HEADER = "x-mikka-project-environment";
5613
5613
  var MODEL_CREDENTIAL_HEADER = "x-mikka-model-credential";
5614
+ var MODEL_GATEWAY_LOOPBACK_HEADER = "x-mikka-model-gateway-loopback";
5614
5615
  var RUN_CREDENTIALS_HEADER = "x-mikka-run-credentials";
5615
5616
  var INITIAL_REPOSITORY_HEADER = "x-mikka-initial-repository";
5616
5617
  var credentialKey = z24.string().min(1).max(4096).refine((value) => !/[\r\n\0]/.test(value));
5617
5618
  var runGitHubCredentialSchema = z24.object({ token: credentialKey, expiresAt: isoTime.nullable() }).strip();
5618
5619
  var credentialBaseUrl = z24.url().max(500).refine((value) => {
5619
5620
  const url = new URL(value);
5620
- return url.protocol === "https:" && !url.username && !url.password && !url.search && !url.hash;
5621
+ return !url.username && !url.password && !url.search && !url.hash && (url.protocol === "https:" || url.protocol === "http:" && ["127.0.0.1", "localhost", "[::1]"].includes(url.hostname));
5621
5622
  });
5622
5623
  var runModelCredentialSchema = z24.discriminatedUnion("kind", [
5623
5624
  z24.object({ kind: z24.literal("api_key"), key: credentialKey }).strict(),
5624
- z24.object({ kind: z24.literal("provider"), protocol: z24.enum(["anthropic", "openai"]), baseUrl: credentialBaseUrl, key: credentialKey }).strict()
5625
+ z24.object({ kind: z24.literal("provider"), protocol: z24.enum(["anthropic", "openai"]), baseUrl: credentialBaseUrl, key: credentialKey }).strict().refine((value) => {
5626
+ const url = new URL(value.baseUrl);
5627
+ if (url.protocol === "https:") return true;
5628
+ const path3 = value.protocol === "anthropic" ? "/api/model-gateway/anthropic" : "/api/model-gateway/openai/v1";
5629
+ return /^mkg_[A-Za-z0-9_-]{43}$/.test(value.key) && url.pathname.endsWith(path3) && /^(?:\/[A-Za-z0-9_-]+)*$/.test(url.pathname.slice(0, -path3.length));
5630
+ })
5625
5631
  ]);
5626
5632
  var deviceRepoSchema = z24.object({
5627
5633
  repoId: id3,
@@ -6591,7 +6597,7 @@ import { join as join4 } from "node:path";
6591
6597
  // package.json
6592
6598
  var package_default = {
6593
6599
  name: "@mikka/daemon",
6594
- version: "0.0.713",
6600
+ version: "0.0.715",
6595
6601
  description: "Local Mikka daemon: runs agents through the user's own CLIs",
6596
6602
  type: "module",
6597
6603
  private: true,
@@ -6659,7 +6665,7 @@ var package_default = {
6659
6665
  engines: {
6660
6666
  node: ">=22"
6661
6667
  },
6662
- gitHead: "86a5ae6b862a4a8733add9049513a74b15513675"
6668
+ gitHead: "edfb82d33849f2fa0deb42030db1f8eca68f1eb4"
6663
6669
  };
6664
6670
 
6665
6671
  // src/paths.ts
@@ -8638,6 +8644,7 @@ var HttpServerLink = class {
8638
8644
  [PROJECT_ENVIRONMENT_HEADER]: "1",
8639
8645
  [RECOVERY_WORKTREE_HEADER]: "1",
8640
8646
  [MODEL_CREDENTIAL_HEADER]: "1",
8647
+ [MODEL_GATEWAY_LOOPBACK_HEADER]: "1",
8641
8648
  [TASK_SECRETS_HEADER]: TASK_SECRETS_VERSION,
8642
8649
  [RUN_CREDENTIALS_HEADER]: "1",
8643
8650
  [TASK_MCP_HEADER]: TASK_MCP_VERSION,
@@ -8752,11 +8759,14 @@ var HttpServerLink = class {
8752
8759
  return runIds;
8753
8760
  }
8754
8761
  async claimRun(deviceId, runId, signal, options) {
8755
- return this.call(
8762
+ const assignment = await this.call(
8756
8763
  "POST",
8757
8764
  devicePaths.claim(checkId(deviceId), checkId(runId)),
8758
8765
  { schema: runAssignmentSchema, claimOf: runId, signal, initialRepository: options?.initialRepository }
8759
8766
  );
8767
+ const model = assignment.modelCredential;
8768
+ if (model?.kind === "provider" && new URL(model.baseUrl).protocol === "http:" && new URL(model.baseUrl).origin !== new URL(this.baseUrl).origin) throw new Error("Loopback model gateway unavailable");
8769
+ return assignment;
8760
8770
  }
8761
8771
  async validateSkillReceipt(runId, receiptId) {
8762
8772
  return this.call("GET", `/v1/runs/${seg2(runId)}/skill-receipt?receiptId=${encodeURIComponent(checkId(receiptId))}`, { schema: skillReceiptRevalidationSchema });
@@ -12043,13 +12053,9 @@ var RESUME_MESSAGE = "Mikka was restarted while you were working. Continue the t
12043
12053
 
12044
12054
  // src/agents/run-credential.ts
12045
12055
  var KEY_ENV = "MIKKA_MODEL_API_KEY";
12046
- var OPENAI_BASE_URL = "https://api.openai.com/v1";
12047
12056
  function checked(credential) {
12048
- if (!credential.key || credential.key.length > 32768 || /[\r\n\0]/.test(credential.key)) throw new Error("Run credential unavailable");
12049
- if (credential.kind === "provider") {
12050
- const url = new URL(credential.baseUrl);
12051
- if (url.protocol !== "https:" || url.username || url.password) throw new Error("Run credential unavailable");
12052
- }
12057
+ if (credential.kind !== "provider") throw new Error("Run credential unavailable");
12058
+ if (!runModelCredentialSchema.safeParse(credential).success) throw new Error("Run credential unavailable");
12053
12059
  return credential;
12054
12060
  }
12055
12061
  function credentialDomain(credential) {
@@ -12058,17 +12064,16 @@ function credentialDomain(credential) {
12058
12064
  function claudeCredentialEnv(credential) {
12059
12065
  if (!credential) return {};
12060
12066
  const value = checked(credential);
12061
- if (value.kind === "provider" && value.protocol !== "anthropic") throw new Error("Claude Code takes Anthropic-compatible providers only");
12067
+ if (value.protocol !== "anthropic") throw new Error("Claude Code takes Anthropic-compatible providers only");
12062
12068
  return {
12063
12069
  ANTHROPIC_API_KEY: value.key,
12064
- ...value.kind === "provider" ? { ANTHROPIC_BASE_URL: value.baseUrl } : {}
12070
+ ANTHROPIC_BASE_URL: value.baseUrl
12065
12071
  };
12066
12072
  }
12067
12073
  function codexCredential(credential) {
12068
12074
  if (!credential) return { args: [], env: {} };
12069
12075
  const value = checked(credential);
12070
- if (value.kind === "provider" && value.protocol !== "openai") throw new Error("Codex takes OpenAI-compatible providers only");
12071
- const baseUrl = value.kind === "provider" ? value.baseUrl : OPENAI_BASE_URL;
12076
+ if (value.protocol !== "openai") throw new Error("Codex takes OpenAI-compatible providers only");
12072
12077
  return {
12073
12078
  args: [
12074
12079
  "-c",
@@ -12076,7 +12081,7 @@ function codexCredential(credential) {
12076
12081
  "-c",
12077
12082
  'model_providers.mikka.name="Mikka"',
12078
12083
  "-c",
12079
- `model_providers.mikka.base_url=${JSON.stringify(baseUrl)}`,
12084
+ `model_providers.mikka.base_url=${JSON.stringify(value.baseUrl)}`,
12080
12085
  "-c",
12081
12086
  `model_providers.mikka.env_key="${KEY_ENV}"`,
12082
12087
  "-c",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@aspectlylabs/mikka",
3
- "version": "0.0.713",
3
+ "version": "0.0.715",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@aspectlylabs/mikka",
9
- "version": "0.0.713",
9
+ "version": "0.0.715",
10
10
  "license": "AGPL-3.0-only",
11
11
  "dependencies": {
12
12
  "@agentclientprotocol/sdk": "1.9.0",
@@ -267,9 +267,9 @@
267
267
  }
268
268
  },
269
269
  "node_modules/@hono/node-server": {
270
- "version": "2.1.9",
271
- "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.9.tgz",
272
- "integrity": "sha512-Sk4NQd3GFY0WZWCzndwFMPwJhtD0y9qjsQ+pjID0/03nK9pxyBCUoUHCho8QYBLBVhi0ssL8UkNPHqbgSOFPIQ==",
270
+ "version": "2.1.11",
271
+ "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.11.tgz",
272
+ "integrity": "sha512-KzKz9vl4vvr1vgLHamj+g5uonbrj5NwAdO3yzOS6cd2HjALVeOgTgeZOyAzNxejbkfOOPIcvuf/Tg8l1pEFLog==",
273
273
  "license": "MIT",
274
274
  "peer": true,
275
275
  "engines": {
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@aspectlylabs/mikka",
3
- "version": "0.0.713",
3
+ "version": "0.0.715",
4
4
  "description": "Local Mikka daemon: runs agents through the user's own CLIs",
5
- "gitHead": "86a5ae6b862a4a8733add9049513a74b15513675",
5
+ "gitHead": "edfb82d33849f2fa0deb42030db1f8eca68f1eb4",
6
6
  "type": "module",
7
7
  "private": false,
8
8
  "license": "AGPL-3.0-only",
package/paths.js CHANGED
@@ -6,7 +6,7 @@ import { join } from "node:path";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@mikka/daemon",
9
- version: "0.0.713",
9
+ version: "0.0.715",
10
10
  description: "Local Mikka daemon: runs agents through the user's own CLIs",
11
11
  type: "module",
12
12
  private: true,
@@ -74,7 +74,7 @@ var package_default = {
74
74
  engines: {
75
75
  node: ">=22"
76
76
  },
77
- gitHead: "86a5ae6b862a4a8733add9049513a74b15513675"
77
+ gitHead: "edfb82d33849f2fa0deb42030db1f8eca68f1eb4"
78
78
  };
79
79
 
80
80
  // src/paths.ts
package/sbom.cdx.json CHANGED
@@ -2,10 +2,10 @@
2
2
  "$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
3
3
  "bomFormat": "CycloneDX",
4
4
  "specVersion": "1.5",
5
- "serialNumber": "urn:uuid:129d7acc-fcbc-4020-b683-0a4fcfc4c0cd",
5
+ "serialNumber": "urn:uuid:901bae4c-a156-40e2-b5c3-2221eb85452a",
6
6
  "version": 1,
7
7
  "metadata": {
8
- "timestamp": "2026-11-20T03:29:34.519Z",
8
+ "timestamp": "2026-11-20T12:11:31.916Z",
9
9
  "lifecycles": [
10
10
  {
11
11
  "phase": "pre-build"
@@ -19,13 +19,13 @@
19
19
  }
20
20
  ],
21
21
  "component": {
22
- "bom-ref": "@aspectlylabs/mikka@0.0.713",
22
+ "bom-ref": "@aspectlylabs/mikka@0.0.715",
23
23
  "type": "library",
24
- "name": ".retained-build-oTg3MK",
25
- "version": "0.0.713",
24
+ "name": ".retained-build-fup7hZ",
25
+ "version": "0.0.715",
26
26
  "scope": "required",
27
27
  "description": "Local Mikka daemon: runs agents through the user's own CLIs",
28
- "purl": "pkg:npm/%40aspectlylabs/mikka@0.0.713",
28
+ "purl": "pkg:npm/%40aspectlylabs/mikka@0.0.715",
29
29
  "properties": [],
30
30
  "externalReferences": [
31
31
  {
@@ -401,23 +401,23 @@
401
401
  ]
402
402
  },
403
403
  {
404
- "bom-ref": "@hono/node-server@2.1.9",
404
+ "bom-ref": "@hono/node-server@2.1.11",
405
405
  "type": "library",
406
406
  "name": "@hono/node-server",
407
- "version": "2.1.9",
407
+ "version": "2.1.11",
408
408
  "scope": "required",
409
- "purl": "pkg:npm/%40hono/node-server@2.1.9",
409
+ "purl": "pkg:npm/%40hono/node-server@2.1.11",
410
410
  "properties": [],
411
411
  "externalReferences": [
412
412
  {
413
413
  "type": "distribution",
414
- "url": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.9.tgz"
414
+ "url": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.11.tgz"
415
415
  }
416
416
  ],
417
417
  "hashes": [
418
418
  {
419
419
  "alg": "SHA-512",
420
- "content": "4a4e0d41ddc6158d166560b39ddc0530fc0986d0f4cbdaa3b10fa98c80f4ff4de72bda71c81094a141c2868f106012c15618b4b2c2fc52434f1ea6e048e14f21"
420
+ "content": "2b32b3f6f978befaf5be02c76a68fe839ba89dbae3e4dc0074edf2cce4ba71dd878c02d578e81381e64ec80ccdc5e8db91f38e3c872fb9ffd383c975a4414ba2"
421
421
  }
422
422
  ],
423
423
  "licenses": [
@@ -4909,7 +4909,7 @@
4909
4909
  ],
4910
4910
  "dependencies": [
4911
4911
  {
4912
- "ref": "@aspectlylabs/mikka@0.0.713",
4912
+ "ref": "@aspectlylabs/mikka@0.0.715",
4913
4913
  "dependsOn": [
4914
4914
  "@agentclientprotocol/sdk@1.9.0",
4915
4915
  "@anthropic-ai/claude-agent-sdk@0.3.305",
@@ -5026,7 +5026,7 @@
5026
5026
  "dependsOn": []
5027
5027
  },
5028
5028
  {
5029
- "ref": "@hono/node-server@2.1.9",
5029
+ "ref": "@hono/node-server@2.1.11",
5030
5030
  "dependsOn": [
5031
5031
  "hono@4.13.19"
5032
5032
  ]
@@ -5044,7 +5044,7 @@
5044
5044
  {
5045
5045
  "ref": "@modelcontextprotocol/sdk@1.32.2",
5046
5046
  "dependsOn": [
5047
- "@hono/node-server@2.1.9",
5047
+ "@hono/node-server@2.1.11",
5048
5048
  "ajv@8.20.0",
5049
5049
  "ajv-formats@3.0.1",
5050
5050
  "content-type@1.0.5",