@caupulican/pi-adaptative 0.93.1 → 0.93.2

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.
@@ -12,6 +12,7 @@ import * as bundledPiAgentCoreNode from "@caupulican/pi-agent-core/node";
12
12
  import * as bundledPiAgentCorePaths from "@caupulican/pi-agent-core/paths";
13
13
  import * as bundledPiAgentCoreProcessTree from "@caupulican/pi-agent-core/process-tree";
14
14
  import * as bundledPiAgentCoreProviderRequestEstimator from "@caupulican/pi-agent-core/provider-request-estimator";
15
+ import * as bundledPiAgentCoreProviderRequestImageBudget from "@caupulican/pi-agent-core/provider-request-image-budget";
15
16
  import * as bundledPiAgentCoreProviderRequestPlanner from "@caupulican/pi-agent-core/provider-request-planner";
16
17
  import * as bundledPiAgentCoreProviderToolProjection from "@caupulican/pi-agent-core/provider-tool-projection";
17
18
  import * as bundledPiAgentCoreReliability from "@caupulican/pi-agent-core/reliability";
@@ -66,6 +67,7 @@ const piAgentCoreVirtualSubpaths = {
66
67
  paths: bundledPiAgentCorePaths,
67
68
  "process-tree": bundledPiAgentCoreProcessTree,
68
69
  "provider-request-estimator": bundledPiAgentCoreProviderRequestEstimator,
70
+ "provider-request-image-budget": bundledPiAgentCoreProviderRequestImageBudget,
69
71
  "provider-request-planner": bundledPiAgentCoreProviderRequestPlanner,
70
72
  "provider-tool-projection": bundledPiAgentCoreProviderToolProjection,
71
73
  reliability: bundledPiAgentCoreReliability,
@@ -1 +1 @@
1
- {"version":3,"file":"bundled-virtual-modules.js","sourceRoot":"","sources":["../../../src/core/extensions/bundled-virtual-modules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,kBAAkB,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,uBAAuB,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,2BAA2B,MAAM,sCAAsC,CAAC;AACpF,OAAO,KAAK,4BAA4B,MAAM,sCAAsC,CAAC;AACrF,OAAO,KAAK,qCAAq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AAE,oBAAoB;CACrD,CAAC,CAAC","sourcesContent":["import * as bundledPiAgentCore from \"@caupulican/pi-agent-core\";\nimport * as bundledPiAgentCoreAgent from \"@caupulican/pi-agent-core/agent\";\nimport * as bundledPiAgentCoreAgentLoop from \"@caupulican/pi-agent-core/agent-loop\";\nimport * as bundledPiAgentCoreCompaction from \"@caupulican/pi-agent-core/compaction\";\nimport * as bundledPiAgentCoreBranchSummarization from \"@caupulican/pi-agent-core/compaction/branch-summarization\";\nimport * as bundledPiAgentCoreCompactionCore from \"@caupulican/pi-agent-core/compaction/compaction\";\nimport * as bundledPiAgentCoreCompactionLoop from \"@caupulican/pi-agent-core/compaction/loop\";\nimport * as bundledPiAgentCoreTokenBudget from \"@caupulican/pi-agent-core/compaction/token-budget\";\nimport * as bundledPiAgentCoreMessageRetention from \"@caupulican/pi-agent-core/message-retention\";\nimport * as bundledPiAgentCoreMessages from \"@caupulican/pi-agent-core/messages\";\nimport * as bundledPiAgentCoreNode from \"@caupulican/pi-agent-core/node\";\nimport * as bundledPiAgentCorePaths from \"@caupulican/pi-agent-core/paths\";\nimport * as bundledPiAgentCoreProcessTree from \"@caupulican/pi-agent-core/process-tree\";\nimport * as bundledPiAgentCoreProviderRequestEstimator from \"@caupulican/pi-agent-core/provider-request-estimator\";\nimport * as bundledPiAgentCoreProviderRequestPlanner from \"@caupulican/pi-agent-core/provider-request-planner\";\nimport * as bundledPiAgentCoreProviderToolProjection from \"@caupulican/pi-agent-core/provider-tool-projection\";\nimport * as bundledPiAgentCoreReliability from \"@caupulican/pi-agent-core/reliability\";\nimport * as bundledPiAgentCoreSession from \"@caupulican/pi-agent-core/session\";\nimport * as bundledPiAgentCoreShellOutput from \"@caupulican/pi-agent-core/shell-output\";\nimport * as bundledPiAgentCoreToolFailureMemory from \"@caupulican/pi-agent-core/tool-failure-memory\";\nimport * as bundledPiAgentCoreToolProtocolResidue from \"@caupulican/pi-agent-core/tool-protocol-residue\";\nimport * as bundledPiAgentCoreTruncate from \"@caupulican/pi-agent-core/truncate\";\nimport * as bundledPiAgentCoreTypes from \"@caupulican/pi-agent-core/types\";\nimport * as bundledPiAgentCoreUsage from \"@caupulican/pi-agent-core/usage\";\nimport * as bundledPiAi from \"@caupulican/pi-ai\";\nimport * as bundledPiAiAbortSignals from \"@caupulican/pi-ai/abort-signals\";\nimport * as bundledPiAiApiRegistry from \"@caupulican/pi-ai/api-registry\";\nimport * as bundledPiAiBedrockProvider from \"@caupulican/pi-ai/bedrock-provider\";\nimport * as bundledPiAiEnvApiKeys from \"@caupulican/pi-ai/env-api-keys\";\nimport * as bundledPiAiEventStream from \"@caupulican/pi-ai/event-stream\";\nimport * as bundledPiAiFaux from \"@caupulican/pi-ai/faux\";\nimport * as bundledPiAiJsonParse from \"@caupulican/pi-ai/json-parse\";\nimport * as bundledPiAiModels from \"@caupulican/pi-ai/models\";\nimport * as bundledPiAiOauth from \"@caupulican/pi-ai/oauth\";\nimport * as bundledPiAiOverflow from \"@caupulican/pi-ai/overflow\";\nimport * as bundledPiAiProviderRetry from \"@caupulican/pi-ai/provider-retry\";\nimport * as bundledPiAiRegisterBuiltins from \"@caupulican/pi-ai/register-builtins\";\nimport * as bundledPiAiSessionResources from \"@caupulican/pi-ai/session-resources\";\nimport * as bundledPiAiStream from \"@caupulican/pi-ai/stream\";\nimport * as bundledPiAiStreamingLines from \"@caupulican/pi-ai/streaming-lines\";\nimport * as bundledPiAiTextToolProtocol from \"@caupulican/pi-ai/text-tool-protocol\";\nimport * as bundledPiAiToolRepairRegistry from \"@caupulican/pi-ai/tool-repair-registry\";\nimport * as bundledPiAiTypeboxHelpers from \"@caupulican/pi-ai/typebox-helpers\";\nimport * as bundledPiAiTypes from \"@caupulican/pi-ai/types\";\nimport * as bundledPiAiUsage from \"@caupulican/pi-ai/usage\";\nimport * as bundledPiAiUuid from \"@caupulican/pi-ai/uuid\";\nimport * as bundledPiAiValidation from \"@caupulican/pi-ai/validation\";\nimport * as bundledPiAiValidationPath from \"@caupulican/pi-ai/validation-path\";\nimport * as bundledPiTui from \"@caupulican/pi-tui\";\nimport * as bundledTypebox from \"typebox\";\nimport * as bundledTypeboxCompile from \"typebox/compile\";\nimport * as bundledTypeboxValue from \"typebox/value\";\nimport * as bundledPiCodingAgent from \"../../index.ts\";\nimport {\n\ttype PiAgentCoreExtensionSubpath,\n\ttype PiAiExtensionSubpath,\n\tregisterBundledExtensionVirtualModules,\n} from \"./virtual-modules.ts\";\n\nconst piAgentCoreVirtualSubpaths: Record<PiAgentCoreExtensionSubpath, unknown> = {\n\tagent: bundledPiAgentCoreAgent,\n\t\"agent-loop\": bundledPiAgentCoreAgentLoop,\n\tcompaction: bundledPiAgentCoreCompaction,\n\t\"compaction/branch-summarization\": bundledPiAgentCoreBranchSummarization,\n\t\"compaction/compaction\": bundledPiAgentCoreCompactionCore,\n\t\"compaction/loop\": bundledPiAgentCoreCompactionLoop,\n\t\"compaction/token-budget\": bundledPiAgentCoreTokenBudget,\n\t\"message-retention\": bundledPiAgentCoreMessageRetention,\n\tmessages: bundledPiAgentCoreMessages,\n\tnode: bundledPiAgentCoreNode,\n\tpaths: bundledPiAgentCorePaths,\n\t\"process-tree\": bundledPiAgentCoreProcessTree,\n\t\"provider-request-estimator\": bundledPiAgentCoreProviderRequestEstimator,\n\t\"provider-request-planner\": bundledPiAgentCoreProviderRequestPlanner,\n\t\"provider-tool-projection\": bundledPiAgentCoreProviderToolProjection,\n\treliability: bundledPiAgentCoreReliability,\n\tsession: bundledPiAgentCoreSession,\n\t\"shell-output\": bundledPiAgentCoreShellOutput,\n\t\"tool-failure-memory\": bundledPiAgentCoreToolFailureMemory,\n\t\"tool-protocol-residue\": bundledPiAgentCoreToolProtocolResidue,\n\ttruncate: bundledPiAgentCoreTruncate,\n\ttypes: bundledPiAgentCoreTypes,\n\tusage: bundledPiAgentCoreUsage,\n};\n\nconst piAiVirtualSubpaths: Record<PiAiExtensionSubpath, unknown> = {\n\t\"api-registry\": bundledPiAiApiRegistry,\n\t\"abort-signals\": bundledPiAiAbortSignals,\n\t\"bedrock-provider\": bundledPiAiBedrockProvider,\n\t\"event-stream\": bundledPiAiEventStream,\n\t\"env-api-keys\": bundledPiAiEnvApiKeys,\n\tfaux: bundledPiAiFaux,\n\t\"json-parse\": bundledPiAiJsonParse,\n\tmodels: bundledPiAiModels,\n\toauth: bundledPiAiOauth,\n\toverflow: bundledPiAiOverflow,\n\t\"provider-retry\": bundledPiAiProviderRetry,\n\t\"register-builtins\": bundledPiAiRegisterBuiltins,\n\tstream: bundledPiAiStream,\n\t\"session-resources\": bundledPiAiSessionResources,\n\t\"streaming-lines\": bundledPiAiStreamingLines,\n\t\"text-tool-protocol\": bundledPiAiTextToolProtocol,\n\t\"tool-repair-registry\": bundledPiAiToolRepairRegistry,\n\t\"typebox-helpers\": bundledPiAiTypeboxHelpers,\n\ttypes: bundledPiAiTypes,\n\tusage: bundledPiAiUsage,\n\tuuid: bundledPiAiUuid,\n\tvalidation: bundledPiAiValidation,\n\t\"validation-path\": bundledPiAiValidationPath,\n};\n\nfunction piAiVirtualModules(packageName: string): Record<string, unknown> {\n\treturn Object.fromEntries([\n\t\t[packageName, bundledPiAi],\n\t\t...Object.entries(piAiVirtualSubpaths).map(([subpath, module]) => [`${packageName}/${subpath}`, module]),\n\t]);\n}\n\nfunction piAgentCoreVirtualModules(packageName: string): Record<string, unknown> {\n\treturn Object.fromEntries([\n\t\t[packageName, bundledPiAgentCore],\n\t\t...Object.entries(piAgentCoreVirtualSubpaths).map(([subpath, module]) => [`${packageName}/${subpath}`, module]),\n\t]);\n}\n\nregisterBundledExtensionVirtualModules({\n\ttypebox: bundledTypebox,\n\t\"typebox/compile\": bundledTypeboxCompile,\n\t\"typebox/value\": bundledTypeboxValue,\n\t\"@sinclair/typebox\": bundledTypebox,\n\t\"@sinclair/typebox/compile\": bundledTypeboxCompile,\n\t\"@sinclair/typebox/value\": bundledTypeboxValue,\n\t...piAgentCoreVirtualModules(\"@caupulican/pi-agent-core\"),\n\t\"@caupulican/pi-tui\": bundledPiTui,\n\t...piAiVirtualModules(\"@caupulican/pi-ai\"),\n\t\"@caupulican/pi-adaptative\": bundledPiCodingAgent,\n\t...piAgentCoreVirtualModules(\"@earendil-works/pi-agent-core\"),\n\t\"@earendil-works/pi-tui\": bundledPiTui,\n\t...piAiVirtualModules(\"@earendil-works/pi-ai\"),\n\t\"@earendil-works/pi-coding-agent\": bundledPiCodingAgent,\n\t...piAgentCoreVirtualModules(\"@mariozechner/pi-agent-core\"),\n\t\"@mariozechner/pi-tui\": bundledPiTui,\n\t...piAiVirtualModules(\"@mariozechner/pi-ai\"),\n\t\"@mariozechner/pi-coding-agent\": bundledPiCodingAgent,\n});\n"]}
1
+ {"version":3,"file":"bundled-virtual-modules.js","sourceRoot":"","sources":["../../../src/core/extensions/bundled-virtual-modules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,kBAAkB,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,uBAAuB,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,2BAA2B,MAAM,sCAAsC,CAAC;AACpF,OAAO,KAAK,4BAA4B,MAAM,sCAAsC,CAAC;AACrF,OAAO,KAAK,qCAAqC,MAAM,2DAA2D,CAAC;AACnH,OAAO,KAAK,gCAAgC,MAAM,iDAAiD,CAAC;AACpG,OAAO,KAAK,gCAAgC,MAAM,2CAA2C,CAAC;AAC9F,OAAO,KAAK,6BAA6B,MAAM,mDAAmD,CAAC;AACnG,OAAO,KAAK,kCAAkC,MAAM,6CAA6C,CAAC;AAClG,OAAO,KAAK,0BAA0B,MAAM,oCAAoC,CAAC;AACjF,OAAO,KAAK,sBAAsB,MAAM,gCAAgC,CAAC;AACzE,OAAO,KAAK,uBAAuB,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,6BAA6B,MAAM,wCAAwC,CAAC;AACxF,OAAO,KAAK,0CAA0C,MAAM,sDAAsD,CAAC;AACnH,OAAO,KAAK,4CAA4C,MAAM,yDAAyD,CAAC;AACxH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,CAAC;QACjC,GAAG,MAAM,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,WAAW,IAAI,OAAO,EAAE,EAAE,MAAM,CAAC,CAAC;KAC/G,CAAC,CAAC;AACJ,CAAC;AAED,sCAAsC,CAAC;IACtC,OAAO,EAAE,cAAc;IACvB,iBAAiB,EAAE,qBAAqB;IACxC,eAAe,EAAE,mBAAmB;IACpC,mBAAmB,EAAE,cAAc;IACnC,2BAA2B,EAAE,qBAAqB;IAClD,yBAAyB,EAAE,mBAAmB;IAC9C,GAAG,yBAAyB,CAAC,2BAA2B,CAAC;IACzD,oBAAoB,EAAE,YAAY;IAClC,GAAG,kBAAkB,CAAC,mBAAmB,CAAC;IAC1C,2BAA2B,EAAE,oBAAoB;IACjD,GAAG,yBAAyB,CAAC,+BAA+B,CAAC;IAC7D,wBAAwB,EAAE,YAAY;IACtC,GAAG,kBAAkB,CAAC,uBAAuB,CAAC;IAC9C,iCAAiC,EAAE,oBAAoB;IACvD,GAAG,yBAAyB,CAAC,6BAA6B,CAAC;IAC3D,sBAAsB,EAAE,YAAY;IACpC,GAAG,kBAAkB,CAAC,qBAAqB,CAAC;IAC5C,+BAA+B,EAAE,oBAAoB;CACrD,CAAC,CAAC","sourcesContent":["import * as bundledPiAgentCore from \"@caupulican/pi-agent-core\";\nimport * as bundledPiAgentCoreAgent from \"@caupulican/pi-agent-core/agent\";\nimport * as bundledPiAgentCoreAgentLoop from \"@caupulican/pi-agent-core/agent-loop\";\nimport * as bundledPiAgentCoreCompaction from \"@caupulican/pi-agent-core/compaction\";\nimport * as bundledPiAgentCoreBranchSummarization from \"@caupulican/pi-agent-core/compaction/branch-summarization\";\nimport * as bundledPiAgentCoreCompactionCore from \"@caupulican/pi-agent-core/compaction/compaction\";\nimport * as bundledPiAgentCoreCompactionLoop from \"@caupulican/pi-agent-core/compaction/loop\";\nimport * as bundledPiAgentCoreTokenBudget from \"@caupulican/pi-agent-core/compaction/token-budget\";\nimport * as bundledPiAgentCoreMessageRetention from \"@caupulican/pi-agent-core/message-retention\";\nimport * as bundledPiAgentCoreMessages from \"@caupulican/pi-agent-core/messages\";\nimport * as bundledPiAgentCoreNode from \"@caupulican/pi-agent-core/node\";\nimport * as bundledPiAgentCorePaths from \"@caupulican/pi-agent-core/paths\";\nimport * as bundledPiAgentCoreProcessTree from \"@caupulican/pi-agent-core/process-tree\";\nimport * as bundledPiAgentCoreProviderRequestEstimator from \"@caupulican/pi-agent-core/provider-request-estimator\";\nimport * as bundledPiAgentCoreProviderRequestImageBudget from \"@caupulican/pi-agent-core/provider-request-image-budget\";\nimport * as bundledPiAgentCoreProviderRequestPlanner from \"@caupulican/pi-agent-core/provider-request-planner\";\nimport * as bundledPiAgentCoreProviderToolProjection from \"@caupulican/pi-agent-core/provider-tool-projection\";\nimport * as bundledPiAgentCoreReliability from \"@caupulican/pi-agent-core/reliability\";\nimport * as bundledPiAgentCoreSession from \"@caupulican/pi-agent-core/session\";\nimport * as bundledPiAgentCoreShellOutput from \"@caupulican/pi-agent-core/shell-output\";\nimport * as bundledPiAgentCoreToolFailureMemory from \"@caupulican/pi-agent-core/tool-failure-memory\";\nimport * as bundledPiAgentCoreToolProtocolResidue from \"@caupulican/pi-agent-core/tool-protocol-residue\";\nimport * as bundledPiAgentCoreTruncate from \"@caupulican/pi-agent-core/truncate\";\nimport * as bundledPiAgentCoreTypes from \"@caupulican/pi-agent-core/types\";\nimport * as bundledPiAgentCoreUsage from \"@caupulican/pi-agent-core/usage\";\nimport * as bundledPiAi from \"@caupulican/pi-ai\";\nimport * as bundledPiAiAbortSignals from \"@caupulican/pi-ai/abort-signals\";\nimport * as bundledPiAiApiRegistry from \"@caupulican/pi-ai/api-registry\";\nimport * as bundledPiAiBedrockProvider from \"@caupulican/pi-ai/bedrock-provider\";\nimport * as bundledPiAiEnvApiKeys from \"@caupulican/pi-ai/env-api-keys\";\nimport * as bundledPiAiEventStream from \"@caupulican/pi-ai/event-stream\";\nimport * as bundledPiAiFaux from \"@caupulican/pi-ai/faux\";\nimport * as bundledPiAiJsonParse from \"@caupulican/pi-ai/json-parse\";\nimport * as bundledPiAiModels from \"@caupulican/pi-ai/models\";\nimport * as bundledPiAiOauth from \"@caupulican/pi-ai/oauth\";\nimport * as bundledPiAiOverflow from \"@caupulican/pi-ai/overflow\";\nimport * as bundledPiAiProviderRetry from \"@caupulican/pi-ai/provider-retry\";\nimport * as bundledPiAiRegisterBuiltins from \"@caupulican/pi-ai/register-builtins\";\nimport * as bundledPiAiSessionResources from \"@caupulican/pi-ai/session-resources\";\nimport * as bundledPiAiStream from \"@caupulican/pi-ai/stream\";\nimport * as bundledPiAiStreamingLines from \"@caupulican/pi-ai/streaming-lines\";\nimport * as bundledPiAiTextToolProtocol from \"@caupulican/pi-ai/text-tool-protocol\";\nimport * as bundledPiAiToolRepairRegistry from \"@caupulican/pi-ai/tool-repair-registry\";\nimport * as bundledPiAiTypeboxHelpers from \"@caupulican/pi-ai/typebox-helpers\";\nimport * as bundledPiAiTypes from \"@caupulican/pi-ai/types\";\nimport * as bundledPiAiUsage from \"@caupulican/pi-ai/usage\";\nimport * as bundledPiAiUuid from \"@caupulican/pi-ai/uuid\";\nimport * as bundledPiAiValidation from \"@caupulican/pi-ai/validation\";\nimport * as bundledPiAiValidationPath from \"@caupulican/pi-ai/validation-path\";\nimport * as bundledPiTui from \"@caupulican/pi-tui\";\nimport * as bundledTypebox from \"typebox\";\nimport * as bundledTypeboxCompile from \"typebox/compile\";\nimport * as bundledTypeboxValue from \"typebox/value\";\nimport * as bundledPiCodingAgent from \"../../index.ts\";\nimport {\n\ttype PiAgentCoreExtensionSubpath,\n\ttype PiAiExtensionSubpath,\n\tregisterBundledExtensionVirtualModules,\n} from \"./virtual-modules.ts\";\n\nconst piAgentCoreVirtualSubpaths: Record<PiAgentCoreExtensionSubpath, unknown> = {\n\tagent: bundledPiAgentCoreAgent,\n\t\"agent-loop\": bundledPiAgentCoreAgentLoop,\n\tcompaction: bundledPiAgentCoreCompaction,\n\t\"compaction/branch-summarization\": bundledPiAgentCoreBranchSummarization,\n\t\"compaction/compaction\": bundledPiAgentCoreCompactionCore,\n\t\"compaction/loop\": bundledPiAgentCoreCompactionLoop,\n\t\"compaction/token-budget\": bundledPiAgentCoreTokenBudget,\n\t\"message-retention\": bundledPiAgentCoreMessageRetention,\n\tmessages: bundledPiAgentCoreMessages,\n\tnode: bundledPiAgentCoreNode,\n\tpaths: bundledPiAgentCorePaths,\n\t\"process-tree\": bundledPiAgentCoreProcessTree,\n\t\"provider-request-estimator\": bundledPiAgentCoreProviderRequestEstimator,\n\t\"provider-request-image-budget\": bundledPiAgentCoreProviderRequestImageBudget,\n\t\"provider-request-planner\": bundledPiAgentCoreProviderRequestPlanner,\n\t\"provider-tool-projection\": bundledPiAgentCoreProviderToolProjection,\n\treliability: bundledPiAgentCoreReliability,\n\tsession: bundledPiAgentCoreSession,\n\t\"shell-output\": bundledPiAgentCoreShellOutput,\n\t\"tool-failure-memory\": bundledPiAgentCoreToolFailureMemory,\n\t\"tool-protocol-residue\": bundledPiAgentCoreToolProtocolResidue,\n\ttruncate: bundledPiAgentCoreTruncate,\n\ttypes: bundledPiAgentCoreTypes,\n\tusage: bundledPiAgentCoreUsage,\n};\n\nconst piAiVirtualSubpaths: Record<PiAiExtensionSubpath, unknown> = {\n\t\"api-registry\": bundledPiAiApiRegistry,\n\t\"abort-signals\": bundledPiAiAbortSignals,\n\t\"bedrock-provider\": bundledPiAiBedrockProvider,\n\t\"event-stream\": bundledPiAiEventStream,\n\t\"env-api-keys\": bundledPiAiEnvApiKeys,\n\tfaux: bundledPiAiFaux,\n\t\"json-parse\": bundledPiAiJsonParse,\n\tmodels: bundledPiAiModels,\n\toauth: bundledPiAiOauth,\n\toverflow: bundledPiAiOverflow,\n\t\"provider-retry\": bundledPiAiProviderRetry,\n\t\"register-builtins\": bundledPiAiRegisterBuiltins,\n\tstream: bundledPiAiStream,\n\t\"session-resources\": bundledPiAiSessionResources,\n\t\"streaming-lines\": bundledPiAiStreamingLines,\n\t\"text-tool-protocol\": bundledPiAiTextToolProtocol,\n\t\"tool-repair-registry\": bundledPiAiToolRepairRegistry,\n\t\"typebox-helpers\": bundledPiAiTypeboxHelpers,\n\ttypes: bundledPiAiTypes,\n\tusage: bundledPiAiUsage,\n\tuuid: bundledPiAiUuid,\n\tvalidation: bundledPiAiValidation,\n\t\"validation-path\": bundledPiAiValidationPath,\n};\n\nfunction piAiVirtualModules(packageName: string): Record<string, unknown> {\n\treturn Object.fromEntries([\n\t\t[packageName, bundledPiAi],\n\t\t...Object.entries(piAiVirtualSubpaths).map(([subpath, module]) => [`${packageName}/${subpath}`, module]),\n\t]);\n}\n\nfunction piAgentCoreVirtualModules(packageName: string): Record<string, unknown> {\n\treturn Object.fromEntries([\n\t\t[packageName, bundledPiAgentCore],\n\t\t...Object.entries(piAgentCoreVirtualSubpaths).map(([subpath, module]) => [`${packageName}/${subpath}`, module]),\n\t]);\n}\n\nregisterBundledExtensionVirtualModules({\n\ttypebox: bundledTypebox,\n\t\"typebox/compile\": bundledTypeboxCompile,\n\t\"typebox/value\": bundledTypeboxValue,\n\t\"@sinclair/typebox\": bundledTypebox,\n\t\"@sinclair/typebox/compile\": bundledTypeboxCompile,\n\t\"@sinclair/typebox/value\": bundledTypeboxValue,\n\t...piAgentCoreVirtualModules(\"@caupulican/pi-agent-core\"),\n\t\"@caupulican/pi-tui\": bundledPiTui,\n\t...piAiVirtualModules(\"@caupulican/pi-ai\"),\n\t\"@caupulican/pi-adaptative\": bundledPiCodingAgent,\n\t...piAgentCoreVirtualModules(\"@earendil-works/pi-agent-core\"),\n\t\"@earendil-works/pi-tui\": bundledPiTui,\n\t...piAiVirtualModules(\"@earendil-works/pi-ai\"),\n\t\"@earendil-works/pi-coding-agent\": bundledPiCodingAgent,\n\t...piAgentCoreVirtualModules(\"@mariozechner/pi-agent-core\"),\n\t\"@mariozechner/pi-tui\": bundledPiTui,\n\t...piAiVirtualModules(\"@mariozechner/pi-ai\"),\n\t\"@mariozechner/pi-coding-agent\": bundledPiCodingAgent,\n});\n"]}
@@ -12,6 +12,7 @@ export declare const PI_AGENT_CORE_EXTENSION_SUBPATHS: {
12
12
  readonly paths: "agent/src/utils/paths.ts";
13
13
  readonly "process-tree": "agent/src/reliability/process-tree.ts";
14
14
  readonly "provider-request-estimator": "agent/src/provider-request-estimator.ts";
15
+ readonly "provider-request-image-budget": "agent/src/provider-request-image-budget.ts";
15
16
  readonly "provider-request-planner": "agent/src/provider-request-planner.ts";
16
17
  readonly "provider-tool-projection": "agent/src/provider-tool-projection.ts";
17
18
  readonly reliability: "agent/src/reliability/index.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-modules.d.ts","sourceRoot":"","sources":["../../../src/core/extensions/virtual-modules.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gCAAgC;aAC5C,KAAK,EAAE,oBAAoB;aAC3B,YAAY,EAAE,yBAAyB;aACvC,UAAU,EAAE,+BAA+B;aAC3C,iCAAiC,EAAE,8CAA8C;aACjF,uBAAuB,EAAE,oCAAoC;aAC7D,iBAAiB,EAAE,8BAA8B;aACjD,yBAAyB,EAAE,sCAAsC;aACjE,mBAAmB,EAAE,wCAAwC;aAC7D,QAAQ,EAAE,uBAAuB;aACjC,IAAI,EAAE,mBAAmB;aACzB,KAAK,EAAE,0BAA0B;aACjC,cAAc,EAAE,uCAAuC;aACvD,4BAA4B,EAAE,yCAAyC;aACvE,0BAA0B,EAAE,uCAAuC;aACnE,0BAA0B,EAAE,uCAAuC;aACnE,WAAW,EAAE,gCAAgC;aAC7C,OAAO,EAAE,sCAAsC;aAC/C,cAAc,EAAE,iCAAiC;aACjD,qBAAqB,EAAE,kCAAkC;aACzD,uBAAuB,EAAE,oCAAoC;aAC7D,QAAQ,EAAE,6BAA6B;aACvC,KAAK,EAAE,oBAAoB;aAC3B,KAAK,EAAE,oBAAo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sBAAsB;aAC5B,UAAU,EAAE,4BAA4B;aACxC,iBAAiB,EAAE,iCAAiC;CAC3C,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAAG,MAAM,OAAO,wBAAwB,CAAC;AAIzE,wBAAgB,sCAAsC,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAG7F;AAED,wBAAgB,iCAAiC,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAKrF"}
@@ -12,6 +12,7 @@ export const PI_AGENT_CORE_EXTENSION_SUBPATHS = {
12
12
  paths: "agent/src/utils/paths.ts",
13
13
  "process-tree": "agent/src/reliability/process-tree.ts",
14
14
  "provider-request-estimator": "agent/src/provider-request-estimator.ts",
15
+ "provider-request-image-budget": "agent/src/provider-request-image-budget.ts",
15
16
  "provider-request-planner": "agent/src/provider-request-planner.ts",
16
17
  "provider-tool-projection": "agent/src/provider-tool-projection.ts",
17
18
  reliability: "agent/src/reliability/index.ts",
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-modules.js","sourceRoot":"","sources":["../../../src/core/extensions/virtual-modules.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC/C,KAAK,EAAE,oBAAoB;IAC3B,YAAY,EAAE,yBAAyB;IACvC,UAAU,EAAE,+BAA+B;IAC3C,iCAAiC,EAAE,8CAA8C;IACjF,uBAAuB,EAAE,oCAAoC;IAC7D,iBAAiB,EAAE,8BAA8B;IACjD,yBAAyB,EAAE,sCAAsC;IACjE,mBAAmB,EAAE,wCAAwC;IAC7D,QAAQ,EAAE,uBAAuB;IACjC,IAAI,EAAE,mBAAmB;IACzB,KAAK,EAAE,0BAA0B;IACjC,cAAc,EAAE,uCAAuC;IACvD,4BAA4B,EAAE,yCAAyC;IACvE,0BAA0B,EAAE,uCAAuC;IACnE,0BAA0B,EAAE,uCAAuC;IACnE,WAAW,EAAE,gCAAgC;IAC7C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C,CAAC;IAC/F,CAAC;IACD,OAAO,qBAAqB,CAAC;AAC9B,CAAC","sourcesContent":["export const PI_AGENT_CORE_EXTENSION_SUBPATHS = {\n\tagent: \"agent/src/agent.ts\",\n\t\"agent-loop\": \"agent/src/agent-loop.ts\",\n\tcompaction: \"agent/src/compaction/index.ts\",\n\t\"compaction/branch-summarization\": \"agent/src/compaction/branch-summarization.ts\",\n\t\"compaction/compaction\": \"agent/src/compaction/compaction.ts\",\n\t\"compaction/loop\": \"agent/src/compaction/loop.ts\",\n\t\"compaction/token-budget\": \"agent/src/compaction/token-budget.ts\",\n\t\"message-retention\": \"agent/src/session/message-retention.ts\",\n\tmessages: \"agent/src/messages.ts\",\n\tnode: \"agent/src/node.ts\",\n\tpaths: \"agent/src/utils/paths.ts\",\n\t\"process-tree\": \"agent/src/reliability/process-tree.ts\",\n\t\"provider-request-estimator\": \"agent/src/provider-request-estimator.ts\",\n\t\"provider-request-planner\": \"agent/src/provider-request-planner.ts\",\n\t\"provider-tool-projection\": \"agent/src/provider-tool-projection.ts\",\n\treliability: \"agent/src/reliability/index.ts\",\n\tsession: \"agent/src/session/session-manager.ts\",\n\t\"shell-output\": \"agent/src/utils/shell-output.ts\",\n\t\"tool-failure-memory\": \"agent/src/tool-failure-memory.ts\",\n\t\"tool-protocol-residue\": \"agent/src/tool-protocol-residue.ts\",\n\ttruncate: \"agent/src/utils/truncate.ts\",\n\ttypes: \"agent/src/types.ts\",\n\tusage: \"agent/src/usage.ts\",\n} as const;\n\nexport type PiAgentCoreExtensionSubpath = keyof typeof PI_AGENT_CORE_EXTENSION_SUBPATHS;\n\nexport const PI_AI_EXTENSION_SUBPATHS = {\n\t\"api-registry\": \"ai/src/api-registry.ts\",\n\t\"abort-signals\": \"ai/src/utils/abort-signals.ts\",\n\t\"bedrock-provider\": \"ai/src/bedrock-provider.ts\",\n\t\"event-stream\": \"ai/src/utils/event-stream.ts\",\n\t\"env-api-keys\": \"ai/src/env-api-keys.ts\",\n\tfaux: \"ai/src/providers/faux.ts\",\n\t\"json-parse\": \"ai/src/utils/json-parse.ts\",\n\tmodels: \"ai/src/models.ts\",\n\toauth: \"ai/src/oauth.ts\",\n\toverflow: \"ai/src/utils/overflow.ts\",\n\t\"provider-retry\": \"ai/src/utils/provider-retry.ts\",\n\t\"register-builtins\": \"ai/src/providers/register-builtins.ts\",\n\tstream: \"ai/src/stream.ts\",\n\t\"session-resources\": \"ai/src/session-resources.ts\",\n\t\"streaming-lines\": \"ai/src/utils/streaming-lines.ts\",\n\t\"text-tool-protocol\": \"ai/src/utils/tool-repair/text-protocol.ts\",\n\t\"tool-repair-registry\": \"ai/src/utils/tool-repair/registry.ts\",\n\t\"typebox-helpers\": \"ai/src/utils/typebox-helpers.ts\",\n\ttypes: \"ai/src/types.ts\",\n\tusage: \"ai/src/usage.ts\",\n\tuuid: \"ai/src/utils/uuid.ts\",\n\tvalidation: \"ai/src/utils/validation.ts\",\n\t\"validation-path\": \"ai/src/utils/validation-path.ts\",\n} as const;\n\nexport type PiAiExtensionSubpath = keyof typeof PI_AI_EXTENSION_SUBPATHS;\n\nlet bundledVirtualModules: Readonly<Record<string, unknown>> | undefined;\n\nexport function registerBundledExtensionVirtualModules(modules: Record<string, unknown>): void {\n\tif (bundledVirtualModules) throw new Error(\"Bundled extension virtual modules are already registered\");\n\tbundledVirtualModules = Object.freeze({ ...modules });\n}\n\nexport function getBundledExtensionVirtualModules(): Readonly<Record<string, unknown>> {\n\tif (!bundledVirtualModules) {\n\t\tthrow new Error(\"Bun extension virtual modules were not registered by the binary entrypoint\");\n\t}\n\treturn bundledVirtualModules;\n}\n"]}
1
+ {"version":3,"file":"virtual-modules.js","sourceRoot":"","sources":["../../../src/core/extensions/virtual-modules.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC/C,KAAK,EAAE,oBAAoB;IAC3B,YAAY,EAAE,yBAAyB;IACvC,UAAU,EAAE,+BAA+B;IAC3C,iCAAiC,EAAE,8CA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ACxC,iBAAiB,EAAE,iCAAiC;CAC3C,CAAC;AAIX,IAAI,qBAAoE,CAAC;AAEzE,MAAM,UAAU,sCAAsC,CAAC,OAAgC;IACtF,IAAI,qBAAqB;QAAE,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IACvG,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,iCAAiC;IAChD,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAC;IAC/F,CAAC;IACD,OAAO,qBAAqB,CAAC;AAC9B,CAAC","sourcesContent":["export const PI_AGENT_CORE_EXTENSION_SUBPATHS = {\n\tagent: \"agent/src/agent.ts\",\n\t\"agent-loop\": \"agent/src/agent-loop.ts\",\n\tcompaction: \"agent/src/compaction/index.ts\",\n\t\"compaction/branch-summarization\": \"agent/src/compaction/branch-summarization.ts\",\n\t\"compaction/compaction\": \"agent/src/compaction/compaction.ts\",\n\t\"compaction/loop\": \"agent/src/compaction/loop.ts\",\n\t\"compaction/token-budget\": \"agent/src/compaction/token-budget.ts\",\n\t\"message-retention\": \"agent/src/session/message-retention.ts\",\n\tmessages: \"agent/src/messages.ts\",\n\tnode: \"agent/src/node.ts\",\n\tpaths: \"agent/src/utils/paths.ts\",\n\t\"process-tree\": \"agent/src/reliability/process-tree.ts\",\n\t\"provider-request-estimator\": \"agent/src/provider-request-estimator.ts\",\n\t\"provider-request-image-budget\": \"agent/src/provider-request-image-budget.ts\",\n\t\"provider-request-planner\": \"agent/src/provider-request-planner.ts\",\n\t\"provider-tool-projection\": \"agent/src/provider-tool-projection.ts\",\n\treliability: \"agent/src/reliability/index.ts\",\n\tsession: \"agent/src/session/session-manager.ts\",\n\t\"shell-output\": \"agent/src/utils/shell-output.ts\",\n\t\"tool-failure-memory\": \"agent/src/tool-failure-memory.ts\",\n\t\"tool-protocol-residue\": \"agent/src/tool-protocol-residue.ts\",\n\ttruncate: \"agent/src/utils/truncate.ts\",\n\ttypes: \"agent/src/types.ts\",\n\tusage: \"agent/src/usage.ts\",\n} as const;\n\nexport type PiAgentCoreExtensionSubpath = keyof typeof PI_AGENT_CORE_EXTENSION_SUBPATHS;\n\nexport const PI_AI_EXTENSION_SUBPATHS = {\n\t\"api-registry\": \"ai/src/api-registry.ts\",\n\t\"abort-signals\": \"ai/src/utils/abort-signals.ts\",\n\t\"bedrock-provider\": \"ai/src/bedrock-provider.ts\",\n\t\"event-stream\": \"ai/src/utils/event-stream.ts\",\n\t\"env-api-keys\": \"ai/src/env-api-keys.ts\",\n\tfaux: \"ai/src/providers/faux.ts\",\n\t\"json-parse\": \"ai/src/utils/json-parse.ts\",\n\tmodels: \"ai/src/models.ts\",\n\toauth: \"ai/src/oauth.ts\",\n\toverflow: \"ai/src/utils/overflow.ts\",\n\t\"provider-retry\": \"ai/src/utils/provider-retry.ts\",\n\t\"register-builtins\": \"ai/src/providers/register-builtins.ts\",\n\tstream: \"ai/src/stream.ts\",\n\t\"session-resources\": \"ai/src/session-resources.ts\",\n\t\"streaming-lines\": \"ai/src/utils/streaming-lines.ts\",\n\t\"text-tool-protocol\": \"ai/src/utils/tool-repair/text-protocol.ts\",\n\t\"tool-repair-registry\": \"ai/src/utils/tool-repair/registry.ts\",\n\t\"typebox-helpers\": \"ai/src/utils/typebox-helpers.ts\",\n\ttypes: \"ai/src/types.ts\",\n\tusage: \"ai/src/usage.ts\",\n\tuuid: \"ai/src/utils/uuid.ts\",\n\tvalidation: \"ai/src/utils/validation.ts\",\n\t\"validation-path\": \"ai/src/utils/validation-path.ts\",\n} as const;\n\nexport type PiAiExtensionSubpath = keyof typeof PI_AI_EXTENSION_SUBPATHS;\n\nlet bundledVirtualModules: Readonly<Record<string, unknown>> | undefined;\n\nexport function registerBundledExtensionVirtualModules(modules: Record<string, unknown>): void {\n\tif (bundledVirtualModules) throw new Error(\"Bundled extension virtual modules are already registered\");\n\tbundledVirtualModules = Object.freeze({ ...modules });\n}\n\nexport function getBundledExtensionVirtualModules(): Readonly<Record<string, unknown>> {\n\tif (!bundledVirtualModules) {\n\t\tthrow new Error(\"Bun extension virtual modules were not registered by the binary entrypoint\");\n\t}\n\treturn bundledVirtualModules;\n}\n"]}
@@ -56,10 +56,10 @@ export class ProviderRequestRuntimeController {
56
56
  }
57
57
  };
58
58
  this.installedAdmission = async (request, signal) => {
59
- const requestTokens = estimateProviderRequestTokens(request.context);
59
+ const requestTokens = estimateProviderRequestTokens(request.context, request.model);
60
60
  const decision = await this.deps.compaction.admitProviderRequest({
61
61
  requestTokens,
62
- nonCompactableTokens: estimateProviderRequestTokens(request.nonCompactableContext),
62
+ nonCompactableTokens: estimateProviderRequestTokens(request.nonCompactableContext, request.model),
63
63
  attempt: request.attempt,
64
64
  });
65
65
  if (decision.action === "replan") {
@@ -1 +1 @@
1
- {"version":3,"file":"provider-request-runtime-controller.js","sourceRoot":"","sources":["../../src/core/provider-request-runtime-controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,sDAAsD,CAAC;AACrG,OAAO,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAkBxH,yFAAyF;AACzF,MAAM,OAAO,gCAAgC;IAW5C,YAAY,IAA0C;QACrD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;IAED,OAAO;QACN,IAAI,IAAI,CAAC,oBAAoB;YAAE,OAAO;QACtC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,wBAAwB,GAAG,KAAK,CAAC,gBAAgB,CAAC;QACvD,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC,WAAW,CAAC;QAC7C,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,oBAAoB,CAAC;QACpD,IAAI,CAAC,2BAA2B,GAAG,KAAK,CAAC,mBAAm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AC,IAAI,KAAK,CAAC;QAC/D,CAAC,CAAC;QAEF,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC,oBAAoB,CAAC;QAC9C,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC,yBAAyB,CAAC;QACxD,KAAK,CAAC,oBAAoB,GAAG,IAAI,CAAC,kBAAkB,CAAC;QACrD,KAAK,CAAC,mBAAmB,GAAG,IAAI,CAAC,4BAA4B,CAAC;IAC/D,CAAC;IAED,OAAO;QACN,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;QAC9B,IAAI,KAAK,CAAC,gBAAgB,KAAK,IAAI,CAAC,yBAAyB,EAAE,CAAC;YAC/D,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC,wBAAwB,CAAC;QACxD,CAAC;QACD,IAAI,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC,oBAAoB;YAAE,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC,mBAAmB,CAAC;QAClG,IAAI,KAAK,CAAC,oBAAoB,KAAK,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC5D,KAAK,CAAC,oBAAoB,GAAG,IAAI,CAAC,iBAAiB,CAAC;QACrD,CAAC;QACD,IAAI,KAAK,CAAC,mBAAmB,KAAK,IAAI,CAAC,4BAA4B,EAAE,CAAC;YACrE,KAAK,CAAC,mBAAmB,GAAG,IAAI,CAAC,2BAA2B,CAAC;QAC9D,CAAC;QACD,IAAI,CAAC,yBAAyB,GAAG,SAAS,CAAC;QAC3C,IAAI,CAAC,oBAAoB,GAAG,SAAS,CAAC;QACtC,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;QACpC,IAAI,CAAC,4BAA4B,GAAG,SAAS,CAAC;IAC/C,CAAC;CACD","sourcesContent":["import type { Agent } from \"@caupulican/pi-agent-core/agent\";\nimport { estimateProviderRequestTokens } from \"@caupulican/pi-agent-core/provider-request-estimator\";\nimport { composeRequestSystemPrompt, narrowRequestMaxTokens } from \"@caupulican/pi-agent-core/provider-request-planner\";\nimport type { CompactionController } from \"./compaction-controller.ts\";\nimport type { ProviderRequestContextController } from \"./provider-request-context-controller.ts\";\n\nexport interface ProviderRequestRuntimeControllerDeps {\n\tagent: Agent;\n\tcompaction: Pick<CompactionController, \"admitProviderRequest\">;\n\tcontext: ProviderRequestContextController;\n\tadmitGoalRequest(): number | undefined;\n\t/**\n\t * True once the goal owning the currently held execution lease crossed its token budget from\n\t * charging the response just received. Checked before EVERY provider request (including a\n\t * multi-step tool-loop follow-up); returning true ends the loop gracefully after the current\n\t * turn's in-flight work completes, instead of letting a doomed request reach admission and throw.\n\t */\n\tshouldStopGoalExecutionAfterTurn(): boolean;\n}\n\n/** Installs and owns the one provider planning/admission hook generation on an Agent. */\nexport class ProviderRequestRuntimeController {\n\tprivate readonly deps: ProviderRequestRuntimeControllerDeps;\n\tprivate previousTransformContext: Agent[\"transformContext\"];\n\tprivate previousPlanContext: Agent[\"planContext\"];\n\tprivate previousAdmission: Agent[\"admitProviderRequest\"];\n\tprivate previousShouldStopAfterTurn: Agent[\"shouldStopAfterTurn\"];\n\tprivate installedTransformContext: Agent[\"transformContext\"];\n\tprivate installedPlanContext: Agent[\"planContext\"];\n\tprivate installedAdmission: Agent[\"admitProviderRequest\"];\n\tprivate installedShouldStopAfterTurn: Agent[\"shouldStopAfterTurn\"];\n\n\tconstructor(deps: ProviderRequestRuntimeControllerDeps) {\n\t\tthis.deps = deps;\n\t}\n\n\tinstall(): void {\n\t\tif (this.installedPlanContext) return;\n\t\tconst agent = this.deps.agent;\n\t\tthis.previousTransformContext = agent.transformContext;\n\t\tthis.previousPlanContext = agent.planContext;\n\t\tthis.previousAdmission = agent.admitProviderRequest;\n\t\tthis.previousShouldStopAfterTurn = agent.shouldStopAfterTurn;\n\t\tconst previousTransformContext = this.previousTransformContext?.bind(agent);\n\t\tconst previousPlanContext = this.previousPlanContext?.bind(agent);\n\t\tconst previousAdmission = this.previousAdmission?.bind(agent);\n\t\tconst previousShouldStopAfterTurn = this.previousShouldStopAfterTurn?.bind(agent);\n\n\t\tthis.installedPlanContext = async ({ messages, attempt }, signal) => {\n\t\t\tconst basePlan = previousPlanContext\n\t\t\t\t? await previousPlanContext({ messages, attempt }, signal)\n\t\t\t\t: {\n\t\t\t\t\t\tmessages: previousTransformContext ? await previousTransformContext(messages, signal) : messages,\n\t\t\t\t\t};\n\t\t\tconst sessionPlan = await this.deps.context.plan(basePlan.messages, signal);\n\t\t\treturn {\n\t\t\t\tmessages: sessionPlan.messages,\n\t\t\t\ttransientMessages: [...(basePlan.transientMessages ?? []), ...(sessionPlan.transientMessages ?? [])],\n\t\t\t\ttransientSystemPrompt: composeRequestSystemPrompt(\n\t\t\t\t\tbasePlan.transientSystemPrompt,\n\t\t\t\t\tsessionPlan.transientSystemPrompt,\n\t\t\t\t),\n\t\t\t\tisCurrent: () => basePlan.isCurrent?.() !== false && sessionPlan.isCurrent?.() !== false,\n\t\t\t\tprepareCommit: () => {\n\t\t\t\t\tif (basePlan.isCurrent?.() === false || sessionPlan.isCurrent?.() === false) return false;\n\t\t\t\t\treturn basePlan.prepareCommit?.() !== false && sessionPlan.prepareCommit?.() !== false;\n\t\t\t\t},\n\t\t\t\tcommit: () => {\n\t\t\t\t\tbasePlan.commit?.();\n\t\t\t\t\tsessionPlan.commit?.();\n\t\t\t\t},\n\t\t\t\tdiscard: () => {\n\t\t\t\t\tsessionPlan.discard?.();\n\t\t\t\t\tbasePlan.discard?.();\n\t\t\t\t},\n\t\t\t};\n\t\t};\n\t\tthis.installedTransformContext = async (messages, signal) => {\n\t\t\tconst plan = await this.installedPlanContext?.({ messages, attempt: 0 }, signal);\n\t\t\tif (!plan) return messages;\n\t\t\ttry {\n\t\t\t\treturn [...plan.messages, ...(plan.transientMessages ?? [])];\n\t\t\t} finally {\n\t\t\t\tplan.discard?.();\n\t\t\t}\n\t\t};\n\t\tthis.installedAdmission = async (request, signal) => {\n\t\t\tconst requestTokens = estimateProviderRequestTokens(request.context);\n\t\t\tconst decision = await this.deps.compaction.admitProviderRequest({\n\t\t\t\trequestTokens,\n\t\t\t\tnonCompactableTokens: estimateProviderRequestTokens(request.nonCompactableContext),\n\t\t\t\tattempt: request.attempt,\n\t\t\t});\n\t\t\tif (decision.action === \"replan\") {\n\t\t\t\treturn {\n\t\t\t\t\taction: \"replan\",\n\t\t\t\t\tcontext: { ...request.sourceContext, messages: agent.state.messages.slice() },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst previous = (await previousAdmission?.(request, signal)) ?? { action: \"send\" as const };\n\t\t\tif (previous.action === \"replan\") return previous;\n\t\t\tconst goalMaxTokens = this.deps.admitGoalRequest();\n\t\t\t// Validated narrowing (shared with the planner's own final pass) instead of a hand-rolled\n\t\t\t// min-merge, so a degenerate goal-computed ceiling fails loudly here at admission instead of\n\t\t\t// silently passing through to fail deep inside the planner.\n\t\t\tconst maxTokens = narrowRequestMaxTokens(\n\t\t\t\tprevious.maxTokens,\n\t\t\t\tgoalMaxTokens,\n\t\t\t\trequest.model.maxTokens,\n\t\t\t\t\"goal execution budget\",\n\t\t\t);\n\t\t\treturn maxTokens === undefined ? previous : { action: \"send\", maxTokens };\n\t\t};\n\t\tthis.installedShouldStopAfterTurn = async (signal) => {\n\t\t\tif (this.deps.shouldStopGoalExecutionAfterTurn()) return true;\n\t\t\treturn (await previousShouldStopAfterTurn?.(signal)) ?? false;\n\t\t};\n\n\t\tagent.planContext = this.installedPlanContext;\n\t\tagent.transformContext = this.installedTransformContext;\n\t\tagent.admitProviderRequest = this.installedAdmission;\n\t\tagent.shouldStopAfterTurn = this.installedShouldStopAfterTurn;\n\t}\n\n\tdispose(): void {\n\t\tconst agent = this.deps.agent;\n\t\tif (agent.transformContext === this.installedTransformContext) {\n\t\t\tagent.transformContext = this.previousTransformContext;\n\t\t}\n\t\tif (agent.planContext === this.installedPlanContext) agent.planContext = this.previousPlanContext;\n\t\tif (agent.admitProviderRequest === this.installedAdmission) {\n\t\t\tagent.admitProviderRequest = this.previousAdmission;\n\t\t}\n\t\tif (agent.shouldStopAfterTurn === this.installedShouldStopAfterTurn) {\n\t\t\tagent.shouldStopAfterTurn = this.previousShouldStopAfterTurn;\n\t\t}\n\t\tthis.installedTransformContext = undefined;\n\t\tthis.installedPlanContext = undefined;\n\t\tthis.installedAdmission = undefined;\n\t\tthis.installedShouldStopAfterTurn = undefined;\n\t}\n}\n"]}
1
+ {"version":3,"file":"provider-request-runtime-controller.js","sourceRoot":"","sources":["../../src/core/provider-request-runtime-controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,sDAAsD,CAAC;AACrG,OAAO,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAkBxH,yFAAyF;AACzF,MAAM,OAAO,gCAAgC;IAW5C,YAAY,IAA0C;QACrD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;IAED,OAAO;QACN,IAAI,IAAI,CAAC,oBAAoB;YAAE,OAAO;QACtC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,wBAAwB,GAAG,KAAK,CAAC,gBAAgB,CAAC;QACvD,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC,WAAW,CAAC;QAC7C,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,oBAAoB,CAAC;QACpD,IAAI,CAAC,2BAA2B,GAAG,KAAK,CAAC,mBAAmB,CAAC;QAC7D,MAAM,wBAAwB,GAAG,IAAI,CAAC,wBAAwB,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5E,MAAM,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAClE,MAAM,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC9D,MAAM,2BAA2B,GAAG,IAAI,CAAC,2BAA2B,EAAE,IAAI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AAC;IAC/D,CAAC;IAED,OAAO;QACN,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;QAC9B,IAAI,KAAK,CAAC,gBAAgB,KAAK,IAAI,CAAC,yBAAyB,EAAE,CAAC;YAC/D,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC,wBAAwB,CAAC;QACxD,CAAC;QACD,IAAI,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC,oBAAoB;YAAE,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC,mBAAmB,CAAC;QAClG,IAAI,KAAK,CAAC,oBAAoB,KAAK,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC5D,KAAK,CAAC,oBAAoB,GAAG,IAAI,CAAC,iBAAiB,CAAC;QACrD,CAAC;QACD,IAAI,KAAK,CAAC,mBAAmB,KAAK,IAAI,CAAC,4BAA4B,EAAE,CAAC;YACrE,KAAK,CAAC,mBAAmB,GAAG,IAAI,CAAC,2BAA2B,CAAC;QAC9D,CAAC;QACD,IAAI,CAAC,yBAAyB,GAAG,SAAS,CAAC;QAC3C,IAAI,CAAC,oBAAoB,GAAG,SAAS,CAAC;QACtC,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;QACpC,IAAI,CAAC,4BAA4B,GAAG,SAAS,CAAC;IAC/C,CAAC;CACD","sourcesContent":["import type { Agent } from \"@caupulican/pi-agent-core/agent\";\nimport { estimateProviderRequestTokens } from \"@caupulican/pi-agent-core/provider-request-estimator\";\nimport { composeRequestSystemPrompt, narrowRequestMaxTokens } from \"@caupulican/pi-agent-core/provider-request-planner\";\nimport type { CompactionController } from \"./compaction-controller.ts\";\nimport type { ProviderRequestContextController } from \"./provider-request-context-controller.ts\";\n\nexport interface ProviderRequestRuntimeControllerDeps {\n\tagent: Agent;\n\tcompaction: Pick<CompactionController, \"admitProviderRequest\">;\n\tcontext: ProviderRequestContextController;\n\tadmitGoalRequest(): number | undefined;\n\t/**\n\t * True once the goal owning the currently held execution lease crossed its token budget from\n\t * charging the response just received. Checked before EVERY provider request (including a\n\t * multi-step tool-loop follow-up); returning true ends the loop gracefully after the current\n\t * turn's in-flight work completes, instead of letting a doomed request reach admission and throw.\n\t */\n\tshouldStopGoalExecutionAfterTurn(): boolean;\n}\n\n/** Installs and owns the one provider planning/admission hook generation on an Agent. */\nexport class ProviderRequestRuntimeController {\n\tprivate readonly deps: ProviderRequestRuntimeControllerDeps;\n\tprivate previousTransformContext: Agent[\"transformContext\"];\n\tprivate previousPlanContext: Agent[\"planContext\"];\n\tprivate previousAdmission: Agent[\"admitProviderRequest\"];\n\tprivate previousShouldStopAfterTurn: Agent[\"shouldStopAfterTurn\"];\n\tprivate installedTransformContext: Agent[\"transformContext\"];\n\tprivate installedPlanContext: Agent[\"planContext\"];\n\tprivate installedAdmission: Agent[\"admitProviderRequest\"];\n\tprivate installedShouldStopAfterTurn: Agent[\"shouldStopAfterTurn\"];\n\n\tconstructor(deps: ProviderRequestRuntimeControllerDeps) {\n\t\tthis.deps = deps;\n\t}\n\n\tinstall(): void {\n\t\tif (this.installedPlanContext) return;\n\t\tconst agent = this.deps.agent;\n\t\tthis.previousTransformContext = agent.transformContext;\n\t\tthis.previousPlanContext = agent.planContext;\n\t\tthis.previousAdmission = agent.admitProviderRequest;\n\t\tthis.previousShouldStopAfterTurn = agent.shouldStopAfterTurn;\n\t\tconst previousTransformContext = this.previousTransformContext?.bind(agent);\n\t\tconst previousPlanContext = this.previousPlanContext?.bind(agent);\n\t\tconst previousAdmission = this.previousAdmission?.bind(agent);\n\t\tconst previousShouldStopAfterTurn = this.previousShouldStopAfterTurn?.bind(agent);\n\n\t\tthis.installedPlanContext = async ({ messages, attempt }, signal) => {\n\t\t\tconst basePlan = previousPlanContext\n\t\t\t\t? await previousPlanContext({ messages, attempt }, signal)\n\t\t\t\t: {\n\t\t\t\t\t\tmessages: previousTransformContext ? await previousTransformContext(messages, signal) : messages,\n\t\t\t\t\t};\n\t\t\tconst sessionPlan = await this.deps.context.plan(basePlan.messages, signal);\n\t\t\treturn {\n\t\t\t\tmessages: sessionPlan.messages,\n\t\t\t\ttransientMessages: [...(basePlan.transientMessages ?? []), ...(sessionPlan.transientMessages ?? [])],\n\t\t\t\ttransientSystemPrompt: composeRequestSystemPrompt(\n\t\t\t\t\tbasePlan.transientSystemPrompt,\n\t\t\t\t\tsessionPlan.transientSystemPrompt,\n\t\t\t\t),\n\t\t\t\tisCurrent: () => basePlan.isCurrent?.() !== false && sessionPlan.isCurrent?.() !== false,\n\t\t\t\tprepareCommit: () => {\n\t\t\t\t\tif (basePlan.isCurrent?.() === false || sessionPlan.isCurrent?.() === false) return false;\n\t\t\t\t\treturn basePlan.prepareCommit?.() !== false && sessionPlan.prepareCommit?.() !== false;\n\t\t\t\t},\n\t\t\t\tcommit: () => {\n\t\t\t\t\tbasePlan.commit?.();\n\t\t\t\t\tsessionPlan.commit?.();\n\t\t\t\t},\n\t\t\t\tdiscard: () => {\n\t\t\t\t\tsessionPlan.discard?.();\n\t\t\t\t\tbasePlan.discard?.();\n\t\t\t\t},\n\t\t\t};\n\t\t};\n\t\tthis.installedTransformContext = async (messages, signal) => {\n\t\t\tconst plan = await this.installedPlanContext?.({ messages, attempt: 0 }, signal);\n\t\t\tif (!plan) return messages;\n\t\t\ttry {\n\t\t\t\treturn [...plan.messages, ...(plan.transientMessages ?? [])];\n\t\t\t} finally {\n\t\t\t\tplan.discard?.();\n\t\t\t}\n\t\t};\n\t\tthis.installedAdmission = async (request, signal) => {\n\t\t\tconst requestTokens = estimateProviderRequestTokens(request.context, request.model);\n\t\t\tconst decision = await this.deps.compaction.admitProviderRequest({\n\t\t\t\trequestTokens,\n\t\t\t\tnonCompactableTokens: estimateProviderRequestTokens(request.nonCompactableContext, request.model),\n\t\t\t\tattempt: request.attempt,\n\t\t\t});\n\t\t\tif (decision.action === \"replan\") {\n\t\t\t\treturn {\n\t\t\t\t\taction: \"replan\",\n\t\t\t\t\tcontext: { ...request.sourceContext, messages: agent.state.messages.slice() },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst previous = (await previousAdmission?.(request, signal)) ?? { action: \"send\" as const };\n\t\t\tif (previous.action === \"replan\") return previous;\n\t\t\tconst goalMaxTokens = this.deps.admitGoalRequest();\n\t\t\t// Validated narrowing (shared with the planner's own final pass) instead of a hand-rolled\n\t\t\t// min-merge, so a degenerate goal-computed ceiling fails loudly here at admission instead of\n\t\t\t// silently passing through to fail deep inside the planner.\n\t\t\tconst maxTokens = narrowRequestMaxTokens(\n\t\t\t\tprevious.maxTokens,\n\t\t\t\tgoalMaxTokens,\n\t\t\t\trequest.model.maxTokens,\n\t\t\t\t\"goal execution budget\",\n\t\t\t);\n\t\t\treturn maxTokens === undefined ? previous : { action: \"send\", maxTokens };\n\t\t};\n\t\tthis.installedShouldStopAfterTurn = async (signal) => {\n\t\t\tif (this.deps.shouldStopGoalExecutionAfterTurn()) return true;\n\t\t\treturn (await previousShouldStopAfterTurn?.(signal)) ?? false;\n\t\t};\n\n\t\tagent.planContext = this.installedPlanContext;\n\t\tagent.transformContext = this.installedTransformContext;\n\t\tagent.admitProviderRequest = this.installedAdmission;\n\t\tagent.shouldStopAfterTurn = this.installedShouldStopAfterTurn;\n\t}\n\n\tdispose(): void {\n\t\tconst agent = this.deps.agent;\n\t\tif (agent.transformContext === this.installedTransformContext) {\n\t\t\tagent.transformContext = this.previousTransformContext;\n\t\t}\n\t\tif (agent.planContext === this.installedPlanContext) agent.planContext = this.previousPlanContext;\n\t\tif (agent.admitProviderRequest === this.installedAdmission) {\n\t\t\tagent.admitProviderRequest = this.previousAdmission;\n\t\t}\n\t\tif (agent.shouldStopAfterTurn === this.installedShouldStopAfterTurn) {\n\t\t\tagent.shouldStopAfterTurn = this.previousShouldStopAfterTurn;\n\t\t}\n\t\tthis.installedTransformContext = undefined;\n\t\tthis.installedPlanContext = undefined;\n\t\tthis.installedAdmission = undefined;\n\t\tthis.installedShouldStopAfterTurn = undefined;\n\t}\n}\n"]}
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider",
3
- "version": "0.93.1",
3
+ "version": "0.93.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-custom-provider",
9
- "version": "0.93.1",
9
+ "version": "0.93.2",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "^0.52.0"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-anthropic",
3
3
  "private": true,
4
- "version": "0.93.1",
4
+ "version": "0.93.2",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-gitlab-duo",
3
3
  "private": true,
4
- "version": "0.93.1",
4
+ "version": "0.93.2",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-sandbox",
3
- "version": "0.93.1",
3
+ "version": "0.93.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-sandbox",
9
- "version": "0.93.1",
9
+ "version": "0.93.2",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sandbox-runtime": "^0.0.26"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-sandbox",
3
3
  "private": true,
4
- "version": "0.93.1",
4
+ "version": "0.93.2",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-with-deps",
3
- "version": "0.93.1",
3
+ "version": "0.93.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-with-deps",
9
- "version": "0.93.1",
9
+ "version": "0.93.2",
10
10
  "dependencies": {
11
11
  "ms": "^2.1.3"
12
12
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-with-deps",
3
3
  "private": true,
4
- "version": "0.93.1",
4
+ "version": "0.93.2",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@caupulican/pi-adaptative",
3
- "version": "0.93.1",
3
+ "version": "0.93.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@caupulican/pi-adaptative",
9
- "version": "0.93.1",
9
+ "version": "0.93.2",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
- "@caupulican/pi-agent-core": "^0.93.1",
13
- "@caupulican/pi-ai": "^0.93.1",
14
- "@caupulican/pi-tui": "^0.93.1",
12
+ "@caupulican/pi-agent-core": "^0.93.2",
13
+ "@caupulican/pi-ai": "^0.93.2",
14
+ "@caupulican/pi-tui": "^0.93.2",
15
15
  "@silvia-odwyer/photon-node": "0.3.4",
16
16
  "chalk": "5.6.2",
17
17
  "cross-spawn": "7.0.6",
@@ -506,11 +506,11 @@
506
506
  }
507
507
  },
508
508
  "node_modules/@caupulican/pi-agent-core": {
509
- "version": "0.93.1",
510
- "resolved": "https://registry.npmjs.org/@caupulican/pi-agent-core/-/pi-agent-core-0.93.1.tgz",
509
+ "version": "0.93.2",
510
+ "resolved": "https://registry.npmjs.org/@caupulican/pi-agent-core/-/pi-agent-core-0.93.2.tgz",
511
511
  "license": "MIT",
512
512
  "dependencies": {
513
- "@caupulican/pi-ai": "^0.93.1",
513
+ "@caupulican/pi-ai": "^0.93.2",
514
514
  "ignore": "7.0.5",
515
515
  "typebox": "1.1.38",
516
516
  "yaml": "2.9.0"
@@ -520,8 +520,8 @@
520
520
  }
521
521
  },
522
522
  "node_modules/@caupulican/pi-ai": {
523
- "version": "0.93.1",
524
- "resolved": "https://registry.npmjs.org/@caupulican/pi-ai/-/pi-ai-0.93.1.tgz",
523
+ "version": "0.93.2",
524
+ "resolved": "https://registry.npmjs.org/@caupulican/pi-ai/-/pi-ai-0.93.2.tgz",
525
525
  "license": "MIT",
526
526
  "dependencies": {
527
527
  "@anthropic-ai/sdk": "0.117.1",
@@ -546,8 +546,8 @@
546
546
  }
547
547
  },
548
548
  "node_modules/@caupulican/pi-tui": {
549
- "version": "0.93.1",
550
- "resolved": "https://registry.npmjs.org/@caupulican/pi-tui/-/pi-tui-0.93.1.tgz",
549
+ "version": "0.93.2",
550
+ "resolved": "https://registry.npmjs.org/@caupulican/pi-tui/-/pi-tui-0.93.2.tgz",
551
551
  "license": "MIT",
552
552
  "dependencies": {
553
553
  "get-east-asian-width": "1.6.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caupulican/pi-adaptative",
3
- "version": "0.93.1",
3
+ "version": "0.93.2",
4
4
  "description": "Adaptive fork of Pi coding agent for self-evolving agent harness experiments",
5
5
  "type": "module",
6
6
  "piConfig": {
@@ -89,9 +89,9 @@
89
89
  "postinstall": "node scripts/postinstall-python-runtime.mjs"
90
90
  },
91
91
  "dependencies": {
92
- "@caupulican/pi-agent-core": "^0.93.1",
93
- "@caupulican/pi-ai": "^0.93.1",
94
- "@caupulican/pi-tui": "^0.93.1",
92
+ "@caupulican/pi-agent-core": "^0.93.2",
93
+ "@caupulican/pi-ai": "^0.93.2",
94
+ "@caupulican/pi-tui": "^0.93.2",
95
95
  "@silvia-odwyer/photon-node": "0.3.4",
96
96
  "chalk": "5.6.2",
97
97
  "cross-spawn": "7.0.6",