@fideliosai/adapter-ollama-local 0.0.41 → 0.0.42

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/index.d.ts +2 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +37 -28
  4. package/dist/index.js.map +1 -1
  5. package/dist/server/concurrency.d.ts +45 -0
  6. package/dist/server/concurrency.d.ts.map +1 -0
  7. package/dist/server/concurrency.js +124 -0
  8. package/dist/server/concurrency.js.map +1 -0
  9. package/dist/server/concurrency.test.d.ts +2 -0
  10. package/dist/server/concurrency.test.d.ts.map +1 -0
  11. package/dist/server/concurrency.test.js +130 -0
  12. package/dist/server/concurrency.test.js.map +1 -0
  13. package/dist/server/config.d.ts +7 -0
  14. package/dist/server/config.d.ts.map +1 -1
  15. package/dist/server/config.js +8 -0
  16. package/dist/server/config.js.map +1 -1
  17. package/dist/server/execute.d.ts.map +1 -1
  18. package/dist/server/execute.js +124 -62
  19. package/dist/server/execute.js.map +1 -1
  20. package/dist/server/index.d.ts +5 -2
  21. package/dist/server/index.d.ts.map +1 -1
  22. package/dist/server/index.js +3 -1
  23. package/dist/server/index.js.map +1 -1
  24. package/dist/server/test.d.ts.map +1 -1
  25. package/dist/server/test.js +10 -4
  26. package/dist/server/test.js.map +1 -1
  27. package/dist/server/test.test.js +1 -1
  28. package/dist/server/test.test.js.map +1 -1
  29. package/dist/server/tools.d.ts +43 -0
  30. package/dist/server/tools.d.ts.map +1 -0
  31. package/dist/server/tools.js +308 -0
  32. package/dist/server/tools.js.map +1 -0
  33. package/dist/server/tools.test.d.ts +2 -0
  34. package/dist/server/tools.test.d.ts.map +1 -0
  35. package/dist/server/tools.test.js +210 -0
  36. package/dist/server/tools.test.js.map +1 -0
  37. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
+ export { getQuotaWindows } from "./server/concurrency.js";
1
2
  export declare const type = "ollama_local";
2
3
  export declare const label = "Ollama (local)";
3
4
  export declare const models: Array<{
4
5
  id: string;
5
6
  label: string;
6
7
  }>;
