@bike4mind/cli 5.0.0 → 5.1.0

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 (37) hide show
  1. package/dist/{AgentHistoryStore-C3hJOgpM.mjs → AgentHistoryStore-DrZ47hqO.mjs} +503 -46
  2. package/dist/{ApiClient-CeuIcSY8.mjs → ApiClient-B8VxyNEM.mjs} +3 -3
  3. package/dist/{BubblewrapRuntime-BF5wXaNS.mjs → BubblewrapRuntime-DotKnqtu.mjs} +2 -2
  4. package/dist/ConfigStore-1lUx9qD8.mjs +2 -0
  5. package/dist/{ConfigStore-nr0ebq4v.mjs → ConfigStore-DfuE49PH.mjs} +17 -1
  6. package/dist/{Logger-CovZt7LL.mjs → Logger-D6QD3c7G.mjs} +2878 -1200
  7. package/dist/{SandboxOrchestrator-DTz_5Zub.mjs → SandboxOrchestrator-Cm9L1TRR.mjs} +1 -1
  8. package/dist/{SandboxRuntimeAdapter-X0HAkbpW.mjs → SandboxRuntimeAdapter-DF9hg5Xl.mjs} +1 -1
  9. package/dist/{SandboxRuntimeAdapter-CC5KlbZ8.mjs → SandboxRuntimeAdapter-HEkl0-qG.mjs} +2 -2
  10. package/dist/{SeatbeltRuntime-zdxVqGZ3.mjs → SeatbeltRuntime-CYsIp616.mjs} +2 -2
  11. package/dist/{WorkItemsClient-lKJCPP0j.mjs → WorkItemsClient-sUftLgOz.mjs} +1 -1
  12. package/dist/{buildToolSearch-BlOSK4m3.mjs → buildToolSearch-Bb-DPCb0.mjs} +2 -2
  13. package/dist/commands/acpCommand.mjs +5 -5
  14. package/dist/commands/apiCommand.mjs +1 -1
  15. package/dist/commands/doctorCommand.mjs +2 -2
  16. package/dist/commands/envCommand.mjs +1 -1
  17. package/dist/commands/headlessCommand.mjs +6 -6
  18. package/dist/commands/mcpCommand.mjs +3 -3
  19. package/dist/commands/mirrorCommand.mjs +2 -2
  20. package/dist/commands/modelsCommand.mjs +4 -4
  21. package/dist/commands/pluginCommand.mjs +1 -1
  22. package/dist/commands/skillsCommand.mjs +3 -3
  23. package/dist/commands/updateCommand.mjs +2 -2
  24. package/dist/{createFile-B8bur5Rb-CVzCarEA.mjs → createFile-CPKmd6Uf-Bk-3V2T3.mjs} +3 -3
  25. package/dist/{deleteFile-9B3gW_Nb-DG2sovIl.mjs → deleteFile-CD_xQ7Y6-C1X4Ievb.mjs} +17 -4
  26. package/dist/{dist-BrBjZ6Cv.mjs → dist-De8Q0ivE.mjs} +163 -40
  27. package/dist/{fit-vnmP4Dfc.mjs → fit-BsHUrxwe.mjs} +3 -3
  28. package/dist/{globFiles-CwJ8qmYo-BR5b2KvO.mjs → globFiles-CoapsO8G-CpvQo-R2.mjs} +9 -5
  29. package/dist/{grepSearch-CLtEqT4j-BnKPtNWr.mjs → grepSearch-DeH7M2e7-BIvo-yNy.mjs} +2 -2
  30. package/dist/index.mjs +9 -9
  31. package/dist/{modelServers-CjSlPFsg.mjs → modelServers-Ca1l2hMC.mjs} +1 -1
  32. package/dist/{package-BTvxFRbB.mjs → package-hEkaJgsy.mjs} +1 -1
  33. package/dist/{pathValidation-BRqf4HFX-CHwtwp3O.mjs → pathValidation-C4ADzpUR-BPIpINwZ.mjs} +36 -12
  34. package/dist/{serve-BLBhPkyw.mjs → serve-CiSddein.mjs} +91 -18
  35. package/dist/{updateChecker-uDIZuEZg.mjs → updateChecker-dZqiMftm.mjs} +1 -1
  36. package/package.json +12 -13
  37. package/dist/ConfigStore--dPqdX3O.mjs +0 -2
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { Ct as getQuestErrorCode, Dt as isEnforceCreditsLocked, E as CompletionReasoningEffortSchema, F as EMBEDDING_MODEL_IDS, Gt as servableEmbeddingDimensions, H as MODEL_INFO_FIELD_GROUP_OF, Jt as stripDeliveredArtifactBlocks, K as OllamaEmbeddingModel, Mt as isSupportedEmbeddingModel, Nt as isSupportedFabFileMimeType, Ot as isExpectedToolError, P as EMBEDDING_MODEL_CATALOG, Pt as isUserInitiatedAbort, S as CONTEXT_WINDOW_SAFETY_BUFFER_TOKENS, T as ChatModels, Tt as hasDeliverablePinnedArtifact, Ut as resolveSettingDefinition, W as ModelBackend, Y as PermissionDeniedError, Yt as stripToolArtifactMarkup, _ as AudioMimeType, _t as escapeThinkMarkers, d as ARTIFACT_REMOVED_PLACEHOLDER, f as AdminAiStoredConfigSchema, gt as createThinkMarkerEscaper, hn as WEBSITE_URL, lt as VoyageAIEmbeddingModel, mn as APP_NAME, ot as SupportedFabFileMimeTypes, p as AiAccessRefusedError, q as OpenAIEmbeddingModel, tn as visibleReplyText, u as ARTIFACT_DELIVERED_PLACEHOLDER, vt as filterToolArtifactMarkup, xt as getEmbeddingModelCapabilities, y as BedrockEmbeddingModel } from "./Logger-CovZt7LL.mjs";
2
+ import { Ct as getQuestErrorCode, Dt as isEnforceCreditsLocked, E as CompletionReasoningEffortSchema, F as EMBEDDING_MODEL_IDS, Ft as isUserInitiatedAbort, H as MODEL_INFO_FIELD_GROUP_OF, K as OllamaEmbeddingModel, Kt as servableEmbeddingDimensions, Nt as isSupportedEmbeddingModel, Ot as isExpectedToolError, P as EMBEDDING_MODEL_CATALOG, Pt as isSupportedFabFileMimeType, S as CONTEXT_WINDOW_SAFETY_BUFFER_TOKENS, T as ChatModels, Tt as hasDeliverablePinnedArtifact, W as ModelBackend, Wt as resolveSettingDefinition, Xt as stripToolArtifactMarkup, Y as PermissionDeniedError, Yt as stripDeliveredArtifactBlocks, _ as AudioMimeType, _t as escapeThinkMarkers, d as ARTIFACT_REMOVED_PLACEHOLDER, f as AdminAiStoredConfigSchema, gn as WEBSITE_URL, gt as createThinkMarkerEscaper, hn as APP_NAME, lt as VoyageAIEmbeddingModel, nn as visibleReplyText, ot as SupportedFabFileMimeTypes, p as AiAccessRefusedError, q as OpenAIEmbeddingModel, u as ARTIFACT_DELIVERED_PLACEHOLDER, vt as filterToolArtifactMarkup, xt as getEmbeddingModelCapabilities, y as BedrockEmbeddingModel } from "./Logger-D6QD3c7G.mjs";
3
3
  import { b as ollamaNumCtx } from "./modelHub-BSB6qRFP.mjs";
