agentfootprint 9.129.0 → 9.131.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 +5 -0
- package/dist/adapters/llm/AnthropicProvider.js +10 -111
- package/dist/adapters/llm/AnthropicProvider.js.map +1 -1
- package/dist/adapters/llm/BedrockProvider.js +11 -4
- package/dist/adapters/llm/BedrockProvider.js.map +1 -1
- package/dist/adapters/llm/InvokeModelGatewayProvider.js +167 -35
- package/dist/adapters/llm/InvokeModelGatewayProvider.js.map +1 -1
- package/dist/adapters/llm/OpenAIProvider.js +5 -0
- package/dist/adapters/llm/OpenAIProvider.js.map +1 -1
- package/dist/adapters/llm/anthropicMessagesWire.js +20 -6
- package/dist/adapters/llm/anthropicMessagesWire.js.map +1 -1
- package/dist/adapters/llm/retryAfter.js +61 -0
- package/dist/adapters/llm/retryAfter.js.map +1 -0
- package/dist/adapters/types.js.map +1 -1
- package/dist/core/Agent.js +30 -0
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/agent/arguments/ask.js +297 -11
- package/dist/core/agent/arguments/ask.js.map +1 -1
- package/dist/core/agent/arguments/dispatch.js +15 -1
- package/dist/core/agent/arguments/dispatch.js.map +1 -1
- package/dist/core/agent/arguments/resolve.js +26 -5
- package/dist/core/agent/arguments/resolve.js.map +1 -1
- package/dist/core/agent/arguments/rows.js +10 -5
- package/dist/core/agent/arguments/rows.js.map +1 -1
- package/dist/core/agent/arguments/serve.js +248 -5
- package/dist/core/agent/arguments/serve.js.map +1 -1
- package/dist/core/agent/arguments/subflow.js +7 -3
- package/dist/core/agent/arguments/subflow.js.map +1 -1
- package/dist/core/agent/assessment/assess.js +45 -6
- package/dist/core/agent/assessment/assess.js.map +1 -1
- package/dist/core/agent/assessment/compose.js +3 -0
- package/dist/core/agent/assessment/compose.js.map +1 -1
- package/dist/core/agent/assessment/reasons.js +18 -0
- package/dist/core/agent/assessment/reasons.js.map +1 -1
- package/dist/core/agent/buildAgentChart.js +31 -1
- package/dist/core/agent/buildAgentChart.js.map +1 -1
- package/dist/core/agent/buildDynamicAgentChart.js +9 -0
- package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/core/agent/coverage/answer.js +19 -7
- package/dist/core/agent/coverage/answer.js.map +1 -1
- package/dist/core/agent/coverage/period.js +67 -2
- package/dist/core/agent/coverage/period.js.map +1 -1
- package/dist/core/agent/coverage/timeLimitFacts.js +70 -0
- package/dist/core/agent/coverage/timeLimitFacts.js.map +1 -0
- package/dist/core/agent/coverage/timeLimits.js +72 -0
- package/dist/core/agent/coverage/timeLimits.js.map +1 -0
- package/dist/core/agent/evidence/evidenceIndex.js +48 -7
- package/dist/core/agent/evidence/evidenceIndex.js.map +1 -1
- package/dist/core/agent/evidence/gate.js +9 -4
- package/dist/core/agent/evidence/gate.js.map +1 -1
- package/dist/core/agent/evidence/normalize.js +1 -105
- package/dist/core/agent/evidence/normalize.js.map +1 -1
- package/dist/core/agent/findings/ledger.js +8 -0
- package/dist/core/agent/findings/ledger.js.map +1 -1
- package/dist/core/agent/findings/types.js.map +1 -1
- package/dist/core/agent/honesty/mounts.js +79 -2
- package/dist/core/agent/honesty/mounts.js.map +1 -1
- package/dist/core/agent/results/subflow.js +43 -11
- package/dist/core/agent/results/subflow.js.map +1 -1
- package/dist/core/agent/stages/argumentAsk.js +75 -3
- package/dist/core/agent/stages/argumentAsk.js.map +1 -1
- package/dist/core/agent/stages/callLLM.js +16 -0
- package/dist/core/agent/stages/callLLM.js.map +1 -1
- package/dist/core/agent/stages/prepareFinal.js +28 -9
- package/dist/core/agent/stages/prepareFinal.js.map +1 -1
- package/dist/core/agent/stages/route.js +64 -6
- package/dist/core/agent/stages/route.js.map +1 -1
- package/dist/core/agent/stages/timeLineage.js +61 -0
- package/dist/core/agent/stages/timeLineage.js.map +1 -0
- package/dist/core/agent/stages/toolCalls.js +32 -1
- package/dist/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/core/runCheckpoint.js +2 -1
- package/dist/core/runCheckpoint.js.map +1 -1
- package/dist/core/slots/buildToolsSlot.js +30 -2
- package/dist/core/slots/buildToolsSlot.js.map +1 -1
- package/dist/core/time/ask.js +8 -3
- package/dist/core/time/ask.js.map +1 -1
- package/dist/core/time/bind.js +25 -55
- package/dist/core/time/bind.js.map +1 -1
- package/dist/core/time/check.js +261 -0
- package/dist/core/time/check.js.map +1 -0
- package/dist/core/time/checkRecord.js +97 -0
- package/dist/core/time/checkRecord.js.map +1 -0
- package/dist/core/time/convert.js +2 -12
- package/dist/core/time/convert.js.map +1 -1
- package/dist/core/time/drift.js +17 -10
- package/dist/core/time/drift.js.map +1 -1
- package/dist/core/time/forms.js +273 -0
- package/dist/core/time/forms.js.map +1 -0
- package/dist/core/time/present.js +2 -1
- package/dist/core/time/present.js.map +1 -1
- package/dist/core/time/range.js +12 -1
- package/dist/core/time/range.js.map +1 -1
- package/dist/core/time/reader.js +6 -2
- package/dist/core/time/reader.js.map +1 -1
- package/dist/core/time/readers/english.js +576 -0
- package/dist/core/time/readers/english.js.map +1 -0
- package/dist/core/time/readingAsk.js +8 -4
- package/dist/core/time/readingAsk.js.map +1 -1
- package/dist/core/time/resolve.js +43 -12
- package/dist/core/time/resolve.js.map +1 -1
- package/dist/core/time/rows.js +123 -6
- package/dist/core/time/rows.js.map +1 -1
- package/dist/core/time/rowsBuild.js +10 -4
- package/dist/core/time/rowsBuild.js.map +1 -1
- package/dist/core/time/textForms.js +133 -0
- package/dist/core/time/textForms.js.map +1 -0
- package/dist/core/time/windows.js +172 -0
- package/dist/core/time/windows.js.map +1 -0
- package/dist/esm/adapters/llm/AnthropicProvider.js +8 -109
- package/dist/esm/adapters/llm/AnthropicProvider.js.map +1 -1
- package/dist/esm/adapters/llm/BedrockProvider.js +11 -4
- package/dist/esm/adapters/llm/BedrockProvider.js.map +1 -1
- package/dist/esm/adapters/llm/InvokeModelGatewayProvider.d.ts +38 -4
- package/dist/esm/adapters/llm/InvokeModelGatewayProvider.js +167 -35
- package/dist/esm/adapters/llm/InvokeModelGatewayProvider.js.map +1 -1
- package/dist/esm/adapters/llm/OpenAIProvider.js +5 -0
- package/dist/esm/adapters/llm/OpenAIProvider.js.map +1 -1
- package/dist/esm/adapters/llm/anthropicMessagesWire.d.ts +6 -1
- package/dist/esm/adapters/llm/anthropicMessagesWire.js +20 -6
- package/dist/esm/adapters/llm/anthropicMessagesWire.js.map +1 -1
- package/dist/esm/adapters/llm/retryAfter.d.ts +27 -0
- package/dist/esm/adapters/llm/retryAfter.js +56 -0
- package/dist/esm/adapters/llm/retryAfter.js.map +1 -0
- package/dist/esm/adapters/types.d.ts +9 -0
- package/dist/esm/adapters/types.js.map +1 -1
- package/dist/esm/core/Agent.js +30 -0
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/agent/arguments/ask.d.ts +72 -3
- package/dist/esm/core/agent/arguments/ask.js +291 -5
- package/dist/esm/core/agent/arguments/ask.js.map +1 -1
- package/dist/esm/core/agent/arguments/dispatch.js +15 -1
- package/dist/esm/core/agent/arguments/dispatch.js.map +1 -1
- package/dist/esm/core/agent/arguments/resolve.d.ts +18 -1
- package/dist/esm/core/agent/arguments/resolve.js +26 -5
- package/dist/esm/core/agent/arguments/resolve.js.map +1 -1
- package/dist/esm/core/agent/arguments/rows.d.ts +8 -6
- package/dist/esm/core/agent/arguments/rows.js +10 -5
- package/dist/esm/core/agent/arguments/rows.js.map +1 -1
- package/dist/esm/core/agent/arguments/serve.d.ts +104 -4
- package/dist/esm/core/agent/arguments/serve.js +245 -5
- package/dist/esm/core/agent/arguments/serve.js.map +1 -1
- package/dist/esm/core/agent/arguments/subflow.d.ts +5 -2
- package/dist/esm/core/agent/arguments/subflow.js +7 -3
- package/dist/esm/core/agent/arguments/subflow.js.map +1 -1
- package/dist/esm/core/agent/assessment/assess.js +45 -6
- package/dist/esm/core/agent/assessment/assess.js.map +1 -1
- package/dist/esm/core/agent/assessment/compose.js +3 -0
- package/dist/esm/core/agent/assessment/compose.js.map +1 -1
- package/dist/esm/core/agent/assessment/reasons.js +18 -0
- package/dist/esm/core/agent/assessment/reasons.js.map +1 -1
- package/dist/esm/core/agent/assessment/types.d.ts +15 -1
- package/dist/esm/core/agent/buildAgentChart.d.ts +34 -0
- package/dist/esm/core/agent/buildAgentChart.js +28 -0
- package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
- package/dist/esm/core/agent/buildDynamicAgentChart.d.ts +1 -1
- package/dist/esm/core/agent/buildDynamicAgentChart.js +9 -0
- package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/esm/core/agent/coverage/answer.d.ts +14 -1
- package/dist/esm/core/agent/coverage/answer.js +18 -6
- package/dist/esm/core/agent/coverage/answer.js.map +1 -1
- package/dist/esm/core/agent/coverage/period.d.ts +41 -0
- package/dist/esm/core/agent/coverage/period.js +64 -1
- package/dist/esm/core/agent/coverage/period.js.map +1 -1
- package/dist/esm/core/agent/coverage/timeLimitFacts.d.ts +56 -0
- package/dist/esm/core/agent/coverage/timeLimitFacts.js +65 -0
- package/dist/esm/core/agent/coverage/timeLimitFacts.js.map +1 -0
- package/dist/esm/core/agent/coverage/timeLimits.d.ts +46 -0
- package/dist/esm/core/agent/coverage/timeLimits.js +67 -0
- package/dist/esm/core/agent/coverage/timeLimits.js.map +1 -0
- package/dist/esm/core/agent/evidence/evidenceIndex.d.ts +25 -2
- package/dist/esm/core/agent/evidence/evidenceIndex.js +47 -7
- package/dist/esm/core/agent/evidence/evidenceIndex.js.map +1 -1
- package/dist/esm/core/agent/evidence/gate.d.ts +7 -0
- package/dist/esm/core/agent/evidence/gate.js +9 -4
- package/dist/esm/core/agent/evidence/gate.js.map +1 -1
- package/dist/esm/core/agent/evidence/normalize.d.ts +0 -34
- package/dist/esm/core/agent/evidence/normalize.js +0 -103
- package/dist/esm/core/agent/evidence/normalize.js.map +1 -1
- package/dist/esm/core/agent/evidence/types.d.ts +12 -1
- package/dist/esm/core/agent/findings/ledger.js +8 -0
- package/dist/esm/core/agent/findings/ledger.js.map +1 -1
- package/dist/esm/core/agent/findings/types.d.ts +2 -2
- package/dist/esm/core/agent/findings/types.js.map +1 -1
- package/dist/esm/core/agent/honesty/mounts.d.ts +13 -0
- package/dist/esm/core/agent/honesty/mounts.js +79 -3
- package/dist/esm/core/agent/honesty/mounts.js.map +1 -1
- package/dist/esm/core/agent/results/subflow.d.ts +34 -2
- package/dist/esm/core/agent/results/subflow.js +43 -11
- package/dist/esm/core/agent/results/subflow.js.map +1 -1
- package/dist/esm/core/agent/stages/argumentAsk.d.ts +10 -0
- package/dist/esm/core/agent/stages/argumentAsk.js +76 -4
- package/dist/esm/core/agent/stages/argumentAsk.js.map +1 -1
- package/dist/esm/core/agent/stages/callLLM.d.ts +6 -0
- package/dist/esm/core/agent/stages/callLLM.js +16 -0
- package/dist/esm/core/agent/stages/callLLM.js.map +1 -1
- package/dist/esm/core/agent/stages/prepareFinal.d.ts +3 -2
- package/dist/esm/core/agent/stages/prepareFinal.js +28 -9
- package/dist/esm/core/agent/stages/prepareFinal.js.map +1 -1
- package/dist/esm/core/agent/stages/route.d.ts +29 -1
- package/dist/esm/core/agent/stages/route.js +64 -7
- package/dist/esm/core/agent/stages/route.js.map +1 -1
- package/dist/esm/core/agent/stages/timeLineage.d.ts +31 -0
- package/dist/esm/core/agent/stages/timeLineage.js +57 -0
- package/dist/esm/core/agent/stages/timeLineage.js.map +1 -0
- package/dist/esm/core/agent/stages/toolCalls.d.ts +11 -0
- package/dist/esm/core/agent/stages/toolCalls.js +32 -1
- package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/esm/core/agent/types.d.ts +12 -0
- package/dist/esm/core/runCheckpoint.js +2 -1
- package/dist/esm/core/runCheckpoint.js.map +1 -1
- package/dist/esm/core/slots/buildToolsSlot.d.ts +29 -0
- package/dist/esm/core/slots/buildToolsSlot.js +30 -2
- package/dist/esm/core/slots/buildToolsSlot.js.map +1 -1
- package/dist/esm/core/time/ask.d.ts +8 -3
- package/dist/esm/core/time/ask.js +8 -3
- package/dist/esm/core/time/ask.js.map +1 -1
- package/dist/esm/core/time/bind.d.ts +8 -33
- package/dist/esm/core/time/bind.js +21 -53
- package/dist/esm/core/time/bind.js.map +1 -1
- package/dist/esm/core/time/check.d.ts +113 -0
- package/dist/esm/core/time/check.js +252 -0
- package/dist/esm/core/time/check.js.map +1 -0
- package/dist/esm/core/time/checkRecord.d.ts +74 -0
- package/dist/esm/core/time/checkRecord.js +90 -0
- package/dist/esm/core/time/checkRecord.js.map +1 -0
- package/dist/esm/core/time/convert.d.ts +2 -3
- package/dist/esm/core/time/convert.js +5 -12
- package/dist/esm/core/time/convert.js.map +1 -1
- package/dist/esm/core/time/drift.d.ts +7 -0
- package/dist/esm/core/time/drift.js +15 -9
- package/dist/esm/core/time/drift.js.map +1 -1
- package/dist/esm/core/time/forms.d.ts +84 -0
- package/dist/esm/core/time/forms.js +268 -0
- package/dist/esm/core/time/forms.js.map +1 -0
- package/dist/esm/core/time/present.d.ts +5 -3
- package/dist/esm/core/time/present.js +2 -1
- package/dist/esm/core/time/present.js.map +1 -1
- package/dist/esm/core/time/range.d.ts +2 -0
- package/dist/esm/core/time/range.js +10 -0
- package/dist/esm/core/time/range.js.map +1 -1
- package/dist/esm/core/time/reader.d.ts +12 -3
- package/dist/esm/core/time/reader.js +6 -2
- package/dist/esm/core/time/reader.js.map +1 -1
- package/dist/esm/core/time/readers/english.d.ts +99 -0
- package/dist/esm/core/time/readers/english.js +572 -0
- package/dist/esm/core/time/readers/english.js.map +1 -0
- package/dist/esm/core/time/readingAsk.js +8 -4
- package/dist/esm/core/time/readingAsk.js.map +1 -1
- package/dist/esm/core/time/resolve.d.ts +27 -6
- package/dist/esm/core/time/resolve.js +41 -11
- package/dist/esm/core/time/resolve.js.map +1 -1
- package/dist/esm/core/time/rows.d.ts +91 -4
- package/dist/esm/core/time/rows.js +116 -5
- package/dist/esm/core/time/rows.js.map +1 -1
- package/dist/esm/core/time/rowsBuild.d.ts +8 -2
- package/dist/esm/core/time/rowsBuild.js +10 -4
- package/dist/esm/core/time/rowsBuild.js.map +1 -1
- package/dist/esm/core/time/textForms.d.ts +53 -0
- package/dist/esm/core/time/textForms.js +126 -0
- package/dist/esm/core/time/textForms.js.map +1 -0
- package/dist/esm/core/time/windows.d.ts +113 -0
- package/dist/esm/core/time/windows.js +166 -0
- package/dist/esm/core/time/windows.js.map +1 -0
- package/dist/esm/events/payloads.d.ts +14 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/answer-account/facts/howSure.js +7 -0
- package/dist/esm/lib/answer-account/facts/howSure.js.map +1 -1
- package/dist/esm/lib/answer-account/templates.d.ts +3 -0
- package/dist/esm/lib/answer-account/templates.js +4 -0
- package/dist/esm/lib/answer-account/templates.js.map +1 -1
- package/dist/esm/lib/time-travel/receipt.d.ts +1 -1
- package/dist/esm/lib/time-travel/servedView.d.ts +1 -1
- package/dist/esm/lib/time-travel/servedView.js +9 -0
- package/dist/esm/lib/time-travel/servedView.js.map +1 -1
- package/dist/esm/locales/timeAsk.d.ts +1 -1
- package/dist/esm/locales/timeAsk.js +2 -2
- package/dist/esm/locales/timeAsk.js.map +1 -1
- package/dist/esm/recorders/core/resilienceHooks.js +1 -0
- package/dist/esm/recorders/core/resilienceHooks.js.map +1 -1
- package/dist/esm/resilience/statedWait.d.ts +22 -0
- package/dist/esm/resilience/statedWait.js +35 -0
- package/dist/esm/resilience/statedWait.js.map +1 -0
- package/dist/esm/resilience/withRetry.d.ts +13 -2
- package/dist/esm/resilience/withRetry.js +16 -1
- package/dist/esm/resilience/withRetry.js.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/answer-account/facts/howSure.js +7 -0
- package/dist/lib/answer-account/facts/howSure.js.map +1 -1
- package/dist/lib/answer-account/templates.js +4 -0
- package/dist/lib/answer-account/templates.js.map +1 -1
- package/dist/lib/time-travel/servedView.js +9 -0
- package/dist/lib/time-travel/servedView.js.map +1 -1
- package/dist/locales/timeAsk.js +2 -2
- package/dist/locales/timeAsk.js.map +1 -1
- package/dist/recorders/core/resilienceHooks.js +1 -0
- package/dist/recorders/core/resilienceHooks.js.map +1 -1
- package/dist/resilience/statedWait.js +39 -0
- package/dist/resilience/statedWait.js.map +1 -0
- package/dist/resilience/withRetry.js +16 -1
- package/dist/resilience/withRetry.js.map +1 -1
- package/dist/types/adapters/llm/AnthropicProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/BedrockProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/InvokeModelGatewayProvider.d.ts +38 -4
- package/dist/types/adapters/llm/InvokeModelGatewayProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/OpenAIProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/anthropicMessagesWire.d.ts +6 -1
- package/dist/types/adapters/llm/anthropicMessagesWire.d.ts.map +1 -1
- package/dist/types/adapters/llm/retryAfter.d.ts +28 -0
- package/dist/types/adapters/llm/retryAfter.d.ts.map +1 -0
- package/dist/types/adapters/types.d.ts +9 -0
- package/dist/types/adapters/types.d.ts.map +1 -1
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/agent/arguments/ask.d.ts +72 -3
- package/dist/types/core/agent/arguments/ask.d.ts.map +1 -1
- package/dist/types/core/agent/arguments/dispatch.d.ts.map +1 -1
- package/dist/types/core/agent/arguments/resolve.d.ts +18 -1
- package/dist/types/core/agent/arguments/resolve.d.ts.map +1 -1
- package/dist/types/core/agent/arguments/rows.d.ts +8 -6
- package/dist/types/core/agent/arguments/rows.d.ts.map +1 -1
- package/dist/types/core/agent/arguments/serve.d.ts +104 -4
- package/dist/types/core/agent/arguments/serve.d.ts.map +1 -1
- package/dist/types/core/agent/arguments/subflow.d.ts +5 -2
- package/dist/types/core/agent/arguments/subflow.d.ts.map +1 -1
- 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/reasons.d.ts.map +1 -1
- package/dist/types/core/agent/assessment/types.d.ts +15 -1
- package/dist/types/core/agent/assessment/types.d.ts.map +1 -1
- package/dist/types/core/agent/buildAgentChart.d.ts +34 -0
- package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/buildDynamicAgentChart.d.ts +1 -1
- package/dist/types/core/agent/buildDynamicAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/coverage/answer.d.ts +14 -1
- package/dist/types/core/agent/coverage/answer.d.ts.map +1 -1
- package/dist/types/core/agent/coverage/period.d.ts +41 -0
- package/dist/types/core/agent/coverage/period.d.ts.map +1 -1
- package/dist/types/core/agent/coverage/timeLimitFacts.d.ts +57 -0
- package/dist/types/core/agent/coverage/timeLimitFacts.d.ts.map +1 -0
- package/dist/types/core/agent/coverage/timeLimits.d.ts +47 -0
- package/dist/types/core/agent/coverage/timeLimits.d.ts.map +1 -0
- package/dist/types/core/agent/evidence/evidenceIndex.d.ts +25 -2
- package/dist/types/core/agent/evidence/evidenceIndex.d.ts.map +1 -1
- package/dist/types/core/agent/evidence/gate.d.ts +7 -0
- package/dist/types/core/agent/evidence/gate.d.ts.map +1 -1
- package/dist/types/core/agent/evidence/normalize.d.ts +0 -34
- package/dist/types/core/agent/evidence/normalize.d.ts.map +1 -1
- package/dist/types/core/agent/evidence/types.d.ts +12 -1
- package/dist/types/core/agent/evidence/types.d.ts.map +1 -1
- package/dist/types/core/agent/findings/ledger.d.ts.map +1 -1
- package/dist/types/core/agent/findings/types.d.ts +2 -2
- package/dist/types/core/agent/findings/types.d.ts.map +1 -1
- package/dist/types/core/agent/honesty/mounts.d.ts +13 -0
- package/dist/types/core/agent/honesty/mounts.d.ts.map +1 -1
- package/dist/types/core/agent/results/subflow.d.ts +34 -2
- package/dist/types/core/agent/results/subflow.d.ts.map +1 -1
- package/dist/types/core/agent/stages/argumentAsk.d.ts +10 -0
- package/dist/types/core/agent/stages/argumentAsk.d.ts.map +1 -1
- package/dist/types/core/agent/stages/callLLM.d.ts +6 -0
- package/dist/types/core/agent/stages/callLLM.d.ts.map +1 -1
- package/dist/types/core/agent/stages/prepareFinal.d.ts +3 -2
- package/dist/types/core/agent/stages/prepareFinal.d.ts.map +1 -1
- package/dist/types/core/agent/stages/route.d.ts +29 -1
- package/dist/types/core/agent/stages/route.d.ts.map +1 -1
- package/dist/types/core/agent/stages/timeLineage.d.ts +32 -0
- package/dist/types/core/agent/stages/timeLineage.d.ts.map +1 -0
- package/dist/types/core/agent/stages/toolCalls.d.ts +11 -0
- package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
- package/dist/types/core/agent/types.d.ts +12 -0
- package/dist/types/core/agent/types.d.ts.map +1 -1
- package/dist/types/core/runCheckpoint.d.ts.map +1 -1
- package/dist/types/core/slots/buildToolsSlot.d.ts +29 -0
- package/dist/types/core/slots/buildToolsSlot.d.ts.map +1 -1
- package/dist/types/core/time/ask.d.ts +8 -3
- package/dist/types/core/time/ask.d.ts.map +1 -1
- package/dist/types/core/time/bind.d.ts +8 -33
- package/dist/types/core/time/bind.d.ts.map +1 -1
- package/dist/types/core/time/check.d.ts +114 -0
- package/dist/types/core/time/check.d.ts.map +1 -0
- package/dist/types/core/time/checkRecord.d.ts +75 -0
- package/dist/types/core/time/checkRecord.d.ts.map +1 -0
- package/dist/types/core/time/convert.d.ts +2 -3
- package/dist/types/core/time/convert.d.ts.map +1 -1
- package/dist/types/core/time/drift.d.ts +7 -0
- package/dist/types/core/time/drift.d.ts.map +1 -1
- package/dist/types/core/time/forms.d.ts +85 -0
- package/dist/types/core/time/forms.d.ts.map +1 -0
- package/dist/types/core/time/present.d.ts +5 -3
- package/dist/types/core/time/present.d.ts.map +1 -1
- package/dist/types/core/time/range.d.ts +2 -0
- package/dist/types/core/time/range.d.ts.map +1 -1
- package/dist/types/core/time/reader.d.ts +12 -3
- package/dist/types/core/time/reader.d.ts.map +1 -1
- package/dist/types/core/time/readers/english.d.ts +100 -0
- package/dist/types/core/time/readers/english.d.ts.map +1 -0
- package/dist/types/core/time/readingAsk.d.ts.map +1 -1
- package/dist/types/core/time/resolve.d.ts +27 -6
- package/dist/types/core/time/resolve.d.ts.map +1 -1
- package/dist/types/core/time/rows.d.ts +91 -4
- package/dist/types/core/time/rows.d.ts.map +1 -1
- package/dist/types/core/time/rowsBuild.d.ts +8 -2
- package/dist/types/core/time/rowsBuild.d.ts.map +1 -1
- package/dist/types/core/time/textForms.d.ts +54 -0
- package/dist/types/core/time/textForms.d.ts.map +1 -0
- package/dist/types/core/time/windows.d.ts +114 -0
- package/dist/types/core/time/windows.d.ts.map +1 -0
- package/dist/types/events/payloads.d.ts +14 -0
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/answer-account/facts/howSure.d.ts.map +1 -1
- package/dist/types/lib/answer-account/templates.d.ts +3 -0
- package/dist/types/lib/answer-account/templates.d.ts.map +1 -1
- package/dist/types/lib/time-travel/receipt.d.ts +1 -1
- package/dist/types/lib/time-travel/receipt.d.ts.map +1 -1
- package/dist/types/lib/time-travel/servedView.d.ts +1 -1
- package/dist/types/lib/time-travel/servedView.d.ts.map +1 -1
- package/dist/types/locales/timeAsk.d.ts +1 -1
- package/dist/types/recorders/core/resilienceHooks.d.ts.map +1 -1
- package/dist/types/resilience/statedWait.d.ts +23 -0
- package/dist/types/resilience/statedWait.d.ts.map +1 -0
- package/dist/types/resilience/withRetry.d.ts +13 -2
- package/dist/types/resilience/withRetry.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* core/time/check — the result checks (time design § 9.2, § 9.4, § 9.6, step T8).
|
|
3
|
+
*
|
|
4
|
+
* Pattern: one pure check per judged call, over what the record already holds
|
|
5
|
+
* — the call's `call-window` row (what the call asked, and the
|
|
6
|
+
* person's window beside it), its `call` row (the clock at
|
|
7
|
+
* dispatch), the periods its result declared, and the tool's facts —
|
|
8
|
+
* and one pure read over the turn's wall-clock sources. None reads
|
|
9
|
+
* words; none reads a period's offset as a clock.
|
|
10
|
+
* Role: core/ leaf (the time layer). Imports `instant.ts`, `range.ts`,
|
|
11
|
+
* `convert.ts` and the row types of `rows.ts`. Asked by the results
|
|
12
|
+
* layer (`results/subflow.ts` · `checkPeriods`), which files the
|
|
13
|
+
* answer on the call's `period` row (`coverage/period.ts` ·
|
|
14
|
+
* `PeriodRow`), and by the limits block (`coverage/period.ts` ·
|
|
15
|
+
* `periodCheckLine`, `clockLines`).
|
|
16
|
+
* Emits: N/A.
|
|
17
|
+
*
|
|
18
|
+
* ## Differs from asked — ONE check for narrower, wider and shifted (§ 9.2)
|
|
19
|
+
*
|
|
20
|
+
* The range the call asked for is compared with the range it READ, and two
|
|
21
|
+
* lists come back: `missing` (asked but not read — a narrower read, or the
|
|
22
|
+
* front of a shifted one) and `extra` (read but not asked — a wider read, or
|
|
23
|
+
* the tail of a shifted one). What was read, first found wins:
|
|
24
|
+
*
|
|
25
|
+
* | Source | The read |
|
|
26
|
+
* |--------|----------|
|
|
27
|
+
* | `declared` | the result's own `period.queried` — inclusive at both ends, read back as `[from, to + step)`, `step` the tool's `granularity` (else 1 ms; § 3.3). Several declared: each is a read |
|
|
28
|
+
* | `sent` | a widened fill the tool does not trim — the `call-window` row's `sent` |
|
|
29
|
+
* | `shifted` | a look-back that ran as sent after the clock moved past the tool's step — the asked range moved by the `call` row's `drift.byMs` |
|
|
30
|
+
* | `asked` | nothing says otherwise — the read IS the asked range (a fill, a binding, a redrawn look-back, a widened fill the tool trims) |
|
|
31
|
+
*
|
|
32
|
+
* Against what: the call's `asked` range — EXCEPT for a window the model
|
|
33
|
+
* chose (`how: 'model-chosen'`), which is compared with the person's window
|
|
34
|
+
* (§ 9.3: claims about the person's window are then "not sure"). A call with
|
|
35
|
+
* neither — refused, not filled, unread — is not compared.
|
|
36
|
+
*
|
|
37
|
+
* Two differences are not differences: a piece no longer than one
|
|
38
|
+
* millisecond (a closed end read as open — `[now − L, now]` against
|
|
39
|
+
* `[now − L, now)`), and § 7.4's first row — a call that SENT a look-back
|
|
40
|
+
* (`drift.ts` · `sentLookback`), with no drift recorded (the dispatch was
|
|
41
|
+
* within the step), whose declared read has the asked length and moved LATER
|
|
42
|
+
* by no more than the tool's step (one minute when none): the tool evaluated
|
|
43
|
+
* the look-back on its own clock, a little after `now`, and that read IS the
|
|
44
|
+
* asked range. Nothing else moves: a read moved EARLIER, a read of a window
|
|
45
|
+
* sent as bounds, or a look-back with a recorded drift is compared as read —
|
|
46
|
+
* its `missing` stands, and the answer is "not sure" (§ 9.2).
|
|
47
|
+
*
|
|
48
|
+
* ## Retention (§ 9.4)
|
|
49
|
+
*
|
|
50
|
+
* `beyondRetention` — the call was refused before dispatch because the window
|
|
51
|
+
* was wholly older than the source keeps, or its read lies wholly before
|
|
52
|
+
* `now − retention`. `partlyBeyondRetention` — the read starts before that
|
|
53
|
+
* edge and ends after it (the result's `held` decides `partly-held`).
|
|
54
|
+
*
|
|
55
|
+
* ## Clocks (§ 9.6)
|
|
56
|
+
*
|
|
57
|
+
* A dataset whose declared time axis names a `zone` holds wall times in that
|
|
58
|
+
* zone — a wall-clock source. {@link clocksDiffer} names the sources and zones
|
|
59
|
+
* when two sources of one answer declare different zones: a label only, every
|
|
60
|
+
* comparison is done on instants. A period's offset (`Z`, `-07:00`) is a
|
|
61
|
+
* spelling of an instant, never a clock, and is never read here.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* periodTimeCheck({
|
|
66
|
+
* window: { how: 'filled', asked: { from: '2026-10-02T15:40:00Z', to: '2026-10-09T15:40:00Z' } },
|
|
67
|
+
* declared: [{ from: '2026-10-07T15:40:00Z', to: '2026-10-09T15:39:59.999Z' }], // clamped to 2 days
|
|
68
|
+
* now: '2026-10-09T15:40:00Z',
|
|
69
|
+
* })?.differs?.missing; // [{ from: '2026-10-02T15:40:00Z', to: '2026-10-07T15:40:00Z' }]
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
import { type InstantText } from './instant.js';
|
|
73
|
+
import { type InclusiveSpan, type TimeRange } from './range.js';
|
|
74
|
+
import { type PeriodFacts, type PeriodForm } from './convert.js';
|
|
75
|
+
import type { CallDrift, CallWindowRow } from './rows.js';
|
|
76
|
+
export { clocksDiffer, distinctSources, isPeriodDiffers, isShifted, type ClocksDiffer, type PeriodDiffers, type ReadSource, type SourceClock, } from './checkRecord.js';
|
|
77
|
+
import type { PeriodDiffers } from './checkRecord.js';
|
|
78
|
+
/** The time layer's result checks on one call — each key present only when it holds. */
|
|
79
|
+
export interface PeriodTimeCheck {
|
|
80
|
+
readonly differs?: PeriodDiffers;
|
|
81
|
+
/** `period-shifted` (§ 7.4): the look-back ran as sent, `byMs` after the turn's `now`. */
|
|
82
|
+
readonly shifted?: {
|
|
83
|
+
readonly byMs: number;
|
|
84
|
+
};
|
|
85
|
+
/** `period-beyond-retention` (§ 9.4). */
|
|
86
|
+
readonly beyondRetention?: true;
|
|
87
|
+
/** `partly-beyond-retention` (§ 9.4). */
|
|
88
|
+
readonly partlyBeyondRetention?: true;
|
|
89
|
+
}
|
|
90
|
+
/** What one call's check reads — every field off a row or a declaration. */
|
|
91
|
+
export interface PeriodCheckInput {
|
|
92
|
+
/** The call's `call-window` row — absent when the tool declares no forms. */
|
|
93
|
+
readonly window?: Pick<CallWindowRow, 'how' | 'form' | 'asked' | 'person' | 'sent' | 'trimmedByTool' | 'partlyBeyondRetention' | 'refused'>;
|
|
94
|
+
/** The call's `call` row's `drift`. */
|
|
95
|
+
readonly drift?: CallDrift;
|
|
96
|
+
/** The `queried` span of every period the call's result declared (inclusive ends). */
|
|
97
|
+
readonly declared?: readonly InclusiveSpan[];
|
|
98
|
+
readonly facts?: PeriodFacts;
|
|
99
|
+
/** The tool's period forms — with the window's `form`, whether the call sent a look-back (§ 7.4). */
|
|
100
|
+
readonly forms?: readonly PeriodForm[];
|
|
101
|
+
/** The turn's clock `now`. */
|
|
102
|
+
readonly now: InstantText;
|
|
103
|
+
}
|
|
104
|
+
/** The parts of `asked` not read, and the parts read not asked. */
|
|
105
|
+
export declare function rangeDifference(asked: TimeRange, read: readonly TimeRange[]): {
|
|
106
|
+
readonly missing: TimeRange[];
|
|
107
|
+
readonly extra: TimeRange[];
|
|
108
|
+
} | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* The time layer's result checks on one call (§ 9.2, § 7.4, § 9.4) —
|
|
111
|
+
* `undefined` when none holds, so an unremarkable call's row gains nothing.
|
|
112
|
+
*/
|
|
113
|
+
export declare function periodTimeCheck(input: PeriodCheckInput): PeriodTimeCheck | undefined;
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* core/time/check — the result checks (time design § 9.2, § 9.4, § 9.6, step T8).
|
|
3
|
+
*
|
|
4
|
+
* Pattern: one pure check per judged call, over what the record already holds
|
|
5
|
+
* — the call's `call-window` row (what the call asked, and the
|
|
6
|
+
* person's window beside it), its `call` row (the clock at
|
|
7
|
+
* dispatch), the periods its result declared, and the tool's facts —
|
|
8
|
+
* and one pure read over the turn's wall-clock sources. None reads
|
|
9
|
+
* words; none reads a period's offset as a clock.
|
|
10
|
+
* Role: core/ leaf (the time layer). Imports `instant.ts`, `range.ts`,
|
|
11
|
+
* `convert.ts` and the row types of `rows.ts`. Asked by the results
|
|
12
|
+
* layer (`results/subflow.ts` · `checkPeriods`), which files the
|
|
13
|
+
* answer on the call's `period` row (`coverage/period.ts` ·
|
|
14
|
+
* `PeriodRow`), and by the limits block (`coverage/period.ts` ·
|
|
15
|
+
* `periodCheckLine`, `clockLines`).
|
|
16
|
+
* Emits: N/A.
|
|
17
|
+
*
|
|
18
|
+
* ## Differs from asked — ONE check for narrower, wider and shifted (§ 9.2)
|
|
19
|
+
*
|
|
20
|
+
* The range the call asked for is compared with the range it READ, and two
|
|
21
|
+
* lists come back: `missing` (asked but not read — a narrower read, or the
|
|
22
|
+
* front of a shifted one) and `extra` (read but not asked — a wider read, or
|
|
23
|
+
* the tail of a shifted one). What was read, first found wins:
|
|
24
|
+
*
|
|
25
|
+
* | Source | The read |
|
|
26
|
+
* |--------|----------|
|
|
27
|
+
* | `declared` | the result's own `period.queried` — inclusive at both ends, read back as `[from, to + step)`, `step` the tool's `granularity` (else 1 ms; § 3.3). Several declared: each is a read |
|
|
28
|
+
* | `sent` | a widened fill the tool does not trim — the `call-window` row's `sent` |
|
|
29
|
+
* | `shifted` | a look-back that ran as sent after the clock moved past the tool's step — the asked range moved by the `call` row's `drift.byMs` |
|
|
30
|
+
* | `asked` | nothing says otherwise — the read IS the asked range (a fill, a binding, a redrawn look-back, a widened fill the tool trims) |
|
|
31
|
+
*
|
|
32
|
+
* Against what: the call's `asked` range — EXCEPT for a window the model
|
|
33
|
+
* chose (`how: 'model-chosen'`), which is compared with the person's window
|
|
34
|
+
* (§ 9.3: claims about the person's window are then "not sure"). A call with
|
|
35
|
+
* neither — refused, not filled, unread — is not compared.
|
|
36
|
+
*
|
|
37
|
+
* Two differences are not differences: a piece no longer than one
|
|
38
|
+
* millisecond (a closed end read as open — `[now − L, now]` against
|
|
39
|
+
* `[now − L, now)`), and § 7.4's first row — a call that SENT a look-back
|
|
40
|
+
* (`drift.ts` · `sentLookback`), with no drift recorded (the dispatch was
|
|
41
|
+
* within the step), whose declared read has the asked length and moved LATER
|
|
42
|
+
* by no more than the tool's step (one minute when none): the tool evaluated
|
|
43
|
+
* the look-back on its own clock, a little after `now`, and that read IS the
|
|
44
|
+
* asked range. Nothing else moves: a read moved EARLIER, a read of a window
|
|
45
|
+
* sent as bounds, or a look-back with a recorded drift is compared as read —
|
|
46
|
+
* its `missing` stands, and the answer is "not sure" (§ 9.2).
|
|
47
|
+
*
|
|
48
|
+
* ## Retention (§ 9.4)
|
|
49
|
+
*
|
|
50
|
+
* `beyondRetention` — the call was refused before dispatch because the window
|
|
51
|
+
* was wholly older than the source keeps, or its read lies wholly before
|
|
52
|
+
* `now − retention`. `partlyBeyondRetention` — the read starts before that
|
|
53
|
+
* edge and ends after it (the result's `held` decides `partly-held`).
|
|
54
|
+
*
|
|
55
|
+
* ## Clocks (§ 9.6)
|
|
56
|
+
*
|
|
57
|
+
* A dataset whose declared time axis names a `zone` holds wall times in that
|
|
58
|
+
* zone — a wall-clock source. {@link clocksDiffer} names the sources and zones
|
|
59
|
+
* when two sources of one answer declare different zones: a label only, every
|
|
60
|
+
* comparison is done on instants. A period's offset (`Z`, `-07:00`) is a
|
|
61
|
+
* spelling of an instant, never a clock, and is never read here.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* periodTimeCheck({
|
|
66
|
+
* window: { how: 'filled', asked: { from: '2026-10-02T15:40:00Z', to: '2026-10-09T15:40:00Z' } },
|
|
67
|
+
* declared: [{ from: '2026-10-07T15:40:00Z', to: '2026-10-09T15:39:59.999Z' }], // clamped to 2 days
|
|
68
|
+
* now: '2026-10-09T15:40:00Z',
|
|
69
|
+
* })?.differs?.missing; // [{ from: '2026-10-02T15:40:00Z', to: '2026-10-07T15:40:00Z' }]
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
import { instantOf, spellInstant } from './instant.js';
|
|
73
|
+
import { fromInclusive, stepMsOf } from './range.js';
|
|
74
|
+
import { durationMs } from './duration.js';
|
|
75
|
+
import { FACT_UNITS, granularityMsOf } from './convert.js';
|
|
76
|
+
import { sentLookback } from './drift.js';
|
|
77
|
+
// ─── The shapes ──────────────────────────────────────────────────────────
|
|
78
|
+
// The record half — the row's shapes, the checkpoint door's tests and the two
|
|
79
|
+
// clock reads — lives in `checkRecord.ts`, split by FILE so the synchronous
|
|
80
|
+
// doors (`coverage/period.ts` · `periodRowIsWellFormed`) never load this
|
|
81
|
+
// module's conversions; every public name is re-exported here.
|
|
82
|
+
export { clocksDiffer, distinctSources, isPeriodDiffers, isShifted, } from './checkRecord.js';
|
|
83
|
+
const msAt = (text) => instantOf(text, 'lenient')?.ms;
|
|
84
|
+
function spanOf(range) {
|
|
85
|
+
const from = msAt(range.from);
|
|
86
|
+
const to = msAt(range.to);
|
|
87
|
+
return from === undefined || to === undefined || !(from < to) ? undefined : [from, to];
|
|
88
|
+
}
|
|
89
|
+
function rangeOf([from, to]) {
|
|
90
|
+
// Both are finite millisecond instants read from a range — each spells.
|
|
91
|
+
return {
|
|
92
|
+
from: spellInstant({ ms: from, nanos: 0 }, 0),
|
|
93
|
+
to: spellInstant({ ms: to, nanos: 0 }, 0),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/** The parts of `a` covered by none of `bs`, in time order. */
|
|
97
|
+
function minus(a, bs) {
|
|
98
|
+
let pieces = [a];
|
|
99
|
+
for (const [bFrom, bTo] of bs) {
|
|
100
|
+
const next = [];
|
|
101
|
+
for (const [from, to] of pieces) {
|
|
102
|
+
if (bTo <= from || bFrom >= to) {
|
|
103
|
+
next.push([from, to]);
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (bFrom > from)
|
|
107
|
+
next.push([from, bFrom]);
|
|
108
|
+
if (bTo < to)
|
|
109
|
+
next.push([bTo, to]);
|
|
110
|
+
}
|
|
111
|
+
pieces = next;
|
|
112
|
+
}
|
|
113
|
+
return pieces;
|
|
114
|
+
}
|
|
115
|
+
/** A piece no longer than one millisecond is a closed end read as open — not a difference. */
|
|
116
|
+
const WIDTH_OF_AN_INSTANT_MS = 1;
|
|
117
|
+
const kept = (pieces) => pieces.filter(([from, to]) => to - from > WIDTH_OF_AN_INSTANT_MS).map(rangeOf);
|
|
118
|
+
/** The parts of `asked` not read, and the parts read not asked. */
|
|
119
|
+
export function rangeDifference(asked, read) {
|
|
120
|
+
const a = spanOf(asked);
|
|
121
|
+
const reads = read.map(spanOf);
|
|
122
|
+
if (a === undefined || reads.some((r) => r === undefined))
|
|
123
|
+
return undefined;
|
|
124
|
+
const spans = reads;
|
|
125
|
+
const missing = kept(minus(a, spans));
|
|
126
|
+
const extraSpans = [];
|
|
127
|
+
for (const r of spans)
|
|
128
|
+
extraSpans.push(...minus(r, [a, ...extraSpans]));
|
|
129
|
+
return { missing, extra: kept(extraSpans.sort((x, y) => x[0] - y[0])) };
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* § 7.4's first row: a look-back sent within the step, whose ONE declared
|
|
133
|
+
* read has the asked length and starts no earlier than the asked range and no
|
|
134
|
+
* more than the tool's step later — the tool's own clock ran a little past
|
|
135
|
+
* `now`. Only forward: dispatch drift never moves a read earlier, so an
|
|
136
|
+
* earlier read is a read that missed the newest part of what was asked.
|
|
137
|
+
*/
|
|
138
|
+
function lookbackWithinStep(input, read) {
|
|
139
|
+
const window = input.window;
|
|
140
|
+
if (read.source !== 'declared' || read.read.length !== 1)
|
|
141
|
+
return false;
|
|
142
|
+
if (window?.asked === undefined || input.drift !== undefined)
|
|
143
|
+
return false;
|
|
144
|
+
if (!sentLookback(window, input.forms ?? []))
|
|
145
|
+
return false;
|
|
146
|
+
const a = spanOf(window.asked);
|
|
147
|
+
const r = spanOf(read.read[0]);
|
|
148
|
+
if (a === undefined || r === undefined)
|
|
149
|
+
return false;
|
|
150
|
+
const lengthGap = Math.abs(r[1] - r[0] - (a[1] - a[0]));
|
|
151
|
+
const moved = r[0] - a[0];
|
|
152
|
+
return lengthGap <= WIDTH_OF_AN_INSTANT_MS && moved >= 0 && moved <= granularityMsOf(input.facts);
|
|
153
|
+
}
|
|
154
|
+
/** What the call read, first found wins (the module table) — `undefined` when nothing says. */
|
|
155
|
+
function readOf(input) {
|
|
156
|
+
const declared = input.declared ?? [];
|
|
157
|
+
if (declared.length > 0) {
|
|
158
|
+
const stepMs = stepMsOf(input.facts?.granularity, FACT_UNITS);
|
|
159
|
+
try {
|
|
160
|
+
return { read: declared.map((q) => fromInclusive(q, stepMs)), source: 'declared', stepMs };
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
return undefined; // a declaration the rule set refused never reaches here; nothing to compare
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
const window = input.window;
|
|
167
|
+
if (window === undefined || window.how === 'refused')
|
|
168
|
+
return undefined;
|
|
169
|
+
if (window.sent !== undefined && window.trimmedByTool !== true) {
|
|
170
|
+
return { read: [window.sent], source: 'sent' };
|
|
171
|
+
}
|
|
172
|
+
if (window.asked === undefined)
|
|
173
|
+
return undefined;
|
|
174
|
+
const asked = spanOf(window.asked);
|
|
175
|
+
if (input.drift?.outcome === 'shifted' && asked !== undefined) {
|
|
176
|
+
const by = input.drift.byMs;
|
|
177
|
+
return { read: [rangeOf([asked[0] + by, asked[1] + by])], source: 'shifted' };
|
|
178
|
+
}
|
|
179
|
+
return { read: [window.asked], source: 'asked' };
|
|
180
|
+
}
|
|
181
|
+
/** The range a call is judged against: the person's window for a model-chosen one, else what it asked. */
|
|
182
|
+
function referenceOf(window) {
|
|
183
|
+
if (window === undefined || window.how === 'refused')
|
|
184
|
+
return undefined;
|
|
185
|
+
if (window.how === 'model-chosen' && window.person !== undefined) {
|
|
186
|
+
return { against: 'person', asked: { from: window.person.from, to: window.person.to } };
|
|
187
|
+
}
|
|
188
|
+
return window.asked === undefined ? undefined : { against: 'asked', asked: window.asked };
|
|
189
|
+
}
|
|
190
|
+
function differsOf(input) {
|
|
191
|
+
const reference = referenceOf(input.window);
|
|
192
|
+
const found = readOf(input);
|
|
193
|
+
if (reference === undefined || found === undefined)
|
|
194
|
+
return undefined;
|
|
195
|
+
// Within the step the look-back IS the asked range (§ 7.4) — then judged like one.
|
|
196
|
+
const read = lookbackWithinStep(input, found) && input.window?.asked !== undefined
|
|
197
|
+
? { read: [input.window.asked], source: 'asked' }
|
|
198
|
+
: found;
|
|
199
|
+
const difference = rangeDifference(reference.asked, read.read);
|
|
200
|
+
if (difference === undefined)
|
|
201
|
+
return undefined;
|
|
202
|
+
if (difference.missing.length === 0 && difference.extra.length === 0)
|
|
203
|
+
return undefined;
|
|
204
|
+
return {
|
|
205
|
+
against: reference.against,
|
|
206
|
+
asked: reference.asked,
|
|
207
|
+
read: read.read,
|
|
208
|
+
source: read.source,
|
|
209
|
+
...(read.stepMs !== undefined && { stepMs: read.stepMs }),
|
|
210
|
+
missing: difference.missing,
|
|
211
|
+
extra: difference.extra,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
/** Where the read lies against `now − retention`: wholly before it, across it, or neither. */
|
|
215
|
+
function retentionOf(input) {
|
|
216
|
+
if (input.window?.how === 'refused') {
|
|
217
|
+
return input.window.refused === 'beyond-retention' ? 'beyond' : undefined;
|
|
218
|
+
}
|
|
219
|
+
const retention = input.facts?.retention === undefined
|
|
220
|
+
? undefined
|
|
221
|
+
: durationMs(input.facts.retention, FACT_UNITS);
|
|
222
|
+
const now = msAt(input.now);
|
|
223
|
+
const read = readOf(input);
|
|
224
|
+
if (retention === undefined || now === undefined || read === undefined) {
|
|
225
|
+
return input.window?.partlyBeyondRetention === true ? 'partly' : undefined;
|
|
226
|
+
}
|
|
227
|
+
const oldest = now - retention;
|
|
228
|
+
const spans = read.read.map(spanOf).filter((s) => s !== undefined);
|
|
229
|
+
if (spans.length > 0 && spans.every(([, to]) => to <= oldest))
|
|
230
|
+
return 'beyond';
|
|
231
|
+
if (spans.some(([from, to]) => from < oldest && to > oldest))
|
|
232
|
+
return 'partly';
|
|
233
|
+
return input.window?.partlyBeyondRetention === true ? 'partly' : undefined;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* The time layer's result checks on one call (§ 9.2, § 7.4, § 9.4) —
|
|
237
|
+
* `undefined` when none holds, so an unremarkable call's row gains nothing.
|
|
238
|
+
*/
|
|
239
|
+
export function periodTimeCheck(input) {
|
|
240
|
+
const differs = differsOf(input);
|
|
241
|
+
const shifted = input.drift?.outcome === 'shifted' ? { byMs: input.drift.byMs } : undefined;
|
|
242
|
+
const retention = retentionOf(input);
|
|
243
|
+
if (differs === undefined && shifted === undefined && retention === undefined)
|
|
244
|
+
return undefined;
|
|
245
|
+
return {
|
|
246
|
+
...(differs !== undefined && { differs }),
|
|
247
|
+
...(shifted !== undefined && { shifted }),
|
|
248
|
+
...(retention === 'beyond' && { beyondRetention: true }),
|
|
249
|
+
...(retention === 'partly' && { partlyBeyondRetention: true }),
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
//# sourceMappingURL=check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../../../src/core/time/check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAoB,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAsC,MAAM,YAAY,CAAC;AACzF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAqC,MAAM,cAAc,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C,4EAA4E;AAE5E,8EAA8E;AAC9E,4EAA4E;AAC5E,yEAAyE;AACzE,+DAA+D;AAC/D,OAAO,EACL,YAAY,EACZ,eAAe,EACf,eAAe,EACf,SAAS,GAKV,MAAM,kBAAkB,CAAC;AA2C1B,MAAM,IAAI,GAAG,CAAC,IAAa,EAAsB,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC;AAEnF,SAAS,MAAM,CAAC,KAAgB;IAC9B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9B,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC1B,OAAO,IAAI,KAAK,SAAS,IAAI,EAAE,KAAK,SAAS,IAAI,CA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,IAAI,EAAE,qBAAqB,EAAE,IAAa,EAAE,CAAC;KACxE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* core/time/checkRecord — the record half of the result checks (time design
|
|
3
|
+
* § 9.2, § 9.6, step T8): the shapes a `period` row carries
|
|
4
|
+
* (`PeriodDiffers`, `ReadSource`), the checkpoint door's tests for them
|
|
5
|
+
* (`isPeriodDiffers`, `isShifted`), and the two reads over the turn's
|
|
6
|
+
* wall-clock sources (`distinctSources`, `clocksDiffer`).
|
|
7
|
+
*
|
|
8
|
+
* Pattern: pure shapes and guards; no conversion, no drift, no clock.
|
|
9
|
+
* Role: split from `check.ts` BY FILE for the synchronous doors — the
|
|
10
|
+
* checkpoint door's row test (`coverage/period.ts` ·
|
|
11
|
+
* `periodRowIsWellFormed`) is on every agent's graph, and a bundler
|
|
12
|
+
* places a whole file there — so this file imports only
|
|
13
|
+
* `instant.ts` and the range and zone types (the optional-family
|
|
14
|
+
* law, `test/lib/trace-toolpack/browserGraph.test.ts`). `check.ts`
|
|
15
|
+
* re-exports every public name.
|
|
16
|
+
* Emits: N/A.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* clocksDiffer([
|
|
21
|
+
* { toolName: 'orders', zone: 'America/New_York' },
|
|
22
|
+
* { toolName: 'tickets', zone: 'Europe/Berlin' },
|
|
23
|
+
* ]); // { tools: ['orders', 'tickets'], zones: ['America/New_York', 'Europe/Berlin'] }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
import type { TimeRange } from './range.js';
|
|
27
|
+
import type { ZoneName } from './zone.js';
|
|
28
|
+
/** Where a check's read range came from — see the module table. */
|
|
29
|
+
export type ReadSource = 'declared' | 'sent' | 'shifted' | 'asked';
|
|
30
|
+
/**
|
|
31
|
+
* `period-differs-from-asked` (§ 9.2): the range compared against, what was
|
|
32
|
+
* read, and the two lists — each piece half-open, in time order, spelled in
|
|
33
|
+
* UTC. At least one list is non-empty (an empty check is not filed).
|
|
34
|
+
*/
|
|
35
|
+
export interface PeriodDiffers {
|
|
36
|
+
/** `asked` — the call's asked range; `person` — the person's window, for a window the model chose. */
|
|
37
|
+
readonly against: 'asked' | 'person';
|
|
38
|
+
/** The range compared against. */
|
|
39
|
+
readonly asked: TimeRange;
|
|
40
|
+
/** What the call read — one range per declared period, else one. */
|
|
41
|
+
readonly read: readonly TimeRange[];
|
|
42
|
+
readonly source: ReadSource;
|
|
43
|
+
/** The step a declared inclusive end was read back with (§ 3.3) — `source: 'declared'` only. */
|
|
44
|
+
readonly stepMs?: number;
|
|
45
|
+
/** Asked but not read. */
|
|
46
|
+
readonly missing: readonly TimeRange[];
|
|
47
|
+
/** Read but not asked. */
|
|
48
|
+
readonly extra: readonly TimeRange[];
|
|
49
|
+
}
|
|
50
|
+
/** A dataset of one call whose declared time axis names a zone — a wall-clock source. */
|
|
51
|
+
export interface SourceClock {
|
|
52
|
+
readonly toolName: string;
|
|
53
|
+
readonly zone: ZoneName;
|
|
54
|
+
}
|
|
55
|
+
/** `clocks-differ` (§ 9.6): the wall-clock sources of one answer, when they declare different zones. */
|
|
56
|
+
export interface ClocksDiffer {
|
|
57
|
+
readonly tools: readonly string[];
|
|
58
|
+
readonly zones: readonly ZoneName[];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The wall-clock sources of one answer, one per tool and zone in the order
|
|
62
|
+
* met — the limits block names each. Fresh plain objects.
|
|
63
|
+
*/
|
|
64
|
+
export declare function distinctSources(sources: readonly SourceClock[]): SourceClock[];
|
|
65
|
+
/**
|
|
66
|
+
* `clocks-differ` (§ 9.6) — the tools and zones when the wall-clock sources
|
|
67
|
+
* of one answer declare more than one zone; `undefined` otherwise. A label
|
|
68
|
+
* only: it changes no standing, and every comparison is made on instants.
|
|
69
|
+
*/
|
|
70
|
+
export declare function clocksDiffer(sources: readonly SourceClock[]): ClocksDiffer | undefined;
|
|
71
|
+
/** The checkpoint door's test for a row's {@link PeriodDiffers}. */
|
|
72
|
+
export declare function isPeriodDiffers(value: unknown): value is PeriodDiffers;
|
|
73
|
+
/** The checkpoint door's test for a row's `shifted`. */
|
|
74
|
+
export declare function isShifted(value: unknown): boolean;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* core/time/checkRecord — the record half of the result checks (time design
|
|
3
|
+
* § 9.2, § 9.6, step T8): the shapes a `period` row carries
|
|
4
|
+
* (`PeriodDiffers`, `ReadSource`), the checkpoint door's tests for them
|
|
5
|
+
* (`isPeriodDiffers`, `isShifted`), and the two reads over the turn's
|
|
6
|
+
* wall-clock sources (`distinctSources`, `clocksDiffer`).
|
|
7
|
+
*
|
|
8
|
+
* Pattern: pure shapes and guards; no conversion, no drift, no clock.
|
|
9
|
+
* Role: split from `check.ts` BY FILE for the synchronous doors — the
|
|
10
|
+
* checkpoint door's row test (`coverage/period.ts` ·
|
|
11
|
+
* `periodRowIsWellFormed`) is on every agent's graph, and a bundler
|
|
12
|
+
* places a whole file there — so this file imports only
|
|
13
|
+
* `instant.ts` and the range and zone types (the optional-family
|
|
14
|
+
* law, `test/lib/trace-toolpack/browserGraph.test.ts`). `check.ts`
|
|
15
|
+
* re-exports every public name.
|
|
16
|
+
* Emits: N/A.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* clocksDiffer([
|
|
21
|
+
* { toolName: 'orders', zone: 'America/New_York' },
|
|
22
|
+
* { toolName: 'tickets', zone: 'Europe/Berlin' },
|
|
23
|
+
* ]); // { tools: ['orders', 'tickets'], zones: ['America/New_York', 'Europe/Berlin'] }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
import { instantOf } from './instant.js';
|
|
27
|
+
// ─── Clocks ──────────────────────────────────────────────────────────────
|
|
28
|
+
/**
|
|
29
|
+
* The wall-clock sources of one answer, one per tool and zone in the order
|
|
30
|
+
* met — the limits block names each. Fresh plain objects.
|
|
31
|
+
*/
|
|
32
|
+
export function distinctSources(sources) {
|
|
33
|
+
const seen = new Set();
|
|
34
|
+
const out = [];
|
|
35
|
+
for (const s of sources) {
|
|
36
|
+
const key = JSON.stringify([s.toolName, s.zone]);
|
|
37
|
+
if (seen.has(key))
|
|
38
|
+
continue;
|
|
39
|
+
seen.add(key);
|
|
40
|
+
out.push({ toolName: s.toolName, zone: s.zone });
|
|
41
|
+
}
|
|
42
|
+
return out;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* `clocks-differ` (§ 9.6) — the tools and zones when the wall-clock sources
|
|
46
|
+
* of one answer declare more than one zone; `undefined` otherwise. A label
|
|
47
|
+
* only: it changes no standing, and every comparison is made on instants.
|
|
48
|
+
*/
|
|
49
|
+
export function clocksDiffer(sources) {
|
|
50
|
+
const distinct = distinctSources(sources);
|
|
51
|
+
const zones = [...new Set(distinct.map((s) => s.zone))];
|
|
52
|
+
if (zones.length < 2)
|
|
53
|
+
return undefined;
|
|
54
|
+
return { tools: [...new Set(distinct.map((s) => s.toolName))], zones };
|
|
55
|
+
}
|
|
56
|
+
// ─── The row arm ─────────────────────────────────────────────────────────
|
|
57
|
+
const isRange = (value) => {
|
|
58
|
+
if (typeof value !== 'object' || value === null)
|
|
59
|
+
return false;
|
|
60
|
+
const r = value;
|
|
61
|
+
const from = instantOf(r.from, 'lenient')?.ms;
|
|
62
|
+
const to = instantOf(r.to, 'lenient')?.ms;
|
|
63
|
+
return from !== undefined && to !== undefined && from < to;
|
|
64
|
+
};
|
|
65
|
+
const isRanges = (value) => Array.isArray(value) && value.every(isRange);
|
|
66
|
+
/** The checkpoint door's test for a row's {@link PeriodDiffers}. */
|
|
67
|
+
export function isPeriodDiffers(value) {
|
|
68
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
69
|
+
return false;
|
|
70
|
+
const d = value;
|
|
71
|
+
return ((d.against === 'asked' || d.against === 'person') &&
|
|
72
|
+
isRange(d.asked) &&
|
|
73
|
+
isRanges(d.read) &&
|
|
74
|
+
d.read.length > 0 &&
|
|
75
|
+
(d.source === 'declared' ||
|
|
76
|
+
d.source === 'sent' ||
|
|
77
|
+
d.source === 'shifted' ||
|
|
78
|
+
d.source === 'asked') &&
|
|
79
|
+
(d.stepMs === undefined || (Number.isInteger(d.stepMs) && d.stepMs > 0)) &&
|
|
80
|
+
isRanges(d.missing) &&
|
|
81
|
+
isRanges(d.extra) &&
|
|
82
|
+
d.missing.length + d.extra.length > 0);
|
|
83
|
+
}
|
|
84
|
+
/** The checkpoint door's test for a row's `shifted`. */
|
|
85
|
+
export function isShifted(value) {
|
|
86
|
+
return (typeof value === 'object' &&
|
|
87
|
+
value !== null &&
|
|
88
|
+
Number.isInteger(value.byMs));
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=checkRecord.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkRecord.js","sourceRoot":"","sources":["../../../../src/core/time/checkRecord.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AA0CzC,4EAA4E;AAE5E;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAA+B;IAC7D,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,GAAG,GAAkB,EAAE,CAAC;IAC9B,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QACjD,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,SAAS;QAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACd,GAAG,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE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js';
|
|
82
|
-
import { type TimeRange } from './range.js';
|
|
82
|
+
import { sameRange, type TimeRange } from './range.js';
|
|
83
|
+
export { sameRange };
|
|
83
84
|
import { type ZoneName } from './zone.js';
|
|
84
85
|
import { type PeriodFacts, type PeriodForm } from './periodForm.js';
|
|
85
86
|
export { BOUND_AS, DEFAULT_GRANULARITY_MS, FACT_UNITS, FORM_KINDS, formArguments, formIssue, isBoundValue, needsZone, parsesUnderForm, PERIOD_SPELLINGS, periodFactProblem, primaryArgument, sugarForm, sugarForms, TIME_REFUSALS, } from './periodForm.js';
|
|
@@ -158,8 +159,6 @@ export declare function readBack(args: Readonly<Record<string, unknown>>, form:
|
|
|
158
159
|
readonly now: InstantText;
|
|
159
160
|
readonly appZone?: ZoneName;
|
|
160
161
|
}): TimeRange | undefined;
|
|
161
|
-
/** Whether two ranges hold the same instants (their spellings and offsets aside). */
|
|
162
|
-
export declare function sameRange(a: TimeRange, b: TimeRange): boolean;
|
|
163
162
|
/**
|
|
164
163
|
* The absolute range a look-back window was sent as to a bounds form —
|
|
165
164
|
* `[now − L, now)`, which reads back one millisecond shorter than the
|
|
@@ -78,8 +78,11 @@
|
|
|
78
78
|
* ```
|
|
79
79
|
*/
|
|
80
80
|
import { AXIS_UNITS, durationMs, isDuration, LOOKBACK_UNITS, spellDuration, } from './duration.js';
|
|
81
|
-
import {
|
|
82
|
-
import { lookbackRange } from './range.js';
|
|
81
|
+
import { instantOf, spellInstant, utcWallMs } from './instant.js';
|
|
82
|
+
import { lookbackRange, sameRange } from './range.js';
|
|
83
|
+
// `sameRange` moved to `range.ts` (the range owner) so the turn's windows
|
|
84
|
+
// (`windows.ts`) read it without this module; re-exported for its callers.
|
|
85
|
+
export { sameRange };
|
|
83
86
|
import { isZoneName, readWall, wallAt } from './zone.js';
|
|
84
87
|
import { dateOf, DEFAULT_GRANULARITY_MS, epochFromText, FACT_UNITS, isPlain, needsZone, wallOf, } from './periodForm.js';
|
|
85
88
|
export { BOUND_AS, DEFAULT_GRANULARITY_MS, FACT_UNITS, FORM_KINDS, formArguments, formIssue, isBoundValue, needsZone, parsesUnderForm, PERIOD_SPELLINGS, periodFactProblem, primaryArgument, sugarForm, sugarForms, TIME_REFUSALS, } from './periodForm.js';
|
|
@@ -564,16 +567,6 @@ export function readBack(args, form, ctx) {
|
|
|
564
567
|
const to = readBound(toValue, 'to', toAs, edge, zone);
|
|
565
568
|
return from === undefined || to === undefined ? undefined : spanRange(from, to);
|
|
566
569
|
}
|
|
567
|
-
/** Whether two ranges hold the same instants (their spellings and offsets aside). */
|
|
568
|
-
export function sameRange(a, b) {
|
|
569
|
-
const af = instantOf(a.from, 'strict');
|
|
570
|
-
const at = instantOf(a.to, 'strict');
|
|
571
|
-
const bf = instantOf(b.from, 'strict');
|
|
572
|
-
const bt = instantOf(b.to, 'strict');
|
|
573
|
-
if (af === undefined || at === undefined || bf === undefined || bt === undefined)
|
|
574
|
-
return false;
|
|
575
|
-
return compareInstants(af, bf) === 0 && compareInstants(at, bt) === 0;
|
|
576
|
-
}
|
|
577
570
|
/**
|
|
578
571
|
* The absolute range a look-back window was sent as to a bounds form —
|
|
579
572
|
* `[now − L, now)`, which reads back one millisecond shorter than the
|