7
- export declare const agentConfigurationDoc = "# ollama_local agent configuration\n\nAdapter: ollama_local\n\nUse when:\n- You want a raw chat/streaming adapter that talks directly to Ollama\n- You want to bypass the Hermes runtime for non-agentic workloads\n (research, classification, summarization, pre-processing)\n- You want to target either a local Ollama daemon (default\n http://localhost:11434) or Ollama Cloud (https://ollama.com) by setting\n OLLAMA_API_KEY\n- You want Ollama-native knobs: keep_alive, num_ctx, think\n\nDon't use when:\n- You need agentic tool execution (Phase 2 \u2014 see FID-16)\n- You need Hermes-style provider routing across multiple backends\n- You need MCP tool servers wired into the run\n\nPhase 1 scope (current):\n- Single-turn chat, streamed deltas piped to onLog(\"stdout\")\n- If the model emits tool_calls they are logged as a warning and the\n response is treated as final (no execution)\n- Sessions: chat history is round-tripped via sessionParams.messages\n so the next heartbeat can resume the conversation if desired\n- Health check probes /api/version + /api/tags + a one-shot \"say hello\"\n chat to mirror PR #44 hermes-local parity\n\nCore fields:\n- model (string, required): Ollama model id, e.g. \"llama3.1\" or\n \"kimi-k2.6:cloud\" \u2014 any id surfaced by /api/tags is valid\n- host (string, optional): Ollama host URL. Defaults to\n http://localhost:11434. Set to https://ollama.com for cloud.\n- promptTemplate (string, optional): user prompt template; supports\n {{agent.id}}, {{agent.name}}, {{run.id}}, {{context.*}}\n- bootstrapPromptTemplate (string, optional): one-time bootstrap prompt\n prepended on the first turn (no resumed session)\n\nTunables (all optional):\n- keepAlive (string | number, optional): Ollama keep_alive \u2014 how long the\n model stays loaded after the request. Examples: \"10m\", 600, \"5m\".\n- numCtx (number, optional): context window size (Ollama options.num_ctx).\n- think (boolean | \"low\" | \"medium\" | \"high\", optional): enable extended\n reasoning for models that support it; thinking trace is streamed to\n onLog(\"stderr\") prefixed with \"[thinking] \".\n- ollamaTier (string, optional): operator-supplied tag describing the\n Ollama Cloud tier (e.g. \"free\", \"pro\", \"team\"). NOTE: there is no\n public Ollama API to verify a tier \u2014 this field is documentation only\n and is surfaced verbatim by testEnvironment.\n\nOperational fields:\n- timeoutSec (number, optional): hard cap on the chat call in seconds.\n Defaults to 300. Implemented via the SDK's .abort() method.\n- env (object, optional): KEY=VALUE bag. OLLAMA_API_KEY here (or via\n the agent secret store) is forwarded as the cloud Bearer token.\n\nNotes:\n- This adapter is in-process. There is no spawned CLI \u2014 all I/O is\n HTTP to the configured host using the official \"ollama\" npm SDK.\n- Streaming deltas are written to onLog(\"stdout\") line by line so they\n are visible live in run logs.\n- Models list is dynamic: GET /api/tags is called against the configured\n host and merged with the cloud /api/tags when OLLAMA_API_KEY is set.\n Results are cached for 60 seconds per (host, hasKey) tuple.\n";
8
+ export declare const agentConfigurationDoc = "# ollama_local agent configuration\n\nAdapter: ollama_local\n\nUse when:\n- You want an in-process agent that talks directly to Ollama (local daemon\n or Ollama Cloud) with full tool-calling support\n- You want to bypass Hermes for autonomous coding tasks using cloud models\n like Kimi-K2.6:cloud, DeepSeek, or other Ollama-hosted models\n- You want Ollama-native knobs: keep_alive, num_ctx, think\n\nPhase 2 capabilities (current):\n- In-process agent harness: native tool-calling loop (read, write, bash,\n grep, edit) executed inside the FideliOS server process\n- Workspace cwd integration: tools run relative to the issue workspace\n- Concurrency cap: Free=1 / Pro=3 / Max=10 concurrent runs per cloud model\n- Multi-turn conversation history via sessionParams.messages\n\nDon't use when:\n- You need MCP tool servers or Hermes-style provider routing\n- You need tools beyond the built-in set (use pi-local or hermes-local)\n\nCore fields:\n- model (string, required): Ollama model id, e.g. \"llama3.1\" or\n \"kimi-k2.6:cloud\" \u2014 any id surfaced by /api/tags is valid\n- host (string, optional): Ollama host URL. Defaults to\n http://localhost:11434. Set to https://ollama.com for cloud.\n- promptTemplate (string, optional): user prompt template; supports\n {{agent.id}}, {{agent.name}}, {{run.id}}, {{context.*}}\n- bootstrapPromptTemplate (string, optional): one-time bootstrap prompt\n prepended on the first turn (no resumed session)\n\nPhase 2 fields (all optional):\n- tier (\"free\" | \"pro\" | \"max\", optional): Ollama Cloud concurrency tier.\n Determines the max concurrent runs for cloud models.\n Free=1, Pro=3, Max=10. Defaults to \"free\".\n- maxTurns (number, optional): Max agent tool-calling loop turns before\n halting. Defaults to 20.\n\nTunables (all optional):\n- keepAlive (string | number, optional): Ollama keep_alive \u2014 how long the\n model stays loaded after the request. Examples: \"10m\", 600, \"5m\".\n- numCtx (number, optional): context window size (Ollama options.num_ctx).\n- think (boolean | \"low\" | \"medium\" | \"high\", optional): enable extended\n reasoning for models that support it; thinking trace is streamed to\n onLog(\"stderr\") prefixed with \"[thinking] \".\n- ollamaTier (string, optional): legacy alias for tier (documentation-only\n label for health check display; tier field controls actual cap logic).\n\nOperational fields:\n- timeoutSec (number, optional): hard cap on the total chat call per turn\n in seconds. Defaults to 300. Implemented via the SDK's .abort() method.\n- env (object, optional): KEY=VALUE bag. OLLAMA_API_KEY here (or via\n the agent secret store) is forwarded as the cloud Bearer token.\n\nBuilt-in tools (OpenAI-compatible, executed in workspace cwd):\n- read(path): read a file\n- write(path, content): write a file\n- bash(command, timeout?): execute a shell command (max 120s)\n- grep(pattern, path?, flags?): search with ripgrep-style patterns\n- edit(path, old_string, new_string): exact-match string replacement\n\nNotes:\n- Fully in-process: no CLI spawned. All I/O is HTTP to the configured\n Ollama host using the official \"ollama\" npm SDK.\n- Streaming deltas are written to onLog(\"stdout\") line by line.\n- Tool execution is logged to onLog(\"stderr\") with name + truncated result.\n- Models list is dynamic: GET /api/tags is called against the configured\n host and merged with the cloud /api/tags when OLLAMA_API_KEY is set.\n Results are cached for 60 seconds per (host, hasKey) tuple.\n- Concurrency cap queues runs that exceed the tier limit; they do not fail.\n";
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,iBAAiB,CAAC;AACnC,eAAO,MAAM,KAAK,mBAAmB,CAAC;AAEtC,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAM,CAAC;AAE/D,eAAO,MAAM,qBAAqB,omGA+DjC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,eAAO,MAAM,IAAI,iBAAiB,CAAC;AACnC,eAAO,MAAM,KAAK,mBAAmB,CAAC;AAEtC,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAM,CAAC;AAE/D,eAAO,MAAM,qBAAqB,mhHAuEjC,CAAC"}
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export { getQuotaWindows } from "./server/concurrency.js";
1
2
  export const type = "ollama_local";