4
4
  import "crypto";
5
5
  import path from "path";
@@ -13,6 +13,7 @@ import https from "https";
13
13
  import OpenAI from "openai";
14
14
  import { Agent } from "undici";
15
15
  import { Ollama } from "ollama";
16
+ import { AsyncLocalStorage } from "node:async_hooks";
16
17
  import { createParser } from "eventsource-parser";
17
18
  //#region ../../b4m-core/observability/dist/index.mjs
18
19
  const REDACTED = "[REDACTED]";
@@ -720,21 +721,22 @@ var BaseStorage = class {
720
721
  }
721
722
  };
722
723
  new Map(EMBEDDING_MODEL_IDS.filter(isSupportedEmbeddingModel).map((model) => [model, getEmbeddingModelCapabilities(model).dimensions.native]));
723
- ChatModels.KIMI_K3;
724
- ChatModels.KIMI_K2_7_CODE, ChatModels.KIMI_K2_7_CODE_HIGHSPEED, ChatModels.KIMI_K2_6, ChatModels.KIMI_K2_5;
724
+ ChatModels.KIMI_K3, ChatModels.KIMI_K3_1_PRO;
725
+ ChatModels.KIMI_K2_7_CODE, ChatModels.KIMI_K2_7_CODE_HIGHSPEED, ChatModels.KIMI_K2_6;
725
726
  ChatModels.KIMI_K2_7_CODE, ChatModels.KIMI_K2_7_CODE_HIGHSPEED;
726
727
  ChatModels.KIMI_K2_7_CODE, ChatModels.KIMI_K2_7_CODE_HIGHSPEED, ChatModels.KIMI_K2_6;
727
- ChatModels.KIMI_K3, ChatModels.KIMI_K2_7_CODE, ChatModels.KIMI_K2_7_CODE_HIGHSPEED, ChatModels.KIMI_K2_6, ChatModels.KIMI_K2_5;
728
- ChatModels.KIMI_K2_THINKING_BEDROCK, ChatModels.KIMI_K2_5_BEDROCK, ChatModels.DEEPSEEK_R1_BEDROCK, ChatModels.DEEPSEEK_FLASH, ChatModels.DEEPSEEK_V4_PRO, ChatModels.KIMI_K3, ChatModels.KIMI_K2_7_CODE, ChatModels.KIMI_K2_7_CODE_HIGHSPEED, ChatModels.KIMI_K2_6, ChatModels.KIMI_K2_5;
728
+ ChatModels.KIMI_K3, ChatModels.KIMI_K3_1_PRO, ChatModels.KIMI_K2_7_CODE, ChatModels.KIMI_K2_7_CODE_HIGHSPEED, ChatModels.KIMI_K2_6;
729
+ ChatModels.KIMI_K2_THINKING_BEDROCK, ChatModels.KIMI_K2_5_BEDROCK, ChatModels.DEEPSEEK_R1_BEDROCK, ChatModels.DEEPSEEK_FLASH, ChatModels.DEEPSEEK_V4_PRO, ChatModels.KIMI_K3, ChatModels.KIMI_K3_1_PRO, ChatModels.KIMI_K2_7_CODE, ChatModels.KIMI_K2_7_CODE_HIGHSPEED, ChatModels.KIMI_K2_6;
729
730
  ChatModels.CLAUDE_4_7_OPUS, ChatModels.CLAUDE_4_7_OPUS_BEDROCK, ChatModels.CLAUDE_4_8_OPUS, ChatModels.CLAUDE_4_8_OPUS_BEDROCK, ChatModels.CLAUDE_5_SONNET, ChatModels.CLAUDE_5_SONNET_BEDROCK, ChatModels.CLAUDE_5_OPUS, ChatModels.CLAUDE_5_OPUS_BEDROCK, ChatModels.CLAUDE_5_5_HAIKU, ChatModels.CLAUDE_5_5_HAIKU_BEDROCK, ChatModels.CLAUDE_5_5_SONNET, ChatModels.CLAUDE_5_5_SONNET_BEDROCK;
730
- ChatModels.CLAUDE_5_SONNET, ChatModels.CLAUDE_5_SONNET_BEDROCK, ChatModels.CLAUDE_5_5_SONNET, ChatModels.CLAUDE_5_5_SONNET_BEDROCK, ChatModels.CLAUDE_FABLE_5, ChatModels.CLAUDE_FABLE_5_BEDROCK, ChatModels.CLAUDE_FABLE_5_1_BEDROCK, ChatModels.CLAUDE_5_OPUS, ChatModels.CLAUDE_5_OPUS_BEDROCK, ChatModels.CLAUDE_5_5_OPUS, ChatModels.CLAUDE_5_5_OPUS_BEDROCK, ChatModels.CLAUDE_5_5_HAIKU, ChatModels.CLAUDE_5_5_HAIKU_BEDROCK;
731
+ ChatModels.CLAUDE_5_SONNET, ChatModels.CLAUDE_5_SONNET_BEDROCK, ChatModels.CLAUDE_5_5_SONNET, ChatModels.CLAUDE_5_5_SONNET_BEDROCK, ChatModels.CLAUDE_FABLE_5, ChatModels.CLAUDE_FABLE_5_1, ChatModels.CLAUDE_FABLE_5_2, ChatModels.CLAUDE_FABLE_5_BEDROCK, ChatModels.CLAUDE_FABLE_5_1_BEDROCK, ChatModels.CLAUDE_5_OPUS, ChatModels.CLAUDE_5_OPUS_BEDROCK, ChatModels.CLAUDE_5_5_OPUS, ChatModels.CLAUDE_5_5_OPUS_BEDROCK, ChatModels.CLAUDE_5_5_HAIKU, ChatModels.CLAUDE_5_5_HAIKU_BEDROCK;
731
732
  ChatModels.DEEPSEEK_FLASH, ChatModels.DEEPSEEK_V4_PRO;
