@code-yeongyu/senpi 2026.10.19-2 → 2026.10.20-1

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 (119) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/bundle/chunks/{anthropic-messages-VVRTT7O5.js → anthropic-messages-3QYMAEH2.js} +1 -1
  3. package/dist/bundle/chunks/{args-35XTBPC7.js → args-NHDT5JG3.js} +1 -1
  4. package/dist/bundle/chunks/{azure-openai-responses-BUSMTCQ5.js → azure-openai-responses-2DCY6QKO.js} +1 -1
  5. package/dist/bundle/chunks/chunk-2JGY3V4H.js +395 -0
  6. package/dist/bundle/chunks/{chunk-2RLZXLXS.js → chunk-2LQZJFKQ.js} +1 -1
  7. package/dist/bundle/chunks/{chunk-2IK7QUJX.js → chunk-2SM4TR4H.js} +1 -1
  8. package/dist/bundle/chunks/{chunk-DXOSXUVI.js → chunk-3YKKXTJM.js} +1 -1
  9. package/dist/bundle/chunks/chunk-6L3H4UVN.js +2 -0
  10. package/dist/bundle/chunks/{chunk-46NW3UKO.js → chunk-7R4CJDWT.js} +1 -1
  11. package/dist/bundle/chunks/chunk-AA2L2RHH.js +2 -0
  12. package/dist/bundle/chunks/chunk-DKBJM22C.js +5 -0
  13. package/dist/bundle/chunks/{chunk-Z32CYNHC.js → chunk-F4YDU66P.js} +1 -1
  14. package/dist/bundle/chunks/chunk-FC2YWHEC.js +6 -0
  15. package/dist/bundle/chunks/{chunk-T2EE5G4S.js → chunk-FRFGJC3I.js} +1 -1
  16. package/dist/bundle/chunks/{chunk-57RKQONO.js → chunk-GBAS4FFM.js} +1 -1
  17. package/dist/bundle/chunks/{chunk-FDCYQYBP.js → chunk-JVLIKUBL.js} +1 -1
  18. package/dist/bundle/chunks/{chunk-EKDY4H2J.js → chunk-JXCHRJA7.js} +1 -1
  19. package/dist/bundle/chunks/{chunk-YID5W42N.js → chunk-KXTWMPCP.js} +1 -1
  20. package/dist/bundle/chunks/{chunk-ADNKYKU4.js → chunk-RYQ2FFF5.js} +1 -1
  21. package/dist/bundle/chunks/chunk-SOMFLLPD.js +3 -0
  22. package/dist/bundle/chunks/{chunk-4CJJ4SK6.js → chunk-SOWFP3I7.js} +1 -1
  23. package/dist/bundle/chunks/{chunk-GX7MTG25.js → chunk-TK6RKAB4.js} +4 -4
  24. package/dist/bundle/chunks/{chunk-NN44F5QF.js → chunk-V6RY5A6T.js} +1 -1
  25. package/dist/bundle/chunks/{chunk-77PVTNLJ.js → chunk-W557SQYL.js} +2 -2
  26. package/dist/bundle/chunks/{chunk-F4ZU4RBE.js → chunk-YIRQJCPA.js} +45 -46
  27. package/dist/bundle/chunks/cli-main-JCQTFUHO.js +3 -0
  28. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-4QEQ7MGK.js +1 -1
  29. package/dist/bundle/chunks/{dispatch-R37L3FW5.js → dispatch-YPCDRQYI.js} +1 -1
  30. package/dist/bundle/chunks/{google-generative-ai-4UOGH7RT.js → google-generative-ai-3SKUSCIL.js} +1 -1
  31. package/dist/bundle/chunks/{google-vertex-2A6KZ5TX.js → google-vertex-YHSIIE4G.js} +1 -1
  32. package/dist/bundle/chunks/{help-fast-path-Z5JGXNCS.js → help-fast-path-TUCMQOOF.js} +1 -1
  33. package/dist/bundle/chunks/{host-command-IP3QAZYI.js → host-command-WEOS6VD6.js} +1 -1
  34. package/dist/bundle/chunks/{host-lifecycle-FRQK5GAC.js → host-lifecycle-ZDCO62Z4.js} +1 -1
  35. package/dist/bundle/chunks/host-lifecycle.js +6 -6
  36. package/dist/bundle/chunks/host-session-command-IGTNZ4F6.js +20 -0
  37. package/dist/bundle/chunks/interactive-mode-5KYT7LMW.js +2 -0
  38. package/dist/bundle/chunks/{multi-session-host-EMI54PTJ.js → multi-session-host-25XQFXJC.js} +5 -5
  39. package/dist/bundle/chunks/openai-codex-responses-4BIPACKV.js +10 -0
  40. package/dist/bundle/chunks/{openai-completions-AGTH2RRA.js → openai-completions-NHDMDAS7.js} +1 -1
  41. package/dist/bundle/chunks/{openai-images-5UGZHY27.js → openai-images-PNXQDBSP.js} +1 -1
  42. package/dist/bundle/chunks/{openai-responses-KGXDGHPI.js → openai-responses-2UOPEJLP.js} +1 -1
  43. package/dist/bundle/chunks/{package-manager-cli-TK44VHGK.js → package-manager-cli-CF53LR5X.js} +1 -1
  44. package/dist/bundle/chunks/{role-F6IEUF2N.js → role-OK7RKBGF.js} +1 -1
  45. package/dist/bundle/chunks/{rotation-stream-XX2NXYL3.js → rotation-stream-QRRJ7G5Y.js} +1 -1
  46. package/dist/bundle/chunks/rpc-mode-LOODTK3J.js +2 -0
  47. package/dist/bundle/chunks/{schedule-command-DYHRFIX2.js → schedule-command-LKL6DLOT.js} +1 -1
  48. package/dist/bundle/chunks/session-control-endpoint-MLANJVB2.js +3 -0
  49. package/dist/bundle/chunks/session-picker-RQDVWJRL.js +2 -0
  50. package/dist/bundle/chunks/session-worker.js +240 -240
  51. package/dist/bundle/chunks/session-write-fence-66EMOO4Y.js +2 -0
  52. package/dist/bundle/chunks/typesafe-system-one-W2ZTYF7X.js +1 -1
  53. package/dist/bundle/cli.js +2 -2
  54. package/dist/bundle/host-supervisor.js +6 -6
  55. package/dist/bundle/index.js +1 -1
  56. package/dist/bundle/rpc-entry.js +1 -1
  57. package/dist/bundle/runtime-manifest.json +1 -1
  58. package/dist/core/agent-session.d.ts +0 -2
  59. package/dist/core/agent-session.js +4 -13
  60. package/dist/core/credential-pool/classify.d.ts +7 -0
  61. package/dist/core/credential-pool/classify.js +12 -4
  62. package/dist/core/credential-pool/failover.js +16 -1
  63. package/dist/core/credential-pool/rotation-stream.js +2 -0
  64. package/dist/core/extensions/builtin/anthropic-subscription/auth-lane.js +8 -62
  65. package/dist/core/extensions/builtin/anthropic-subscription/context-window.d.ts +25 -0
  66. package/dist/core/extensions/builtin/anthropic-subscription/context-window.js +38 -0
  67. package/dist/core/extensions/builtin/anthropic-subscription/index.d.ts +2 -2
  68. package/dist/core/extensions/builtin/anthropic-subscription/index.js +4 -6
  69. package/dist/core/extensions/builtin/anthropic-subscription/long-context-retry.d.ts +18 -0
  70. package/dist/core/extensions/builtin/anthropic-subscription/long-context-retry.js +74 -0
  71. package/dist/core/extensions/builtin/anthropic-subscription/long-context.js +13 -5
  72. package/dist/core/extensions/builtin/anthropic-subscription/options.d.ts +0 -10
  73. package/dist/core/extensions/builtin/anthropic-subscription/options.js +8 -16
  74. package/dist/core/extensions/builtin/anthropic-subscription/session-registry-wiring.js +1 -1
  75. package/dist/core/extensions/builtin/anthropic-subscription/session-sync.js +3 -0
  76. package/dist/core/extensions/builtin/terminal/lease-file.d.ts +1 -0
  77. package/dist/core/extensions/builtin/terminal/lease-file.js +5 -3
  78. package/dist/core/foreign-session-holders.d.ts +2 -3
  79. package/dist/core/provider-failure.d.ts +2 -0
  80. package/dist/core/provider-failure.js +3 -0
  81. package/dist/core/reserved-keywords.js +1 -1
  82. package/dist/core/session-hold-errors.d.ts +2 -0
  83. package/dist/core/session-holder-records.d.ts +21 -0
  84. package/dist/core/session-holder-records.js +76 -0
  85. package/dist/core/session-holders.d.ts +3 -3
  86. package/dist/core/session-holders.js +4 -41
  87. package/dist/core/session-manager.d.ts +1 -0
  88. package/dist/core/session-manager.js +8 -1
  89. package/dist/core/session-write-fence.d.ts +18 -0
  90. package/dist/core/session-write-fence.js +71 -0
  91. package/dist/core/user-text-blocks.d.ts +11 -0
  92. package/dist/core/user-text-blocks.js +19 -1
  93. package/dist/modes/rpc/host-daemon-registration.js +2 -1
  94. package/dist/modes/rpc/host-generations.d.ts +6 -0
  95. package/dist/modes/rpc/host-generations.js +35 -4
  96. package/dist/modes/rpc/host-lifecycle-scratch.d.ts +9 -2
  97. package/dist/modes/rpc/host-lifecycle-scratch.js +26 -6
  98. package/dist/modes/rpc/host-lifecycle.js +1 -1
  99. package/dist/modes/rpc/host-reservations.d.ts +5 -0
  100. package/dist/modes/rpc/host-reservations.js +54 -12
  101. package/dist/modes/rpc/host-stalled-evidence.d.ts +27 -1
  102. package/dist/modes/rpc/host-stalled-evidence.js +52 -4
  103. package/dist/modes/rpc/multi-session-host.js +10 -1
  104. package/dist/modes/rpc/session-command-router.js +2 -0
  105. package/dist/modes/rpc/session-held.js +2 -0
  106. package/package.json +6 -6
  107. package/dist/bundle/chunks/chunk-74V6LCWU.js +0 -2
  108. package/dist/bundle/chunks/chunk-DDQJSVIZ.js +0 -5
  109. package/dist/bundle/chunks/chunk-DY2EM44T.js +0 -395
  110. package/dist/bundle/chunks/chunk-HOXW5IHD.js +0 -6
  111. package/dist/bundle/chunks/chunk-UAQW2T7G.js +0 -2
  112. package/dist/bundle/chunks/cli-main-RXZVFXK7.js +0 -3
  113. package/dist/bundle/chunks/host-session-command-KGCQPMES.js +0 -20
  114. package/dist/bundle/chunks/interactive-mode-DQOPIZSI.js +0 -2
  115. package/dist/bundle/chunks/openai-codex-responses-I2NSK6AD.js +0 -10
  116. package/dist/bundle/chunks/rpc-mode-X6J3FC3N.js +0 -2
  117. package/dist/bundle/chunks/session-control-endpoint-XN4BAZTU.js +0 -3
  118. package/dist/bundle/chunks/session-picker-US5YPKC7.js +0 -2
  119. /package/dist/bundle/chunks/{chunk-KW6654UH.js → chunk-RPAHOJ6F.js} +0 -0
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
2
- import{AgentSession,AgentSessionRuntime,ArminComponent,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DefaultResourceLoader,EVAL_HANDLE_ERROR_CODES,EvalHandleError,ExtensionEditorComponent,ExtensionRunner,FooterComponent,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,buildNoticeBox,classifyRead,collectOrphanedChildren,connectWebViewService,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLsTool,createLsToolDefinition,createPowerShellTool,createReadOnlyTools,createReadTool,createReadToolDefinition,createWriteTool,createWriteToolDefinition,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,formatDimensionNote,formatSkillsForPrompt,generateDiffString,generateUnifiedPatch,kernelToolsStorage,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,noticeEntryRenderer,noticeMessageRenderer,parseFrontmatter,readStoredCredential,registerReadClassifier,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runPrintMode,runRpcMode,stripFrontmatter,wrapRegisteredTool,wrapRegisteredTools}from"./chunks/chunk-F4ZU4RBE.js";import"./chunks/chunk-HOXW5IHD.js";import"./chunks/chunk-25FRFTSP.js";import{DEFAULT_COMPACTION_SETTINGS,SESSION_CONTROL_DELIVERY_TYPE,calculateContextTokens,collectEntriesForBranchSummary,compact,defineTool,estimateTokens,findCutPoint,findTurnStartIndex,generateBranchSummary,generateSummary,generateSummaryWithUsage,getLastAssistantUsage,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isSessionControlDeliveryDetails,isToolCallEventType,isWriteToolResult,prepareBranchEntries,serializeConversation,sessionControlSenderOf,shouldCompact,withFileMutationQueue}from"./chunks/chunk-DY2EM44T.js";import{RpcClient,RpcClientOpenInFlightError,RpcTransportGoneError,UnknownCommandError,isTransportGoneError}from"./chunks/chunk-FDCYQYBP.js";import"./chunks/chunk-MF57DS3V.js";import"./chunks/chunk-KW6654UH.js";import"./chunks/chunk-SR7DBNWN.js";import"./chunks/chunk-2MOGCBPT.js";import{DefaultPackageManager,DynamicBorder,ExtensionInputComponent,ExtensionSelectorComponent,SessionSelectorComponent,SettingsManager,keyHint,keyText,parseSkillBlock,rawKeyHint}from"./chunks/chunk-2RLZXLXS.js";import"./chunks/chunk-EFJKVUID.js";import{Theme,findReservedKeywordRuns,findReservedKeywordSpans,getLanguageFromPath,getMarkdownTheme,getSelectListTheme,getSettingsListTheme,highlightCode,initTheme}from"./chunks/chunk-T2EE5G4S.js";import{CURRENT_SESSION_VERSION,SessionManager,VIRTUAL_MODEL_STATE_ENTRY,buildContextEntries,buildSessionContext,buildSessionProjection,convertToLlm,getLatestCompactionEntry,migrateSessionEntries,parseSessionEntries,sessionEntryToContextMessages}from"./chunks/chunk-GX7MTG25.js";import"./chunks/chunk-ZMS6YEAO.js";import{ProjectTrustStore,hasTrustRequiringProjectResources}from"./chunks/chunk-HMK6F3RG.js";import"./chunks/chunk-74V6LCWU.js";import"./chunks/chunk-QZBH7PDO.js";import{readOwnFootprint,readProcessFootprint}from"./chunks/chunk-MTQQ2VQH.js";import{DEFAULT_HOST_LAUNCH_SPEC,HOST_EXIT_ERROR,HOST_EXIT_FALLBACK,HOST_EXIT_OK,HOST_EXIT_REFUSED,HOST_EXIT_USAGE,HostLaunchSpecError,PINNED_HOST_CLIENT_CAPABILITIES,TUI_PROBE_TIMEOUT_MS,classifyEndpointLiveness,endpointProbeTimeoutMs,ensureHost,handoffHost,loadHostLaunchSpec,parseHostLaunchSpec,readAllHostStatus,readHostStatus,runHostCommand,runHostRequest}from"./chunks/chunk-Z32CYNHC.js";import{GENERATION_HANDOFF_CAPABILITY,HOST_PROTOCOL_VERSION,HostEnsureRefusedError,REQUIRED_HOST_CAPABILITIES,compareEngineOrdinal,decideHostAction,engineBuildIdentity,engineBuildIdentityFrom,gcHostEndpoints,parseHostProtocolInfo,probeHost,stopHost}from"./chunks/chunk-YID5W42N.js";import{listHostEndpoints}from"./chunks/chunk-6IWSMXBA.js";import{createSyntheticSourceInfo}from"./chunks/chunk-QMRJYMNH.js";import"./chunks/chunk-FM7NDZR5.js";import{parseArgs}from"./chunks/chunk-EPQK674G.js";import"./chunks/chunk-26UBFF6N.js";import"./chunks/chunk-IBDADH5Z.js";import"./chunks/chunk-3474DPZK.js";import"./chunks/chunk-77PVTNLJ.js";import"./chunks/chunk-DDQJSVIZ.js";import{ENDPOINT_REGISTRY_VERSION,createHostDaemonPaths,daemonDirectoryName,shardKey,shardSocketPath,shardSocketPathForKey}from"./chunks/chunk-KUZPBZUK.js";import"./chunks/chunk-IQWPR35S.js";import"./chunks/chunk-H4QOEVS5.js";import"./chunks/chunk-KLAX467B.js";import"./chunks/chunk-HB35RBP4.js";import"./chunks/chunk-QXJVKVA2.js";import"./chunks/chunk-7X72IACK.js";import"./chunks/chunk-GZVCRV7I.js";import"./chunks/chunk-KUPQO7MC.js";import"./chunks/chunk-U3VOXCGP.js";import"./chunks/chunk-QXREUA5F.js";import"./chunks/chunk-RUGYFYH7.js";import"./chunks/chunk-OEFCY46F.js";import"./chunks/chunk-KRNXUTZJ.js";import"./chunks/chunk-TAV6QZFM.js";import"./chunks/chunk-PELNNWGO.js";import{DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,formatSize,truncateHead,truncateLine,truncateTail,truncateToVisualLines}from"./chunks/chunk-4CJJ4SK6.js";import{sanitizeTerminalLabel,visibleWidth}from"./chunks/chunk-JKNUKBS3.js";import{getPowerShellConfig,getShellConfig,withBundledBunCommands}from"./chunks/chunk-EKDY4H2J.js";import"./chunks/chunk-YU4AYH4C.js";import"./chunks/chunk-2IK7QUJX.js";import"./chunks/chunk-COH5F7QV.js";import"./chunks/chunk-RFB5CBW7.js";import"./chunks/chunk-2VZJTDUX.js";import"./chunks/chunk-XSRM367N.js";import"./chunks/chunk-WASCMT6Y.js";import"./chunks/chunk-T36LJ6MW.js";import"./chunks/chunk-QGJLZ6BI.js";import"./chunks/chunk-UAQW2T7G.js";import"./chunks/chunk-WHPDEDCC.js";import"./chunks/chunk-HK46JMSC.js";import"./chunks/chunk-WQLMQGOW.js";import"./chunks/chunk-WDTJ6JKE.js";import"./chunks/chunk-5ROMKDLK.js";import"./chunks/chunk-3W47LTXQ.js";import"./chunks/chunk-45SZOLCU.js";import"./chunks/chunk-LAWS3FYQ.js";import"./chunks/chunk-DMI55M2N.js";import"./chunks/chunk-PJ34QVL5.js";import"./chunks/chunk-BMX2U22F.js";import"./chunks/chunk-YU2P3CAR.js";import"./chunks/chunk-ADNKYKU4.js";import"./chunks/chunk-ZOFZRJSL.js";import"./chunks/chunk-2SOVDETB.js";import"./chunks/chunk-RAIZG6HA.js";import"./chunks/chunk-HRPMLI7O.js";import"./chunks/chunk-QEQG42HL.js";import{CONFIG_DIR_NAME,VERSION,getAgentDir,getDocsPath,getExamplesPath,getPackageDir,getReadmePath}from"./chunks/chunk-4J4ABCCL.js";import"./chunks/chunk-ATQFN5HI.js";import"./chunks/chunk-MIENF2YK.js";import"./chunks/chunk-OXNWERO4.js";import"./chunks/chunk-QN2BHP3M.js";import"./chunks/chunk-WIAXG52U.js";import"./chunks/chunk-7ASLQ243.js";import"./chunks/chunk-IKOFCODM.js";export{AgentSession,AgentSessionRuntime,ArminComponent,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CONFIG_DIR_NAME,CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DEFAULT_HOST_LAUNCH_SPEC,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,DefaultPackageManager,DefaultResourceLoader,DynamicBorder,ENDPOINT_REGISTRY_VERSION,EVAL_HANDLE_ERROR_CODES,EvalHandleError,ExtensionEditorComponent,ExtensionInputComponent,ExtensionRunner,ExtensionSelectorComponent,FooterComponent,GENERATION_HANDOFF_CAPABILITY,HOST_EXIT_ERROR,HOST_EXIT_FALLBACK,HOST_EXIT_OK,HOST_EXIT_REFUSED,HOST_EXIT_USAGE,HOST_PROTOCOL_VERSION,HostEnsureRefusedError,HostLaunchSpecError,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,PINNED_HOST_CLIENT_CAPABILITIES,ProjectTrustStore,REQUIRED_HOST_CAPABILITIES,RpcClient,RpcClientOpenInFlightError,RpcTransportGoneError,SESSION_CONTROL_DELIVERY_TYPE,SessionManager,SessionSelectorComponent,SettingsManager,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,TUI_PROBE_TIMEOUT_MS,Theme,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UnknownCommandError,UserMessageComponent,UserMessageSelectorComponent,VERSION,VIRTUAL_MODEL_STATE_ENTRY,buildContextEntries,buildNoticeBox,buildSessionContext,buildSessionProjection,calculateContextTokens,classifyEndpointLiveness,classifyRead,collectEntriesForBranchSummary,collectOrphanedChildren,compact,compareEngineOrdinal,connectWebViewService,convertToLlm,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createHostDaemonPaths,createLocalBashOperations,createLsTool,createLsToolDefinition,createPowerShellTool,createReadOnlyTools,createReadTool,createReadToolDefinition,createSyntheticSourceInfo,createWriteTool,createWriteToolDefinition,daemonDirectoryName,decideHostAction,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,endpointProbeTimeoutMs,engineBuildIdentity,engineBuildIdentityFrom,ensureHost,estimateTokens,findCutPoint,findReservedKeywordRuns,findReservedKeywordSpans,findTurnStartIndex,formatDimensionNote,formatSize,formatSkillsForPrompt,gcHostEndpoints,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getAgentDir,getDocsPath,getExamplesPath,getLanguageFromPath,getLastAssistantUsage,getLatestCompactionEntry,getMarkdownTheme,getPackageDir,getPowerShellConfig,getReadmePath,getSelectListTheme,getSettingsListTheme,getShellConfig,handoffHost,hasTrustRequiringProjectResources,highlightCode,initTheme,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isSessionControlDeliveryDetails,isToolCallEventType,isTransportGoneError,isWriteToolResult,kernelToolsStorage,keyHint,keyText,listHostEndpoints,loadHostLaunchSpec,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,noticeEntryRenderer,noticeMessageRenderer,parseArgs,parseFrontmatter,parseHostLaunchSpec,parseHostProtocolInfo,parseSessionEntries,parseSkillBlock,prepareBranchEntries,probeHost,rawKeyHint,readAllHostStatus,readHostStatus,readOwnFootprint,readProcessFootprint,readStoredCredential,registerReadClassifier,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runHostCommand,runHostRequest,runPrintMode,runRpcMode,sanitizeTerminalLabel,serializeConversation,sessionControlSenderOf,sessionEntryToContextMessages,shardKey,shardSocketPath,shardSocketPathForKey,shouldCompact,stopHost,stripFrontmatter,truncateHead,truncateLine,truncateTail,truncateToVisualLines,visibleWidth,withBundledBunCommands,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools};
2
+ import{AgentSession,AgentSessionRuntime,ArminComponent,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DefaultResourceLoader,EVAL_HANDLE_ERROR_CODES,EvalHandleError,ExtensionEditorComponent,ExtensionRunner,FooterComponent,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,buildNoticeBox,classifyRead,collectOrphanedChildren,connectWebViewService,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLsTool,createLsToolDefinition,createPowerShellTool,createReadOnlyTools,createReadTool,createReadToolDefinition,createWriteTool,createWriteToolDefinition,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,formatDimensionNote,formatSkillsForPrompt,generateDiffString,generateUnifiedPatch,kernelToolsStorage,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,noticeEntryRenderer,noticeMessageRenderer,parseFrontmatter,readStoredCredential,registerReadClassifier,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runPrintMode,runRpcMode,stripFrontmatter,wrapRegisteredTool,wrapRegisteredTools}from"./chunks/chunk-YIRQJCPA.js";import{RpcClient,RpcClientOpenInFlightError,RpcTransportGoneError,UnknownCommandError,isTransportGoneError}from"./chunks/chunk-JVLIKUBL.js";import"./chunks/chunk-FC2YWHEC.js";import{DefaultPackageManager,DynamicBorder,ExtensionInputComponent,ExtensionSelectorComponent,SessionSelectorComponent,SettingsManager,keyHint,keyText,parseSkillBlock,rawKeyHint}from"./chunks/chunk-2LQZJFKQ.js";import"./chunks/chunk-25FRFTSP.js";import"./chunks/chunk-EFJKVUID.js";import{DEFAULT_COMPACTION_SETTINGS,SESSION_CONTROL_DELIVERY_TYPE,calculateContextTokens,collectEntriesForBranchSummary,compact,defineTool,estimateTokens,findCutPoint,findTurnStartIndex,generateBranchSummary,generateSummary,generateSummaryWithUsage,getLastAssistantUsage,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isSessionControlDeliveryDetails,isToolCallEventType,isWriteToolResult,prepareBranchEntries,serializeConversation,sessionControlSenderOf,shouldCompact,withFileMutationQueue}from"./chunks/chunk-2JGY3V4H.js";import"./chunks/chunk-MF57DS3V.js";import{Theme,findReservedKeywordRuns,findReservedKeywordSpans,getLanguageFromPath,getMarkdownTheme,getSelectListTheme,getSettingsListTheme,highlightCode,initTheme}from"./chunks/chunk-FRFGJC3I.js";import{CURRENT_SESSION_VERSION,SessionManager,VIRTUAL_MODEL_STATE_ENTRY,buildContextEntries,buildSessionContext,buildSessionProjection,convertToLlm,getLatestCompactionEntry,migrateSessionEntries,parseSessionEntries,sessionEntryToContextMessages}from"./chunks/chunk-TK6RKAB4.js";import"./chunks/chunk-ZMS6YEAO.js";import"./chunks/chunk-RPAHOJ6F.js";import"./chunks/chunk-SR7DBNWN.js";import"./chunks/chunk-2MOGCBPT.js";import{ProjectTrustStore,hasTrustRequiringProjectResources}from"./chunks/chunk-HMK6F3RG.js";import"./chunks/chunk-6L3H4UVN.js";import"./chunks/chunk-QZBH7PDO.js";import"./chunks/chunk-SOMFLLPD.js";import{readOwnFootprint,readProcessFootprint}from"./chunks/chunk-MTQQ2VQH.js";import{DEFAULT_HOST_LAUNCH_SPEC,HOST_EXIT_ERROR,HOST_EXIT_FALLBACK,HOST_EXIT_OK,HOST_EXIT_REFUSED,HOST_EXIT_USAGE,HostLaunchSpecError,PINNED_HOST_CLIENT_CAPABILITIES,TUI_PROBE_TIMEOUT_MS,classifyEndpointLiveness,endpointProbeTimeoutMs,ensureHost,handoffHost,loadHostLaunchSpec,parseHostLaunchSpec,readAllHostStatus,readHostStatus,runHostCommand,runHostRequest}from"./chunks/chunk-F4YDU66P.js";import{GENERATION_HANDOFF_CAPABILITY,HOST_PROTOCOL_VERSION,HostEnsureRefusedError,REQUIRED_HOST_CAPABILITIES,compareEngineOrdinal,decideHostAction,engineBuildIdentity,engineBuildIdentityFrom,gcHostEndpoints,parseHostProtocolInfo,probeHost,stopHost}from"./chunks/chunk-KXTWMPCP.js";import{createSyntheticSourceInfo}from"./chunks/chunk-QMRJYMNH.js";import{listHostEndpoints}from"./chunks/chunk-6IWSMXBA.js";import"./chunks/chunk-FM7NDZR5.js";import{parseArgs}from"./chunks/chunk-EPQK674G.js";import"./chunks/chunk-26UBFF6N.js";import"./chunks/chunk-IBDADH5Z.js";import"./chunks/chunk-3474DPZK.js";import"./chunks/chunk-W557SQYL.js";import"./chunks/chunk-DKBJM22C.js";import{ENDPOINT_REGISTRY_VERSION,createHostDaemonPaths,daemonDirectoryName,shardKey,shardSocketPath,shardSocketPathForKey}from"./chunks/chunk-KUZPBZUK.js";import"./chunks/chunk-IQWPR35S.js";import"./chunks/chunk-H4QOEVS5.js";import"./chunks/chunk-KLAX467B.js";import"./chunks/chunk-HB35RBP4.js";import"./chunks/chunk-QXJVKVA2.js";import"./chunks/chunk-7X72IACK.js";import"./chunks/chunk-GZVCRV7I.js";import"./chunks/chunk-KUPQO7MC.js";import"./chunks/chunk-U3VOXCGP.js";import"./chunks/chunk-QXREUA5F.js";import"./chunks/chunk-RUGYFYH7.js";import"./chunks/chunk-OEFCY46F.js";import"./chunks/chunk-KRNXUTZJ.js";import"./chunks/chunk-TAV6QZFM.js";import"./chunks/chunk-PELNNWGO.js";import{DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,formatSize,truncateHead,truncateLine,truncateTail,truncateToVisualLines}from"./chunks/chunk-SOWFP3I7.js";import{sanitizeTerminalLabel,visibleWidth}from"./chunks/chunk-JKNUKBS3.js";import{getPowerShellConfig,getShellConfig,withBundledBunCommands}from"./chunks/chunk-JXCHRJA7.js";import"./chunks/chunk-YU4AYH4C.js";import"./chunks/chunk-2SM4TR4H.js";import"./chunks/chunk-COH5F7QV.js";import"./chunks/chunk-RFB5CBW7.js";import"./chunks/chunk-2VZJTDUX.js";import"./chunks/chunk-XSRM367N.js";import"./chunks/chunk-WASCMT6Y.js";import"./chunks/chunk-T36LJ6MW.js";import"./chunks/chunk-QGJLZ6BI.js";import"./chunks/chunk-WHPDEDCC.js";import"./chunks/chunk-AA2L2RHH.js";import"./chunks/chunk-HK46JMSC.js";import"./chunks/chunk-WQLMQGOW.js";import"./chunks/chunk-WDTJ6JKE.js";import"./chunks/chunk-5ROMKDLK.js";import"./chunks/chunk-3W47LTXQ.js";import"./chunks/chunk-LAWS3FYQ.js";import"./chunks/chunk-45SZOLCU.js";import"./chunks/chunk-DMI55M2N.js";import"./chunks/chunk-PJ34QVL5.js";import"./chunks/chunk-BMX2U22F.js";import"./chunks/chunk-YU2P3CAR.js";import"./chunks/chunk-RYQ2FFF5.js";import"./chunks/chunk-ZOFZRJSL.js";import"./chunks/chunk-2SOVDETB.js";import"./chunks/chunk-RAIZG6HA.js";import"./chunks/chunk-HRPMLI7O.js";import"./chunks/chunk-QEQG42HL.js";import{CONFIG_DIR_NAME,VERSION,getAgentDir,getDocsPath,getExamplesPath,getPackageDir,getReadmePath}from"./chunks/chunk-4J4ABCCL.js";import"./chunks/chunk-ATQFN5HI.js";import"./chunks/chunk-MIENF2YK.js";import"./chunks/chunk-OXNWERO4.js";import"./chunks/chunk-QN2BHP3M.js";import"./chunks/chunk-WIAXG52U.js";import"./chunks/chunk-7ASLQ243.js";import"./chunks/chunk-IKOFCODM.js";export{AgentSession,AgentSessionRuntime,ArminComponent,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CONFIG_DIR_NAME,CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DEFAULT_HOST_LAUNCH_SPEC,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,DefaultPackageManager,DefaultResourceLoader,DynamicBorder,ENDPOINT_REGISTRY_VERSION,EVAL_HANDLE_ERROR_CODES,EvalHandleError,ExtensionEditorComponent,ExtensionInputComponent,ExtensionRunner,ExtensionSelectorComponent,FooterComponent,GENERATION_HANDOFF_CAPABILITY,HOST_EXIT_ERROR,HOST_EXIT_FALLBACK,HOST_EXIT_OK,HOST_EXIT_REFUSED,HOST_EXIT_USAGE,HOST_PROTOCOL_VERSION,HostEnsureRefusedError,HostLaunchSpecError,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,PINNED_HOST_CLIENT_CAPABILITIES,ProjectTrustStore,REQUIRED_HOST_CAPABILITIES,RpcClient,RpcClientOpenInFlightError,RpcTransportGoneError,SESSION_CONTROL_DELIVERY_TYPE,SessionManager,SessionSelectorComponent,SettingsManager,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,TUI_PROBE_TIMEOUT_MS,Theme,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UnknownCommandError,UserMessageComponent,UserMessageSelectorComponent,VERSION,VIRTUAL_MODEL_STATE_ENTRY,buildContextEntries,buildNoticeBox,buildSessionContext,buildSessionProjection,calculateContextTokens,classifyEndpointLiveness,classifyRead,collectEntriesForBranchSummary,collectOrphanedChildren,compact,compareEngineOrdinal,connectWebViewService,convertToLlm,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createHostDaemonPaths,createLocalBashOperations,createLsTool,createLsToolDefinition,createPowerShellTool,createReadOnlyTools,createReadTool,createReadToolDefinition,createSyntheticSourceInfo,createWriteTool,createWriteToolDefinition,daemonDirectoryName,decideHostAction,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,endpointProbeTimeoutMs,engineBuildIdentity,engineBuildIdentityFrom,ensureHost,estimateTokens,findCutPoint,findReservedKeywordRuns,findReservedKeywordSpans,findTurnStartIndex,formatDimensionNote,formatSize,formatSkillsForPrompt,gcHostEndpoints,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getAgentDir,getDocsPath,getExamplesPath,getLanguageFromPath,getLastAssistantUsage,getLatestCompactionEntry,getMarkdownTheme,getPackageDir,getPowerShellConfig,getReadmePath,getSelectListTheme,getSettingsListTheme,getShellConfig,handoffHost,hasTrustRequiringProjectResources,highlightCode,initTheme,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isSessionControlDeliveryDetails,isToolCallEventType,isTransportGoneError,isWriteToolResult,kernelToolsStorage,keyHint,keyText,listHostEndpoints,loadHostLaunchSpec,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,noticeEntryRenderer,noticeMessageRenderer,parseArgs,parseFrontmatter,parseHostLaunchSpec,parseHostProtocolInfo,parseSessionEntries,parseSkillBlock,prepareBranchEntries,probeHost,rawKeyHint,readAllHostStatus,readHostStatus,readOwnFootprint,readProcessFootprint,readStoredCredential,registerReadClassifier,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runHostCommand,runHostRequest,runPrintMode,runRpcMode,sanitizeTerminalLabel,serializeConversation,sessionControlSenderOf,sessionEntryToContextMessages,shardKey,shardSocketPath,shardSocketPathForKey,shouldCompact,stopHost,stripFrontmatter,truncateHead,truncateLine,truncateTail,truncateToVisualLines,visibleWidth,withBundledBunCommands,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
3
- import"./chunks/chunk-46NW3UKO.js";import{main}from"./chunks/chunk-F4ZU4RBE.js";import"./chunks/chunk-HOXW5IHD.js";import"./chunks/chunk-25FRFTSP.js";import"./chunks/chunk-DY2EM44T.js";import"./chunks/chunk-FDCYQYBP.js";import"./chunks/chunk-MF57DS3V.js";import"./chunks/chunk-KW6654UH.js";import"./chunks/chunk-SR7DBNWN.js";import"./chunks/chunk-2MOGCBPT.js";import{configureHttpDispatcher}from"./chunks/chunk-2RLZXLXS.js";import"./chunks/chunk-EFJKVUID.js";import"./chunks/chunk-T2EE5G4S.js";import"./chunks/chunk-GX7MTG25.js";import"./chunks/chunk-ZMS6YEAO.js";import"./chunks/chunk-HMK6F3RG.js";import"./chunks/chunk-74V6LCWU.js";import"./chunks/chunk-QZBH7PDO.js";import"./chunks/chunk-MTQQ2VQH.js";import"./chunks/chunk-Z32CYNHC.js";import"./chunks/chunk-YID5W42N.js";import"./chunks/chunk-6IWSMXBA.js";import"./chunks/chunk-QMRJYMNH.js";import"./chunks/chunk-FM7NDZR5.js";import"./chunks/chunk-EPQK674G.js";import"./chunks/chunk-26UBFF6N.js";import"./chunks/chunk-IBDADH5Z.js";import"./chunks/chunk-3474DPZK.js";import"./chunks/chunk-77PVTNLJ.js";import"./chunks/chunk-DDQJSVIZ.js";import"./chunks/chunk-KUZPBZUK.js";import"./chunks/chunk-IQWPR35S.js";import"./chunks/chunk-H4QOEVS5.js";import"./chunks/chunk-KLAX467B.js";import"./chunks/chunk-HB35RBP4.js";import"./chunks/chunk-QXJVKVA2.js";import"./chunks/chunk-7X72IACK.js";import"./chunks/chunk-GZVCRV7I.js";import"./chunks/chunk-KUPQO7MC.js";import"./chunks/chunk-U3VOXCGP.js";import"./chunks/chunk-QXREUA5F.js";import"./chunks/chunk-RUGYFYH7.js";import"./chunks/chunk-OEFCY46F.js";import"./chunks/chunk-KRNXUTZJ.js";import"./chunks/chunk-TAV6QZFM.js";import"./chunks/chunk-PELNNWGO.js";import"./chunks/chunk-4CJJ4SK6.js";import"./chunks/chunk-JKNUKBS3.js";import"./chunks/chunk-EKDY4H2J.js";import"./chunks/chunk-YU4AYH4C.js";import"./chunks/chunk-2IK7QUJX.js";import"./chunks/chunk-COH5F7QV.js";import"./chunks/chunk-RFB5CBW7.js";import"./chunks/chunk-2VZJTDUX.js";import"./chunks/chunk-XSRM367N.js";import"./chunks/chunk-WASCMT6Y.js";import"./chunks/chunk-T36LJ6MW.js";import"./chunks/chunk-QGJLZ6BI.js";import"./chunks/chunk-UAQW2T7G.js";import"./chunks/chunk-WHPDEDCC.js";import"./chunks/chunk-HK46JMSC.js";import"./chunks/chunk-WQLMQGOW.js";import"./chunks/chunk-WDTJ6JKE.js";import"./chunks/chunk-5ROMKDLK.js";import"./chunks/chunk-3W47LTXQ.js";import"./chunks/chunk-45SZOLCU.js";import"./chunks/chunk-LAWS3FYQ.js";import"./chunks/chunk-DMI55M2N.js";import"./chunks/chunk-PJ34QVL5.js";import"./chunks/chunk-BMX2U22F.js";import"./chunks/chunk-YU2P3CAR.js";import"./chunks/chunk-ADNKYKU4.js";import"./chunks/chunk-ZOFZRJSL.js";import"./chunks/chunk-2SOVDETB.js";import"./chunks/chunk-RAIZG6HA.js";import"./chunks/chunk-HRPMLI7O.js";import"./chunks/chunk-QEQG42HL.js";import{APP_NAME,scrubBrandFromEnvironment}from"./chunks/chunk-4J4ABCCL.js";import"./chunks/chunk-ATQFN5HI.js";import"./chunks/chunk-MIENF2YK.js";import"./chunks/chunk-OXNWERO4.js";import"./chunks/chunk-QN2BHP3M.js";import"./chunks/chunk-WIAXG52U.js";import"./chunks/chunk-7ASLQ243.js";import"./chunks/chunk-IKOFCODM.js";process.title=`${APP_NAME}-rpc`;scrubBrandFromEnvironment();process.env.PI_CODING_AGENT="true";process.env.AI_AGENT=APP_NAME;process.emitWarning=(()=>{});configureHttpDispatcher();main(["--mode","rpc",...process.argv.slice(2)]);
3
+ import"./chunks/chunk-7R4CJDWT.js";import{main}from"./chunks/chunk-YIRQJCPA.js";import"./chunks/chunk-JVLIKUBL.js";import"./chunks/chunk-FC2YWHEC.js";import{configureHttpDispatcher}from"./chunks/chunk-2LQZJFKQ.js";import"./chunks/chunk-25FRFTSP.js";import"./chunks/chunk-EFJKVUID.js";import"./chunks/chunk-2JGY3V4H.js";import"./chunks/chunk-MF57DS3V.js";import"./chunks/chunk-FRFGJC3I.js";import"./chunks/chunk-TK6RKAB4.js";import"./chunks/chunk-ZMS6YEAO.js";import"./chunks/chunk-RPAHOJ6F.js";import"./chunks/chunk-SR7DBNWN.js";import"./chunks/chunk-2MOGCBPT.js";import"./chunks/chunk-HMK6F3RG.js";import"./chunks/chunk-6L3H4UVN.js";import"./chunks/chunk-QZBH7PDO.js";import"./chunks/chunk-SOMFLLPD.js";import"./chunks/chunk-MTQQ2VQH.js";import"./chunks/chunk-F4YDU66P.js";import"./chunks/chunk-KXTWMPCP.js";import"./chunks/chunk-QMRJYMNH.js";import"./chunks/chunk-6IWSMXBA.js";import"./chunks/chunk-FM7NDZR5.js";import"./chunks/chunk-EPQK674G.js";import"./chunks/chunk-26UBFF6N.js";import"./chunks/chunk-IBDADH5Z.js";import"./chunks/chunk-3474DPZK.js";import"./chunks/chunk-W557SQYL.js";import"./chunks/chunk-DKBJM22C.js";import"./chunks/chunk-KUZPBZUK.js";import"./chunks/chunk-IQWPR35S.js";import"./chunks/chunk-H4QOEVS5.js";import"./chunks/chunk-KLAX467B.js";import"./chunks/chunk-HB35RBP4.js";import"./chunks/chunk-QXJVKVA2.js";import"./chunks/chunk-7X72IACK.js";import"./chunks/chunk-GZVCRV7I.js";import"./chunks/chunk-KUPQO7MC.js";import"./chunks/chunk-U3VOXCGP.js";import"./chunks/chunk-QXREUA5F.js";import"./chunks/chunk-RUGYFYH7.js";import"./chunks/chunk-OEFCY46F.js";import"./chunks/chunk-KRNXUTZJ.js";import"./chunks/chunk-TAV6QZFM.js";import"./chunks/chunk-PELNNWGO.js";import"./chunks/chunk-SOWFP3I7.js";import"./chunks/chunk-JKNUKBS3.js";import"./chunks/chunk-JXCHRJA7.js";import"./chunks/chunk-YU4AYH4C.js";import"./chunks/chunk-2SM4TR4H.js";import"./chunks/chunk-COH5F7QV.js";import"./chunks/chunk-RFB5CBW7.js";import"./chunks/chunk-2VZJTDUX.js";import"./chunks/chunk-XSRM367N.js";import"./chunks/chunk-WASCMT6Y.js";import"./chunks/chunk-T36LJ6MW.js";import"./chunks/chunk-QGJLZ6BI.js";import"./chunks/chunk-WHPDEDCC.js";import"./chunks/chunk-AA2L2RHH.js";import"./chunks/chunk-HK46JMSC.js";import"./chunks/chunk-WQLMQGOW.js";import"./chunks/chunk-WDTJ6JKE.js";import"./chunks/chunk-5ROMKDLK.js";import"./chunks/chunk-3W47LTXQ.js";import"./chunks/chunk-LAWS3FYQ.js";import"./chunks/chunk-45SZOLCU.js";import"./chunks/chunk-DMI55M2N.js";import"./chunks/chunk-PJ34QVL5.js";import"./chunks/chunk-BMX2U22F.js";import"./chunks/chunk-YU2P3CAR.js";import"./chunks/chunk-RYQ2FFF5.js";import"./chunks/chunk-ZOFZRJSL.js";import"./chunks/chunk-2SOVDETB.js";import"./chunks/chunk-RAIZG6HA.js";import"./chunks/chunk-HRPMLI7O.js";import"./chunks/chunk-QEQG42HL.js";import{APP_NAME,scrubBrandFromEnvironment}from"./chunks/chunk-4J4ABCCL.js";import"./chunks/chunk-ATQFN5HI.js";import"./chunks/chunk-MIENF2YK.js";import"./chunks/chunk-OXNWERO4.js";import"./chunks/chunk-QN2BHP3M.js";import"./chunks/chunk-WIAXG52U.js";import"./chunks/chunk-7ASLQ243.js";import"./chunks/chunk-IKOFCODM.js";process.title=`${APP_NAME}-rpc`;scrubBrandFromEnvironment();process.env.PI_CODING_AGENT="true";process.env.AI_AGENT=APP_NAME;process.emitWarning=(()=>{});configureHttpDispatcher();main(["--mode","rpc",...process.argv.slice(2)]);
@@ -1 +1 @@
1
- {"buildId":"bf255b915f51dd21","externals":["@earendil-works/chord","@earendil-works/pi-pty","@silvia-odwyer/photon-node","bufferutil","canvas","kerberos","supports-color","utf-8-validate"]}
1
+ {"buildId":"22fcd7712f77113d","externals":["@earendil-works/chord","@earendil-works/pi-pty","@silvia-odwyer/photon-node","bufferutil","canvas","kerberos","supports-color","utf-8-validate"]}
@@ -990,8 +990,6 @@ export declare class AgentSession {
990
990
  releaseSettledSessionMemory(): void;
991
991
  private _emitAgentIdleAfterDeferredTurns;
992
992
  private _promptAgent;
993
- /** Extract text content used to track fork-owned queued user messages. */
994
- private _extractUserMessageText;
995
993
  private _lastAssistantMessage;
996
994
  /** Internal handler for agent events - shared by subscribe and reconnect */
997
995
  private _handleAgentEvent;
@@ -133,7 +133,7 @@ import { TranscriptWriteFailures } from "./transcript-write-failures.js";
133
133
  import { AgentDeadlineTracker, resolveTurnDeadlineSettings, TURN_DEADLINE_ENTRY_TYPE, TURN_DEADLINE_GRACE_MS, } from "./turn-deadline.js";
134
134
  import { commandShapedName, findUnknownCommand } from "./unknown-command.js";
135
135
  import { addUsageToTotals, combineUsage, createUsageTotals } from "./usage-totals.js";
136
- import { keepsTextBlocksVerbatim, userTextContent } from "./user-text-blocks.js";
136
+ import { joinUserTextBlocks, keepsTextBlocksVerbatim, userMessageText, userTextContent } from "./user-text-blocks.js";
137
137
  import { findLatestResponse, getBranchSelection, getVirtualModelState, isVirtualModel, VIRTUAL_MODEL_STATE_ENTRY, } from "./virtual-models.js";
138
138
  /** Externally registered tools routed through eval in addition to declared eval exposure. */
139
139
  const EVAL_ONLY_TOOL_NAMES = new Set(["workflow", "monitor"]);
@@ -1953,7 +1953,7 @@ export class AgentSession {
1953
1953
  const prepared = userMessage?.role === "user"
1954
1954
  ? {
1955
1955
  ...readClientMessageIdentity(userMessage),
1956
- text: this._extractUserMessageText(userMessage.content),
1956
+ text: userMessageText(userMessage.content),
1957
1957
  images: typeof userMessage.content === "string"
1958
1958
  ? undefined
1959
1959
  : userMessage.content.filter((part) => part.type === "image"),
@@ -1976,15 +1976,6 @@ export class AgentSession {
1976
1976
  throw error;
1977
1977
  }
1978
1978
  }
1979
- /** Extract text content used to track fork-owned queued user messages. */
1980
- _extractUserMessageText(content) {
1981
- if (typeof content === "string")
1982
- return content;
1983
- return content
1984
- .filter((part) => part.type === "text")
1985
- .map((part) => part.text)
1986
- .join("");
1987
- }
1988
1979
  _createRetryPromiseForAgentEnd(event) {
1989
1980
  if (event.type !== "agent_end" || this._retryPromise) {
1990
1981
  return;
@@ -2247,7 +2238,7 @@ export class AgentSession {
2247
2238
  if (event.type === "message_start" && event.message.role === "user") {
2248
2239
  this._overflowRecoveryRungs = 0;
2249
2240
  this._retryFallback.resetTurn();
2250
- const messageText = contentText(event.message.content, "");
2241
+ const messageText = userMessageText(event.message.content);
2251
2242
  if (messageText) {
2252
2243
  const { clientMessageId } = readClientMessageIdentity(event.message);
2253
2244
  const queued = clientMessageId === undefined
@@ -4925,7 +4916,7 @@ export class AgentSession {
4925
4916
  images.push(part);
4926
4917
  }
4927
4918
  }
4928
- text = textParts.join("\n");
4919
+ text = joinUserTextBlocks(textParts);
4929
4920
  if (textParts.length > 1)
4930
4921
  textBlocks = textParts;
4931
4922
  if (images.length === 0)
@@ -33,6 +33,13 @@ export declare function rateLimitCooldown(failureCount: number, serverHintMs?: n
33
33
  cooldownMs: number;
34
34
  retryAfterWasCapped: boolean;
35
35
  };
36
+ /** The cooldown of a spent account whose limit names a future reset: exactly until that reset, capped. */
37
+ export declare function usageLimitCooldown(resetMs: number, policy?: {
38
+ capMs?: number;
39
+ }): {
40
+ cooldownMs: number;
41
+ retryAfterWasCapped: boolean;
42
+ };
36
43
  /**
37
44
  * Maps a provider failure onto the credential-pool action space. Credential-
38
45
  * scoped failures fail over (permanently for auth/billing, cooldown for rate
@@ -25,6 +25,11 @@ export function rateLimitCooldown(failureCount, serverHintMs, policy = {}) {
25
25
  retryAfterWasCapped: floored > cap,
26
26
  };
27
27
  }
28
+ /** The cooldown of a spent account whose limit names a future reset: exactly until that reset, capped. */
29
+ export function usageLimitCooldown(resetMs, policy = {}) {
30
+ const cap = policy.capMs ?? COOLDOWN_CAP_MS;
31
+ return { cooldownMs: Math.min(cap, resetMs), retryAfterWasCapped: resetMs > cap };
32
+ }
28
33
  const INVALID_KEY_TEXT = /invalid[ _-]?(?:api[ _-]?)?key|authentication[_ ]?error|invalid x-api-key|unauthorized/i;
29
34
  const ACCOUNT_SCOPED_403_TEXT = /account|credential|token|api[ _-]?key|organization|subscription/i;
30
35
  const RATE_LIMIT_TEXT = /rate[ _-]?limit|too many requests|resource_exhausted/i;
@@ -96,14 +101,17 @@ export function classifyCredentialFailure(error, context = {}) {
96
101
  const hint = extract429RetryAfterMs({ status: status ?? 429, bodyText: text }, nowMs) ??
97
102
  (usageLimit ? (normalized.retryAfterMs ?? usageLimitResetMs(text, nowMs)) : undefined);
98
103
  const modelFamily = rateLimitModelFamily(text);
104
+ const policy = { baseMs: context.cooldownBaseMs, capMs: context.cooldownCapMs };
99
105
  return {
100
106
  kind: "failover",
101
107
  block: {
102
108
  reason: "rate_limit",
103
- ...rateLimitCooldown(failureCount, hint, {
104
- baseMs: context.cooldownBaseMs,
105
- capMs: context.cooldownCapMs,
106
- }),
109
+ // A spent account comes back at the reset it names, so that reset is the cooldown: an
110
+ // exponential backoff grown from earlier failures would keep it blocked past it (senpi#3771).
111
+ // A reset already past (clock skew, a stale string) proves nothing and keeps the default floor.
112
+ ...(usageLimit && hint !== undefined && hint > 0
113
+ ? usageLimitCooldown(hint, policy)
114
+ : rateLimitCooldown(failureCount, hint, policy)),
107
115
  ...(modelFamily === undefined ? {} : { modelFamily }),
108
116
  },
109
117
  };
@@ -32,6 +32,20 @@ function isAvailable(slot, now) {
32
32
  // listSlots excludes that lease for later callers; the holder must remain runnable.
33
33
  return true;
34
34
  }
35
+ /**
36
+ * When every slot is cooling and this request has tried none, the rate-limited slot due back first
37
+ * still gets the request (senpi#3771). A cooldown only predicts when a limit lifts: the provider can
38
+ * lift it earlier (a usage reset the user redeemed), and refusing locally would fail every turn with
39
+ * no provider answer until the prediction expires, even across a restart. A slot still limited
40
+ * answers at once and is blocked again; one that recovered serves the turn and is cleared.
41
+ */
42
+ function coolingProbe(slots, attempted) {
43
+ if (attempted.size > 0)
44
+ return [];
45
+ const cooling = slots.filter((slot) => slot.blockReason === "rate_limit" && slot.blockedUntil !== undefined);
46
+ const soonest = cooling.reduce((best, slot) => (best === undefined || (slot.blockedUntil ?? 0) < (best.blockedUntil ?? 0) ? slot : best), undefined);
47
+ return soonest === undefined ? [] : [soonest];
48
+ }
35
49
  function soonestRetryAt(slots, now) {
36
50
  const deadlines = slots
37
51
  .map((slot) => slot.blockedUntil)
@@ -76,7 +90,8 @@ export async function* runCredentialFailover(options) {
76
90
  let startAnnounced = false;
77
91
  while (true) {
78
92
  const slots = await options.listSlots();
79
- const candidates = slots.filter((slot) => !attempted.has(slot.name) && isAvailable(slot, now()));
93
+ const available = slots.filter((slot) => !attempted.has(slot.name) && isAvailable(slot, now()));
94
+ const candidates = available.length > 0 ? available : coolingProbe(slots, attempted);
80
95
  if (candidates.length === 0) {
81
96
  if (lastTerminalEvent !== undefined) {
82
97
  yield lastTerminalEvent;
@@ -96,6 +96,8 @@ export function streamWithCredentialRotation(options) {
96
96
  lease: undefined,
97
97
  blockedUntil: undefined,
98
98
  blockReason: undefined,
99
+ // A healthy answer ends the failure run; a later limit starts its backoff afresh (senpi#3771).
100
+ failureCount: undefined,
99
101
  // Serving one model says nothing about another model's quota:
100
102
  // only the blocks on the model that just served are lifted.
101
103
  modelBlocks: pruneModelBlocks(current.modelBlocks, now(), options.modelId),
@@ -11,11 +11,11 @@ import { createAttemptMessages } from "./auth-attempt.js";
11
11
  import { recoverAuthBlockedSlots } from "./auth-block-recovery.js";
12
12
  import { hasRequestOauthToken, mergeRequestAuthEnvironment, stripManagedAuthEnvironment } from "./auth-environment.js";
13
13
  import { writeConfigDirCredential } from "./config-dir-credentials.js";
14
- import { classifySdkError, sdkAssistantFailure, sdkResultFailure } from "./errors.js";
14
+ import { asksLegacyLongContext } from "./context-window.js";
15
15
  import { runFailover } from "./failover.js";
16
16
  import { markLongContextRefused } from "./long-context.js";
17
+ import { classifyForRequest, retryAtStandardWindowOnce, sdkFailure, visibleSdkMessage } from "./long-context-retry.js";
17
18
  import { isGrantRejected, refreshFailure } from "./refresh-failure.js";
18
- import { refusalError } from "./refusal.js";
19
19
  export { ANTHROPIC_SUBSCRIPTION_PROVIDER_ID } from "./account-management.js";
20
20
  export const EXPIRING_WITHIN_MS = 5 * 60_000;
21
21
  /** A managed lane with an empty pool must refuse rather than spawn the SDK against ambient host credentials. */
@@ -131,64 +131,6 @@ async function prepareSlot(pool, selected, signal) {
131
131
  const directory = writeConfigDirCredential(activeBoundary.getAgentDir(), slot, access);
132
132
  return { env: { ...childEnvironment, CLAUDE_CONFIG_DIR: directory }, credentialDigest };
133
133
  }
134
- function sdkFailure(message) {
135
- const refusal = refusalError(message);
136
- if (refusal)
137
- return refusal;
138
- if (message.type === "assistant")
139
- return sdkAssistantFailure(message);
140
- if (message.type === "result")
141
- return sdkResultFailure(message);
142
- return undefined;
143
- }
144
- function visibleSdkMessage(message) {
145
- if (message.type !== "stream_event")
146
- return false;
147
- return /^(?:content_block_start|content_block_delta|content_block_stop)$/.test(message.event.type);
148
- }
149
- /**
150
- * The ambient lane has no account failover, so a refused 1M window is retried here: once, and only
151
- * before anything visible streamed. Messages pass through as they arrive (system/init, api_retry and
152
- * refusals keep their order and timing); the refused attempt is closed before the retry starts, after
153
- * the refusal is recorded so the rebuilt options ask for the standard window (senpi#3408).
154
- */
155
- async function* retryAtStandardWindowOnce(attempt) {
156
- const first = (await attempt())[Symbol.asyncIterator]();
157
- let refused = false;
158
- let finished = false;
159
- try {
160
- let visible = false;
161
- for (;;) {
162
- const next = await first.next();
163
- if (next.done) {
164
- finished = true;
165
- return;
166
- }
167
- const failure = visible ? undefined : sdkFailure(next.value);
168
- if (failure !== undefined && classifySdkError(failure).kind === "long_context_unavailable") {
169
- refused = true;
170
- break;
171
- }
172
- visible ||= visibleSdkMessage(next.value);
173
- yield next.value;
174
- }
175
- }
176
- finally {
177
- // Closes the first query on every exit (refusal, consumer return, error) before any retry spawns.
178
- if (!finished) {
179
- try {
180
- await first.return?.();
181
- }
182
- catch {
183
- // Closing the first query must never replace the error (or the refusal) that ended it.
184
- }
185
- }
186
- }
187
- if (!refused)
188
- return;
189
- markLongContextRefused();
190
- yield* await attempt();
191
- }
192
134
  /** Resolves managed OAuth immediately before each subprocess spawn and retries only pre-delta failures. */
193
135
  export async function* queryWithAuthLane(input) {
194
136
  const signal = input.signal ?? new AbortController().signal;
@@ -201,12 +143,14 @@ export async function* queryWithAuthLane(input) {
201
143
  delete ambientEnvironment[name];
202
144
  }
203
145
  // Lane-owned variables from buildOptions (the compaction-owner overlay) win over the host.
146
+ let askedLegacyLongContext = false;
204
147
  const ambientAttempt = async () => {
205
148
  const options = input.buildOptions("ambient");
149
+ askedLegacyLongContext = asksLegacyLongContext(options.model);
206
150
  options.env = { ...ambientEnvironment, ...options.env };
207
151
  return createAttemptMessages(input, { accountName: "ambient", accounts: [], authLane: "ambient", options });
208
152
  };
209
- yield* retryAtStandardWindowOnce(ambientAttempt);
153
+ yield* retryAtStandardWindowOnce(ambientAttempt, () => askedLegacyLongContext);
210
154
  return;
211
155
  }
212
156
  pool.accounts = await recoverAuthBlockedSlots({
@@ -221,6 +165,7 @@ export async function* queryWithAuthLane(input) {
221
165
  now: activeBoundary.now(),
222
166
  transientError: (error) => (error instanceof CredentialStoreBusyError ? error : refreshFailure(error)),
223
167
  });
168
+ let askedLegacyLongContext = false;
224
169
  yield* runFailover({
225
170
  accounts: pool.accounts,
226
171
  accountFallback: input.providerSettings.accountFallback,
@@ -240,6 +185,7 @@ export async function* queryWithAuthLane(input) {
240
185
  }),
241
186
  runAttempt: async (slot) => {
242
187
  const options = input.buildOptions(pool.lane);
188
+ askedLegacyLongContext = asksLegacyLongContext(options.model);
243
189
  const accounts = pool.accounts.map((account) => ({ ...account }));
244
190
  const prepared = await prepareSlot(pool, slot, signal);
245
191
  options.env = { ...prepared.env, ...options.env };
@@ -251,7 +197,7 @@ export async function* queryWithAuthLane(input) {
251
197
  credentialDigest: prepared.credentialDigest,
252
198
  });
253
199
  },
254
- classify: classifySdkError,
200
+ classify: (error) => classifyForRequest(error, askedLegacyLongContext),
255
201
  ...(input.sessionId === undefined ? {} : { sessionKey: input.sessionId }),
256
202
  onLongContextRefused: () => markLongContextRefused(),
257
203
  store: pool.store,
@@ -0,0 +1,25 @@
1
+ import type { Api, Model } from "@earendil-works/pi-ai";
2
+ /** Claude Code's default window when a request does not ask for the long context. */
3
+ export declare const CLAUDE_CODE_DEFAULT_CONTEXT_WINDOW = 200000;
4
+ /**
5
+ * Models whose 1M window is reachable only through Claude Code's `[1m]` opt-in, which sends the legacy
6
+ * `context-1m-2025-08-07` beta that a subscription without extra usage refuses. These are the rows of
7
+ * the bundled Claude Code catalog with `supports_1m_beta` and without `native_1m` (pinned against the
8
+ * installed binary by the senpi#3801 regression test). Every other model above 200k has a native 1M
9
+ * window on every plan and is requested by its plain id.
10
+ */
11
+ export declare const LEGACY_LONG_CONTEXT_MODEL_IDS: ReadonlySet<string>;
12
+ type WindowedModel = Pick<Model<Api>, "id" | "contextWindow">;
13
+ /** The window a request gets, which is what compaction plans against: only a legacy id loses 1M on a refusal. */
14
+ export declare function plannedContextWindow(model: WindowedModel, longContext?: boolean): number;
15
+ /**
16
+ * The model id Claude Code is given. A subscription (OAuth) session ignores `options.betas`, so `[1m]`
17
+ * is the only way to open a legacy model's 1M window; it is added only for those ids while the account
18
+ * has not refused it. A native-1M model keeps its plain id: `[1m]` would send the legacy beta and get
19
+ * the request refused (senpi#3801).
20
+ */
21
+ export declare function sdkModelId(model: WindowedModel): string;
22
+ /** Whether a built request asked for the legacy long-context window, the only request it can be refused for. */
23
+ export declare function asksLegacyLongContext(sdkModel: string | undefined): boolean;
24
+ export {};
25
+ //# sourceMappingURL=context-window.d.ts.map
@@ -0,0 +1,38 @@
1
+ import { longContextAvailable } from "./long-context.js";
2
+ /** Claude Code's default window when a request does not ask for the long context. */
3
+ export const CLAUDE_CODE_DEFAULT_CONTEXT_WINDOW = 200_000;
4
+ /**
5
+ * Models whose 1M window is reachable only through Claude Code's `[1m]` opt-in, which sends the legacy
6
+ * `context-1m-2025-08-07` beta that a subscription without extra usage refuses. These are the rows of
7
+ * the bundled Claude Code catalog with `supports_1m_beta` and without `native_1m` (pinned against the
8
+ * installed binary by the senpi#3801 regression test). Every other model above 200k has a native 1M
9
+ * window on every plan and is requested by its plain id.
10
+ */
11
+ export const LEGACY_LONG_CONTEXT_MODEL_IDS = new Set([
12
+ "claude-3-7-sonnet",
13
+ "claude-opus-4-6",
14
+ "claude-sonnet-4-0",
15
+ "claude-sonnet-4-5",
16
+ "claude-sonnet-4-6",
17
+ ]);
18
+ function opensLegacyLongContext(model) {
19
+ return model.contextWindow > CLAUDE_CODE_DEFAULT_CONTEXT_WINDOW && LEGACY_LONG_CONTEXT_MODEL_IDS.has(model.id);
20
+ }
21
+ /** The window a request gets, which is what compaction plans against: only a legacy id loses 1M on a refusal. */
22
+ export function plannedContextWindow(model, longContext = longContextAvailable()) {
23
+ return opensLegacyLongContext(model) && !longContext ? CLAUDE_CODE_DEFAULT_CONTEXT_WINDOW : model.contextWindow;
24
+ }
25
+ /**
26
+ * The model id Claude Code is given. A subscription (OAuth) session ignores `options.betas`, so `[1m]`
27
+ * is the only way to open a legacy model's 1M window; it is added only for those ids while the account
28
+ * has not refused it. A native-1M model keeps its plain id: `[1m]` would send the legacy beta and get
29
+ * the request refused (senpi#3801).
30
+ */
31
+ export function sdkModelId(model) {
32
+ return opensLegacyLongContext(model) && longContextAvailable() ? `${model.id}[1m]` : model.id;
33
+ }
34
+ /** Whether a built request asked for the legacy long-context window, the only request it can be refused for. */
35
+ export function asksLegacyLongContext(sdkModel) {
36
+ return sdkModel?.endsWith("[1m]") === true;
37
+ }
38
+ //# sourceMappingURL=context-window.js.map
@@ -8,8 +8,8 @@ export type AnthropicSubscriptionExtensionDeps = {
8
8
  };
9
9
  /**
10
10
  * The lane's models carry the window their requests actually get, which is what compaction plans
11
- * against: the catalog window while the 1M window is available, Claude Code's 200k default after the
12
- * account refused it (senpi#3408).
11
+ * against: the catalog window, except a legacy long-context id at Claude Code's 200k default after the
12
+ * account refused its 1M opt-in (senpi#3408, senpi#3801).
13
13
  */
14
14
  export declare const anthropicSubscriptionModels: (longContext?: boolean) => {
15
15
  id: string;
@@ -8,17 +8,17 @@ import { toBuiltinProviderContext } from "../provider-context.js";
8
8
  import { registerClaudeAccountCommand } from "./account-command.js";
9
9
  import { ANTHROPIC_SUBSCRIPTION_PROVIDER_ID } from "./account-management.js";
10
10
  import { CLAUDE_SDK_OAUTH_API_ID } from "./api-id.js";
11
+ import { plannedContextWindow } from "./context-window.js";
11
12
  import { longContextAvailable, onLongContextAvailabilityChange } from "./long-context.js";
12
13
  import { createOAuthConfig } from "./oauth-login.js";
13
- import { CLAUDE_CODE_DEFAULT_CONTEXT_WINDOW } from "./options.js";
14
14
  import { registerSessionRegistry } from "./session-registry-wiring.js";
15
15
  import { loadAnthropicSubscriptionProviderSettingsFromDisk, } from "./settings.js";
16
16
  import { streamAnthropicSubscription } from "./stream.js";
17
17
  export { ANTHROPIC_SUBSCRIPTION_PROVIDER_ID } from "./account-management.js";
18
18
  /**
19
19
  * The lane's models carry the window their requests actually get, which is what compaction plans
20
- * against: the catalog window while the 1M window is available, Claude Code's 200k default after the
21
- * account refused it (senpi#3408).
20
+ * against: the catalog window, except a legacy long-context id at Claude Code's 200k default after the
21
+ * account refused its 1M opt-in (senpi#3408, senpi#3801).
22
22
  */
23
23
  export const anthropicSubscriptionModels = (longContext = longContextAvailable()) => getModels("anthropic").map((model) => ({
24
24
  id: model.id,
@@ -26,9 +26,7 @@ export const anthropicSubscriptionModels = (longContext = longContextAvailable()
26
26
  reasoning: model.reasoning,
27
27
  input: model.input,
28
28
  cost: model.cost,
29
- contextWindow: longContext
30
- ? model.contextWindow
31
- : Math.min(model.contextWindow, CLAUDE_CODE_DEFAULT_CONTEXT_WINDOW),
29
+ contextWindow: plannedContextWindow(model, longContext),
32
30
  maxTokens: model.maxTokens,
33
31
  thinkingLevelMap: {
34
32
  ...model.thinkingLevelMap,
@@ -0,0 +1,18 @@
1
+ import { type SdkErrorClassification } from "./errors.ts";
2
+ import type { SDKMessage } from "./sdk-boundary.ts";
3
+ export declare function sdkFailure(message: SDKMessage): unknown | undefined;
4
+ export declare function visibleSdkMessage(message: SDKMessage): boolean;
5
+ /**
6
+ * Only a request that asked for the legacy `[1m]` window can have that window refused. The same words
7
+ * on any other request (a native-1M model, which never sends the legacy beta) are an ordinary failure:
8
+ * never a recorded refusal, a 200k retry, or a rate limit that blocks the account (senpi#3801).
9
+ */
10
+ export declare function classifyForRequest(error: unknown, askedLegacyLongContext: boolean): SdkErrorClassification;
11
+ /**
12
+ * The ambient lane has no account failover, so a refused 1M window is retried here: once, and only
13
+ * before anything visible streamed. Messages pass through as they arrive (system/init, api_retry and
14
+ * refusals keep their order and timing); the refused attempt is closed before the retry starts, after
15
+ * the refusal is recorded so the rebuilt options ask for the standard window (senpi#3408).
16
+ */
17
+ export declare function retryAtStandardWindowOnce(attempt: () => Promise<AsyncIterable<SDKMessage>>, askedLegacyLongContext: () => boolean): AsyncGenerator<SDKMessage>;
18
+ //# sourceMappingURL=long-context-retry.d.ts.map
@@ -0,0 +1,74 @@
1
+ import { classifySdkError, sdkAssistantFailure, sdkResultFailure } from "./errors.js";
2
+ import { markLongContextRefused } from "./long-context.js";
3
+ import { refusalError } from "./refusal.js";
4
+ export function sdkFailure(message) {
5
+ const refusal = refusalError(message);
6
+ if (refusal)
7
+ return refusal;
8
+ if (message.type === "assistant")
9
+ return sdkAssistantFailure(message);
10
+ if (message.type === "result")
11
+ return sdkResultFailure(message);
12
+ return undefined;
13
+ }
14
+ export function visibleSdkMessage(message) {
15
+ if (message.type !== "stream_event")
16
+ return false;
17
+ return /^(?:content_block_start|content_block_delta|content_block_stop)$/.test(message.event.type);
18
+ }
19
+ /**
20
+ * Only a request that asked for the legacy `[1m]` window can have that window refused. The same words
21
+ * on any other request (a native-1M model, which never sends the legacy beta) are an ordinary failure:
22
+ * never a recorded refusal, a 200k retry, or a rate limit that blocks the account (senpi#3801).
23
+ */
24
+ export function classifyForRequest(error, askedLegacyLongContext) {
25
+ const classification = classifySdkError(error);
26
+ return classification.kind === "long_context_unavailable" && !askedLegacyLongContext
27
+ ? { kind: "other", retryable: false }
28
+ : classification;
29
+ }
30
+ /**
31
+ * The ambient lane has no account failover, so a refused 1M window is retried here: once, and only
32
+ * before anything visible streamed. Messages pass through as they arrive (system/init, api_retry and
33
+ * refusals keep their order and timing); the refused attempt is closed before the retry starts, after
34
+ * the refusal is recorded so the rebuilt options ask for the standard window (senpi#3408).
35
+ */
36
+ export async function* retryAtStandardWindowOnce(attempt, askedLegacyLongContext) {
37
+ const first = (await attempt())[Symbol.asyncIterator]();
38
+ let refused = false;
39
+ let finished = false;
40
+ try {
41
+ let visible = false;
42
+ for (;;) {
43
+ const next = await first.next();
44
+ if (next.done) {
45
+ finished = true;
46
+ return;
47
+ }
48
+ const failure = visible ? undefined : sdkFailure(next.value);
49
+ if (failure !== undefined &&
50
+ classifyForRequest(failure, askedLegacyLongContext()).kind === "long_context_unavailable") {
51
+ refused = true;
52
+ break;
53
+ }
54
+ visible ||= visibleSdkMessage(next.value);
55
+ yield next.value;
56
+ }
57
+ }
58
+ finally {
59
+ // Closes the first query on every exit (refusal, consumer return, error) before any retry spawns.
60
+ if (!finished) {
61
+ try {
62
+ await first.return?.();
63
+ }
64
+ catch {
65
+ // Closing the first query must never replace the error (or the refusal) that ended it.
66
+ }
67
+ }
68
+ }
69
+ if (!refused)
70
+ return;
71
+ markLongContextRefused();
72
+ yield* await attempt();
73
+ }
74
+ //# sourceMappingURL=long-context-retry.js.map
@@ -1,9 +1,14 @@
1
- import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
1
+ import { mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
2
2
  import { dirname, join } from "node:path";
3
3
  import { getAgentDir } from "../../../../config.js";
4
4
  /** How long a refusal holds before the 1M window is tried again (the account may have enabled extra usage). */
5
5
  export const LONG_CONTEXT_REFUSAL_TTL_MS = 6 * 60 * 60 * 1_000;
6
6
  const STATE_FILE = "anthropic-subscription-long-context.json";
7
+ /**
8
+ * Refusals before version 2 were recorded for native-1M models too, which never needed the opt-in
9
+ * (senpi#3801); such a record is dropped on first read so the legacy ids do not inherit it.
10
+ */
11
+ const STATE_VERSION = 2;
7
12
  const listeners = new Set();
8
13
  let refusedUntil;
9
14
  let loaded = false;
@@ -14,9 +19,12 @@ function load() {
14
19
  loaded = true;
15
20
  try {
16
21
  const parsed = JSON.parse(readFileSync(statePath(), "utf8"));
17
- const until = parsed !== null && typeof parsed === "object"
18
- ? parsed.refusedUntil
19
- : undefined;
22
+ const state = parsed !== null && typeof parsed === "object" ? parsed : {};
23
+ if (state.version !== STATE_VERSION) {
24
+ rmSync(statePath(), { force: true });
25
+ return;
26
+ }
27
+ const until = state.refusedUntil;
20
28
  if (typeof until === "number" && Number.isFinite(until)) {
21
29
  refusedUntil = until;
22
30
  scheduleExpiry(Date.now());
@@ -66,7 +74,7 @@ export function markLongContextRefused(now = Date.now()) {
66
74
  try {
67
75
  mkdirSync(dirname(statePath()), { recursive: true });
68
76
  const temporary = `${statePath()}.${process.pid}.tmp`;
69
- writeFileSync(temporary, `${JSON.stringify({ refusedUntil })}\n`);
77
+ writeFileSync(temporary, `${JSON.stringify({ version: STATE_VERSION, refusedUntil })}\n`);
70
78
  renameSync(temporary, statePath());
71
79
  }
72
80
  catch {
@@ -14,15 +14,5 @@ export interface AnthropicSubscriptionQueryOptionsInput {
14
14
  readonly sessionId?: string;
15
15
  readonly onGuidance?: (text: string) => void;
16
16
  }
17
- /** Claude Code's default window when a request does not ask for the long context (its `A68`). */
18
- export declare const CLAUDE_CODE_DEFAULT_CONTEXT_WINDOW = 200000;
19
- /**
20
- * The model id Claude Code is given. A subscription (OAuth) session ignores `options.betas` ("Custom
21
- * betas are only available for API key users"); the `[1m]` suffix is Claude Code's own way to ask for
22
- * the 1M window, and it then sends `context-1m-2025-08-07` on the wire. A model above the default
23
- * window gets the suffix while the account has not refused it, so the window senpi plans against is
24
- * the window the request gets (senpi#3408).
25
- */
26
- export declare function sdkModelId(model: Pick<Model<Api>, "id" | "contextWindow">): string;
27
17
  export declare function buildAnthropicSubscriptionQueryOptions(input: AnthropicSubscriptionQueryOptionsInput): Options;
28
18
  //# sourceMappingURL=options.d.ts.map