2
3
  export const label = "Ollama (local)";
3
4
  export const models = [];
@@ -6,27 +7,22 @@ export const agentConfigurationDoc = `# ollama_local agent configuration
6
7
  Adapter: ollama_local
7
8
 
8
9
  Use when:
9
- - You want a raw chat/streaming adapter that talks directly to Ollama
10
- - You want to bypass the Hermes runtime for non-agentic workloads
11
- (research, classification, summarization, pre-processing)
12
- - You want to target either a local Ollama daemon (default
13
- http://localhost:11434) or Ollama Cloud (https://ollama.com) by setting
14
- OLLAMA_API_KEY
10
+ - You want an in-process agent that talks directly to Ollama (local daemon
11
+ or Ollama Cloud) with full tool-calling support
12
+ - You want to bypass Hermes for autonomous coding tasks using cloud models
13
+ like Kimi-K2.6:cloud, DeepSeek, or other Ollama-hosted models
15
14
  - You want Ollama-native knobs: keep_alive, num_ctx, think
16
15
 
17
- Don't use when:
18
- - You need agentic tool execution (Phase 2 — see FID-16)
19
- - You need Hermes-style provider routing across multiple backends
20
- - You need MCP tool servers wired into the run
16
+ Phase 2 capabilities (current):
17
+ - In-process agent harness: native tool-calling loop (read, write, bash,
18
+ grep, edit) executed inside the FideliOS server process
19
+ - Workspace cwd integration: tools run relative to the issue workspace
20
+ - Concurrency cap: Free=1 / Pro=3 / Max=10 concurrent runs per cloud model
21
+ - Multi-turn conversation history via sessionParams.messages
21
22
 
22
- Phase 1 scope (current):
23
- - Single-turn chat, streamed deltas piped to onLog("stdout")
24
- - If the model emits tool_calls they are logged as a warning and the
25
- response is treated as final (no execution)
26
- - Sessions: chat history is round-tripped via sessionParams.messages
27
- so the next heartbeat can resume the conversation if desired
28
- - Health check probes /api/version + /api/tags + a one-shot "say hello"
29
- chat to mirror PR #44 hermes-local parity
23
+ Don't use when:
24
+ - You need MCP tool servers or Hermes-style provider routing
25
+ - You need tools beyond the built-in set (use pi-local or hermes-local)
30
26
 
31
27
  Core fields:
32
28
  - model (string, required): Ollama model id, e.g. "llama3.1" or
@@ -38,6 +34,13 @@ Core fields:
38
34
  - bootstrapPromptTemplate (string, optional): one-time bootstrap prompt
39
35
  prepended on the first turn (no resumed session)
40
36
 
37
+ Phase 2 fields (all optional):
38
+ - tier ("free" | "pro" | "max", optional): Ollama Cloud concurrency tier.
39
+ Determines the max concurrent runs for cloud models.
40
+ Free=1, Pro=3, Max=10. Defaults to "free".
41
+ - maxTurns (number, optional): Max agent tool-calling loop turns before
42
+ halting. Defaults to 20.
43
+
41
44
  Tunables (all optional):
42
45
  - keepAlive (string | number, optional): Ollama keep_alive — how long the
43
46
  model stays loaded after the request. Examples: "10m", 600, "5m".
@@ -45,24 +48,30 @@ Tunables (all optional):
45
48
  - think (boolean | "low" | "medium" | "high", optional): enable extended
46
49
  reasoning for models that support it; thinking trace is streamed to
47
50
  onLog("stderr") prefixed with "[thinking] ".
48
- - ollamaTier (string, optional): operator-supplied tag describing the
49
- Ollama Cloud tier (e.g. "free", "pro", "team"). NOTE: there is no
50
- public Ollama API to verify a tier — this field is documentation only
51
- and is surfaced verbatim by testEnvironment.
51
+ - ollamaTier (string, optional): legacy alias for tier (documentation-only
52
+ label for health check display; tier field controls actual cap logic).
52
53
 
53
54
  Operational fields:
54
- - timeoutSec (number, optional): hard cap on the chat call in seconds.
55
- Defaults to 300. Implemented via the SDK's .abort() method.
55
+ - timeoutSec (number, optional): hard cap on the total chat call per turn
56
+ in seconds. Defaults to 300. Implemented via the SDK's .abort() method.
56
57
  - env (object, optional): KEY=VALUE bag. OLLAMA_API_KEY here (or via
57
58
  the agent secret store) is forwarded as the cloud Bearer token.
58
59
 
60
+ Built-in tools (OpenAI-compatible, executed in workspace cwd):
61
+ - read(path): read a file
62
+ - write(path, content): write a file
63
+ - bash(command, timeout?): execute a shell command (max 120s)
64
+ - grep(pattern, path?, flags?): search with ripgrep-style patterns
65
+ - edit(path, old_string, new_string): exact-match string replacement
66
+
59
67
  Notes:
60
- - This adapter is in-process. There is no spawned CLI all I/O is
61
- HTTP to the configured host using the official "ollama" npm SDK.
62
- - Streaming deltas are written to onLog("stdout") line by line so they
63
- are visible live in run logs.
68
+ - Fully in-process: no CLI spawned. All I/O is HTTP to the configured
69
+ Ollama host using the official "ollama" npm SDK.
70
+ - Streaming deltas are written to onLog("stdout") line by line.
71
+ - Tool execution is logged to onLog("stderr") with name + truncated result.
64
72
  - Models list is dynamic: GET /api/tags is called against the configured
65
73
  host and merged with the cloud /api/tags when OLLAMA_API_KEY is set.
66
74
  Results are cached for 60 seconds per (host, hasKey) tuple.
75
+ - Concurrency cap queues runs that exceed the tier limit; they do not fail.
67
76
  `;