732
733
  ModelBackend.Anthropic, ModelBackend.Gemini, ModelBackend.XAI, ModelBackend.Ollama, ModelBackend.BFL, ModelBackend.LocalImage, ModelBackend.AWS;
733
734
  CompletionReasoningEffortSchema.options;
734
735
  //#endregion
735
736
  //#region ../../b4m-core/llm-adapters/dist/index.mjs
736
- function getAbortAwareRetrySignal({ retryMode, abortSignal, stream, tools, responseFormat, _internal }) {
737
- if (retryMode !== "abort-aware") return void 0;
737
+ function getAbortAwareRetrySignal({ retryMode, abortSignal, stream, tools, responseFormat, _internal }, singleAttemptSupported = false) {
738
+ if (retryMode !== "abort-aware" && retryMode !== "single-attempt") return void 0;
739
+ if (retryMode === "single-attempt" && !singleAttemptSupported) throw new Error("Single-attempt completion is unsupported by this adapter");
738
740
  if (!abortSignal) throw new Error("Abort-aware completion retries require an abort signal");
739
741
  abortSignal.throwIfAborted();
740
742
  const hasTools = Array.isArray(tools) ? tools.length > 0 : tools !== void 0;
@@ -1530,7 +1532,53 @@ function appendIdentityReminderToMessages(messages, identityReminder) {
1530
1532
  content: identityReminder
1531
1533
  }, ...messages];
1532
1534
  }
1533
- ChatModels.CLAUDE_4_5_SONNET, ChatModels.CLAUDE_4_1_OPUS, ChatModels.CLAUDE_4_5_HAIKU, ChatModels.CLAUDE_4_5_OPUS, ChatModels.CLAUDE_4_6_SONNET, ChatModels.CLAUDE_4_6_OPUS;
1535
+ ChatModels.CLAUDE_4_5_SONNET, ChatModels.CLAUDE_4_5_HAIKU, ChatModels.CLAUDE_4_6_SONNET, ChatModels.CLAUDE_4_6_OPUS;
1536
+ /**
1537
+ * A reasoning model spent its whole output budget thinking and produced no answer
1538
+ * (finish_reason: length). The same budget fails the same way, so callers must not retry it.
1539
+ * The message keeps the "output budget was exhausted" phrase that log searches and tests match.
1540
+ */
1541
+ var OutputBudgetExhaustedError = class extends Error {
1542
+ provider;
1543
+ model;
1544
+ constructor(provider, model) {
1545
+ super(`${provider} returned no content for ${model}: the output budget was exhausted before any answer was produced (finish_reason: length). Raise maxTokens or lower the reasoning effort.`);
1546
+ this.provider = provider;
1547
+ this.model = model;
1548
+ this.name = "OutputBudgetExhaustedError";
1549
+ }
1550
+ };
1551
+ /**
1552
+ * The stream closed with no finish reason and nothing usable. Transient, so worth one retry.
1553
+ * The message must not say "aborted", "overloaded" or "timeout": the fallback predicates match those.
1554
+ */
1555
+ var StreamEndedWithoutFinishError = class extends Error {
1556
+ provider;
1557
+ model;
1558
+ constructor(provider, model) {
1559
+ super(`${provider} returned no content for ${model} (finish_reason: unknown).`);
1560
+ this.provider = provider;
1561
+ this.model = model;
1562
+ this.name = "StreamEndedWithoutFinishError";
1563
+ }
1564
+ };
1565
+ /**
1566
+ * The turn ended normally (terminal event received) after streaming only a reasoning block: no
1567
+ * displayed text and no tool call. Usually a one-off sampling outcome, so worth one same-model retry
1568
+ * and then the fallback chain. Distinct from a stall (an LlmTimeoutError or "stream timeout" message)
1569
+ * and from the deterministic empty turn left by the max-tool-calls cap, which must not be retried.
1570
+ * The message must not say "aborted", "overloaded" or "timeout": the fallback predicates match those.
1571
+ */
1572
+ var HiddenReasoningOnlyEmptyError = class extends Error {
1573
+ provider;
1574
+ model;
1575
+ constructor(provider, model, message) {
1576
+ super(message);
1577
+ this.provider = provider;
1578
+ this.model = model;
1579
+ this.name = "HiddenReasoningOnlyEmptyError";
1580
+ }
1581
+ };
1534
1582
  ChatModels.CLAUDE_4_5_SONNET_BEDROCK, ChatModels.CLAUDE_4_5_HAIKU_BEDROCK, ChatModels.CLAUDE_4_5_OPUS_BEDROCK, ChatModels.CLAUDE_4_6_SONNET_BEDROCK, ChatModels.CLAUDE_4_6_OPUS_BEDROCK;
1535
1583
  /**
1536
1584
  * Models served by ConverseBedrockBackend. Adding a Converse-compatible Bedrock model is a
@@ -1577,35 +1625,6 @@ function normalizeOllamaDoneReason(reason) {
1577
1625
  default: return reason;
1578
1626
  }
1579
1627
  }
1580
- /**
1581
- * A reasoning model spent its whole output budget thinking and produced no answer
1582
- * (finish_reason: length). The same budget fails the same way, so callers must not retry it.
1583
- * The message keeps the "output budget was exhausted" phrase that log searches and tests match.
1584
- */
1585
- var OutputBudgetExhaustedError = class extends Error {
1586
- provider;
1587
- model;
1588
- constructor(provider, model) {
1589
- super(`${provider} returned no content for ${model}: the output budget was exhausted before any answer was produced (finish_reason: length). Raise maxTokens or lower the reasoning effort.`);
1590
- this.provider = provider;
1591
- this.model = model;
1592
- this.name = "OutputBudgetExhaustedError";
1593
- }
1594
- };
1595
- /**
1596
- * The stream closed with no finish reason and nothing usable. Transient, so worth one retry.
1597
- * The message must not say "aborted", "overloaded" or "timeout": the fallback predicates match those.
1598
- */
1599
- var StreamEndedWithoutFinishError = class extends Error {
1600
- provider;
1601
- model;
1602
- constructor(provider, model) {
1603
- super(`${provider} returned no content for ${model} (finish_reason: unknown).`);
1604
- this.provider = provider;
1605
- this.model = model;
1606
- this.name = "StreamEndedWithoutFinishError";
1607
- }
1608
- };
1609
1628
  /** Type guard: does this message already carry OpenAI-style `tool_calls`? */
