agentfootprint 16.2.1 → 16.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CAPABILITIES.md +1 -0
- package/dist/adapters/llm/AnthropicProvider.js +26 -0
- package/dist/adapters/llm/AnthropicProvider.js.map +1 -1
- package/dist/adapters/llm/OllamaProvider.js +16 -61
- package/dist/adapters/llm/OllamaProvider.js.map +1 -1
- package/dist/adapters/llm/anthropicThinkingReplay.js +2 -24
- package/dist/adapters/llm/anthropicThinkingReplay.js.map +1 -1
- package/dist/adapters/llm/anthropicToolArguments.js +9 -3
- package/dist/adapters/llm/anthropicToolArguments.js.map +1 -1
- package/dist/adapters/llm/ollamaErrors.js +61 -0
- package/dist/adapters/llm/ollamaErrors.js.map +1 -0
- package/dist/adapters/observability/assessmentReasonWords.js +3 -0
- package/dist/adapters/observability/assessmentReasonWords.js.map +1 -1
- package/dist/adapters/observability/auditShapes/events/decisions.js +1 -0
- package/dist/adapters/observability/auditShapes/events/decisions.js.map +1 -1
- package/dist/adapters/observability/auditShapes/events/streaming.js +1 -0
- package/dist/adapters/observability/auditShapes/events/streaming.js.map +1 -1
- package/dist/answer-account/facts/standing.js +12 -3
- package/dist/answer-account/facts/standing.js.map +1 -1
- package/dist/answer-account/howSureReasonTemplates.js +4 -0
- package/dist/answer-account/howSureReasonTemplates.js.map +1 -1
- package/dist/answer-account/templates.js +1 -1
- package/dist/artifacts/fileArtifacts.js +2 -2
- package/dist/artifacts/fileArtifacts.js.map +1 -1
- package/dist/artifacts/gcsArtifacts.js +3 -5
- package/dist/artifacts/gcsArtifacts.js.map +1 -1
- package/dist/artifacts/inMemoryArtifacts.js +2 -2
- package/dist/artifacts/inMemoryArtifacts.js.map +1 -1
- package/dist/artifacts/minting.js +49 -29
- package/dist/artifacts/minting.js.map +1 -1
- package/dist/artifacts/naming.js +12 -2
- package/dist/artifacts/naming.js.map +1 -1
- package/dist/artifacts/payload.js +27 -13
- package/dist/artifacts/payload.js.map +1 -1
- package/dist/artifacts/s3Artifacts.js +3 -5
- package/dist/artifacts/s3Artifacts.js.map +1 -1
- package/dist/artifacts/sqliteArtifacts.js +13 -8
- package/dist/artifacts/sqliteArtifacts.js.map +1 -1
- package/dist/artifacts/types.js.map +1 -1
- package/dist/core/agent/assessment/assess.js +5 -4
- package/dist/core/agent/assessment/assess.js.map +1 -1
- package/dist/core/agent/assessment/compose.js +13 -9
- package/dist/core/agent/assessment/compose.js.map +1 -1
- package/dist/core/agent/assessment/reasonClasses.js +3 -0
- package/dist/core/agent/assessment/reasonClasses.js.map +1 -1
- package/dist/core/agent/assessment/reasons.js +21 -0
- package/dist/core/agent/assessment/reasons.js.map +1 -1
- package/dist/core/agent/assessment/results/library-did/stage.js +88 -0
- package/dist/core/agent/assessment/results/library-did/stage.js.map +1 -0
- package/dist/core/agent/assessment/stage.js +3 -1
- package/dist/core/agent/assessment/stage.js.map +1 -1
- package/dist/core/agent/assessment/standingAdmission.js +14 -0
- package/dist/core/agent/assessment/standingAdmission.js.map +1 -1
- package/dist/core/agent/assessment/standingFacts.js +7 -0
- package/dist/core/agent/assessment/standingFacts.js.map +1 -1
- package/dist/core/agent/buildDynamicAgentChart.js +4 -64
- package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/core/agent/dynamicTurnSeed.js +71 -0
- package/dist/core/agent/dynamicTurnSeed.js.map +1 -0
- package/dist/core/agent/honesty/answerFoldReads.js +3 -0
- package/dist/core/agent/honesty/answerFoldReads.js.map +1 -1
- package/dist/core/agent/honesty/libraryResultLimits.js +140 -0
- package/dist/core/agent/honesty/libraryResultLimits.js.map +1 -0
- package/dist/core/agent/honesty/settledToolCalls.js +5 -0
- package/dist/core/agent/honesty/settledToolCalls.js.map +1 -1
- package/dist/core/agent/llmCallReads.js +12 -4
- package/dist/core/agent/llmCallReads.js.map +1 -1
- package/dist/core/agent/recordedCalls/toolTurnCheckpoint.js +41 -4
- package/dist/core/agent/recordedCalls/toolTurnCheckpoint.js.map +1 -1
- package/dist/core/agent/requestTurn/checkpoint.js +187 -0
- package/dist/core/agent/requestTurn/checkpoint.js.map +1 -0
- package/dist/core/agent/requestTurn/native.js +30 -0
- package/dist/core/agent/requestTurn/native.js.map +1 -0
- package/dist/core/agent/requestTurn/replayPrefix.js +100 -0
- package/dist/core/agent/requestTurn/replayPrefix.js.map +1 -0
- package/dist/core/agent/requestTurn/state.js +76 -0
- package/dist/core/agent/requestTurn/state.js.map +1 -0
- package/dist/core/agent/resultRowsets/resumed.js.map +1 -1
- package/dist/core/agent/runtime/chart/chartDependencies.js +2 -0
- package/dist/core/agent/runtime/chart/chartDependencies.js.map +1 -1
- package/dist/core/agent/runtime/conversation/owner.js +1 -0
- package/dist/core/agent/runtime/conversation/owner.js.map +1 -1
- package/dist/core/agent/runtime/conversation/seedHistory.js +11 -2
- package/dist/core/agent/runtime/conversation/seedHistory.js.map +1 -1
- package/dist/core/agent/stages/callLLM/groundedText.js +7 -2
- package/dist/core/agent/stages/callLLM/groundedText.js.map +1 -1
- package/dist/core/agent/stages/callLLM/liveChunks.js +74 -0
- package/dist/core/agent/stages/callLLM/liveChunks.js.map +1 -0
- package/dist/core/agent/stages/callLLM/requestOnly.js +84 -0
- package/dist/core/agent/stages/callLLM/requestOnly.js.map +1 -0
- package/dist/core/agent/stages/callLLM/requestProjection.js +26 -0
- package/dist/core/agent/stages/callLLM/requestProjection.js.map +1 -0
- package/dist/core/agent/stages/callLLM.js +67 -118
- package/dist/core/agent/stages/callLLM.js.map +1 -1
- package/dist/core/agent/stages/seed.js +1 -2
- package/dist/core/agent/stages/seed.js.map +1 -1
- package/dist/core/agent/stages/toolCalls/decorators/limitsOperations.js +7 -8
- package/dist/core/agent/stages/toolCalls/decorators/limitsOperations.js.map +1 -1
- package/dist/core/agent/stages/toolCalls/execution/artifactsOperations.js +2 -0
- package/dist/core/agent/stages/toolCalls/execution/artifactsOperations.js.map +1 -1
- package/dist/core/agent/stages/toolCalls/execution/contextOperations.js +21 -6
- package/dist/core/agent/stages/toolCalls/execution/contextOperations.js.map +1 -1
- package/dist/core/agent/stages/toolCalls/execution/dispatchCall.js +7 -0
- package/dist/core/agent/stages/toolCalls/execution/dispatchCall.js.map +1 -1
- package/dist/core/agent/stages/toolCalls/execution/initialInvocation.js +3 -1
- package/dist/core/agent/stages/toolCalls/execution/initialInvocation.js.map +1 -1
- package/dist/core/agent/stages/toolCalls/execution/resumedInvocation.js +4 -4
- package/dist/core/agent/stages/toolCalls/execution/resumedInvocation.js.map +1 -1
- package/dist/core/agent/stages/toolCalls/resume/ask.js +4 -1
- package/dist/core/agent/stages/toolCalls/resume/ask.js.map +1 -1
- package/dist/core/agent/stages/toolCalls/resume/checkIn.js +4 -1
- package/dist/core/agent/stages/toolCalls/resume/checkIn.js.map +1 -1
- package/dist/core/agent/stages/toolCalls/resume/credential.js +8 -1
- package/dist/core/agent/stages/toolCalls/resume/credential.js.map +1 -1
- package/dist/core/agent/stages/toolCalls/resume/plain.js +2 -0
- package/dist/core/agent/stages/toolCalls/resume/plain.js.map +1 -1
- package/dist/core/agent/toolResultCap.js +0 -0
- package/dist/core/agent/toolResultCap.js.map +1 -1
- package/dist/core/checkpointFailurePhase.js +38 -0
- package/dist/core/checkpointFailurePhase.js.map +1 -0
- package/dist/core/runCheckpoint.js +10 -36
- package/dist/core/runCheckpoint.js.map +1 -1
- package/dist/esm/adapters/llm/AnthropicProvider.d.ts +5 -0
- package/dist/esm/adapters/llm/AnthropicProvider.js +26 -0
- package/dist/esm/adapters/llm/AnthropicProvider.js.map +1 -1
- package/dist/esm/adapters/llm/OllamaProvider.js +13 -58
- package/dist/esm/adapters/llm/OllamaProvider.js.map +1 -1
- package/dist/esm/adapters/llm/anthropicThinkingReplay.js +2 -24
- package/dist/esm/adapters/llm/anthropicThinkingReplay.js.map +1 -1
- package/dist/esm/adapters/llm/anthropicToolArguments.d.ts +3 -1
- package/dist/esm/adapters/llm/anthropicToolArguments.js +9 -3
- package/dist/esm/adapters/llm/anthropicToolArguments.js.map +1 -1
- package/dist/esm/adapters/llm/ollamaErrors.d.ts +23 -0
- package/dist/esm/adapters/llm/ollamaErrors.js +55 -0
- package/dist/esm/adapters/llm/ollamaErrors.js.map +1 -0
- package/dist/esm/adapters/observability/assessmentReasonWords.js +3 -0
- package/dist/esm/adapters/observability/assessmentReasonWords.js.map +1 -1
- package/dist/esm/adapters/observability/auditShapes/events/decisions.js +1 -0
- package/dist/esm/adapters/observability/auditShapes/events/decisions.js.map +1 -1
- package/dist/esm/adapters/observability/auditShapes/events/streaming.js +1 -0
- package/dist/esm/adapters/observability/auditShapes/events/streaming.js.map +1 -1
- package/dist/esm/answer-account/facts/standing.js +12 -3
- package/dist/esm/answer-account/facts/standing.js.map +1 -1
- package/dist/esm/answer-account/howSureReasonTemplates.d.ts +4 -0
- package/dist/esm/answer-account/howSureReasonTemplates.js +4 -0
- package/dist/esm/answer-account/howSureReasonTemplates.js.map +1 -1
- package/dist/esm/answer-account/templates.d.ts +5 -1
- package/dist/esm/answer-account/templates.js +1 -1
- package/dist/esm/artifacts/fileArtifacts.js +3 -3
- package/dist/esm/artifacts/fileArtifacts.js.map +1 -1
- package/dist/esm/artifacts/gcsArtifacts.js +4 -6
- package/dist/esm/artifacts/gcsArtifacts.js.map +1 -1
- package/dist/esm/artifacts/inMemoryArtifacts.js +3 -3
- package/dist/esm/artifacts/inMemoryArtifacts.js.map +1 -1
- package/dist/esm/artifacts/minting.d.ts +2 -1
- package/dist/esm/artifacts/minting.js +50 -30
- package/dist/esm/artifacts/minting.js.map +1 -1
- package/dist/esm/artifacts/naming.d.ts +2 -0
- package/dist/esm/artifacts/naming.js +10 -1
- package/dist/esm/artifacts/naming.js.map +1 -1
- package/dist/esm/artifacts/payload.d.ts +13 -0
- package/dist/esm/artifacts/payload.js +21 -10
- package/dist/esm/artifacts/payload.js.map +1 -1
- package/dist/esm/artifacts/s3Artifacts.js +4 -6
- package/dist/esm/artifacts/s3Artifacts.js.map +1 -1
- package/dist/esm/artifacts/sqliteArtifacts.js +14 -9
- package/dist/esm/artifacts/sqliteArtifacts.js.map +1 -1
- package/dist/esm/artifacts/types.d.ts +2 -0
- package/dist/esm/artifacts/types.js.map +1 -1
- package/dist/esm/core/agent/assessment/assess.d.ts +2 -4
- package/dist/esm/core/agent/assessment/assess.js +5 -4
- package/dist/esm/core/agent/assessment/assess.js.map +1 -1
- package/dist/esm/core/agent/assessment/compose.js +13 -9
- package/dist/esm/core/agent/assessment/compose.js.map +1 -1
- package/dist/esm/core/agent/assessment/reasonClasses.js +3 -0
- package/dist/esm/core/agent/assessment/reasonClasses.js.map +1 -1
- package/dist/esm/core/agent/assessment/reasons.js +21 -0
- package/dist/esm/core/agent/assessment/reasons.js.map +1 -1
- package/dist/esm/core/agent/assessment/results/library-did/stage.d.ts +16 -0
- package/dist/esm/core/agent/assessment/results/library-did/stage.js +82 -0
- package/dist/esm/core/agent/assessment/results/library-did/stage.js.map +1 -0
- package/dist/esm/core/agent/assessment/stage.js +3 -1
- package/dist/esm/core/agent/assessment/stage.js.map +1 -1
- package/dist/esm/core/agent/assessment/standingAdmission.js +14 -0
- package/dist/esm/core/agent/assessment/standingAdmission.js.map +1 -1
- package/dist/esm/core/agent/assessment/standingFacts.d.ts +3 -0
- package/dist/esm/core/agent/assessment/standingFacts.js +7 -0
- package/dist/esm/core/agent/assessment/standingFacts.js.map +1 -1
- package/dist/esm/core/agent/assessment/types.d.ts +3 -1
- package/dist/esm/core/agent/buildDynamicAgentChart.js +3 -63
- package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/esm/core/agent/dynamicTurnSeed.d.ts +14 -0
- package/dist/esm/core/agent/dynamicTurnSeed.js +67 -0
- package/dist/esm/core/agent/dynamicTurnSeed.js.map +1 -0
- package/dist/esm/core/agent/honesty/answerFoldReads.d.ts +2 -1
- package/dist/esm/core/agent/honesty/answerFoldReads.js +3 -0
- package/dist/esm/core/agent/honesty/answerFoldReads.js.map +1 -1
- package/dist/esm/core/agent/honesty/libraryResultLimits.d.ts +44 -0
- package/dist/esm/core/agent/honesty/libraryResultLimits.js +131 -0
- package/dist/esm/core/agent/honesty/libraryResultLimits.js.map +1 -0
- package/dist/esm/core/agent/honesty/settledToolCalls.js +5 -0
- package/dist/esm/core/agent/honesty/settledToolCalls.js.map +1 -1
- package/dist/esm/core/agent/llmCallReads.d.ts +4 -2
- package/dist/esm/core/agent/llmCallReads.js +10 -2
- package/dist/esm/core/agent/llmCallReads.js.map +1 -1
- package/dist/esm/core/agent/recordedCalls/toolTurnCheckpoint.d.ts +3 -0
- package/dist/esm/core/agent/recordedCalls/toolTurnCheckpoint.js +41 -4
- package/dist/esm/core/agent/recordedCalls/toolTurnCheckpoint.js.map +1 -1
- package/dist/esm/core/agent/requestTurn/checkpoint.d.ts +6 -0
- package/dist/esm/core/agent/requestTurn/checkpoint.js +182 -0
- package/dist/esm/core/agent/requestTurn/checkpoint.js.map +1 -0
- package/dist/esm/core/agent/requestTurn/native.d.ts +4 -0
- package/dist/esm/core/agent/requestTurn/native.js +26 -0
- package/dist/esm/core/agent/requestTurn/native.js.map +1 -0
- package/dist/esm/core/agent/requestTurn/replayPrefix.d.ts +40 -0
- package/dist/esm/core/agent/requestTurn/replayPrefix.js +94 -0
- package/dist/esm/core/agent/requestTurn/replayPrefix.js.map +1 -0
- package/dist/esm/core/agent/requestTurn/state.d.ts +23 -0
- package/dist/esm/core/agent/requestTurn/state.js +68 -0
- package/dist/esm/core/agent/requestTurn/state.js.map +1 -0
- package/dist/esm/core/agent/resultRowsets/resumed.d.ts +4 -13
- package/dist/esm/core/agent/resultRowsets/resumed.js.map +1 -1
- package/dist/esm/core/agent/runtime/chart/chartDependencies.js +2 -0
- package/dist/esm/core/agent/runtime/chart/chartDependencies.js.map +1 -1
- package/dist/esm/core/agent/runtime/conversation/owner.js +1 -0
- package/dist/esm/core/agent/runtime/conversation/owner.js.map +1 -1
- package/dist/esm/core/agent/runtime/conversation/seedHistory.d.ts +4 -19
- package/dist/esm/core/agent/runtime/conversation/seedHistory.js +10 -1
- package/dist/esm/core/agent/runtime/conversation/seedHistory.js.map +1 -1
- package/dist/esm/core/agent/stages/callLLM/groundedText.d.ts +1 -1
- package/dist/esm/core/agent/stages/callLLM/groundedText.js +7 -2
- package/dist/esm/core/agent/stages/callLLM/groundedText.js.map +1 -1
- package/dist/esm/core/agent/stages/callLLM/liveChunks.d.ts +16 -0
- package/dist/esm/core/agent/stages/callLLM/liveChunks.js +70 -0
- package/dist/esm/core/agent/stages/callLLM/liveChunks.js.map +1 -0
- package/dist/esm/core/agent/stages/callLLM/requestOnly.d.ts +23 -0
- package/dist/esm/core/agent/stages/callLLM/requestOnly.js +78 -0
- package/dist/esm/core/agent/stages/callLLM/requestOnly.js.map +1 -0
- package/dist/esm/core/agent/stages/callLLM/requestProjection.d.ts +10 -0
- package/dist/esm/core/agent/stages/callLLM/requestProjection.js +22 -0
- package/dist/esm/core/agent/stages/callLLM/requestProjection.js.map +1 -0
- package/dist/esm/core/agent/stages/callLLM.js +68 -119
- package/dist/esm/core/agent/stages/callLLM.js.map +1 -1
- package/dist/esm/core/agent/stages/seed.js +2 -3
- package/dist/esm/core/agent/stages/seed.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls/compose.d.ts +2 -5
- package/dist/esm/core/agent/stages/toolCalls/contracts/callCells.d.ts +2 -1
- package/dist/esm/core/agent/stages/toolCalls/contracts/callFacts.d.ts +2 -1
- package/dist/esm/core/agent/stages/toolCalls/contracts/operations/context.d.ts +2 -1
- package/dist/esm/core/agent/stages/toolCalls/contracts/operations/limits.d.ts +8 -4
- package/dist/esm/core/agent/stages/toolCalls/decorators/limitsOperations.js +7 -8
- package/dist/esm/core/agent/stages/toolCalls/decorators/limitsOperations.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls/execution/artifactsOperations.js +2 -0
- package/dist/esm/core/agent/stages/toolCalls/execution/artifactsOperations.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls/execution/contextOperations.js +21 -6
- package/dist/esm/core/agent/stages/toolCalls/execution/contextOperations.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls/execution/dispatchCall.js +7 -0
- package/dist/esm/core/agent/stages/toolCalls/execution/dispatchCall.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls/execution/finalizeCallResult.d.ts +1 -4
- package/dist/esm/core/agent/stages/toolCalls/execution/initialInvocation.js +3 -1
- package/dist/esm/core/agent/stages/toolCalls/execution/initialInvocation.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls/execution/resumedInvocation.js +4 -4
- package/dist/esm/core/agent/stages/toolCalls/execution/resumedInvocation.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls/resume/ask.js +4 -1
- package/dist/esm/core/agent/stages/toolCalls/resume/ask.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls/resume/checkIn.js +4 -1
- package/dist/esm/core/agent/stages/toolCalls/resume/checkIn.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls/resume/credential.js +8 -1
- package/dist/esm/core/agent/stages/toolCalls/resume/credential.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls/resume/plain.js +2 -0
- package/dist/esm/core/agent/stages/toolCalls/resume/plain.js.map +1 -1
- package/dist/esm/core/agent/toolResultCap.d.ts +7 -0
- package/dist/esm/core/agent/toolResultCap.js +0 -0
- package/dist/esm/core/agent/toolResultCap.js.map +1 -1
- package/dist/esm/core/agent/types/state/honesty.d.ts +4 -0
- package/dist/esm/core/checkpointFailurePhase.d.ts +15 -0
- package/dist/esm/core/checkpointFailurePhase.js +34 -0
- package/dist/esm/core/checkpointFailurePhase.js.map +1 -0
- package/dist/esm/core/runCheckpoint.d.ts +1 -15
- package/dist/esm/core/runCheckpoint.js +8 -34
- package/dist/esm/core/runCheckpoint.js.map +1 -1
- package/dist/esm/core/runCheckpointTypes.d.ts +3 -0
- package/dist/esm/events/payloads/artifacts.d.ts +2 -0
- package/dist/esm/events/payloads/dependencyTypes.d.ts +1 -1
- package/dist/esm/events/payloads/thinking.d.ts +8 -21
- package/dist/esm/hosting/standingAgent/artifacts/facts.js +1 -0
- package/dist/esm/hosting/standingAgent/artifacts/facts.js.map +1 -1
- package/dist/esm/lib/saidByPerson.d.ts +2 -0
- package/dist/esm/lib/saidByPerson.js +3 -0
- package/dist/esm/lib/saidByPerson.js.map +1 -1
- package/dist/esm/provider-contract/types.d.ts +7 -15
- package/dist/esm/provider-contract/types.js.map +1 -1
- package/dist/esm/redaction/conversation.js +13 -1
- package/dist/esm/redaction/conversation.js.map +1 -1
- package/dist/esm/redaction/knownStrings/fields-1.d.ts +1 -1
- package/dist/esm/redaction/knownStrings/fields-1.js +1 -1
- package/dist/esm/redaction/knownStrings/fields-1.js.map +1 -1
- package/dist/esm/redaction/knownStrings/fields-2.d.ts +1 -0
- package/dist/esm/redaction/knownStrings/fields-2.js +1 -0
- package/dist/esm/redaction/knownStrings/fields-2.js.map +1 -1
- package/dist/esm/redaction/knownStrings/words-1.d.ts +4 -4
- package/dist/esm/redaction/knownStrings/words-1.js +4 -4
- package/dist/esm/redaction/knownStrings/words-1.js.map +1 -1
- package/dist/esm/redaction/knownStrings/words-2.d.ts +6 -0
- package/dist/esm/redaction/knownStrings/words-2.js +6 -0
- package/dist/esm/redaction/knownStrings/words-2.js.map +1 -1
- package/dist/esm/thinking/anthropicTurn.d.ts +12 -0
- package/dist/esm/thinking/anthropicTurn.js +24 -0
- package/dist/esm/thinking/anthropicTurn.js.map +1 -0
- package/dist/esm/thinking/types.d.ts +7 -9
- package/dist/esm/time-travel/servedView/gaps.d.ts +1 -1
- package/dist/esm/time-travel/servedView/gaps.js +28 -2
- package/dist/esm/time-travel/servedView/gaps.js.map +1 -1
- package/dist/hosting/standingAgent/artifacts/facts.js +1 -0
- package/dist/hosting/standingAgent/artifacts/facts.js.map +1 -1
- package/dist/lib/saidByPerson.js +4 -1
- package/dist/lib/saidByPerson.js.map +1 -1
- package/dist/provider-contract/types.js.map +1 -1
- package/dist/redaction/conversation.js +13 -1
- package/dist/redaction/conversation.js.map +1 -1
- package/dist/redaction/knownStrings/fields-1.js +1 -1
- package/dist/redaction/knownStrings/fields-1.js.map +1 -1
- package/dist/redaction/knownStrings/fields-2.js +1 -0
- package/dist/redaction/knownStrings/fields-2.js.map +1 -1
- package/dist/redaction/knownStrings/words-1.js +4 -4
- package/dist/redaction/knownStrings/words-1.js.map +1 -1
- package/dist/redaction/knownStrings/words-2.js +6 -0
- package/dist/redaction/knownStrings/words-2.js.map +1 -1
- package/dist/thinking/anthropicTurn.js +28 -0
- package/dist/thinking/anthropicTurn.js.map +1 -0
- package/dist/time-travel/servedView/gaps.js +28 -2
- package/dist/time-travel/servedView/gaps.js.map +1 -1
- package/dist/types/adapters/llm/AnthropicProvider.d.ts +5 -0
- package/dist/types/adapters/llm/AnthropicProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/OllamaProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/anthropicThinkingReplay.d.ts.map +1 -1
- package/dist/types/adapters/llm/anthropicToolArguments.d.ts +3 -1
- package/dist/types/adapters/llm/anthropicToolArguments.d.ts.map +1 -1
- package/dist/types/adapters/llm/ollamaErrors.d.ts +24 -0
- package/dist/types/adapters/llm/ollamaErrors.d.ts.map +1 -0
- package/dist/types/adapters/observability/assessmentReasonWords.d.ts.map +1 -1
- package/dist/types/adapters/observability/auditShapes/events/decisions.d.ts.map +1 -1
- package/dist/types/adapters/observability/auditShapes/events/streaming.d.ts.map +1 -1
- package/dist/types/answer-account/facts/standing.d.ts.map +1 -1
- package/dist/types/answer-account/howSureReasonTemplates.d.ts +4 -0
- package/dist/types/answer-account/howSureReasonTemplates.d.ts.map +1 -1
- package/dist/types/answer-account/templates.d.ts +5 -1
- package/dist/types/answer-account/templates.d.ts.map +1 -1
- package/dist/types/artifacts/gcsArtifacts.d.ts.map +1 -1
- package/dist/types/artifacts/minting.d.ts +2 -1
- package/dist/types/artifacts/minting.d.ts.map +1 -1
- package/dist/types/artifacts/naming.d.ts +2 -0
- package/dist/types/artifacts/naming.d.ts.map +1 -1
- package/dist/types/artifacts/payload.d.ts +13 -0
- package/dist/types/artifacts/payload.d.ts.map +1 -1
- package/dist/types/artifacts/s3Artifacts.d.ts.map +1 -1
- package/dist/types/artifacts/sqliteArtifacts.d.ts.map +1 -1
- package/dist/types/artifacts/types.d.ts +2 -0
- package/dist/types/artifacts/types.d.ts.map +1 -1
- package/dist/types/core/agent/assessment/assess.d.ts +2 -4
- package/dist/types/core/agent/assessment/assess.d.ts.map +1 -1
- package/dist/types/core/agent/assessment/compose.d.ts.map +1 -1
- package/dist/types/core/agent/assessment/reasonClasses.d.ts.map +1 -1
- package/dist/types/core/agent/assessment/reasons.d.ts.map +1 -1
- package/dist/types/core/agent/assessment/results/library-did/stage.d.ts +17 -0
- package/dist/types/core/agent/assessment/results/library-did/stage.d.ts.map +1 -0
- package/dist/types/core/agent/assessment/stage.d.ts.map +1 -1
- package/dist/types/core/agent/assessment/standingAdmission.d.ts.map +1 -1
- package/dist/types/core/agent/assessment/standingFacts.d.ts +3 -0
- package/dist/types/core/agent/assessment/standingFacts.d.ts.map +1 -1
- package/dist/types/core/agent/assessment/types.d.ts +3 -1
- package/dist/types/core/agent/assessment/types.d.ts.map +1 -1
- package/dist/types/core/agent/buildDynamicAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/dynamicTurnSeed.d.ts +15 -0
- package/dist/types/core/agent/dynamicTurnSeed.d.ts.map +1 -0
- package/dist/types/core/agent/honesty/answerFoldReads.d.ts +2 -1
- package/dist/types/core/agent/honesty/answerFoldReads.d.ts.map +1 -1
- package/dist/types/core/agent/honesty/libraryResultLimits.d.ts +45 -0
- package/dist/types/core/agent/honesty/libraryResultLimits.d.ts.map +1 -0
- package/dist/types/core/agent/honesty/settledToolCalls.d.ts.map +1 -1
- package/dist/types/core/agent/llmCallReads.d.ts +4 -2
- package/dist/types/core/agent/llmCallReads.d.ts.map +1 -1
- package/dist/types/core/agent/recordedCalls/toolTurnCheckpoint.d.ts +3 -0
- package/dist/types/core/agent/recordedCalls/toolTurnCheckpoint.d.ts.map +1 -1
- package/dist/types/core/agent/requestTurn/checkpoint.d.ts +7 -0
- package/dist/types/core/agent/requestTurn/checkpoint.d.ts.map +1 -0
- package/dist/types/core/agent/requestTurn/native.d.ts +5 -0
- package/dist/types/core/agent/requestTurn/native.d.ts.map +1 -0
- package/dist/types/core/agent/requestTurn/replayPrefix.d.ts +41 -0
- package/dist/types/core/agent/requestTurn/replayPrefix.d.ts.map +1 -0
- package/dist/types/core/agent/requestTurn/state.d.ts +24 -0
- package/dist/types/core/agent/requestTurn/state.d.ts.map +1 -0
- package/dist/types/core/agent/resultRowsets/resumed.d.ts +4 -13
- package/dist/types/core/agent/resultRowsets/resumed.d.ts.map +1 -1
- package/dist/types/core/agent/runtime/chart/chartDependencies.d.ts.map +1 -1
- package/dist/types/core/agent/runtime/conversation/owner.d.ts.map +1 -1
- package/dist/types/core/agent/runtime/conversation/seedHistory.d.ts +4 -19
- package/dist/types/core/agent/runtime/conversation/seedHistory.d.ts.map +1 -1
- package/dist/types/core/agent/stages/callLLM/groundedText.d.ts +1 -1
- package/dist/types/core/agent/stages/callLLM/groundedText.d.ts.map +1 -1
- package/dist/types/core/agent/stages/callLLM/liveChunks.d.ts +17 -0
- package/dist/types/core/agent/stages/callLLM/liveChunks.d.ts.map +1 -0
- package/dist/types/core/agent/stages/callLLM/requestOnly.d.ts +24 -0
- package/dist/types/core/agent/stages/callLLM/requestOnly.d.ts.map +1 -0
- package/dist/types/core/agent/stages/callLLM/requestProjection.d.ts +11 -0
- package/dist/types/core/agent/stages/callLLM/requestProjection.d.ts.map +1 -0
- package/dist/types/core/agent/stages/callLLM.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls/compose.d.ts +2 -5
- package/dist/types/core/agent/stages/toolCalls/compose.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls/contracts/callCells.d.ts +2 -1
- package/dist/types/core/agent/stages/toolCalls/contracts/callCells.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls/contracts/callFacts.d.ts +2 -1
- package/dist/types/core/agent/stages/toolCalls/contracts/callFacts.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls/contracts/operations/context.d.ts +2 -1
- package/dist/types/core/agent/stages/toolCalls/contracts/operations/context.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls/contracts/operations/limits.d.ts +8 -4
- package/dist/types/core/agent/stages/toolCalls/contracts/operations/limits.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls/decorators/limitsOperations.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls/execution/artifactsOperations.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls/execution/contextOperations.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls/execution/dispatchCall.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls/execution/finalizeCallResult.d.ts +1 -4
- package/dist/types/core/agent/stages/toolCalls/execution/finalizeCallResult.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls/execution/initialInvocation.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls/execution/resumedInvocation.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls/resume/ask.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls/resume/checkIn.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls/resume/credential.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls/resume/plain.d.ts.map +1 -1
- package/dist/types/core/agent/toolResultCap.d.ts +7 -0
- package/dist/types/core/agent/toolResultCap.d.ts.map +1 -1
- package/dist/types/core/agent/types/state/honesty.d.ts +4 -0
- package/dist/types/core/agent/types/state/honesty.d.ts.map +1 -1
- package/dist/types/core/checkpointFailurePhase.d.ts +16 -0
- package/dist/types/core/checkpointFailurePhase.d.ts.map +1 -0
- package/dist/types/core/runCheckpoint.d.ts +1 -15
- package/dist/types/core/runCheckpoint.d.ts.map +1 -1
- package/dist/types/core/runCheckpointTypes.d.ts +3 -0
- package/dist/types/core/runCheckpointTypes.d.ts.map +1 -1
- package/dist/types/events/payloads/artifacts.d.ts +2 -0
- package/dist/types/events/payloads/artifacts.d.ts.map +1 -1
- package/dist/types/events/payloads/dependencyTypes.d.ts +1 -1
- package/dist/types/events/payloads/dependencyTypes.d.ts.map +1 -1
- package/dist/types/events/payloads/thinking.d.ts +8 -21
- package/dist/types/events/payloads/thinking.d.ts.map +1 -1
- package/dist/types/hosting/standingAgent/artifacts/facts.d.ts.map +1 -1
- package/dist/types/lib/saidByPerson.d.ts +2 -0
- package/dist/types/lib/saidByPerson.d.ts.map +1 -1
- package/dist/types/provider-contract/types.d.ts +7 -15
- package/dist/types/provider-contract/types.d.ts.map +1 -1
- package/dist/types/redaction/conversation.d.ts.map +1 -1
- package/dist/types/redaction/knownStrings/fields-1.d.ts +1 -1
- package/dist/types/redaction/knownStrings/fields-2.d.ts +1 -0
- package/dist/types/redaction/knownStrings/fields-2.d.ts.map +1 -1
- package/dist/types/redaction/knownStrings/words-1.d.ts +4 -4
- package/dist/types/redaction/knownStrings/words-2.d.ts +6 -0
- package/dist/types/redaction/knownStrings/words-2.d.ts.map +1 -1
- package/dist/types/thinking/anthropicTurn.d.ts +13 -0
- package/dist/types/thinking/anthropicTurn.d.ts.map +1 -0
- package/dist/types/thinking/types.d.ts +7 -9
- package/dist/types/thinking/types.d.ts.map +1 -1
- package/dist/types/time-travel/servedView/gaps.d.ts +1 -1
- package/dist/types/time-travel/servedView/gaps.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { throwIfAborted } from '../../../../lib/abort.js';
|
|
2
|
+
import { typedEmit } from '../../../../recorders/core/typedEmit.js';
|
|
3
|
+
/** One attempt's live output, subject to the call stage's cancellation signal. */
|
|
4
|
+
export function liveChunkEmitter(scope, signal, options) {
|
|
5
|
+
const { providerName, iteration, suppressDraftTokens, textFilter, onFirstChunk } = options;
|
|
6
|
+
let firstChunkFired = false;
|
|
7
|
+
let lastTokenIndex = -1;
|
|
8
|
+
return {
|
|
9
|
+
push(chunk) {
|
|
10
|
+
// A provider is a port anyone can implement, and a non-terminal
|
|
11
|
+
// chunk that carries no `content` used to die when checking its length,
|
|
12
|
+
// naming neither the provider nor the contract it missed. A provider
|
|
13
|
+
// that uses its own terminal marker instead of `done: true` hits this
|
|
14
|
+
// path, so the refusal names the terminal contract as well.
|
|
15
|
+
const visible = chunk.content;
|
|
16
|
+
if (typeof visible !== 'string') {
|
|
17
|
+
throw new TypeError(`provider '${providerName}' yielded a stream chunk whose \`content\` is ` +
|
|
18
|
+
`${visible === undefined ? 'missing' : `a ${typeof visible}`}. ` +
|
|
19
|
+
`Every chunk from LLMProvider.stream() is ` +
|
|
20
|
+
`{ tokenIndex: number, content: string, done: boolean }, and the LAST one is ` +
|
|
21
|
+
`{ content: '', done: true, response } — the response payload rides the ` +
|
|
22
|
+
`terminal chunk. A chunk that ends the stream any other way is not seen as ` +
|
|
23
|
+
`terminal, and its missing content stops the run here.`);
|
|
24
|
+
}
|
|
25
|
+
const tokenIndex = chunk.tokenIndex;
|
|
26
|
+
const thinking = suppressDraftTokens ? undefined : chunk.thinkingDelta;
|
|
27
|
+
const hasThinking = typeof thinking === 'string' && thinking.length > 0;
|
|
28
|
+
const hasText = visible.length > 0;
|
|
29
|
+
const kind = hasThinking ? chunk.thinkingKind : undefined;
|
|
30
|
+
throwIfAborted(signal);
|
|
31
|
+
if (!firstChunkFired && (hasThinking || hasText)) {
|
|
32
|
+
firstChunkFired = true;
|
|
33
|
+
onFirstChunk?.();
|
|
34
|
+
}
|
|
35
|
+
if (hasThinking) {
|
|
36
|
+
lastTokenIndex = tokenIndex;
|
|
37
|
+
typedEmit(scope, 'agentfootprint.stream.thinking_delta', {
|
|
38
|
+
iteration,
|
|
39
|
+
tokenIndex,
|
|
40
|
+
kind: kind === 'provider-summary' || kind === 'raw-reasoning' ? kind : 'unclassified',
|
|
41
|
+
content: thinking,
|
|
42
|
+
});
|
|
43
|
+
// An inline listener can cancel the run during delivery of this fragment.
|
|
44
|
+
throwIfAborted(signal);
|
|
45
|
+
}
|
|
46
|
+
if (hasText && !suppressDraftTokens) {
|
|
47
|
+
const content = textFilter === undefined ? visible : textFilter.push(visible);
|
|
48
|
+
lastTokenIndex = tokenIndex;
|
|
49
|
+
if (content.length > 0) {
|
|
50
|
+
typedEmit(scope, 'agentfootprint.stream.token', { iteration, tokenIndex, content });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
finish() {
|
|
55
|
+
throwIfAborted(signal);
|
|
56
|
+
// The scanner can hold a trailing newline or partial key through EOF.
|
|
57
|
+
const content = textFilter?.end() ?? '';
|
|
58
|
+
if (content.length > 0) {
|
|
59
|
+
typedEmit(scope, 'agentfootprint.stream.token', {
|
|
60
|
+
iteration,
|
|
61
|
+
tokenIndex: lastTokenIndex + 1,
|
|
62
|
+
content,
|
|
63
|
+
});
|
|
64
|
+
// An abort here also prevents fallback completion on older streams.
|
|
65
|
+
throwIfAborted(signal);
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=liveChunks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liveChunks.js","sourceRoot":"","sources":["../../../../../../src/core/agent/stages/callLLM/liveChunks.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { TypedScope } from 'footprintjs';
|
|
2
|
+
import type { LLMMessage, LLMToolSchema } from '../../../../provider-contract/types.js';
|
|
3
|
+
import type { ToolsWithheld } from '../../composeRequest.js';
|
|
4
|
+
import type { FindingsLedger } from '../../findings/types.js';
|
|
5
|
+
import type { RequestOnlyMessage } from '../../requestTurn/replayPrefix.js';
|
|
6
|
+
import type { AgentState } from '../../types.js';
|
|
7
|
+
import type { CallLLMStageDeps } from './types.js';
|
|
8
|
+
interface RequestOnlyContext {
|
|
9
|
+
readonly iteration: number;
|
|
10
|
+
readonly committed: readonly LLMMessage[];
|
|
11
|
+
readonly messages: readonly LLMMessage[];
|
|
12
|
+
readonly ledger: FindingsLedger | undefined;
|
|
13
|
+
readonly registeredToolSchemas: readonly LLMToolSchema[];
|
|
14
|
+
readonly withheld: ToolsWithheld | null;
|
|
15
|
+
}
|
|
16
|
+
/** A pending turn cannot absorb a temporary change to its signed system prompt. */
|
|
17
|
+
export declare function recoveryFeedback(instruction: string): RequestOnlyMessage;
|
|
18
|
+
export declare function isRecoveryFeedback(message: LLMMessage): boolean;
|
|
19
|
+
/** Lines composed for THIS request and written to no history — each with
|
|
20
|
+
* the mechanism that composed it, so the receipt can say a line existed
|
|
21
|
+
* without saying what it said. */
|
|
22
|
+
export declare function requestOnlyMessages(scope: TypedScope<AgentState>, deps: CallLLMStageDeps, { iteration, committed, messages, ledger, registeredToolSchemas, withheld }: RequestOnlyContext): readonly RequestOnlyMessage[];
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { NATIVE_RECOVERY_FRAME_PREFIX } from '../../../../lib/saidByPerson.js';
|
|
2
|
+
import { evidenceConclusionLine } from '../../evidence/recovery.js';
|
|
3
|
+
import { FINDINGS_LAYOUT, findingsContext, findingsContextBytes } from '../../findings/context.js';
|
|
4
|
+
import { stagedRefsNudgeFor } from '../stagedRefsNudge.js';
|
|
5
|
+
const INTERNAL_RETRY = `${NATIVE_RECOVERY_FRAME_PREFIX} This is framework guidance, not a message from the person or evidence.]`;
|
|
6
|
+
/** A pending turn cannot absorb a temporary change to its signed system prompt. */
|
|
7
|
+
export function recoveryFeedback(instruction) {
|
|
8
|
+
return {
|
|
9
|
+
reason: 'native-turn-recovery',
|
|
10
|
+
message: {
|
|
11
|
+
role: 'user',
|
|
12
|
+
content: `${INTERNAL_RETRY}\n${instruction.replace('this is a system instruction, not a new user message', 'this feedback is not a new user message')}`,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function isRecoveryFeedback(message) {
|
|
17
|
+
return message.role === 'user' && message.content.startsWith(INTERNAL_RETRY);
|
|
18
|
+
}
|
|
19
|
+
/** Lines composed for THIS request and written to no history — each with
|
|
20
|
+
* the mechanism that composed it, so the receipt can say a line existed
|
|
21
|
+
* without saying what it said. */
|
|
22
|
+
export function requestOnlyMessages(scope, deps, { iteration, committed, messages, ledger, registeredToolSchemas, withheld }) {
|
|
23
|
+
const requestOnly = [];
|
|
24
|
+
// THE STAGED-REFS NUDGE (`nudge: true` on the evidence gate). Judged on
|
|
25
|
+
// `registeredToolSchemas` — the tools REALLY served this call, so the
|
|
26
|
+
// wrap-up's withheld surface arms nothing and a synthetic schema tool is
|
|
27
|
+
// never named a spender. The line is request-only: `scope.history` is
|
|
28
|
+
// untouched, so it never enters the exempt corpus and never persists —
|
|
29
|
+
// recomposed each iteration, present exactly while both conditions hold.
|
|
30
|
+
const nudge = deps.toolWants === undefined
|
|
31
|
+
? undefined
|
|
32
|
+
: stagedRefsNudgeFor(scope, messages, deps.toolWants, registeredToolSchemas, iteration);
|
|
33
|
+
if (nudge !== undefined) {
|
|
34
|
+
requestOnly.push({ message: nudge, reason: 'staged-refs-nudge' });
|
|
35
|
+
}
|
|
36
|
+
// THE TIME LINE (step T6b, `.time({ reader })` only) — the library's conclusion about the
|
|
37
|
+
// person's time words, LAST, at the decision point: a settled window with its source and each
|
|
38
|
+
// tool's values, or a quote not confirmed yet and the one move that asks the person. Composed
|
|
39
|
+
// by the tools slot from the tools it served (`agent/arguments/serve/windows.ts` · `timeWindowsLine`)
|
|
40
|
+
// and served only on the iteration that composed it — a slot that did not re-run (classic
|
|
41
|
+
// mode) leaves an older line, which is never served. Request-only like the nudge above; not
|
|
42
|
+
// on the wrap-up call, whose tools are withheld. `servedView` rebuilds it from the same key.
|
|
43
|
+
const timeLine = deps.timeLine === true ? scope.timeLine : undefined;
|
|
44
|
+
if (timeLine !== undefined &&
|
|
45
|
+
timeLine.iteration === iteration &&
|
|
46
|
+
timeLine.text.length > 0 &&
|
|
47
|
+
// `wrapUpAsked` is read here as it always was (an unarmed agent's reads
|
|
48
|
+
// are unchanged); `withheld` adds the revision's rule.
|
|
49
|
+
scope.wrapUpAsked !== true &&
|
|
50
|
+
withheld === null) {
|
|
51
|
+
const line = { role: 'user', content: timeLine.text };
|
|
52
|
+
requestOnly.push({ message: line, reason: 'time-window-line' });
|
|
53
|
+
}
|
|
54
|
+
// THE EVIDENCE CONCLUSION (the figures dial) — the library's finding about
|
|
55
|
+
// the numbers it flagged, LAST, on the one call that serves the revision
|
|
56
|
+
// instruction (`evidence/figures.ts` · `figuresConclusionLine`). Absent
|
|
57
|
+
// whenever the dial is off or no flagged value was a number.
|
|
58
|
+
const conclusion = deps.hasEvidenceRecovery === true
|
|
59
|
+
? evidenceConclusionLine(scope.evidenceRecovery, scope.evidenceRecoveryUsed, iteration)
|
|
60
|
+
: undefined;
|
|
61
|
+
if (conclusion !== undefined) {
|
|
62
|
+
const line = { role: 'user', content: conclusion };
|
|
63
|
+
requestOnly.push({ message: line, reason: 'evidence-conclusion' });
|
|
64
|
+
}
|
|
65
|
+
if (deps.hasFindingsLedger === true) {
|
|
66
|
+
// A resumed leg can have a different host configuration from its checkpoint.
|
|
67
|
+
// Record the layout actually used by THIS call; replay reads its commit.
|
|
68
|
+
scope.findingsLayout = FINDINGS_LAYOUT;
|
|
69
|
+
scope.findingsContextBytes = findingsContextBytes(deps.findingsContextBytes);
|
|
70
|
+
const line = {
|
|
71
|
+
role: 'user',
|
|
72
|
+
content: findingsContext(committed, ledger, deps.findingsContextBytes),
|
|
73
|
+
};
|
|
74
|
+
requestOnly.push({ message: line, reason: 'findings-data' });
|
|
75
|
+
}
|
|
76
|
+
return requestOnly;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=requestOnly.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestOnly.js","sourceRoot":"","sources":["../../../../../../src/core/agent/stages/callLLM/requestOnly.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TypedScope } from 'footprintjs';
|
|
2
|
+
import type { LLMMessage } from '../../../../provider-contract/types.js';
|
|
3
|
+
import type { AgentState } from '../../types.js';
|
|
4
|
+
/** Decide which native prefix is still live as the stage assembles this call. */
|
|
5
|
+
export declare function projectCallHistory(scope: TypedScope<AgentState>, history: readonly LLMMessage[], rendered: readonly LLMMessage[], needsPrivateClosure: boolean): {
|
|
6
|
+
replayFrames: readonly import("../../requestTurn/replayPrefix.js").ReplayPrefixFrame[] | undefined;
|
|
7
|
+
closure: import("../../requestTurn/replayPrefix.js").RequestOnlyMessage | undefined;
|
|
8
|
+
continuing: import("../../requestTurn/replayPrefix.js").ReplayPrefixProjection | undefined;
|
|
9
|
+
messages: readonly LLMMessage[];
|
|
10
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { openReplayProjection, privateTurnEnd, readRequestReplay, } from '../../requestTurn/state.js';
|
|
2
|
+
/** Decide which native prefix is still live as the stage assembles this call. */
|
|
3
|
+
export function projectCallHistory(scope, history, rendered, needsPrivateClosure) {
|
|
4
|
+
const stored = 'requestReplay' in scope
|
|
5
|
+
? scope.$getValue('requestReplay')
|
|
6
|
+
: undefined;
|
|
7
|
+
const replayState = stored === undefined ? undefined : readRequestReplay(stored);
|
|
8
|
+
const prefix = openReplayProjection(replayState, history, rendered);
|
|
9
|
+
const closure = needsPrivateClosure && prefix !== undefined && replayState?.closing !== undefined
|
|
10
|
+
? privateTurnEnd(history, replayState.closing, scope.$getArgs()
|
|
11
|
+
?.priorReplayThinking ??
|
|
12
|
+
scope.$getValue('thinkingBlocks'))
|
|
13
|
+
: undefined;
|
|
14
|
+
const continuing = closure === undefined ? prefix : undefined;
|
|
15
|
+
return {
|
|
16
|
+
replayFrames: replayState?.frames,
|
|
17
|
+
closure,
|
|
18
|
+
continuing,
|
|
19
|
+
messages: continuing?.history ?? rendered,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=requestProjection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestProjection.js","sourceRoot":"","sources":["../../../../../../src/core/agent/stages/callLLM/requestProjection.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,iBAAiB,GAElB,MAAM,4BAA4B,CAAC;AAGpC,iFAAiF;AACjF,MAAM,UAAU,kBAAkB,CAChC,KAA6B,EAC7B,OAA8B,EAC9B,QAA+B,EAC/B,mBAA4B;IAE5B,MAAM,MAAM,GACV,eAAe,IAAI,KAAK;QACtB,CAAC,CAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAoC;QACtE,CAAC,CAAC,SAAS,CAAC;IAChB,MAAM,WAAW,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACjF,MAAM,MAAM,GAAG,oBAAoB,CAAC,WAAW,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IACpE,MAAM,OAAO,GACX,mBAAmB,IAAI,MAAM,KAAK,SAAS,IAAI,WAAW,EAAE,OAAO,KAAK,SAAS;QAC/E,CAAC,CAAC,cAAc,CACZ,OAAO,EACP,WAAW,CAAC,OAAO,EACnB,KAAK,CAAC,QAAQ,EAAsD;YAClE,EAAE,mBAAmB;YACpB,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAkC,CACtE;QACH,CAAC,CAAC,SAAS,CAAC;IAChB,MAAM,UAAU,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9D,OAAO;QACL,YAAY,EAAE,WAAW,EAAE,MAAM;QACjC,OAAO;QACP,UAAU;QACV,QAAQ,EAAE,UAAU,EAAE,OAAO,IAAI,QAAQ;KAC1C,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { projectSourceInstructions } from '../sourceContract.js';
|
|
2
2
|
import { recordModelContext } from '../../../recorders/core/recordModelContext.js';
|
|
3
3
|
import { groundedTextOf } from './callLLM/groundedText.js';
|
|
4
|
-
import { FINDINGS_LAYOUT, findingsContext, findingsContextBytes } from '../findings/context.js';
|
|
5
4
|
import { captureFindingsRequest } from '../findings/admission.js';
|
|
6
5
|
import { issuedTicketsOf } from '../placedTickets.js';
|
|
7
6
|
import { completeObserved, observeCallRequests, servedRequestRecorder, streamObserved, } from './callLLM/servedRequest.js';
|
|
@@ -13,14 +12,15 @@ import { wireViolationsOf } from '../../../integrity/invariant-violation/wire.js
|
|
|
13
12
|
import { danglingReferencesOf } from '../../../integrity/dangling-reference/check.js';
|
|
14
13
|
import { declaredEnumValuesOf, unsupportedArgumentsOf, } from '../../../integrity/unsupported-argument/check.js';
|
|
15
14
|
import { toolNameOfMessage } from '../window/toolNames.js';
|
|
16
|
-
import {
|
|
15
|
+
import { evidenceRecoveryPiece } from '../evidence/recovery.js';
|
|
17
16
|
import { joinSystemPrompt, stripFrameworkFields, toolsWithheld } from '../composeRequest.js';
|
|
18
17
|
import { readExternalGrounds } from './callLLM/externalGrounds.js';
|
|
19
18
|
import { identifyAcceptedToolCalls } from './callLLM/acceptedCalls.js';
|
|
19
|
+
import { liveChunkEmitter } from './callLLM/liveChunks.js';
|
|
20
|
+
import { recoveryFeedback, requestOnlyMessages } from './callLLM/requestOnly.js';
|
|
20
21
|
import { assertForcedRequestSupported, describeProviderDispatch, detachProviderInput, providerDispatchFor, receiptProviderRequest, selectOutputFormat, } from './callLLM/providerRequest.js';
|
|
21
22
|
import { buildReceipt, receiptPieces } from '../receipt/receipt.js';
|
|
22
23
|
import { RECEIPT_KEY } from '../../../lib/conventions.js';
|
|
23
|
-
import { stagedRefsNudgeFor } from './stagedRefsNudge.js';
|
|
24
24
|
import { fileIntegrityFindings } from '../integrityFindings.js';
|
|
25
25
|
import { resilienceHooks } from '../../../recorders/core/resilienceHooks.js';
|
|
26
26
|
import { replayAttempts } from '../../../resilience/replayAttempt.js';
|
|
@@ -30,6 +30,10 @@ import { emitCostTick } from '../../cost.js';
|
|
|
30
30
|
import { applyOutputSchema } from '../../../answer-validation/outputSchema.js';
|
|
31
31
|
import { carriesFindingsDecoration, splitFindings, withoutFindingsArgument, } from '../findings/reserved.js';
|
|
32
32
|
import { collapseJudged } from '../findings/serve.js';
|
|
33
|
+
import { captureReplayPrefix, replayCacheMarkers } from '../requestTurn/replayPrefix.js';
|
|
34
|
+
import { afterReplayResponse, sameReplayProjection } from '../requestTurn/state.js';
|
|
35
|
+
import { writeRequestReplay } from '../requestTurn/native.js';
|
|
36
|
+
import { projectCallHistory } from './callLLM/requestProjection.js';
|
|
33
37
|
import { readSchemaToolAnswer } from '../outputEnforcement.js';
|
|
34
38
|
import { executeWithReliability, ValidationFailure, } from './reliabilityExecution.js';
|
|
35
39
|
/** The wrap-up call's tool list (9.56.0). A frozen module constant so the
|
|
@@ -148,7 +152,7 @@ export function buildCallLLMStage(deps) {
|
|
|
148
152
|
const collapsed = deps.hasFindingsLedger === true
|
|
149
153
|
? collapseJudged(committed, ledger, deps.findingsServe ?? 'ledger-and-facts')
|
|
150
154
|
: committed;
|
|
151
|
-
const
|
|
155
|
+
const rendered = collapsed === committed ? history : stripFrameworkFields(collapsed, true);
|
|
152
156
|
// ── the declared ontology, served (9.106.0) ──────────────────────────
|
|
153
157
|
// ONE gated read of the run constant seed wrote; the piece is a pure
|
|
154
158
|
// function of the spec and nothing else (no call number, no clock — the
|
|
@@ -208,80 +212,45 @@ export function buildCallLLMStage(deps) {
|
|
|
208
212
|
const registeredToolSchemas = withheld !== null
|
|
209
213
|
? EMPTY_TOOL_SCHEMAS
|
|
210
214
|
: scope.dynamicToolSchemas ?? deps.toolSchemas;
|
|
215
|
+
const { replayFrames, closure, continuing, messages } = projectCallHistory(scope, history, rendered, recoveryPiece !== undefined && withheld !== null);
|
|
211
216
|
// The forced schema rides on the wire and in `llm_start`. Offered contracts
|
|
212
217
|
// specialize the findings instruction in request-only copies that replay rebuilds.
|
|
213
|
-
const
|
|
218
|
+
const recoveryNote = recoveryPiece !== undefined && continuing !== undefined && withheld === null
|
|
219
|
+
? recoveryFeedback(recoveryPiece.rawContent)
|
|
220
|
+
: undefined;
|
|
221
|
+
const systemRecovery = recoveryNote === undefined ? recoveryPiece : undefined;
|
|
222
|
+
const systemPieces = projectSourceInstructions(systemRecovery === undefined && ontologyPieceRecord === undefined
|
|
214
223
|
? systemPromptInjections
|
|
215
224
|
: [
|
|
216
225
|
...systemPromptInjections,
|
|
217
|
-
...(
|
|
226
|
+
...(systemRecovery === undefined ? [] : [systemRecovery]),
|
|
218
227
|
...(ontologyPieceRecord === undefined ? [] : [ontologyPieceRecord]),
|
|
219
228
|
], registeredToolSchemas);
|
|
220
229
|
const systemPrompt = joinSystemPrompt(systemPieces);
|
|
221
230
|
const activeToolSchemas = deps.schemaTool
|
|
222
231
|
? [...registeredToolSchemas, deps.schemaTool]
|
|
223
232
|
: registeredToolSchemas;
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
const
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
// by the tools slot from the tools it served (`agent/arguments/serve/windows.ts` · `timeWindowsLine`)
|
|
246
|
-
// and served only on the iteration that composed it — a slot that did not re-run (classic
|
|
247
|
-
// mode) leaves an older line, which is never served. Request-only like the nudge above; not
|
|
248
|
-
// on the wrap-up call, whose tools are withheld. `servedView` rebuilds it from the same key.
|
|
249
|
-
const timeLine = deps.timeLine === true ? scope.timeLine : undefined;
|
|
250
|
-
if (timeLine !== undefined &&
|
|
251
|
-
timeLine.iteration === iteration &&
|
|
252
|
-
timeLine.text.length > 0 &&
|
|
253
|
-
// `wrapUpAsked` is read here as it always was (an unarmed agent's reads
|
|
254
|
-
// are unchanged); `withheld` adds the revision's rule.
|
|
255
|
-
scope.wrapUpAsked !== true &&
|
|
256
|
-
withheld === null) {
|
|
257
|
-
const line = { role: 'user', content: timeLine.text };
|
|
258
|
-
requestOnly.push({ message: line, reason: 'time-window-line' });
|
|
259
|
-
wireMessages = [...wireMessages, line];
|
|
260
|
-
}
|
|
261
|
-
// THE EVIDENCE CONCLUSION (the figures dial) — the library's finding about
|
|
262
|
-
// the numbers it flagged, LAST, on the one call that serves the revision
|
|
263
|
-
// instruction (`evidence/figures.ts` · `figuresConclusionLine`). Absent
|
|
264
|
-
// whenever the dial is off or no flagged value was a number.
|
|
265
|
-
const conclusion = deps.hasEvidenceRecovery === true
|
|
266
|
-
? evidenceConclusionLine(scope.evidenceRecovery, scope.evidenceRecoveryUsed, iteration)
|
|
267
|
-
: undefined;
|
|
268
|
-
if (conclusion !== undefined) {
|
|
269
|
-
const line = { role: 'user', content: conclusion };
|
|
270
|
-
requestOnly.push({ message: line, reason: 'evidence-conclusion' });
|
|
271
|
-
wireMessages = [...wireMessages, line];
|
|
272
|
-
}
|
|
273
|
-
if (deps.hasFindingsLedger === true) {
|
|
274
|
-
// A resumed leg can have a different host configuration from its checkpoint.
|
|
275
|
-
// Record the layout actually used by THIS call; replay reads its commit.
|
|
276
|
-
scope.findingsLayout = FINDINGS_LAYOUT;
|
|
277
|
-
scope.findingsContextBytes = findingsContextBytes(deps.findingsContextBytes);
|
|
278
|
-
const line = {
|
|
279
|
-
role: 'user',
|
|
280
|
-
content: findingsContext(committed, ledger, deps.findingsContextBytes),
|
|
281
|
-
};
|
|
282
|
-
requestOnly.push({ message: line, reason: 'findings-data' });
|
|
283
|
-
wireMessages = [...wireMessages, line];
|
|
284
|
-
}
|
|
233
|
+
const freshNotes = requestOnlyMessages(scope, deps, {
|
|
234
|
+
iteration,
|
|
235
|
+
committed,
|
|
236
|
+
messages,
|
|
237
|
+
ledger,
|
|
238
|
+
registeredToolSchemas,
|
|
239
|
+
withheld,
|
|
240
|
+
});
|
|
241
|
+
const recoveryContext = closure ?? recoveryNote;
|
|
242
|
+
const tail = recoveryContext === undefined ? freshNotes : [recoveryContext, ...freshNotes];
|
|
243
|
+
const prefixWire = continuing?.wire ?? messages;
|
|
244
|
+
const wireMessages = tail.length === 0 ? prefixWire : [...prefixWire, ...tail.map(({ message }) => message)];
|
|
245
|
+
const requestOnly = continuing === undefined
|
|
246
|
+
? tail
|
|
247
|
+
: [
|
|
248
|
+
...continuing.additions.map(({ message, reason, wireIndex }) => ({
|
|
249
|
+
message,
|
|
250
|
+
reason: `native-turn-prefix:${wireIndex}:${reason}`,
|
|
251
|
+
})),
|
|
252
|
+
...tail,
|
|
253
|
+
];
|
|
285
254
|
typedEmit(scope, 'agentfootprint.stream.llm_start', {
|
|
286
255
|
iteration,
|
|
287
256
|
provider: provider.name,
|
|
@@ -333,7 +302,7 @@ export function buildCallLLMStage(deps) {
|
|
|
333
302
|
// A custom strategy can create remote cache handles, so refuse a known
|
|
334
303
|
// unsupported effective request before even that preparation does I/O.
|
|
335
304
|
assertForcedRequestSupported(provider, baseRequest);
|
|
336
|
-
const cacheMarkers = scope.cacheMarkers ?? [];
|
|
305
|
+
const cacheMarkers = replayCacheMarkers(scope.cacheMarkers ?? [], continuing);
|
|
337
306
|
const detached = detachProviderInput(baseRequest, cacheMarkers, deps.outputFormat);
|
|
338
307
|
const serving = deps.recordReceipt === false
|
|
339
308
|
? undefined
|
|
@@ -410,7 +379,7 @@ export function buildCallLLMStage(deps) {
|
|
|
410
379
|
iteration,
|
|
411
380
|
systemPieces,
|
|
412
381
|
tools: activeToolSchemas,
|
|
413
|
-
requestOnly,
|
|
382
|
+
requestOnly: freshNotes,
|
|
414
383
|
}));
|
|
415
384
|
// THE CLOSURE CHECK (9.60.0, dangling-reference). At assembly, BEFORE the
|
|
416
385
|
// call — the composition defect exists whether or not the call lands. A
|
|
@@ -469,8 +438,8 @@ export function buildCallLLMStage(deps) {
|
|
|
469
438
|
}
|
|
470
439
|
// Streaming-first: when the provider implements `stream()` we
|
|
471
440
|
// consume chunk-by-chunk so consumers see tokens as they arrive
|
|
472
|
-
// instead of waiting for the full LLM call to finish.
|
|
473
|
-
//
|
|
441
|
+
// instead of waiting for the full LLM call to finish. Non-terminal
|
|
442
|
+
// chunks can carry thinking, visible text, or both. The
|
|
474
443
|
// terminal chunk SHOULD carry the authoritative `LLMResponse`;
|
|
475
444
|
// when it doesn't (older providers, partial implementations) we
|
|
476
445
|
// fall back to `complete()` for the authoritative payload —
|
|
@@ -492,6 +461,11 @@ export function buildCallLLMStage(deps) {
|
|
|
492
461
|
let answeredBy = { provider: provider.name, model, native: false };
|
|
493
462
|
let localFallback = false;
|
|
494
463
|
let acceptedFindingsRequest;
|
|
464
|
+
const preserveReplay = deps.hasEvidenceRecovery === true ||
|
|
465
|
+
deps.hasFindingsLedger === true ||
|
|
466
|
+
tail.length > 0 ||
|
|
467
|
+
continuing !== undefined;
|
|
468
|
+
let acceptedProjection = false;
|
|
495
469
|
const issued = deps.findings === true ? issuedTicketsOf(scope.placedTickets) : undefined;
|
|
496
470
|
const capture = (req) => captureFindingsRequest(req, committed, iteration, issued);
|
|
497
471
|
// The run signal reaches the wire. See callLLM/README.md#dispatch-lifetime.
|
|
@@ -505,17 +479,19 @@ export function buildCallLLMStage(deps) {
|
|
|
505
479
|
const attempts = replayAttempts(req, hooks.providerHooks ?? providerHooks);
|
|
506
480
|
let dispatch = describeProviderDispatch(selectedProvider, req);
|
|
507
481
|
let candidate = deps.findings === true ? capture(req) : undefined;
|
|
482
|
+
let stableProjection = preserveReplay && sameReplayProjection(wireMessages, req.messages);
|
|
508
483
|
if (selectedProvider !== provider)
|
|
509
484
|
serving?.discard();
|
|
510
|
-
const attemptHooks = observeCallRequests(attempts.hooks, serving === undefined && deps.findings !== true
|
|
485
|
+
const attemptHooks = observeCallRequests(attempts.hooks, serving === undefined && deps.findings !== true && !preserveReplay
|
|
511
486
|
? undefined
|
|
512
487
|
: (request) => {
|
|
513
488
|
serving?.beforeRequest(request);
|
|
514
489
|
if (deps.findings === true)
|
|
515
490
|
candidate = capture(request);
|
|
491
|
+
if (preserveReplay)
|
|
492
|
+
stableProjection = sameReplayProjection(wireMessages, request.messages);
|
|
516
493
|
}, serving?.discard);
|
|
517
494
|
let resp;
|
|
518
|
-
let firstChunkFired = false;
|
|
519
495
|
// THE STREAM CARRIES WHAT STANDS (9.114.2, `.findings()`): each chunk
|
|
520
496
|
// goes through the scanner the answer's peel uses, so a token never
|
|
521
497
|
// carries the model's `_findings` notes — not even when a chunk ends
|
|
@@ -525,7 +501,13 @@ export function buildCallLLMStage(deps) {
|
|
|
525
501
|
const shown = peel !== undefined && deps.suppressDraftTokens !== true
|
|
526
502
|
? peel.reservedMemberFilter()
|
|
527
503
|
: undefined;
|
|
528
|
-
|
|
504
|
+
const liveChunks = liveChunkEmitter(scope, runSignal, {
|
|
505
|
+
providerName: selectedProvider.name,
|
|
506
|
+
iteration,
|
|
507
|
+
suppressDraftTokens: deps.suppressDraftTokens === true,
|
|
508
|
+
textFilter: shown,
|
|
509
|
+
onFirstChunk: hooks.onFirstChunk,
|
|
510
|
+
});
|
|
529
511
|
if (selectedProvider.stream) {
|
|
530
512
|
for await (const chunk of streamObserved(selectedProvider, attempts.request, attemptHooks, runSignal)) {
|
|
531
513
|
if (chunk.done) {
|
|
@@ -533,51 +515,10 @@ export function buildCallLLMStage(deps) {
|
|
|
533
515
|
resp = chunk.response;
|
|
534
516
|
break;
|
|
535
517
|
}
|
|
536
|
-
|
|
537
|
-
// chunk that carries no `content` used to die on the next line as
|
|
538
|
-
// `Cannot read properties of undefined (reading 'length')` —
|
|
539
|
-
// naming neither the provider nor the contract it missed. The
|
|
540
|
-
// commonest shape of the mistake is a chunk that ends the stream
|
|
541
|
-
// with its own marker instead of `done: true`, which is why the
|
|
542
|
-
// refusal says what the terminal chunk looks like.
|
|
543
|
-
if (typeof chunk.content !== 'string') {
|
|
544
|
-
throw new TypeError(`provider '${selectedProvider.name}' yielded a stream chunk whose \`content\` is ` +
|
|
545
|
-
`${chunk.content === undefined ? 'missing' : `a ${typeof chunk.content}`}. ` +
|
|
546
|
-
`Every chunk from LLMProvider.stream() is ` +
|
|
547
|
-
`{ tokenIndex: number, content: string, done: boolean }, and the LAST one is ` +
|
|
548
|
-
`{ content: '', done: true, response } — the response payload rides the ` +
|
|
549
|
-
`terminal chunk. A chunk that ends the stream any other way is not seen as ` +
|
|
550
|
-
`terminal, and its missing content stops the run here.`);
|
|
551
|
-
}
|
|
552
|
-
if (chunk.content.length > 0) {
|
|
553
|
-
if (!firstChunkFired) {
|
|
554
|
-
firstChunkFired = true;
|
|
555
|
-
hooks.onFirstChunk?.();
|
|
556
|
-
}
|
|
557
|
-
if (deps.suppressDraftTokens !== true) {
|
|
558
|
-
const content = shown === undefined ? chunk.content : shown.push(chunk.content);
|
|
559
|
-
lastTokenIndex = chunk.tokenIndex;
|
|
560
|
-
if (content.length > 0) {
|
|
561
|
-
typedEmit(scope, 'agentfootprint.stream.token', {
|
|
562
|
-
iteration,
|
|
563
|
-
tokenIndex: chunk.tokenIndex,
|
|
564
|
-
content,
|
|
565
|
-
});
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
}
|
|
518
|
+
liveChunks.push(chunk);
|
|
569
519
|
}
|
|
570
520
|
}
|
|
571
|
-
|
|
572
|
-
// last token (whitespace, a key it was reading, a `{`…).
|
|
573
|
-
const held = shown?.end() ?? '';
|
|
574
|
-
if (held.length > 0) {
|
|
575
|
-
typedEmit(scope, 'agentfootprint.stream.token', {
|
|
576
|
-
iteration,
|
|
577
|
-
tokenIndex: lastTokenIndex + 1,
|
|
578
|
-
content: held,
|
|
579
|
-
});
|
|
580
|
-
}
|
|
521
|
+
liveChunks.finish();
|
|
581
522
|
if (!resp) {
|
|
582
523
|
// No `stream()` OR stream finished without a response payload.
|
|
583
524
|
// Raw errors propagate so the reliability loop can classify them;
|
|
@@ -594,6 +535,8 @@ export function buildCallLLMStage(deps) {
|
|
|
594
535
|
dispatch = describeProviderDispatch(selectedProvider, completion);
|
|
595
536
|
if (deps.findings === true)
|
|
596
537
|
candidate = capture(completion);
|
|
538
|
+
if (preserveReplay)
|
|
539
|
+
stableProjection = sameReplayProjection(wireMessages, completion.messages);
|
|
597
540
|
resp = await completeObserved(selectedProvider, completion, attemptHooks, runSignal);
|
|
598
541
|
}
|
|
599
542
|
// An answer that arrived after the abort is not an answer: refused here,
|
|
@@ -623,6 +566,7 @@ export function buildCallLLMStage(deps) {
|
|
|
623
566
|
: tagThinkingResponse(resp, String(hooks.providerIndex));
|
|
624
567
|
answeredBy = dispatch;
|
|
625
568
|
acceptedFindingsRequest = candidate;
|
|
569
|
+
acceptedProjection = stableProjection;
|
|
626
570
|
return attempts.response(answered);
|
|
627
571
|
};
|
|
628
572
|
// v2.13 — build the output-schema validator hook when both
|
|
@@ -750,6 +694,11 @@ export function buildCallLLMStage(deps) {
|
|
|
750
694
|
if (response.replay !== undefined || 'llmLatestReplay' in scope) {
|
|
751
695
|
scope.llmLatestReplay = response.replay === undefined ? undefined : [response.replay];
|
|
752
696
|
}
|
|
697
|
+
const nextReplay = !localFallback && acceptedProjection
|
|
698
|
+
? afterReplayResponse(response, continuing === undefined ? [] : replayFrames ?? [], (replay) => captureReplayPrefix(replay, history, messages, tail, continuing?.frozenBefore ?? 0), deps.toolsOffAfterRevision === true)
|
|
699
|
+
: undefined;
|
|
700
|
+
if (nextReplay !== undefined || replayFrames !== undefined)
|
|
701
|
+
writeRequestReplay(scope, nextReplay);
|
|
753
702
|
// v2.14 — hand provider-specific raw thinking data to the
|
|
754
703
|
// NormalizeThinking sub-subflow (the next stage in sf-call-llm
|
|
755
704
|
// when a ThinkingHandler is configured). Undefined when the
|
|
@@ -855,7 +804,7 @@ export function buildCallLLMStage(deps) {
|
|
|
855
804
|
// The recovery piece quotes the model's words; only the trusted
|
|
856
805
|
// system injections count as grounds when that piece is present.
|
|
857
806
|
// Findings DATA is a request-only message after history.
|
|
858
|
-
...(
|
|
807
|
+
...(systemRecovery === undefined
|
|
859
808
|
? llmRequest.systemPrompt === undefined
|
|
860
809
|
? []
|
|
861
810
|
: [llmRequest.systemPrompt]
|
|
@@ -867,7 +816,7 @@ export function buildCallLLMStage(deps) {
|
|
|
867
816
|
: []),
|
|
868
817
|
// Every tool result as the TOOL's own bytes — the inputs layer's note
|
|
869
818
|
// after a filled call's result is the library's words (`groundedTextOf`).
|
|
870
|
-
...groundedTextOf(frameMessages, committed),
|
|
819
|
+
...groundedTextOf(frameMessages, committed, continuing?.historyPositions),
|
|
871
820
|
],
|
|
872
821
|
assistant: frameMessages.filter((m) => m.role === 'assistant').map((m) => m.content),
|
|
873
822
|
...(external.length > 0 && { external }),
|