68
77
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,cAAc,CAAC;AACnC,MAAM,CAAC,MAAM,KAAK,GAAG,gBAAgB,CAAC;AAEtC,MAAM,CAAC,MAAM,MAAM,GAAyC,EAAE,CAAC;AAE/D,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+DpC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,CAAC,MAAM,IAAI,GAAG,cAAc,CAAC;AACnC,MAAM,CAAC,MAAM,KAAK,GAAG,gBAAgB,CAAC;AAEtC,MAAM,CAAC,MAAM,MAAM,GAAyC,EAAE,CAAC;AAE/D,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuEpC,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Concurrency cap singleton for ollama_local cloud model runs.
3
+ *
4
+ * Tier caps (Free=1 / PRO=3 / MAX=10) are enforced per (adapterType+model) key.
5
+ * Applies when the model ends with `:cloud` or the host points at Ollama Cloud.
6
+ * Local daemon runs are not subject to a cap.
7
+ */
8
+ import type { ProviderQuotaResult } from "@fideliosai/adapter-utils";
9
+ export type OllamaTierName = "free" | "pro" | "max";
10
+ export declare const TIER_CAPS: Record<OllamaTierName, number>;
11
+ export declare const DEFAULT_TIER: OllamaTierName;
12
+ /** Normalize a raw config value to a valid tier name, falling back to "free". */
13
+ export declare function parseTier(raw: unknown): OllamaTierName;
14
+ /** Returns the concurrency cap for the given tier. */
15
+ export declare function tierCap(tier: OllamaTierName): number;
16
+ /** @internal exposed for tests only */
17
+ export declare function _resetSlotsForTests(): void;
18
+ /**
19
+ * Acquire a concurrency slot for the given key+cap.
20
+ * If the cap is already reached, the returned Promise queues until a slot is freed.
21
+ * Returns a release function — call it when the run completes (use try/finally).
22
+ */
23
+ export declare function acquireConcurrencySlot(key: string, cap: number): Promise<() => void>;
24
+ /**
25
+ * Returns the current active count for a key (0 if not seen yet).
26
+ * For diagnostic use only.
27
+ */
28
+ export declare function getActiveCount(key: string): number;
29
+ /**
30
+ * Build a concurrency key for ollama cloud runs.
31
+ * Format: "ollama_cloud:<model>"
32
+ */
33
+ export declare function buildConcurrencyKey(model: string): string;
34
+ /**
35
+ * True when this run should be subject to the concurrency cap.
36
+ * Applies for cloud-hosted models (`:cloud` suffix or ollama.com host).
37
+ */
38
+ export declare function requiresConcurrencyCap(model: string, isCloud: boolean): boolean;
39
+ /**
40
+ * getQuotaWindows — reports the configured tier + cap as a quota window.
41
+ * There is no public Ollama API to poll live utilization, so we surface the
42
+ * cap and current in-process active count as a "configured" window.
43
+ */
44
+ export declare function getQuotaWindows(tier: OllamaTierName, model: string, isCloud: boolean): Promise<ProviderQuotaResult>;
45
+ //# sourceMappingURL=concurrency.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"concurrency.d.ts","sourceRoot":"","sources":["../../src/server/concurrency.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;AAEpD,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAIpD,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,cAAuB,CAAC;AAEnD,iFAAiF;AACjF,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,cAAc,CAMtD;AAED,sDAAsD;AACtD,wBAAgB,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAEpD;AAWD,uCAAuC;AACvC,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AAcD;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,CAc1F;AAaD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAE/E;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,mBAAmB,CAAC,CAuB9B"}
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Concurrency cap singleton for ollama_local cloud model runs.
3
+ *
4
+ * Tier caps (Free=1 / PRO=3 / MAX=10) are enforced per (adapterType+model) key.
5
+ * Applies when the model ends with `:cloud` or the host points at Ollama Cloud.
6
+ * Local daemon runs are not subject to a cap.
7
+ */
8
+ export const TIER_CAPS = {
9
+ free: 1,
10
+ pro: 3,
11
+ max: 10,
12
+ };
13
+ export const DEFAULT_TIER = "free";
14
+ /** Normalize a raw config value to a valid tier name, falling back to "free". */
15
+ export function parseTier(raw) {
16
+ if (typeof raw === "string") {
17
+ const lower = raw.trim().toLowerCase();
18
+ if (lower === "pro" || lower === "max" || lower === "free")
19
+ return lower;
20
+ }
21
+ return DEFAULT_TIER;
22
+ }
23
+ /** Returns the concurrency cap for the given tier. */
24
+ export function tierCap(tier) {
25
+ return TIER_CAPS[tier];
26
+ }
27
+ // Module-level singleton: Map<concurrencyKey, SlotQueue>
28
+ const slotsMap = new Map();
29
+ /** @internal exposed for tests only */
30
+ export function _resetSlotsForTests() {
31
+ slotsMap.clear();
32
+ }
33
+ function getOrCreateSlot(key, cap) {
34
+ let slot = slotsMap.get(key);
35
+ if (!slot) {
36
+ slot = { active: 0, cap, waiting: [] };
37
+ slotsMap.set(key, slot);
38
+ }
39
+ else {
40
+ // Update cap in case the operator changed the tier config.
41
+ slot.cap = cap;
42
+ }
43
+ return slot;
44
+ }
45
+ /**
46
+ * Acquire a concurrency slot for the given key+cap.
47
+ * If the cap is already reached, the returned Promise queues until a slot is freed.
48
+ * Returns a release function — call it when the run completes (use try/finally).
49
+ */
50
+ export async function acquireConcurrencySlot(key, cap) {
51
+ const slot = getOrCreateSlot(key, cap);
52
+ if (slot.active < slot.cap) {
53
+ slot.active++;
54
+ return makeRelease(slot);
55
+ }
56
+ // Queue: wait for a slot to become available.
57
+ await new Promise((resolve) => {
58
+ slot.waiting.push(resolve);
59
+ });
60
+ slot.active++;
61
+ return makeRelease(slot);
62
+ }
63
+ function makeRelease(slot) {
64
+ let released = false;
65
+ return () => {
66
+ if (released)
67
+ return;
68
+ released = true;
69
+ slot.active = Math.max(0, slot.active - 1);
70
+ const next = slot.waiting.shift();
71
+ if (next)
72
+ next();
73
+ };
74
+ }
75
+ /**
76
+ * Returns the current active count for a key (0 if not seen yet).
77
+ * For diagnostic use only.
78
+ */
79
+ export function getActiveCount(key) {
80
+ return slotsMap.get(key)?.active ?? 0;
81
+ }
82
+ /**
83
+ * Build a concurrency key for ollama cloud runs.
84
+ * Format: "ollama_cloud:<model>"
85
+ */
86
+ export function buildConcurrencyKey(model) {
87
+ return `ollama_cloud:${model}`;
88
+ }
89
+ /**
90
+ * True when this run should be subject to the concurrency cap.
91
+ * Applies for cloud-hosted models (`:cloud` suffix or ollama.com host).
92
+ */
93
+ export function requiresConcurrencyCap(model, isCloud) {
94
+ return isCloud || /:\s*cloud\s*$/i.test(model.trim());
95
+ }
96
+ /**
97
+ * getQuotaWindows — reports the configured tier + cap as a quota window.
98
+ * There is no public Ollama API to poll live utilization, so we surface the
99
+ * cap and current in-process active count as a "configured" window.
100
+ */
101
+ export async function getQuotaWindows(tier, model, isCloud) {
102
+ const cap = tierCap(tier);
103
+ const key = buildConcurrencyKey(model);
104
+ const active = getActiveCount(key);
105
+ const usedPercent = cap > 0 ? Math.min(100, Math.round((active / cap) * 100)) : null;
106
+ const subject = requiresConcurrencyCap(model, isCloud);
107
+ return {
108
+ provider: "ollama",
109
+ source: "ollama_local_concurrency",
110
+ ok: true,
111
+ windows: [
112
+ {
113
+ label: `Concurrency cap (${tier})`,
114
+ usedPercent: subject ? usedPercent : null,
115
+ resetsAt: null,
116
+ valueLabel: subject ? `${active}/${cap} active` : "N/A (local model)",
117
+ detail: subject
118
+ ? `Configured tier: ${tier}, cap: ${cap} concurrent run(s). Active: ${active}.`
119
+ : `Concurrency cap applies to cloud models only. Configured tier: ${tier} (cap: ${cap}).`,
120
+ },
121
+ ],
122
+ };
123
+ }
124
+ //# sourceMappingURL=concurrency.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"concurrency.js","sourceRoot":"","sources":["../../src/server/concurrency.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,MAAM,CAAC,MAAM,SAAS,GAAmC;IACvD,IAAI,EAAE,CAAC;IACP,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,EAAE;CACR,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAmB,MAAM,CAAC;AAEnD,iFAAiF;AACjF,MAAM,UAAU,SAAS,CAAC,GAAY;IACpC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACvC,IAAI,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,MAAM;YAAE,OAAO,KAAK,CAAC;IAC3E,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,OAAO,CAAC,IAAoB;IAC1C,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAQD,yDAAyD;AACzD,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAqB,CAAC;AAE9C,uCAAuC;AACvC,MAAM,UAAU,mBAAmB;IACjC,QAAQ,CAAC,KAAK,EAAE,CAAC;AACnB,CAAC;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AE,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI;gBACzC,QAAQ,EAAE,IAAI;gBACd,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,mBAAmB;gBACrE,MAAM,EAAE,OAAO;oBACb,CAAC,CAAC,oBAAoB,IAAI,UAAU,GAAG,+BAA+B,MAAM,GAAG;oBAC/E,CAAC,CAAC,kEAAkE,IAAI,UAAU,GAAG,IAAI;aAC5F;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=concurrency.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"concurrency.test.d.ts","sourceRoot":"","sources":["../../src/server/concurrency.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,130 @@
1
+ import { afterEach, describe, expect, it } from "vitest";
2
+ import { _resetSlotsForTests, acquireConcurrencySlot, buildConcurrencyKey, getActiveCount, getQuotaWindows, parseTier, requiresConcurrencyCap, TIER_CAPS, tierCap, } from "./concurrency.js";
3
+ afterEach(() => {
4
+ _resetSlotsForTests();
5
+ });
6
+ describe("parseTier", () => {
7
+ it("parses valid tier names case-insensitively", () => {
8
+ expect(parseTier("free")).toBe("free");
9
+ expect(parseTier("pro")).toBe("pro");
10
+ expect(parseTier("max")).toBe("max");
11
+ expect(parseTier("PRO")).toBe("pro");
12
+ expect(parseTier("MAX")).toBe("max");
13
+ });
14
+ it("falls back to free for unknown values", () => {
15
+ expect(parseTier("team")).toBe("free");
16
+ expect(parseTier("enterprise")).toBe("free");
17
+ expect(parseTier(null)).toBe("free");
18
+ expect(parseTier(undefined)).toBe("free");
19
+ expect(parseTier(42)).toBe("free");
20
+ expect(parseTier("")).toBe("free");
21
+ });
22
+ });
23
+ describe("tierCap", () => {
24
+ it("returns correct caps for each tier", () => {
25
+ expect(tierCap("free")).toBe(TIER_CAPS.free);
26
+ expect(tierCap("pro")).toBe(TIER_CAPS.pro);
27
+ expect(tierCap("max")).toBe(TIER_CAPS.max);
28
+ expect(TIER_CAPS.free).toBe(1);
29
+ expect(TIER_CAPS.pro).toBe(3);
30
+ expect(TIER_CAPS.max).toBe(10);
31
+ });
32
+ });
33
+ describe("requiresConcurrencyCap", () => {
34
+ it("applies when host is cloud", () => {
35
+ expect(requiresConcurrencyCap("llama3.1", true)).toBe(true);
36
+ });
37
+ it("applies when model has :cloud suffix", () => {
38
+ expect(requiresConcurrencyCap("kimi-k2.6:cloud", false)).toBe(true);
39
+ expect(requiresConcurrencyCap("model:CLOUD", false)).toBe(true);
40
+ expect(requiresConcurrencyCap("model:cloud", false)).toBe(true);
41
+ });
42
+ it("does not apply for local models on local host", () => {
43
+ expect(requiresConcurrencyCap("llama3.1", false)).toBe(false);
44
+ expect(requiresConcurrencyCap("codellama:13b", false)).toBe(false);
45
+ });
46
+ });
47
+ describe("buildConcurrencyKey", () => {
48
+ it("prefixes with ollama_cloud:", () => {
49
+ expect(buildConcurrencyKey("kimi-k2.6:cloud")).toBe("ollama_cloud:kimi-k2.6:cloud");
50
+ expect(buildConcurrencyKey("llama3.1")).toBe("ollama_cloud:llama3.1");
51
+ });
52
+ });
53
+ describe("acquireConcurrencySlot", () => {
54
+ it("immediately grants a slot when under cap", async () => {
55
+ const release = await acquireConcurrencySlot("test-key", 2);
56
+ expect(getActiveCount("test-key")).toBe(1);
57
+ release();
58
+ expect(getActiveCount("test-key")).toBe(0);
59
+ });
60
+ it("release is idempotent", async () => {
61
+ const release = await acquireConcurrencySlot("test-key", 2);
62
+ release();
63
+ release(); // second call is a no-op
64
+ expect(getActiveCount("test-key")).toBe(0);
65
+ });
66
+ it("queues when at cap and resolves when released", async () => {
67
+ const key = "cap-test";
68
+ const cap = 1;
69
+ const release1 = await acquireConcurrencySlot(key, cap);
70
+ expect(getActiveCount(key)).toBe(1);
71
+ // Second acquire should queue (cap=1, already 1 active).
72
+ let release2 = null;
73
+ const p2 = acquireConcurrencySlot(key, cap).then((r) => {
74
+ release2 = r;
75
+ });
76
+ // Still 1 active, p2 is pending.
77
+ expect(getActiveCount(key)).toBe(1);
78
+ // Releasing the first slot should unblock p2.
79
+ release1();
80
+ await p2;
81
+ expect(release2).not.toBeNull();
82
+ expect(getActiveCount(key)).toBe(1);
83
+ release2();
84
+ expect(getActiveCount(key)).toBe(0);
85
+ });
86
+ it("allows multiple simultaneous slots up to cap", async () => {
87
+ const key = "multi-cap";
88
+ const cap = 3;
89
+ const r1 = await acquireConcurrencySlot(key, cap);
90
+ const r2 = await acquireConcurrencySlot(key, cap);
91
+ const r3 = await acquireConcurrencySlot(key, cap);
92
+ expect(getActiveCount(key)).toBe(3);
93
+ r1();
94
+ expect(getActiveCount(key)).toBe(2);
95
+ r2();
96
+ r3();
97
+ expect(getActiveCount(key)).toBe(0);
98
+ });
99
+ });
100
+ describe("getQuotaWindows", () => {
101
+ it("returns ok result with configured tier + cap for cloud model", async () => {
102
+ const result = await getQuotaWindows("pro", "kimi-k2.6:cloud", false);
103
+ expect(result.ok).toBe(true);
104
+ expect(result.provider).toBe("ollama");
105
+ expect(result.windows).toHaveLength(1);
106
+ const w = result.windows[0];
107
+ expect(w.label).toContain("pro");
108
+ expect(w.valueLabel).toContain("0/3");
109
+ expect(w.usedPercent).toBe(0);
110
+ });
111
+ it("shows N/A for local models", async () => {
112
+ const result = await getQuotaWindows("free", "llama3.1", false);
113
+ expect(result.ok).toBe(true);
114
+ const w = result.windows[0];
115
+ expect(w.valueLabel).toContain("N/A");
116
+ expect(w.usedPercent).toBeNull();
117
+ });
118
+ it("reflects active count in usedPercent", async () => {
119
+ const key = buildConcurrencyKey("kimi-k2.6:cloud");
120
+ const release = await acquireConcurrencySlot(key, 3);
121
+ const result = await getQuotaWindows("pro", "kimi-k2.6:cloud", false);
122
+ const w = result.windows[0];
123
+ expect(w.usedPercent).toBe(33); // 1/3 = 33%
124
+ expect(w.valueLabel).toContain("1/3");
125
+ release();
126
+ const result2 = await getQuotaWindows("pro", "kimi-k2.6:cloud", false);
127
+ expect(result2.windows[0].usedPercent).toBe(0);
128
+ });
129
+ });
130
+ //# sourceMappingURL=concurrency.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"concurrency.test.js","sourceRoot":"","sources":["../../src/server/concurrency.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,SAAS,EACT,sBAAsB,EACtB,SAAS,EACT,OAAO,GACR,MAAM,kBAAkB,CAAC;AAE1B,SAAS,CAAC,GAAG,EAAE;IACb,mBAAmB,EAAE,CAAC;AACxB,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QACpD,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvC,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,C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AAE,CAAC;QAC7B,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY;QAC5C,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAEtC,OAAO,EAAE,CAAC;QAEV,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC,KAAK,EAAE,iBAAiB,EAAE,KAAK,CAAC,CAAC;QACvE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAE,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -3,10 +3,13 @@
3
3
  * untrusted Record<string, unknown>. Kept separate from execute.ts so the