1610
1629
  function hasToolCalls(msg) {
1611
1630
  return msg.role === "assistant" && "tool_calls" in msg;
@@ -2397,12 +2416,14 @@ var OllamaBackend = class OllamaBackend {
2397
2416
  }
2398
2417
  };
2399
2418
  ChatModels.O1_PREVIEW, ChatModels.O1_MINI, ChatModels.O1, ChatModels.O3_MINI, ChatModels.O3, ChatModels.O4_MINI;
2400
- ChatModels.GPT5, ChatModels.GPT5_2025_08_07, ChatModels.GPT5_MINI, ChatModels.GPT5_NANO, ChatModels.GPT5_CHAT_LATEST;
2401
- ChatModels.GPT5_1, ChatModels.GPT5_1_CHAT_LATEST;
2419
+ ChatModels.GPT5, ChatModels.GPT5_2025_08_07, ChatModels.GPT5_MINI, ChatModels.GPT5_NANO;
2420
+ ChatModels.GPT5_1;
2402
2421
  ChatModels.GPT5_2, ChatModels.GPT5_2_CHAT_LATEST;
2403
2422
  ChatModels.GPT5_4, ChatModels.GPT5_4_MINI, ChatModels.GPT5_4_MINI_2026_03_17, ChatModels.GPT5_4_NANO;
2404
2423
  ChatModels.GPT5_5;
2405
2424
  ChatModels.GPT5_6_SOL, ChatModels.GPT5_6_LUNA, ChatModels.GPT5_6_TERRA;
2425
+ ChatModels.GPT6_2_ASTRA, ChatModels.GPT6_2_SOL, ChatModels.GPT6_1_TERRA, ChatModels.GPT6_LUNA;
2426
+ new AsyncLocalStorage();
2406
2427
  ModelBackend.Bedrock, ModelBackend.AWS, ModelBackend.OpenAI, ModelBackend.Anthropic, ModelBackend.Gemini, ModelBackend.Ollama, ModelBackend.OpenAICompatible, ModelBackend.BFL, ModelBackend.XAI, ModelBackend.Kimi, ModelBackend.DeepSeek, ModelBackend.LocalImage, ModelBackend.VoyageAI;
2407
2428
  Object.values(ModelBackend);
2408
2429
  Object.entries(MODEL_INFO_FIELD_GROUP_OF);
@@ -8419,6 +8440,7 @@ var OpenAICompatibleBackend = class {
8419
8440
  if (!sawProse && calls.length === 0) {
8420
8441
  if (finishReason === "length") throw new OutputBudgetExhaustedError(this.options.label, name);
8421
8442
  if (finishReason === void 0 && !options.abortSignal?.aborted) throw new StreamEndedWithoutFinishError(this.options.label, name);
8443
+ if (reasoning && finishReason !== void 0 && toolCallCount < maxToolCalls) throw new HiddenReasoningOnlyEmptyError(this.options.label, name, `${this.options.label} returned only reasoning for ${name}, with no displayed text and no tool call (finish_reason: ${finishReason}).`);
8422
8444
  throw new Error(`${this.options.label} returned no content for ${name} (finish_reason: ${finishReason ?? "unknown"}).`);
8423
8445
  }
8424
8446
  if (calls.length === 0) return;
@@ -8633,6 +8655,7 @@ function textOf(message) {
8633
8655
  if (!Array.isArray(content)) return "";
8634
8656
  return content.map((part) => typeof part === "string" ? part : part.text ?? "").join("");
8635
8657
  }
8658
+ Object.freeze({ provenance: "not_reported" });
8636
8659
  ModelBackend.Ollama, ModelBackend.LocalImage;
8637
8660
  //#endregion
8638
8661
  //#region ../../b4m-core/utils/dist/index.mjs
@@ -9176,6 +9199,10 @@ const operations = {
9176
9199
  method: "POST",
9177
9200
  path: "/api/v1/files/bulk-delete"
9178
9201
  },
9202
+ cancelFunctionCall: {
9203
+ method: "POST",
9204
+ path: "/api/v1/functions/calls/{call_id}/cancel"
9205
+ },
9179
9206
  cancelImageJob: {
9180
9207
  method: "POST",
9181
9208
  path: "/api/v1/image-jobs/{id}/cancel"
@@ -9204,6 +9231,10 @@ const operations = {
9204
9231
  method: "POST",
9205
9232
  path: "/api/v1/briefs"
9206
9233
  },
9234
+ composeFollowUpBrief: {
9235
+ method: "POST",
9236
+ path: "/api/v1/briefs/follow-ups"
9237
+ },
9207
9238
  createAgent: {
9208
9239
  method: "POST",
9209
9240
  path: "/api/v1/agents"
@@ -9252,6 +9283,10 @@ const operations = {
9252
9283
  method: "POST",
9253
9284
  path: "/api/v1/files"
9254
9285
  },
9286
+ createFunction: {
9287
+ method: "POST",
9288
+ path: "/api/v1/functions"
9289
+ },
9255
9290
  createImageJob: {
9256
9291
  method: "POST",
9257
9292
  path: "/api/v1/image-jobs"
@@ -9276,6 +9311,10 @@ const operations = {
9276
9311
  method: "POST",
9277
9312
  path: "/api/v1/sessions"
9278
9313
  },
9314
+ createSessionTurn: {
9315
+ method: "POST",
9316
+ path: "/api/v1/turns"
9317
+ },
9279
9318
  createSkill: {
9280
9319
  method: "POST",
9281
9320
  path: "/api/v1/skills"
@@ -9324,6 +9363,10 @@ const operations = {
9324
9363
  method: "DELETE",
9325
9364
  path: "/api/v1/files/{id}"
9326
9365
  },
9366
+ deleteFunction: {
9367
+ method: "DELETE",
9368
+ path: "/api/v1/functions/{id}"
9369
+ },
9327
9370
  deletePersona: {
9328
9371
  method: "DELETE",
9329
9372
  path: "/api/v1/personas/{id}"
@@ -9344,6 +9387,10 @@ const operations = {
9344
9387
  method: "POST",
9345
9388
  path: "/api/v1/pending-actions/{questId}/deny"
9346
9389
  },
9390
+ editBriefDecision: {
9391
+ method: "PATCH",
9392
+ path: "/api/v1/briefs/{id}/decisions/{decisionId}"
9393
+ },
9347
9394
  editImage: {
9348
9395
  method: "POST",
9349
9396
  path: "/api/v1/image-edits"
@@ -9364,6 +9411,10 @@ const operations = {
9364
9411
  method: "POST",
9365
9412
  path: "/api/v1/tools/web-fetch"
9366
9413
  },
9414
+ findFunctionRecipient: {
9415
+ method: "GET",
9416
+ path: "/api/v1/functions/{id}/recipient"
9417
+ },
9367
9418
  generateAgentAvatar: {
9368
9419
  method: "POST",
9369
9420
  path: "/api/v1/agents/{id}/generate-avatar"
@@ -9404,6 +9455,10 @@ const operations = {
9404
9455
  method: "GET",
9405
9456
  path: "/api/v1/artifacts/{id}/versions/{version}"
9406
9457
  },
9458
+ getAuthoredFunction: {
9459
+ method: "GET",
9460
+ path: "/api/v1/functions/{id}/source"
9461
+ },
9407
9462
  getBrief: {
9408
9463
  method: "GET",
9409
9464
  path: "/api/v1/briefs/{id}"
@@ -9492,10 +9547,22 @@ const operations = {
9492
9547
  method: "GET",
9493
9548
  path: "/api/v1/functions/calls/{call_id}"
9494
9549
  },
9550
+ getFunctionCallSummary: {
9551
+ method: "GET",
9552
+ path: "/api/v1/functions/{id}/calls"
9553
+ },
9554
+ getFunctionShare: {
9555
+ method: "GET",
9556
+ path: "/api/v1/functions/{id}/share"
9557
+ },
9495
9558
  getImageJob: {
9496
9559
  method: "GET",
9497
9560
  path: "/api/v1/image-jobs/{id}"
9498
9561
  },
9562
+ getInterruptionFeedback: {
9563
+ method: "GET",
9564
+ path: "/api/v1/assistant/interruptions"
9565
+ },
9499
9566
  getMe: {
9500
9567
  method: "GET",
9501
9568
  path: "/api/v1/me"
@@ -9588,6 +9655,10 @@ const operations = {
9588
9655
  method: "GET",
9589
9656
  path: "/api/v1/assistant/instructions"
9590
9657
  },
9658
+ listAuthoredFunctions: {
9659
+ method: "GET",
9660
+ path: "/api/v1/functions/mine"
9661
+ },
9591
9662
  listBriefs: {
9592
9663
  method: "GET",
9593
9664
  path: "/api/v1/briefs"
@@ -9728,10 +9799,18 @@ const operations = {
9728
9799
  method: "POST",
9729
9800
  path: "/api/v1/personas"
9730
9801
  },
9802
+ pinFunctionData: {
9803
+ method: "POST",
9804
+ path: "/api/v1/functions/{id}/data"
9805
+ },
9731
9806
  postSlackMessage: {
9732
9807
  method: "POST",
9733
9808
  path: "/api/v1/slack/messages"
9734
9809
  },
9810
+ promoteFunction: {
9811
+ method: "POST",
9812
+ path: "/api/v1/functions/{id}/promote"
9813
+ },
9735
9814
  publishArtifact: {
9736
9815
  method: "POST",
9737
9816
  path: "/api/v1/artifacts/{id}/publish"
@@ -9788,10 +9867,26 @@ const operations = {
9788
9867
  method: "POST",
9789
9868
  path: "/api/v1/skills/market/versions/{vid}/rescan"
9790
9869
  },
9870
+ resolveBriefDecision: {
9871
+ method: "POST",
9872
+ path: "/api/v1/briefs/{id}/decisions/{decisionId}/resolve"
9873
+ },
9874
+ reviewFunction: {
9875
+ method: "POST",
9876
+ path: "/api/v1/functions/{id}/review"
9877
+ },
9791
9878
  reviewSkillMarketVersion: {
9792
9879
  method: "POST",
9793
9880
  path: "/api/v1/skills/market/versions/{vid}/review"
9794
9881
  },
9882
+ runFunctionTests: {
9883
+ method: "POST",
9884
+ path: "/api/v1/functions/{id}/test-runs"
9885
+ },
9886
+ saveFunctionCode: {
9887
+ method: "PUT",
9888
+ path: "/api/v1/functions/{id}/code"
9889
+ },
9795
9890
  searchArtifacts: {
9796
9891
  method: "GET",
9797
9892
  path: "/api/v1/artifacts/search"
@@ -9820,6 +9915,22 @@ const operations = {
9820
9915
  method: "POST",
9821
9916
  path: "/api/v1/session-handoffs"
9822
9917
  },
9918
+ setFunctionExamples: {
9919
+ method: "PUT",
9920
+ path: "/api/v1/functions/{id}/examples"
9921
+ },
9922
+ setFunctionSources: {
9923
+ method: "PUT",
9924
+ path: "/api/v1/functions/{id}/sources"
9925
+ },
9926
+ setInterruptionFeedback: {
9927
+ method: "PUT",
9928
+ path: "/api/v1/assistant/interruptions"
9929
+ },
9930
+ shareFunction: {
9931
+ method: "PUT",
9932
+ path: "/api/v1/functions/{id}/share"
9933
+ },
9823
9934
  startAgentExecution: {
9824
9935
  method: "POST",
9825
9936
  path: "/api/v1/agent-executions"
@@ -9844,6 +9955,10 @@ const operations = {
9844
9955
  method: "POST",
9845
9956
  path: "/api/v1/data-lakes/{id}/config-history/{event_id}/undo"
9846
9957
  },
9958
+ unpinFunctionData: {
9959
+ method: "DELETE",
9960
+ path: "/api/v1/functions/{id}/data/{name}"
9961
+ },
9847
9962
  unpublishArtifact: {
9848
9963
  method: "DELETE",
9849
9964
  path: "/api/v1/artifacts/{id}/publish"
@@ -9852,6 +9967,10 @@ const operations = {
9852
9967
  method: "DELETE",
9853
9968
  path: "/api/v1/push-tokens"
9854
9969
  },
9970
+ unshareFunction: {
9971
+ method: "DELETE",
9972
+ path: "/api/v1/functions/{id}/share"
9973
+ },
9855
9974
  updateAgent: {
9856
9975
  method: "PATCH",
9857
9976
  path: "/api/v1/agents/{id}"
@@ -9868,6 +9987,10 @@ const operations = {
9868
9987
  method: "PATCH",
9869
9988
  path: "/api/v1/files/{id}"
9870
9989
  },
9990
+ updateFunction: {
9991
+ method: "PATCH",
9992
+ path: "/api/v1/functions/{id}"
9993
+ },
9871
9994
  updateObligation: {
9872
9995
  method: "PATCH",
9873
9996
  path: "/api/v1/obligations/{id}"
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import "./Logger-CovZt7LL.mjs";
2
+ import "./Logger-D6QD3c7G.mjs";
3
3
  import { S as vramNeedsLlamaServer, b as ollamaNumCtx, v as estimateFitFromSize } from "./modelHub-BSB6qRFP.mjs";
4
- import { t as version } from "./package-BTvxFRbB.mjs";
4
+ import { t as version } from "./package-hEkaJgsy.mjs";
5
5
  import { D as PRODUCTION_CURATED_KEYS, U as loadCuratedManifest, _ as resolveCuratedUrl, h as probeHardware, n as CuratedStore, t as CuratedListSource, u as curatedStoreRoot, w as BUNDLED_CURATED_JSON_TEXT } from "./dist-K7a9yOUb.mjs";
6
- import { Q as formatBytes, it as largestProjectorBytes } from "./modelServers-CjSlPFsg.mjs";
6
+ import { Q as formatBytes, it as largestProjectorBytes } from "./modelServers-Ca1l2hMC.mjs";
7
7
  import path from "node:path";
8
8
  import { homedir } from "node:os";
9
9
  //#region src/models/curatedList.ts
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import { n as isPathAllowed } from "./pathValidation-BRqf4HFX-CHwtwp3O.mjs";
2
+ import { a as isPathAllowed, r as createPathChecker } from "./pathValidation-C4ADzpUR-BPIpINwZ.mjs";
3
3
  import path from "path";
4
4
  import { stat } from "fs/promises";
5
5
  import { glob } from "glob";
6
- //#region ../../b4m-core/services/dist/globFiles-CwJ8qmYo.mjs
6
+ //#region ../../b4m-core/services/dist/globFiles-CoapsO8G.mjs
7
7
  const DEFAULT_IGNORE_PATTERNS = [
8
8
  "**/node_modules/**",
9
9
  "**/.git/**",
@@ -25,7 +25,7 @@ async function findFiles(params, allowedDirectories) {
25
25
  throw new Error(`Access denied: Cannot search outside allowed directories. ${dirsMsg}`);
26
26
  }
27
27
  if (path.isAbsolute(pattern) || pattern.split("/").includes("..")) throw new Error("Access denied: Cannot search outside allowed directories. The pattern must be relative to the search directory.");
28
- const matches = await glob(pattern, {
28
+ const expanded = await glob(pattern, {
29
29
  cwd: targetDir,
30
30
  dot: false,
31
31
  ignore: respect_git_ignore ? DEFAULT_IGNORE_PATTERNS : [],
@@ -34,7 +34,11 @@ async function findFiles(params, allowedDirectories) {
34
34
  nocase: !case_sensitive,
35
35
  maxDepth: 20
36
36
  });
37
- if (matches.length === 0) return `No files found matching pattern: ${pattern}${dir_path ? ` in ${dir_path}` : ""}`;
37
+ const checkPath = createPathChecker(allowedDirectories);
38
+ const matches = expanded.filter((match) => checkPath(match).allowed);
39
+ const skipped = expanded.length - matches.length;
40
+ const skippedNote = skipped > 0 ? `\n${skipped} match(es) outside the allowed directories were skipped.` : "";
41
+ if (matches.length === 0) return `No files found matching pattern: ${pattern}${dir_path ? ` in ${dir_path}` : ""}${skippedNote}`;
38
42
  const filesWithStats = [];
39
43
  for (const filePath of matches) try {
40
44
  const stats = await stat(filePath);
@@ -49,7 +53,7 @@ async function findFiles(params, allowedDirectories) {
49
53
  const MAX_RESULTS = 500;
50
54
  const truncated = filesWithStats.length > MAX_RESULTS;
51
55
  const results = truncated ? filesWithStats.slice(0, MAX_RESULTS) : filesWithStats;
52
- return `${`Found ${filesWithStats.length} file(s)${truncated ? ` (showing first ${MAX_RESULTS})` : ""} matching: ${pattern}`}${dir_path ? `\nDirectory: ${dir_path}` : ""}\n\n${results.map((file) => path.relative(baseCwd, file.path)).join("\n")}`;
56
+ return `${`Found ${filesWithStats.length} file(s)${truncated ? ` (showing first ${MAX_RESULTS})` : ""} matching: ${pattern}`}${dir_path ? `\nDirectory: ${dir_path}` : ""}${skippedNote}\n\n${results.map((file) => path.relative(baseCwd, file.path)).join("\n")}`;
53
57
  }
54
58
  const globFilesTool = {
55
59
  name: "glob_files",
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { n as isPathAllowed } from "./pathValidation-BRqf4HFX-CHwtwp3O.mjs";
2
+ import { a as isPathAllowed } from "./pathValidation-C4ADzpUR-BPIpINwZ.mjs";
3
3
  import { existsSync } from "fs";
4
4
  import path from "path";
5
5
  import { stat } from "fs/promises";
6
6
  import { execFile } from "child_process";
7
7
  import { promisify } from "util";
8
- //#region ../../b4m-core/services/dist/grepSearch-CLtEqT4j.mjs
8
+ //#region ../../b4m-core/services/dist/grepSearch-DeH7M2e7.mjs
9
9
  const execFileAsync = promisify(execFile);
10
10
  /** Cached ripgrep binary path after first resolution */
11
11
  let cachedRgPath = null;
package/dist/index.mjs CHANGED
@@ -1,17 +1,17 @@
1
1
  #!/usr/bin/env node
2
- import { $ as signInUncheckedMessage, A as FallbackLlmBackend, B as DEFAULT_THOROUGHNESS, C as resetTodoStore, D as createResumeAgentTool, E as createCoordinateTaskTool, G as SIGN_IN_DURING_TURN, H as LOGGED_OUT_RESTART, I as ALWAYS_DENIED_FOR_AGENTS, J as SIGN_IN_HINT, K as SIGN_IN_EXPIRED, L as DEFAULT_AGENT_MODEL, M as substituteArguments, N as PermissionManager, O as createBackgroundAgentTools, P as buildCliToolList, Q as signInUncheckedLoginMessage, R as DEFAULT_MAX_ITERATIONS, S as createWriteTodosTool, St as COMPACTION_SUMMARY_MARKER, T as parseAgentConfig, U as NoLocalModelsError, V as LOCAL_SESSION_CONTINUES, W as SIGNED_OUT_BANNER, X as loginBlocked, _t as CommandHistoryStore, b as createFindDefinitionTool, bt as searchFiles, c as checkSavedSignIn, ct as wrapTools, et as signedOutCommandMessage, f as buildLlmBackend, ft as getPlanModeFilePath, gt as CheckpointStore, ht as hasFileReferences, j as isConnectionDrop, k as createAgentDelegateTool, l as settleSignInRefresh, lt as getProcessHooks, mt as processFileReferences, nt as buildSystemPrompt, pt as CustomCommandStore, rt as buildSkillsPromptSection, s as buildSandbox, st as findIterationBoundary, tt as signedOutNoMatchMessage, u as startupMode, ut as setWebSocketToolExecutor, v as createGetFileStructureTool, vt as SessionStore, w as createSkillTool, wt as MAX_PASTE_SIZE, x as createTodoStore, xt as warmFileCache, y as createWorkItemTools, yt as formatFileSize, z as DEFAULT_RETRY_CONFIG } from "./AgentHistoryStore-C3hJOgpM.mjs";
3
- import { D as sanitizeTerminalText, E as escapeTerminalControlChars, S as LOCAL_DEV_URL, T as parseApiUrl, _ as getEnvironmentName, c as ToolCatalog, g as getDefaultApiUrl, h as getCreditsUrl, m as ApiEndpointUnconfiguredError, o as extractCompactInstructions, t as ConfigStore, v as requireApiUrl, y as resolveApiEndpoint } from "./ConfigStore-nr0ebq4v.mjs";
2
+ import { $ as signInUncheckedMessage, A as FallbackLlmBackend, B as DEFAULT_THOROUGHNESS, C as resetTodoStore, D as createResumeAgentTool, E as createCoordinateTaskTool, G as SIGN_IN_DURING_TURN, H as LOGGED_OUT_RESTART, I as ALWAYS_DENIED_FOR_AGENTS, J as SIGN_IN_HINT, K as SIGN_IN_EXPIRED, L as DEFAULT_AGENT_MODEL, M as substituteArguments, N as PermissionManager, O as createBackgroundAgentTools, P as buildCliToolList, Q as signInUncheckedLoginMessage, R as DEFAULT_MAX_ITERATIONS, S as createWriteTodosTool, St as COMPACTION_SUMMARY_MARKER, T as parseAgentConfig, U as NoLocalModelsError, V as LOCAL_SESSION_CONTINUES, W as SIGNED_OUT_BANNER, X as loginBlocked, _t as CommandHistoryStore, b as createFindDefinitionTool, bt as searchFiles, c as checkSavedSignIn, ct as wrapTools, et as signedOutCommandMessage, f as buildLlmBackend, ft as getPlanModeFilePath, gt as CheckpointStore, ht as hasFileReferences, j as isConnectionDrop, k as createAgentDelegateTool, l as settleSignInRefresh, lt as getProcessHooks, mt as processFileReferences, nt as buildSystemPrompt, pt as CustomCommandStore, rt as buildSkillsPromptSection, s as buildSandbox, st as findIterationBoundary, tt as signedOutNoMatchMessage, u as startupMode, ut as setWebSocketToolExecutor, v as createGetFileStructureTool, vt as SessionStore, w as createSkillTool, wt as MAX_PASTE_SIZE, x as createTodoStore, xt as warmFileCache, y as createWorkItemTools, yt as formatFileSize, z as DEFAULT_RETRY_CONFIG } from "./AgentHistoryStore-DrZ47hqO.mjs";
3
+ import { D as sanitizeTerminalText, E as escapeTerminalControlChars, S as LOCAL_DEV_URL, T as parseApiUrl, _ as getEnvironmentName, c as ToolCatalog, g as getDefaultApiUrl, h as getCreditsUrl, m as ApiEndpointUnconfiguredError, o as extractCompactInstructions, t as ConfigStore, v as requireApiUrl, y as resolveApiEndpoint } from "./ConfigStore-DfuE49PH.mjs";
4
4
  import { a as selectLiveSubagentTokens, i as selectLiveSubagentCredits, n as selectActiveBackgroundShells, o as useCliStore, r as selectCompletedBackgroundShells, t as selectActiveBackgroundAgents } from "./store-CmOg7JIt.mjs";
5
- import { a as extractErrorMessage$1 } from "./dist-BrBjZ6Cv.mjs";
6
- import { C as CREDIT_DEDUCT_TRANSACTION_TYPES, Et as isEarlyStop, Rt as planLeaves, T as ChatModels, Zt as tokenEstimateMultiplier, an as DELEGATION_PAYLOAD_SCHEMA_NAME, cn as actorKindSchema, in as ACTOR_COLOR_SLOTS, ln as delegationPayloadSchema, n as SESSION_ID_PATTERN, on as actorColorIndex, r as isValidSessionId, sn as actorKindMarker, t as logger, un as selfClaimedActorKindSchema, zt as planProgress } from "./Logger-CovZt7LL.mjs";
5
+ import { a as extractErrorMessage$1 } from "./dist-De8Q0ivE.mjs";
6
+ import { Bt as planProgress, C as CREDIT_DEDUCT_TRANSACTION_TYPES, Et as isEarlyStop, Qt as tokenEstimateMultiplier, T as ChatModels, an as ACTOR_COLOR_SLOTS, cn as actorKindMarker, dn as selfClaimedActorKindSchema, ln as actorKindSchema, n as SESSION_ID_PATTERN, on as DELEGATION_PAYLOAD_SCHEMA_NAME, r as isValidSessionId, sn as actorColorIndex, t as logger, un as delegationPayloadSchema, zt as planLeaves } from "./Logger-D6QD3c7G.mjs";
7
7
  import { a as rewireReservedNames, i as mergeCommands, n as COMMANDS, t as RemoteSkillSource } from "./RemoteSkillSource-HqoLRV56.mjs";
8
8
  import { r as isFeatureEnabled, t as PluginStore } from "./PluginStore-DwvOJ-G3.mjs";
9
- import { i as getTokenCounter, n as ConversationContext, r as reconstructTurnBlocks, t as WorkItemsClient } from "./WorkItemsClient-lKJCPP0j.mjs";
9
+ import { i as getTokenCounter, n as ConversationContext, r as reconstructTurnBlocks, t as WorkItemsClient } from "./WorkItemsClient-sUftLgOz.mjs";
10
10
  import { t as getShellSessionManager } from "./ShellSessionManager-6o8KZzl1-vrbPAUTq.mjs";
11
- import { r as OAuthClient, t as ApiClient } from "./ApiClient-CeuIcSY8.mjs";
12
- import { t as version } from "./package-BTvxFRbB.mjs";
13
- import { a as NotifyingLlmBackend, i as deferredToolRegistry, n as buildAgent, r as buildSupportingStores, t as buildToolSearch } from "./buildToolSearch-BlOSK4m3.mjs";
14
- import { s as getStartupUpdateStatus } from "./updateChecker-uDIZuEZg.mjs";
11
+ import { r as OAuthClient, t as ApiClient } from "./ApiClient-B8VxyNEM.mjs";
12
+ import { t as version } from "./package-hEkaJgsy.mjs";
13
+ import { a as NotifyingLlmBackend, i as deferredToolRegistry, n as buildAgent, r as buildSupportingStores, t as buildToolSearch } from "./buildToolSearch-Bb-DPCb0.mjs";
14
+ import { s as getStartupUpdateStatus } from "./updateChecker-dZqiMftm.mjs";
15
15
  import React, { createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
16
16
  import { Box, Static, Text, measureElement, render, useApp, useInput, usePaste, useStdin, useStdout } from "ink";
17
17
  import { formatWithOptions, promisify } from "node:util";
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { D as sanitizeTerminalText } from "./ConfigStore-nr0ebq4v.mjs";
2
+ import { D as sanitizeTerminalText } from "./ConfigStore-DfuE49PH.mjs";
3
3
  import { C as trackChild, H as isPermissiveEntry, K as ollamaModelKey, L as findHubBuild, O as curatedBuildForRef, Q as PullIdleTimeoutError, R as hubBuildTag, S as signalTree, T as HUGGING_FACE_SSH_KEYS_URL, V as isHubRepoId, Y as HubAccessError, Z as ModelNotFoundError, b as lmStudioModelsSchema, c as checkReviewedLayers, d as detectRuntimes, et as parseBaseUrl, f as licensesChanged, i as OllamaRuntime, k as curatedEntryForRef, l as checkRuntime, p as manifestChange, s as checkInstalledDigest, x as productFromOwner, y as OpenAICompatibleRuntime, z as isAbliteratedModel } from "./dist-K7a9yOUb.mjs";
4
4
  import { createHash } from "crypto";
5
5
  import path from "node:path";
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  //#region package.json
3
- var version = "5.0.0";
3
+ var version = "5.1.0";
4
4
  //#endregion
5
5
  export { version as t };
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { readlinkSync, realpathSync } from "fs";
3
3
  import path from "path";
4
- //#region ../../b4m-core/services/dist/pathValidation-BRqf4HFX.mjs
4
+ //#region ../../b4m-core/services/dist/pathValidation-C4ADzpUR.mjs
5
5
  /**
6
6
  * Resolves a path to its canonical form, following symlinks.
7
7
  * If the path doesn't exist (e.g., file being created), resolves the
@@ -31,18 +31,27 @@ function resolveRealPath(filePath) {
31
31
  * @returns Object with validation result, resolved path, and matched directory if allowed
32
32
  */
33
33
  function isPathAllowed(filePath, allowedDirectories) {
34
+ return createPathChecker(allowedDirectories)(filePath);
35
+ }
36
+ /**
37
+ * {@link isPathAllowed} with the working directory and allowed directories resolved once, for
38
+ * checking many paths against the same roots.
39
+ */
40
+ function createPathChecker(allowedDirectories) {
34
41
  const cwd = resolveRealPath(process.cwd());
35
42
  const allAllowed = [cwd, ...(allowedDirectories || []).map((d) => resolveRealPath(d))];
36
- const normalizedPath = path.normalize(filePath);
37
- const resolvedPath = resolveRealPath(path.isAbsolute(normalizedPath) ? normalizedPath : path.resolve(cwd, normalizedPath));
38
- for (const dir of allAllowed) if (resolvedPath === dir || resolvedPath.startsWith(dir + path.sep)) return {
39
- allowed: true,
40
- resolvedPath,
41
- matchedDirectory: dir
42
- };
43
- return {
44
- allowed: false,
45
- resolvedPath
43
+ return (filePath) => {
44
+ const normalizedPath = path.normalize(filePath);
45
+ const resolvedPath = resolveRealPath(path.isAbsolute(normalizedPath) ? normalizedPath : path.resolve(cwd, normalizedPath));
46
+ for (const dir of allAllowed) if (resolvedPath === dir || resolvedPath.startsWith(dir + path.sep)) return {
47
+ allowed: true,
48
+ resolvedPath,
49
+ matchedDirectory: dir
50
+ };
51
+ return {
52
+ allowed: false,
53
+ resolvedPath
54
+ };
46
55
  };
47
56
  }
48
57
  /**
@@ -63,5 +72,20 @@ function assertPathAllowed(filePath, allowedDirectories, operation = "access") {
63
72
  }
64
73
  return result.resolvedPath;
65
74
  }
75
+ /** Whether a file name is `.git`, compared the way case-insensitive filesystems and Windows do. */
76
+ function isGitDirectoryName(name) {
77
+ return name.replace(/[. ]+$/, "").toLowerCase() === ".git";
78
+ }
79
+ /**
80
+ * {@link assertPathAllowed} for a tool that creates, edits or deletes files: also refuses any path
81
+ * with a `.git` segment below the allowed directory it falls in. Only literal `.git` segments are
82
+ * covered, not a hooks directory configured elsewhere through `core.hooksPath`.
83
+ */
84
+ function assertWritablePath(filePath, allowedDirectories, operation = "write") {
85
+ const resolvedPath = assertPathAllowed(filePath, allowedDirectories, operation);
86
+ const { matchedDirectory } = isPathAllowed(resolvedPath, allowedDirectories);
87
+ if ((matchedDirectory ? path.relative(matchedDirectory, resolvedPath) : resolvedPath).split(/[\\/]/).some(isGitDirectoryName)) throw new Error(`Access denied: Cannot ${operation} files inside a .git directory.`);
88
+ return resolvedPath;
89
+ }
66
90
  //#endregion
67
- export { isPathAllowed as n, assertPathAllowed as t };
91
+ export { isPathAllowed as a, isGitDirectoryName as i, assertWritablePath as n, createPathChecker as r, assertPathAllowed as t };