4
4
  * tests can exercise them without spinning up a fake fetch().
5
5
  */
6
+ import { type OllamaTierName } from "./concurrency.js";
6
7
  export declare const DEFAULT_HOST = "http://localhost:11434";
7
8
  export declare const CLOUD_HOST = "https://ollama.com";
8
9
  export declare const DEFAULT_TIMEOUT_SEC = 300;
10
+ export declare const DEFAULT_MAX_TURNS = 20;
9
11
  export type ThinkOption = boolean | "low" | "medium" | "high";
12
+ export type { OllamaTierName };
10
13
  export interface OllamaConfig {
11
14
  host: string;
12
15
  model: string;
@@ -16,6 +19,10 @@ export interface OllamaConfig {
16
19
  think: ThinkOption | null;
17
20
  ollamaTier: string | null;
18
21
  timeoutSec: number;
22
+ /** Parsed concurrency tier (free/pro/max) — caps concurrent cloud runs. */
23
+ tier: OllamaTierName;
24
+ /** Max agent loop turns before halting. Default: 20. */
25
+ maxTurns: number;
19
26
  }
20
27
  /**
21
28
  * Parse and normalize the adapter config object. Throws if `model` is
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/server/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,YAAY,2BAA2B,CAAC;AACrD,eAA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,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAClC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,IAAI,EAAE,cAAc,CAAC;IACrB,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;CAClB;AAwDD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,OAAO,GAAG,YAAY,CA0ClE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAG5F;AAED,wEAAwE;AACxE,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjD"}
@@ -3,9 +3,11 @@
3
3
  * untrusted Record<string, unknown>. Kept separate from execute.ts so the
4
4
  * tests can exercise them without spinning up a fake fetch().
5
5
  */
6
+ import { parseTier } from "./concurrency.js";
6
7
  export const DEFAULT_HOST = "http://localhost:11434";
7
8
  export const CLOUD_HOST = "https://ollama.com";
8
9
  export const DEFAULT_TIMEOUT_SEC = 300;
10
+ export const DEFAULT_MAX_TURNS = 20;
9
11
  function asString(value, fallback = "") {
10
12
  return typeof value === "string" ? value : fallback;
11
13
  }
@@ -83,6 +85,10 @@ export function parseOllamaConfig(rawConfig) {
83
85
  const ollamaTier = asString(config.ollamaTier).trim() || null;
84
86
  const timeoutSecRaw = asNumberOrNull(config.timeoutSec);
85
87
  const timeoutSec = timeoutSecRaw !== null && timeoutSecRaw > 0 ? timeoutSecRaw : DEFAULT_TIMEOUT_SEC;
88
+ // Phase 2: concurrency tier + agent loop turn limit.
89
+ const tier = parseTier(config.tier ?? config.ollamaTier);
90
+ const maxTurnsRaw = asNumberOrNull(config.maxTurns);
91
+ const maxTurns = maxTurnsRaw !== null && maxTurnsRaw > 0 ? Math.floor(maxTurnsRaw) : DEFAULT_MAX_TURNS;
86
92
  return {
87
93
  host,
88
94
  model,
@@ -92,6 +98,8 @@ export function parseOllamaConfig(rawConfig) {
92
98
  think,
93
99
  ollamaTier,
94
100
  timeoutSec,
101
+ tier,
102
+ maxTurns,
95
103
  };
96
104
  }
97
105
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/server/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,wBAAwB,CAAC;AACrD,MAAM,CAAC,MAAM,UAAU,GAAG,oBAAoB,CAAC;AAC/C,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAevC,SAAS,QAAQ,CAAC,KAAc,EAAE,QAAQ,GAAG,EAAE;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AACtD,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACtE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;QAC9C,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QAC/B,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACvC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;I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AAG,SAAS,CAAC,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC;IACzD,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACpD,MAAM,QAAQ,GACZ,WAAW,KAAK,IAAI,IAAI,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC;IAExF,OAAO;QACL,IAAI;QACJ,KAAK;QACL,MAAM,EAAE,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI;QACnD,SAAS;QACT,MAAM;QACN,KAAK;QACL,UAAU;QACV,UAAU;QACV,IAAI;QACJ,QAAQ;KACT,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAqB;IACtD,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,OAAO,EAAE,aAAa,EAAE,UAAU,MAAM,EAAE,EAAE,CAAC;AAC/C,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,gCAAgC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;AAC5D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/server/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,2BAA2B,CAAC;AAqLnC,wBAAsB,OAAO,CAC3B,GAAG,EAAE,uBAAuB,GAC3B,OAAO,CAAC,sBAAsB,CAAC,CA8KjC"}
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/server/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,2BAA2B,CAAC;AAwMnC,wBAAsB,OAAO,CAC3B,GAAG,EAAE,uBAAuB,GAC3B,OAAO,CAAC,sBAAsB,CAAC,CAsPjC"}