agentfootprint 9.59.1 → 9.60.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/AGENTS.md +1 -1
- package/CLAUDE.md +1 -1
- package/ai-instructions/claude-code/SKILL.md +1 -1
- package/dist/adapters/llm/AnthropicProvider.js +9 -2
- package/dist/adapters/llm/AnthropicProvider.js.map +1 -1
- package/dist/adapters/llm/BrowserAnthropicProvider.js +5 -1
- package/dist/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
- package/dist/adapters/llm/MockProvider.js +4 -0
- package/dist/adapters/llm/MockProvider.js.map +1 -1
- package/dist/adapters/llm/wireManifest.js +38 -0
- package/dist/adapters/llm/wireManifest.js.map +1 -0
- package/dist/adapters/types.js.map +1 -1
- package/dist/core/Agent.js +129 -1
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/agent/buildAgentChart.js +11 -0
- package/dist/core/agent/buildAgentChart.js.map +1 -1
- package/dist/core/agent/buildDynamicAgentChart.js +23 -0
- package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/core/agent/stages/callLLM.js +83 -0
- package/dist/core/agent/stages/callLLM.js.map +1 -1
- package/dist/core/slots/buildToolsSlot.js +64 -3
- package/dist/core/slots/buildToolsSlot.js.map +1 -1
- package/dist/core/tools.js +34 -0
- package/dist/core/tools.js.map +1 -1
- package/dist/esm/adapters/llm/AnthropicProvider.js +9 -2
- package/dist/esm/adapters/llm/AnthropicProvider.js.map +1 -1
- package/dist/esm/adapters/llm/BrowserAnthropicProvider.js +5 -1
- package/dist/esm/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
- package/dist/esm/adapters/llm/MockProvider.js +4 -0
- package/dist/esm/adapters/llm/MockProvider.js.map +1 -1
- package/dist/esm/adapters/llm/wireManifest.d.ts +29 -0
- package/dist/esm/adapters/llm/wireManifest.js +34 -0
- package/dist/esm/adapters/llm/wireManifest.js.map +1 -0
- package/dist/esm/adapters/types.d.ts +20 -0
- package/dist/esm/adapters/types.js.map +1 -1
- package/dist/esm/core/Agent.d.ts +27 -0
- package/dist/esm/core/Agent.js +129 -1
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/agent/buildAgentChart.js +11 -0
- package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
- package/dist/esm/core/agent/buildDynamicAgentChart.js +23 -0
- package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/esm/core/agent/stages/callLLM.d.ts +15 -0
- package/dist/esm/core/agent/stages/callLLM.js +83 -0
- package/dist/esm/core/agent/stages/callLLM.js.map +1 -1
- package/dist/esm/core/agent/types.d.ts +17 -0
- package/dist/esm/core/slots/buildToolsSlot.d.ts +24 -0
- package/dist/esm/core/slots/buildToolsSlot.js +64 -3
- package/dist/esm/core/slots/buildToolsSlot.js.map +1 -1
- package/dist/esm/core/tools.d.ts +36 -0
- package/dist/esm/core/tools.js +34 -0
- package/dist/esm/core/tools.js.map +1 -1
- package/dist/esm/events/dispatcher.d.ts +1 -1
- package/dist/esm/events/dispatcher.js.map +1 -1
- package/dist/esm/events/payloads.d.ts +27 -0
- package/dist/esm/events/registry.d.ts +7 -1
- package/dist/esm/events/registry.js +6 -0
- package/dist/esm/events/registry.js.map +1 -1
- package/dist/esm/integrity/assertion/conflicts.d.ts +35 -0
- package/dist/esm/integrity/assertion/conflicts.js +74 -0
- package/dist/esm/integrity/assertion/conflicts.js.map +1 -0
- package/dist/esm/integrity/assertion/types.d.ts +74 -0
- package/dist/esm/integrity/assertion/types.js +0 -0
- package/dist/esm/integrity/assertion/types.js.map +1 -0
- package/dist/esm/integrity/dangling-reference/check.d.ts +45 -0
- package/dist/esm/integrity/dangling-reference/check.js +68 -0
- package/dist/esm/integrity/dangling-reference/check.js.map +1 -0
- package/dist/esm/integrity/disposition/lifecycle.d.ts +35 -0
- package/dist/esm/integrity/disposition/lifecycle.js +63 -0
- package/dist/esm/integrity/disposition/lifecycle.js.map +1 -0
- package/dist/esm/integrity/finding/types.d.ts +57 -0
- package/dist/esm/integrity/finding/types.js +47 -0
- package/dist/esm/integrity/finding/types.js.map +1 -0
- package/dist/esm/integrity/invariant-violation/check.d.ts +52 -0
- package/dist/esm/integrity/invariant-violation/check.js +82 -0
- package/dist/esm/integrity/invariant-violation/check.js.map +1 -0
- package/dist/esm/integrity/invariant-violation/wire.d.ts +43 -0
- package/dist/esm/integrity/invariant-violation/wire.js +93 -0
- package/dist/esm/integrity/invariant-violation/wire.js.map +1 -0
- package/dist/esm/recorders/core/IntegrityRecorder.d.ts +20 -0
- package/dist/esm/recorders/core/IntegrityRecorder.js +25 -0
- package/dist/esm/recorders/core/IntegrityRecorder.js.map +1 -0
- package/dist/events/dispatcher.js.map +1 -1
- package/dist/events/registry.js +6 -0
- package/dist/events/registry.js.map +1 -1
- package/dist/integrity/assertion/conflicts.js +78 -0
- package/dist/integrity/assertion/conflicts.js.map +1 -0
- package/dist/integrity/assertion/types.js +0 -0
- package/dist/integrity/assertion/types.js.map +1 -0
- package/dist/integrity/dangling-reference/check.js +72 -0
- package/dist/integrity/dangling-reference/check.js.map +1 -0
- package/dist/integrity/disposition/lifecycle.js +67 -0
- package/dist/integrity/disposition/lifecycle.js.map +1 -0
- package/dist/integrity/finding/types.js +52 -0
- package/dist/integrity/finding/types.js.map +1 -0
- package/dist/integrity/invariant-violation/check.js +86 -0
- package/dist/integrity/invariant-violation/check.js.map +1 -0
- package/dist/integrity/invariant-violation/wire.js +97 -0
- package/dist/integrity/invariant-violation/wire.js.map +1 -0
- package/dist/recorders/core/IntegrityRecorder.js +29 -0
- package/dist/recorders/core/IntegrityRecorder.js.map +1 -0
- package/dist/types/adapters/llm/AnthropicProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/BrowserAnthropicProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/MockProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/wireManifest.d.ts +30 -0
- package/dist/types/adapters/llm/wireManifest.d.ts.map +1 -0
- package/dist/types/adapters/types.d.ts +20 -0
- package/dist/types/adapters/types.d.ts.map +1 -1
- package/dist/types/core/Agent.d.ts +27 -0
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/buildDynamicAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/stages/callLLM.d.ts +15 -0
- package/dist/types/core/agent/stages/callLLM.d.ts.map +1 -1
- package/dist/types/core/agent/types.d.ts +17 -0
- package/dist/types/core/agent/types.d.ts.map +1 -1
- package/dist/types/core/slots/buildToolsSlot.d.ts +24 -0
- package/dist/types/core/slots/buildToolsSlot.d.ts.map +1 -1
- package/dist/types/core/tools.d.ts +36 -0
- package/dist/types/core/tools.d.ts.map +1 -1
- package/dist/types/events/dispatcher.d.ts +1 -1
- package/dist/types/events/dispatcher.d.ts.map +1 -1
- package/dist/types/events/payloads.d.ts +27 -0
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/events/registry.d.ts +7 -1
- package/dist/types/events/registry.d.ts.map +1 -1
- package/dist/types/integrity/assertion/conflicts.d.ts +36 -0
- package/dist/types/integrity/assertion/conflicts.d.ts.map +1 -0
- package/dist/types/integrity/assertion/types.d.ts +75 -0
- package/dist/types/integrity/assertion/types.d.ts.map +1 -0
- package/dist/types/integrity/dangling-reference/check.d.ts +46 -0
- package/dist/types/integrity/dangling-reference/check.d.ts.map +1 -0
- package/dist/types/integrity/disposition/lifecycle.d.ts +36 -0
- package/dist/types/integrity/disposition/lifecycle.d.ts.map +1 -0
- package/dist/types/integrity/finding/types.d.ts +58 -0
- package/dist/types/integrity/finding/types.d.ts.map +1 -0
- package/dist/types/integrity/invariant-violation/check.d.ts +53 -0
- package/dist/types/integrity/invariant-violation/check.d.ts.map +1 -0
- package/dist/types/integrity/invariant-violation/wire.d.ts +44 -0
- package/dist/types/integrity/invariant-violation/wire.d.ts.map +1 -0
- package/dist/types/recorders/core/IntegrityRecorder.d.ts +21 -0
- package/dist/types/recorders/core/IntegrityRecorder.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* major bump. See agentfootprint_v2_detailed_design.md for rules.
|
|
17
17
|
*/
|
|
18
18
|
import type { AgentfootprintEventEnvelope } from './types.js';
|
|
19
|
-
import type { AgentHandoffPayload, AgentIterationEndPayload, AgentIterationStartPayload, AgentBudgetExhaustedPayload, AgentRouteDecidedPayload, AgentTurnEndPayload, AgentTurnStartPayload, CompositionEnterPayload, CompositionExitPayload, ConditionalRouteDecidedPayload, ContextBudgetPressurePayload, ContextEvaluatedPayload, ContextEvictedPayload, ContextInjectedPayload, ContextSlotComposedPayload, CostLimitHitPayload, CostTickPayload, EmbeddingGeneratedPayload, ErrorCircuitChangedPayload, ErrorFatalPayload, ErrorRecoveredPayload, ErrorRetriedPayload, EvalScorePayload, EvalThresholdCrossedPayload, AgentOutputSchemaValidationFailedPayload, AgentOutputContractUnmetPayload, AgentOutputSchemaRetryPayload, AgentEvidenceCheckedPayload, AgentRunConfiguredPayload, AgentThinkingParseFailedPayload, StreamThinkingDeltaPayload, StreamThinkingEndPayload, FallbackTriggeredPayload, LLMEndPayload, LLMStartPayload, LLMTokenPayload, LoopIterationExitPayload, LoopIterationStartPayload, MemoryAttachedPayload, MemoryDetachedPayload, MemoryRetrievedPayload, MemoryStrategyAppliedPayload, MemoryWrittenPayload, ParallelBranchCompletePayload, ParallelForkStartPayload, ParallelMergeEndPayload, PauseRequestPayload, PauseResumePayload, CheckInRequestPayload, CheckInDecisionPayload, PermissionCheckPayload, PermissionGateClosedPayload, PermissionHaltPayload, PermissionGateOpenedPayload, CredentialRequestedPayload, CredentialAcquiredPayload, CredentialAuthorizationRequiredPayload, CredentialFailedPayload, ReliabilityFailFastPayload, ReliabilityRetriedPayload, ReliabilityRecoveredPayload, ResilienceOutputFallbackTriggeredPayload, ResilienceOutputCannedUsedPayload, RiskFlaggedPayload, SkillActivatedPayload, SkillDeactivatedPayload, SkillEscalatedPayload, SkillGraphDeclaredPayload, SkillRejectedPayload, SkillRerouteSupersededPayload, SkillRouteConflictPayload, SkillStepAdvancedPayload, SkillStepSkippedPayload, SkillStepsUnfinishedPayload, SkillTurnRoutedPayload, ToolAbsentPayload, ToolCoverageDeclaredPayload, ToolSemanticsDeclaredPayload, ToolsCodeRunPayload, ToolEffectPayload, ToolRepeatedCallPayload, ToolResultRefusedPayload, ToolEndPayload, ToolsActivatedPayload, ToolsDeactivatedPayload, ToolsDiscoveryStartedPayload, ToolsDiscoveryCompletedPayload, ToolsDiscoveryFailedPayload, ToolsShadowedPayload, ToolsSessionStartedPayload, ToolsSessionReusedPayload, ToolsSessionClosedPayload, ToolsSessionCloseFailedPayload, ToolsOfferedPayload, ToolProgressPayload, ToolStartPayload, ValidationArgsInvalidPayload, MiddlewareDecisionPayload, ArtifactMintedPayload, ArtifactResolvedPayload, ArtifactExpiredPayload, ArtifactRefusedPayload, ArtifactPresentedPayload, MapEngagedPayload, MapParkedPayload } from './payloads.js';
|
|
19
|
+
import type { AgentHandoffPayload, AgentIterationEndPayload, AgentIterationStartPayload, AgentBudgetExhaustedPayload, AgentRouteDecidedPayload, AgentTurnEndPayload, AgentTurnStartPayload, CompositionEnterPayload, CompositionExitPayload, ConditionalRouteDecidedPayload, ContextBudgetPressurePayload, ContextEvaluatedPayload, ContextEvictedPayload, ContextInjectedPayload, ContextSlotComposedPayload, CostLimitHitPayload, CostTickPayload, EmbeddingGeneratedPayload, ErrorCircuitChangedPayload, ErrorFatalPayload, ErrorRecoveredPayload, ErrorRetriedPayload, EvalScorePayload, EvalThresholdCrossedPayload, AgentOutputSchemaValidationFailedPayload, AgentOutputContractUnmetPayload, AgentOutputSchemaRetryPayload, AgentEvidenceCheckedPayload, AgentRunConfiguredPayload, AgentThinkingParseFailedPayload, StreamThinkingDeltaPayload, StreamThinkingEndPayload, FallbackTriggeredPayload, LLMEndPayload, LLMStartPayload, LLMTokenPayload, LoopIterationExitPayload, LoopIterationStartPayload, MemoryAttachedPayload, MemoryDetachedPayload, MemoryRetrievedPayload, MemoryStrategyAppliedPayload, MemoryWrittenPayload, ParallelBranchCompletePayload, ParallelForkStartPayload, ParallelMergeEndPayload, PauseRequestPayload, PauseResumePayload, CheckInRequestPayload, CheckInDecisionPayload, PermissionCheckPayload, PermissionGateClosedPayload, PermissionHaltPayload, PermissionGateOpenedPayload, CredentialRequestedPayload, CredentialAcquiredPayload, CredentialAuthorizationRequiredPayload, CredentialFailedPayload, ReliabilityFailFastPayload, ReliabilityRetriedPayload, ReliabilityRecoveredPayload, ResilienceOutputFallbackTriggeredPayload, ResilienceOutputCannedUsedPayload, RiskFlaggedPayload, SkillActivatedPayload, SkillDeactivatedPayload, SkillEscalatedPayload, SkillGraphDeclaredPayload, SkillRejectedPayload, SkillRerouteSupersededPayload, SkillRouteConflictPayload, SkillStepAdvancedPayload, SkillStepSkippedPayload, SkillStepsUnfinishedPayload, SkillTurnRoutedPayload, ToolAbsentPayload, ToolCoverageDeclaredPayload, ToolSemanticsDeclaredPayload, ToolsCodeRunPayload, ToolEffectPayload, ToolRepeatedCallPayload, ToolResultRefusedPayload, ToolEndPayload, ToolsActivatedPayload, ToolsDeactivatedPayload, ToolsDiscoveryStartedPayload, ToolsDiscoveryCompletedPayload, ToolsDiscoveryFailedPayload, ToolsShadowedPayload, ToolsSessionStartedPayload, ToolsSessionReusedPayload, ToolsSessionClosedPayload, ToolsSessionCloseFailedPayload, ToolsOfferedPayload, ToolProgressPayload, ToolStartPayload, ValidationArgsInvalidPayload, MiddlewareDecisionPayload, ArtifactMintedPayload, ArtifactResolvedPayload, ArtifactExpiredPayload, ArtifactRefusedPayload, ArtifactPresentedPayload, MapEngagedPayload, MapParkedPayload, IntegrityContextErrorPayload, IntegrityDispositionPayload } from './payloads.js';
|
|
20
20
|
export declare const EVENT_NAMES: {
|
|
21
21
|
readonly composition: {
|
|
22
22
|
readonly enter: "agentfootprint.composition.enter";
|
|
@@ -104,6 +104,10 @@ export declare const EVENT_NAMES: {
|
|
|
104
104
|
readonly engaged: "agentfootprint.map.engaged";
|
|
105
105
|
readonly parked: "agentfootprint.map.parked";
|
|
106
106
|
};
|
|
107
|
+
readonly integrity: {
|
|
108
|
+
readonly contextError: "agentfootprint.integrity.context_error";
|
|
109
|
+
readonly disposition: "agentfootprint.integrity.disposition";
|
|
110
|
+
};
|
|
107
111
|
readonly validation: {
|
|
108
112
|
readonly argsInvalid: "agentfootprint.validation.args_invalid";
|
|
109
113
|
};
|
|
@@ -276,6 +280,8 @@ export interface AgentfootprintEventMap {
|
|
|
276
280
|
'agentfootprint.artifacts.presented': AgentfootprintEventEnvelope<'agentfootprint.artifacts.presented', ArtifactPresentedPayload>;
|
|
277
281
|
'agentfootprint.map.engaged': AgentfootprintEventEnvelope<'agentfootprint.map.engaged', MapEngagedPayload>;
|
|
278
282
|
'agentfootprint.map.parked': AgentfootprintEventEnvelope<'agentfootprint.map.parked', MapParkedPayload>;
|
|
283
|
+
'agentfootprint.integrity.context_error': AgentfootprintEventEnvelope<'agentfootprint.integrity.context_error', IntegrityContextErrorPayload>;
|
|
284
|
+
'agentfootprint.integrity.disposition': AgentfootprintEventEnvelope<'agentfootprint.integrity.disposition', IntegrityDispositionPayload>;
|
|
279
285
|
}
|
|
280
286
|
/** Union of every typed event. Consumers use this for exhaustive `switch`. */
|
|
281
287
|
export type AgentfootprintEvent = AgentfootprintEventMap[keyof AgentfootprintEventMap];
|
|
@@ -105,6 +105,10 @@ export const EVENT_NAMES = {
|
|
|
105
105
|
engaged: 'agentfootprint.map.engaged',
|
|
106
106
|
parked: 'agentfootprint.map.parked',
|
|
107
107
|
},
|
|
108
|
+
integrity: {
|
|
109
|
+
contextError: 'agentfootprint.integrity.context_error',
|
|
110
|
+
disposition: 'agentfootprint.integrity.disposition',
|
|
111
|
+
},
|
|
108
112
|
validation: {
|
|
109
113
|
argsInvalid: 'agentfootprint.validation.args_invalid',
|
|
110
114
|
},
|
|
@@ -281,5 +285,7 @@ export const ALL_EVENT_TYPES = [
|
|
|
281
285
|
'agentfootprint.artifacts.presented',
|
|
282
286
|
'agentfootprint.map.engaged',
|
|
283
287
|
'agentfootprint.map.parked',
|
|
288
|
+
'agentfootprint.integrity.context_error',
|
|
289
|
+
'agentfootprint.integrity.disposition',
|
|
284
290
|
];
|
|
285
291
|
//# sourceMappingURL=registry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/events/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/events/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAiHH,yEAAyE;AACzE,gEAAgE;AAChE,wEAAwE;AACxE,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,WAAW,EAAE;QACX,KAAK,EAAE,kCAAkC;QACzC,IAAI,EAAE,iCAAiC;QACvC,SAAS,EAAE,uCAAuC;QAClD,cAAc,EAAE,4CAA4C;QAC5D,QAAQ,EAAE,sCAAsC;QAChD,YAAY,EAAE,0CAA0C;QACxD,cAAc,EAAE,4CAA4C;QAC5D,aAAa,EAAE,2CAA2C;KAC3D;IACD,KAAK,EAAE;QACL,SAAS,EAAE,iCAAiC;QAC5C,OAAO,EAAE,+BAA+B;QACxC,cAAc,EAAE,sCAAsC;QACtD,YAAY,EAAE,oCAAoC;QAClD,YAAY,EAAE,oCAAoC;QAClD,OAAO,EAAE,8BAA8B;QACvC,4BAA4B,EAAE,sDAAsD;QACpF,iBAAiB,EAAE,0CAA0C;QAC7D,mBAAmB,EAAE,4CAA4C;QACjE,eAAe,EAAE,uCAAuC;QACxD,aAAa,EAAE,qCAAqC;QACpD,mBAAmB,EAAE,4CAA4C;QACjE,eAAe,EAAE,uCAAuC;KACzD;IACD,MAAM,EAAE;QACN,QAAQ,EAAE,iCAAiC;QAC3C,MAAM,EAAE,+BAA+B;QACvC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IAChC,qCAAqC;IACrC,kCAAkC;IAClC,+BAA+B;IAC/B,yCAAyC;IACzC,qCAAqC;IACrC,kCAAkC;IAClC,oCAAoC;IACpC,mCAAmC;IACnC,uCAAuC;IACvC,gCAAgC;IAChC,iCAAiC;IACjC,uCAAuC;IACvC,uCAAuC;IACvC,gCAAgC;IAChC,qCAAqC;IACrC,oCAAoC;IACpC,kDAAkD;IAClD,kCAAkC;IAClC,6BAA6B;IAC7B,mCAAmC;IACnC,0BAA0B;IAC1B,+BAA+B;IAC/B,2BAA2B;IAC3B,uCAAuC;IACvC,8BAA8B;IAC9B,gCAAgC;IAChC,4BAA4B;IAC5B,sCAAsC;IACtC,sCAAsC;IACtC,oCAAoC;IACpC,sCAAsC;IACtC,qDAAqD;IACrD,8CAA8C;IAC9C,8BAA8B;IAC9B,6BAA6B;IAC7B,gCAAgC;IAChC,iCAAiC;IACjC,oCAAoC;IACpC,oCAAoC;IACpC,iCAAiC;IACjC,mCAAmC;IACnC,kCAAkC;IAClC,kCAAkC;IAClC,oCAAoC;IACpC,4BAA4B;IAC5B,2BAA2B;IAC3B,wCAAwC;IACxC,sCAAsC;CAC9B,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* conflictsOf — the exclusion comparison, pure.
|
|
3
|
+
*
|
|
4
|
+
* Pattern: pure function over a finite assertion set. No I/O, no store.
|
|
5
|
+
* Role: the algebra's first comparison: two `asserted` (never quoted)
|
|
6
|
+
* assertions on one single-valued `(subject, predicate, epoch)`
|
|
7
|
+
* key with different comparable values cannot both be true.
|
|
8
|
+
*
|
|
9
|
+
* What it deliberately does NOT do:
|
|
10
|
+
* - fire across strata (history is quotation);
|
|
11
|
+
* - compare unknowns (honest absence — an unknown neither corroborates
|
|
12
|
+
* nor contradicts);
|
|
13
|
+
* - fire on multi-valued predicates (the declared exception);
|
|
14
|
+
* - infer subject identity (no stamp, no comparison);
|
|
15
|
+
* - resolve anything — it names pairs; the caller files findings.
|
|
16
|
+
*
|
|
17
|
+
* Values compare by structural equality over their comparable face (a
|
|
18
|
+
* known `Claim` compares by its value), via JSON with sorted keys — the
|
|
19
|
+
* same determinism bar the house holds serialization to elsewhere.
|
|
20
|
+
*/
|
|
21
|
+
import { type Assertion } from './types.js';
|
|
22
|
+
/** One exclusion: the two-or-more assertions that cannot all be true. */
|
|
23
|
+
export interface Conflict {
|
|
24
|
+
readonly key: string;
|
|
25
|
+
/** Every distinct-valued assertion on the key, in input order. */
|
|
26
|
+
readonly assertions: readonly Assertion[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Find every single-valued key carrying two or more distinct values.
|
|
30
|
+
*
|
|
31
|
+
* @param assertions the finite set under comparison (one payload, or one
|
|
32
|
+
* write-delta joined with the standing set for a subject)
|
|
33
|
+
* @param multiValued predicates exempt from single-valuedness, declared
|
|
34
|
+
*/
|
|
35
|
+
export declare function conflictsOf(assertions: readonly Assertion[], multiValued?: ReadonlySet<string>): readonly Conflict[];
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* conflictsOf — the exclusion comparison, pure.
|
|
3
|
+
*
|
|
4
|
+
* Pattern: pure function over a finite assertion set. No I/O, no store.
|
|
5
|
+
* Role: the algebra's first comparison: two `asserted` (never quoted)
|
|
6
|
+
* assertions on one single-valued `(subject, predicate, epoch)`
|
|
7
|
+
* key with different comparable values cannot both be true.
|
|
8
|
+
*
|
|
9
|
+
* What it deliberately does NOT do:
|
|
10
|
+
* - fire across strata (history is quotation);
|
|
11
|
+
* - compare unknowns (honest absence — an unknown neither corroborates
|
|
12
|
+
* nor contradicts);
|
|
13
|
+
* - fire on multi-valued predicates (the declared exception);
|
|
14
|
+
* - infer subject identity (no stamp, no comparison);
|
|
15
|
+
* - resolve anything — it names pairs; the caller files findings.
|
|
16
|
+
*
|
|
17
|
+
* Values compare by structural equality over their comparable face (a
|
|
18
|
+
* known `Claim` compares by its value), via JSON with sorted keys — the
|
|
19
|
+
* same determinism bar the house holds serialization to elsewhere.
|
|
20
|
+
*/
|
|
21
|
+
import { assertionKey, comparableValueOf, participates } from './types.js';
|
|
22
|
+
/** Deterministic structural rendering — sorted keys, no ambient state. */
|
|
23
|
+
function renderValue(value) {
|
|
24
|
+
const face = comparableValueOf(value);
|
|
25
|
+
return JSON.stringify(face, (_k, v) => {
|
|
26
|
+
if (v !== null && typeof v === 'object' && !Array.isArray(v)) {
|
|
27
|
+
const sorted = {};
|
|
28
|
+
for (const key of Object.keys(v).sort()) {
|
|
29
|
+
sorted[key] = v[key];
|
|
30
|
+
}
|
|
31
|
+
return sorted;
|
|
32
|
+
}
|
|
33
|
+
return v;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Find every single-valued key carrying two or more distinct values.
|
|
38
|
+
*
|
|
39
|
+
* @param assertions the finite set under comparison (one payload, or one
|
|
40
|
+
* write-delta joined with the standing set for a subject)
|
|
41
|
+
* @param multiValued predicates exempt from single-valuedness, declared
|
|
42
|
+
*/
|
|
43
|
+
export function conflictsOf(assertions, multiValued = new Set()) {
|
|
44
|
+
const byKey = new Map();
|
|
45
|
+
for (const a of assertions) {
|
|
46
|
+
if (a.stratum !== 'asserted')
|
|
47
|
+
continue; // history is quotation
|
|
48
|
+
if (multiValued.has(a.predicate))
|
|
49
|
+
continue; // the declared exception
|
|
50
|
+
if (!participates(a.value))
|
|
51
|
+
continue; // unknowns never compare
|
|
52
|
+
const key = assertionKey(a);
|
|
53
|
+
let entry = byKey.get(key);
|
|
54
|
+
if (entry === undefined) {
|
|
55
|
+
entry = { byValue: new Map(), order: [] };
|
|
56
|
+
byKey.set(key, entry);
|
|
57
|
+
}
|
|
58
|
+
const rendered = renderValue(a.value);
|
|
59
|
+
const bucket = entry.byValue.get(rendered);
|
|
60
|
+
if (bucket === undefined)
|
|
61
|
+
entry.byValue.set(rendered, [a]);
|
|
62
|
+
else
|
|
63
|
+
bucket.push(a);
|
|
64
|
+
entry.order.push(a);
|
|
65
|
+
}
|
|
66
|
+
const conflicts = [];
|
|
67
|
+
for (const [key, entry] of byKey) {
|
|
68
|
+
if (entry.byValue.size < 2)
|
|
69
|
+
continue;
|
|
70
|
+
conflicts.push({ key, assertions: entry.order });
|
|
71
|
+
}
|
|
72
|
+
return conflicts;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=conflicts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conflicts.js","sourceRoot":"","sources":["../../../../src/integrity/assertion/conflicts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAkB,MAAM,YAAY,CAAC;AAS3F,0EAA0E;AAC1E,SAAS,WAAW,CAAC,KAAc;IACjC,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACtC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAU,EAAE,EAAE;QAC7C,IAAI,CAAC,KAAK,IAAI,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7D,MAAM,MAAM,GAA4B,EAAE,CAAC;YAC3C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,CAAW,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;gBAClD,MAAM,CAAC,GAAG,CAAC,GAAI,CAA6B,CAAC,GAAG,CAAC,CAAC;YACpD,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CACzB,UAAgC,EAChC,cAAmC,IAAI,GAAG,EAAE;IAE5C,MAAM,KAAK,GAAG,IAAI,GAAG,EAAqE,CAAC;IAE3F,KAAK,MAA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AK,EAAE,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Assertion — one typed claim about one subject, with the two rules that
|
|
3
|
+
* give the algebra its teeth.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: plain data + a keyed identity. Pure, structuredClone-safe.
|
|
6
|
+
* Role: the Context Integrity substrate. Everything a seam adapter
|
|
7
|
+
* hands a check is first normalised into assertions keyed by
|
|
8
|
+
* `(subject, predicate, epoch)`, so every check compares one
|
|
9
|
+
* shape and subject identity is READ off stamps, never inferred.
|
|
10
|
+
*
|
|
11
|
+
* THE TWO RULES:
|
|
12
|
+
*
|
|
13
|
+
* **Serving is asserting; history is quotation.** A tool schema on the
|
|
14
|
+
* wire asserts "available now"; a block labelled current-state asserts its
|
|
15
|
+
* contents as current. Transcript history is `quoted` — it legitimately
|
|
16
|
+
* holds superseded values, and checks never fire across the quoted
|
|
17
|
+
* stratum. This one distinction eliminates the false-positive class of
|
|
18
|
+
* stale-but-honest history with no judgment call.
|
|
19
|
+
*
|
|
20
|
+
* **Single-valued by default.** Two `asserted` assertions on one key with
|
|
21
|
+
* different values contradict; multi-valued predicates are the declared
|
|
22
|
+
* exception. Exemptions are declared, rules are never authored.
|
|
23
|
+
*
|
|
24
|
+
* Honest absence: a value that IS an unknown (a `Claim` whose kind is not
|
|
25
|
+
* `'known'`) never participates in a comparison — an unknown can neither
|
|
26
|
+
* corroborate nor contradict, and anything derived from it is unknown.
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* A stamped identity edge — WHO a fact is about, written at the one moment
|
|
30
|
+
* the code demonstrably knows both ends (registration, mount, mint). The
|
|
31
|
+
* checker only ever reads these; it never infers identity. Facts without a
|
|
32
|
+
* shared stamped subject are incomparable, and incomparable means silent —
|
|
33
|
+
* which is why the disposition ledger counts `unreachable`.
|
|
34
|
+
*/
|
|
35
|
+
export interface SubjectRef {
|
|
36
|
+
/** What kind of thing — 'map' | 'skill' | 'tool' | 'action' | app kinds. Open by design. */
|
|
37
|
+
readonly kind: string;
|
|
38
|
+
readonly id: string;
|
|
39
|
+
}
|
|
40
|
+
/** The strata rule, as a type: only `asserted` facts can contradict. */
|
|
41
|
+
export type AssertionStratum = 'asserted' | 'quoted';
|
|
42
|
+
/** One typed claim about one subject. */
|
|
43
|
+
export interface Assertion {
|
|
44
|
+
readonly subject: SubjectRef;
|
|
45
|
+
/** The relation this asserts — 'status', 'offered', 'position', … */
|
|
46
|
+
readonly predicate: string;
|
|
47
|
+
/**
|
|
48
|
+
* The claimed value. May be a plain value or a `Claim<T>`; a non-`known`
|
|
49
|
+
* Claim never participates in any comparison (honest absence).
|
|
50
|
+
*/
|
|
51
|
+
readonly value: unknown;
|
|
52
|
+
/**
|
|
53
|
+
* The epoch this was asserted UNDER — a monotonic version from the
|
|
54
|
+
* subject's own counter (a session version, a cursor version). Two
|
|
55
|
+
* assertions at DIFFERENT epochs are history, not contradiction; absent
|
|
56
|
+
* means "the current, unversioned world", and only matches absent.
|
|
57
|
+
*/
|
|
58
|
+
readonly epoch?: number;
|
|
59
|
+
readonly stratum: AssertionStratum;
|
|
60
|
+
/** Where this came from — one plain sentence or a source ref. */
|
|
61
|
+
readonly provenance: string;
|
|
62
|
+
/** The universal join key into commit logs and recordings, when known. */
|
|
63
|
+
readonly runtimeStageId?: string;
|
|
64
|
+
/** Dev-posture canary material — quarantined from every real count. */
|
|
65
|
+
readonly synthetic?: true;
|
|
66
|
+
}
|
|
67
|
+
/** The identity a single-valued comparison runs over. */
|
|
68
|
+
export declare function assertionKey(a: Assertion): string;
|
|
69
|
+
/** Same stamped subject — the only identity the algebra ever claims. */
|
|
70
|
+
export declare function sameSubject(a: SubjectRef, b: SubjectRef): boolean;
|
|
71
|
+
/** Does this value participate in comparisons? Unknowns never do. */
|
|
72
|
+
export declare function participates(value: unknown): boolean;
|
|
73
|
+
/** The comparable face of a value: a known Claim compares by its value. */
|
|
74
|
+
export declare function comparableValueOf(value: unknown): unknown;
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/integrity/assertion/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AA8CH,yDAAyD;AACzD,MAAM,UAAU,YAAY,CAAC,CAAY;IACvC,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC3D,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,CAAC,SAAS,IAAI,KAAK,EAAE,CAAC;AACrE,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,WAAW,CAAC,CAAa,EAAE,CAAa;IACtD,OAAO,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;AAC5C,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,MAAM,KAAK,GAAG,KAAuC,CAAC;IACtD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAClF,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,KAAK,CAAC,IAAI,KAAK,gBAAgB;YAAE,OAAO,KAAK,CAAC;IAChF,CAAC;IACD,OAAO,KAAK,KAAK,SAAS,CAAC;AAC7B,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,MAAM,KAAK,GAAG,KAAuC,CAAC;IACtD,IACE,KAAK,KAAK,IAAI;QACd,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,CAAC,IAAI,KAAK,OAAO;QACtB,OAAO,IAAK,KAAgB,EAC5B,CAAC;QACD,OAAQ,KAA4B,CAAC,KAAK,CAAC;IAC7C,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dangling-reference — a served capability whose declared argument ground
|
|
3
|
+
* has left the window and was not re-established.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: pure function over three name sets; the closure check.
|
|
6
|
+
* Role: the decidable fragment of "does everything the model is being
|
|
7
|
+
* offered still have its evidence in reach?". The measured
|
|
8
|
+
* failure: a `whats_here` result carrying the valid ids was
|
|
9
|
+
* evicted by the window strategy while the tool that FIRES at
|
|
10
|
+
* those ids stayed on the wire; the model assembled a plausible
|
|
11
|
+
* id from memory and was refused. The drop already speaks
|
|
12
|
+
* (9.57.0, `WindowRecord.droppedObservations`); this makes the
|
|
13
|
+
* next composition answerable for it.
|
|
14
|
+
*
|
|
15
|
+
* DECLARED, NEVER INFERRED. The library cannot know that one tool's
|
|
16
|
+
* arguments come from another tool's results — only the author does. The
|
|
17
|
+
* edge is `Tool.argumentsFrom`, stamped at definition; a tool that
|
|
18
|
+
* declares nothing is never this check's subject, which is the whole
|
|
19
|
+
* zero-delta story.
|
|
20
|
+
*
|
|
21
|
+
* THE TWO FENCES, stated because they are the check's honesty:
|
|
22
|
+
* - A ground that was NEVER dropped is silent even with no result in the
|
|
23
|
+
* window — the model simply has not called it yet, and offering the
|
|
24
|
+
* dependent tool ahead of that is legitimate sequencing, not a defect.
|
|
25
|
+
* - A re-fetched ground (a fresh result present in the window) is silent
|
|
26
|
+
* however many drops preceded it — the evidence is back in reach.
|
|
27
|
+
* The defect is exactly the third state: WAS grounded, evidence evicted,
|
|
28
|
+
* nothing re-established, capability still offered.
|
|
29
|
+
*/
|
|
30
|
+
import type { ContextError } from '../finding/types.js';
|
|
31
|
+
/** One served tool and the grounds its author declared. */
|
|
32
|
+
export interface ServedGroundedTool {
|
|
33
|
+
readonly name: string;
|
|
34
|
+
/** `Tool.argumentsFrom` — tool names whose results ground this one's arguments. */
|
|
35
|
+
readonly argumentsFrom: readonly string[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Compare the served tools' declared grounds against what the window has
|
|
39
|
+
* dropped and what it currently holds.
|
|
40
|
+
*
|
|
41
|
+
* @param droppedResults tool names whose RESULTS have left the window this
|
|
42
|
+
* run (union of `WindowRecord.droppedObservations`).
|
|
43
|
+
* @param presentResults tool names with a result currently IN the window.
|
|
44
|
+
*/
|
|
45
|
+
export declare function danglingReferencesOf(servedTools: readonly ServedGroundedTool[], droppedResults: ReadonlySet<string>, presentResults: ReadonlySet<string>, epoch: number): readonly ContextError[];
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dangling-reference — a served capability whose declared argument ground
|
|
3
|
+
* has left the window and was not re-established.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: pure function over three name sets; the closure check.
|
|
6
|
+
* Role: the decidable fragment of "does everything the model is being
|
|
7
|
+
* offered still have its evidence in reach?". The measured
|
|
8
|
+
* failure: a `whats_here` result carrying the valid ids was
|
|
9
|
+
* evicted by the window strategy while the tool that FIRES at
|
|
10
|
+
* those ids stayed on the wire; the model assembled a plausible
|
|
11
|
+
* id from memory and was refused. The drop already speaks
|
|
12
|
+
* (9.57.0, `WindowRecord.droppedObservations`); this makes the
|
|
13
|
+
* next composition answerable for it.
|
|
14
|
+
*
|
|
15
|
+
* DECLARED, NEVER INFERRED. The library cannot know that one tool's
|
|
16
|
+
* arguments come from another tool's results — only the author does. The
|
|
17
|
+
* edge is `Tool.argumentsFrom`, stamped at definition; a tool that
|
|
18
|
+
* declares nothing is never this check's subject, which is the whole
|
|
19
|
+
* zero-delta story.
|
|
20
|
+
*
|
|
21
|
+
* THE TWO FENCES, stated because they are the check's honesty:
|
|
22
|
+
* - A ground that was NEVER dropped is silent even with no result in the
|
|
23
|
+
* window — the model simply has not called it yet, and offering the
|
|
24
|
+
* dependent tool ahead of that is legitimate sequencing, not a defect.
|
|
25
|
+
* - A re-fetched ground (a fresh result present in the window) is silent
|
|
26
|
+
* however many drops preceded it — the evidence is back in reach.
|
|
27
|
+
* The defect is exactly the third state: WAS grounded, evidence evicted,
|
|
28
|
+
* nothing re-established, capability still offered.
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Compare the served tools' declared grounds against what the window has
|
|
32
|
+
* dropped and what it currently holds.
|
|
33
|
+
*
|
|
34
|
+
* @param droppedResults tool names whose RESULTS have left the window this
|
|
35
|
+
* run (union of `WindowRecord.droppedObservations`).
|
|
36
|
+
* @param presentResults tool names with a result currently IN the window.
|
|
37
|
+
*/
|
|
38
|
+
export function danglingReferencesOf(servedTools, droppedResults, presentResults, epoch) {
|
|
39
|
+
const findings = [];
|
|
40
|
+
for (const tool of servedTools) {
|
|
41
|
+
const missing = tool.argumentsFrom.filter((ground) => droppedResults.has(ground) && !presentResults.has(ground));
|
|
42
|
+
if (missing.length === 0)
|
|
43
|
+
continue;
|
|
44
|
+
findings.push({
|
|
45
|
+
kind: 'dangling-reference',
|
|
46
|
+
seam: 'compose',
|
|
47
|
+
subjects: [
|
|
48
|
+
{ kind: 'tool', id: tool.name },
|
|
49
|
+
...missing.map((id) => ({ kind: 'tool', id })),
|
|
50
|
+
],
|
|
51
|
+
witnesses: missing.map((ground) => ({
|
|
52
|
+
subject: { kind: 'tool', id: tool.name },
|
|
53
|
+
predicate: 'argument-ground',
|
|
54
|
+
value: `results of '${ground}' evicted, not re-established`,
|
|
55
|
+
epoch,
|
|
56
|
+
stratum: 'asserted',
|
|
57
|
+
provenance: `window ledger: '${ground}' in droppedObservations, no result in window`,
|
|
58
|
+
})),
|
|
59
|
+
epoch,
|
|
60
|
+
message: `'${tool.name}' is being offered while the results that ground its arguments have left ` +
|
|
61
|
+
`the window (${missing.join(', ')}) and were not re-established. A call the model makes ` +
|
|
62
|
+
`with remembered values cannot be checked against evidence nobody can see — re-fetching ` +
|
|
63
|
+
`(calling ${missing.join(', ')} again) re-grounds it; nothing here withholds the tool.`,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return findings;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../../../src/integrity/dangling-reference/check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAYH;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAClC,WAA0C,EAC1C,cAAmC,EACnC,cAAmC,EACnC,KAAa;IAEb,MAAM,QAAQ,GAAmB,EAAE,CAAC;IACpC,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;QAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CACvC,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CACtE,CAAC;QACF,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QACnC,QAAQ,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,oBAAoB;YAC1B,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE;gBACR,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE;gBAC/B,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAc,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;aAC3D;YACD,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;gBAClC,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE;gBACxC,SAAS,EAAE,iBAAiB;gBAC5B,KAAK,EAAE,eAAe,MAAM,+BAA+B;gBAC3D,KAAK;gBACL,OAAO,EAAE,UAAmB;gBAC5B,UAAU,EAAE,mBAAmB,MAAM,+CAA+C;aACrF,CAAC,CAAC;YACH,KAAK;YACL,OAAO,EACL,IAAI,IAAI,CAAC,IAAI,2EAA2E;gBACxF,eAAe,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,wDAAwD;gBACzF,yFAAyF;gBACzF,YAAY,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,yDAAyD;SAC1F,CAAC,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The disposition ledger's run lifecycle — registration, the dev canary,
|
|
3
|
+
* and nothing else.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: two small functions bracketing a run; the ledger stays the one
|
|
6
|
+
* accumulator, this file only decides WHO is registered and runs
|
|
7
|
+
* the canary.
|
|
8
|
+
* Role: a check is registered exactly when its preconditions exist on
|
|
9
|
+
* THIS agent (wire: always — every run calls the model;
|
|
10
|
+
* compose-invariant: a mount kernel is configured; dangling: at
|
|
11
|
+
* least one tool declared `argumentsFrom`). Registration is what
|
|
12
|
+
* makes silence auditable — an unregistered check is honest
|
|
13
|
+
* absence, a registered one that never notes is the wiring rot
|
|
14
|
+
* `assertAlive` exists to name.
|
|
15
|
+
*
|
|
16
|
+
* THE CANARY (dev posture): each registered check's PURE function is run
|
|
17
|
+
* once against a synthetic, deliberately contradictory fixture. A check
|
|
18
|
+
* that cannot catch its own canary is dead — it runs but cannot fire —
|
|
19
|
+
* which is theorem (ii); theorem (i), the unhooked pipeline, is what the
|
|
20
|
+
* real per-encounter notes prove. Canary findings never surface as events
|
|
21
|
+
* and never touch the real counts (`noteSynthetic` quarantine).
|
|
22
|
+
*/
|
|
23
|
+
import { type DispositionLedger } from './ledger.js';
|
|
24
|
+
export type IntegrityPosture = 'observe' | 'dev';
|
|
25
|
+
/** Which checks this agent's configuration makes applicable. */
|
|
26
|
+
export interface IntegrityChecksPresent {
|
|
27
|
+
readonly wire: boolean;
|
|
28
|
+
readonly composeInvariant: boolean;
|
|
29
|
+
readonly dangling: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Start one run's ledger: register the present checks and, in dev posture,
|
|
33
|
+
* prove each can still catch its own synthetic defect.
|
|
34
|
+
*/
|
|
35
|
+
export declare function beginIntegrityRun(present: IntegrityChecksPresent, posture: IntegrityPosture): DispositionLedger;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The disposition ledger's run lifecycle — registration, the dev canary,
|
|
3
|
+
* and nothing else.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: two small functions bracketing a run; the ledger stays the one
|
|
6
|
+
* accumulator, this file only decides WHO is registered and runs
|
|
7
|
+
* the canary.
|
|
8
|
+
* Role: a check is registered exactly when its preconditions exist on
|
|
9
|
+
* THIS agent (wire: always — every run calls the model;
|
|
10
|
+
* compose-invariant: a mount kernel is configured; dangling: at
|
|
11
|
+
* least one tool declared `argumentsFrom`). Registration is what
|
|
12
|
+
* makes silence auditable — an unregistered check is honest
|
|
13
|
+
* absence, a registered one that never notes is the wiring rot
|
|
14
|
+
* `assertAlive` exists to name.
|
|
15
|
+
*
|
|
16
|
+
* THE CANARY (dev posture): each registered check's PURE function is run
|
|
17
|
+
* once against a synthetic, deliberately contradictory fixture. A check
|
|
18
|
+
* that cannot catch its own canary is dead — it runs but cannot fire —
|
|
19
|
+
* which is theorem (ii); theorem (i), the unhooked pipeline, is what the
|
|
20
|
+
* real per-encounter notes prove. Canary findings never surface as events
|
|
21
|
+
* and never touch the real counts (`noteSynthetic` quarantine).
|
|
22
|
+
*/
|
|
23
|
+
import { dispositionLedger } from './ledger.js';
|
|
24
|
+
import { invariantViolationsOf } from '../invariant-violation/check.js';
|
|
25
|
+
import { wireViolationsOf } from '../invariant-violation/wire.js';
|
|
26
|
+
import { danglingReferencesOf } from '../dangling-reference/check.js';
|
|
27
|
+
/**
|
|
28
|
+
* Start one run's ledger: register the present checks and, in dev posture,
|
|
29
|
+
* prove each can still catch its own synthetic defect.
|
|
30
|
+
*/
|
|
31
|
+
export function beginIntegrityRun(present, posture) {
|
|
32
|
+
const ledger = dispositionLedger();
|
|
33
|
+
if (present.wire)
|
|
34
|
+
ledger.register('invariant-violation', 'wire');
|
|
35
|
+
if (present.composeInvariant)
|
|
36
|
+
ledger.register('invariant-violation', 'compose');
|
|
37
|
+
if (present.dangling)
|
|
38
|
+
ledger.register('dangling-reference', 'compose');
|
|
39
|
+
if (posture !== 'dev')
|
|
40
|
+
return ledger;
|
|
41
|
+
// The canaries — one known-bad fixture per registered check, through the
|
|
42
|
+
// REAL pure function. Epoch -1 marks them as no run iteration's business.
|
|
43
|
+
if (present.wire) {
|
|
44
|
+
ledger.noteSynthetic('invariant-violation', 'wire', 'minted');
|
|
45
|
+
const caught = wireViolationsOf({ names: ['canary_tool'], provenance: 'canary: composed frame' }, { names: ['canary_tool', 'canary_ghost'], provenance: 'canary: wire' }, -1);
|
|
46
|
+
if (caught.length > 0)
|
|
47
|
+
ledger.noteSynthetic('invariant-violation', 'wire', 'caught');
|
|
48
|
+
}
|
|
49
|
+
if (present.composeInvariant) {
|
|
50
|
+
ledger.noteSynthetic('invariant-violation', 'compose', 'minted');
|
|
51
|
+
const caught = invariantViolationsOf({ mapId: 'canary-map', standing: 'parked', iteration: -1, ownedToolNames: ['canary_tool'] }, { names: ['canary_tool'], provenance: 'canary: serving' });
|
|
52
|
+
if (caught.length > 0)
|
|
53
|
+
ledger.noteSynthetic('invariant-violation', 'compose', 'caught');
|
|
54
|
+
}
|
|
55
|
+
if (present.dangling) {
|
|
56
|
+
ledger.noteSynthetic('dangling-reference', 'compose', 'minted');
|
|
57
|
+
const caught = danglingReferencesOf([{ name: 'canary_tool', argumentsFrom: ['canary_ground'] }], new Set(['canary_ground']), new Set(), -1);
|
|
58
|
+
if (caught.length > 0)
|
|
59
|
+
ledger.noteSynthetic('dangling-reference', 'compose', 'caught');
|
|
60
|
+
}
|
|
61
|
+
return ledger;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=lifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../../../src/integrity/disposition/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,iBAAiB,EAA0B,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAWtE;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAA+B,EAC/B,OAAyB;IAEzB,MAAM,MAAM,GAAG,iBAAiB,EAAE,CAAC;IACnC,IAAI,OAAO,CAAC,IAAI;QAAE,MAAM,CAAC,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;IACjE,IAAI,OAAO,CAAC,gBAAgB;QAAE,MAAM,CAAC,QAAQ,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC;IAChF,IAAI,OAAO,CAAC,QAAQ;QAAE,MAAM,CAAC,QAAQ,CAAC,oBAAoB,EAAE,SAAS,CAAC,CAAC;IACvE,IAAI,OAAO,KAAK,KAAK;QAAE,OAAO,MAAM,CAAC;IAErC,yEAAyE;IACzE,0EAA0E;IAC1E,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,MAAM,CAAC,aAAa,CAAC,qBAAqB,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC9D,MAAM,MAAM,GAAG,gBAAgB,CAC7B,EAAE,KAAK,E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QAAQ,CAAC,CAAC;IACzF,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ContextError — the ONE visible finding type, named in the words people
|
|
3
|
+
* already use for these defects.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: plain data + identity-keyed dedup. Pure.
|
|
6
|
+
* Role: everything a Context Integrity check detects is filed as
|
|
7
|
+
* exactly this shape, at every seam — a uniform finding is what
|
|
8
|
+
* makes findings a CORPUS (each one a labelled instance carrying
|
|
9
|
+
* its check, seam, subjects and witnesses) and what keeps the
|
|
10
|
+
* disposition accounting honest across seams.
|
|
11
|
+
*
|
|
12
|
+
* NAMING LAW: the `kind` is the plain software-defect name, never the
|
|
13
|
+
* algebra term — the people reading a finding are not reading the
|
|
14
|
+
* mechanism. The one guardrail that outranks the naming: never use a
|
|
15
|
+
* familiar name that is subtly wrong. ("State loss" for the evicted-
|
|
16
|
+
* identifiers failure would send an engineer hunting a storage bug that
|
|
17
|
+
* does not exist; the ledger held every identifier — they stopped being
|
|
18
|
+
* SERVED. `dangling-reference` is what a linker means and what happened.)
|
|
19
|
+
*/
|
|
20
|
+
import type { Assertion, SubjectRef } from '../assertion/types.js';
|
|
21
|
+
import type { IntegritySeam } from '../disposition/types.js';
|
|
22
|
+
/**
|
|
23
|
+
* The five defect classes, by their plain names:
|
|
24
|
+
*
|
|
25
|
+
* | kind | means | mechanism |
|
|
26
|
+
* |---|---|---|
|
|
27
|
+
* | `invariant-violation` | two things that cannot both be true were both asserted | exclusion |
|
|
28
|
+
* | `unsupported-argument` | acted on a value nothing served | domain |
|
|
29
|
+
* | `dangling-reference` | offered an action whose inputs are no longer available | closure |
|
|
30
|
+
* | `duplicate-execution` | did settled work again | once |
|
|
31
|
+
* | `unsupported-claim` | stated something the record does not support | grounding |
|
|
32
|
+
*/
|
|
33
|
+
export type ContextErrorKind = 'invariant-violation' | 'unsupported-argument' | 'dangling-reference' | 'duplicate-execution' | 'unsupported-claim';
|
|
34
|
+
/** One detected context error — a labelled instance, automatically. */
|
|
35
|
+
export interface ContextError {
|
|
36
|
+
readonly kind: ContextErrorKind;
|
|
37
|
+
readonly seam: IntegritySeam;
|
|
38
|
+
/** The stamped subjects this is about. */
|
|
39
|
+
readonly subjects: readonly SubjectRef[];
|
|
40
|
+
/** The two-or-more assertions that prove it — copies, plain data. */
|
|
41
|
+
readonly witnesses: readonly Assertion[];
|
|
42
|
+
/** The epoch the conflict was judged at, when the witnesses carry one. */
|
|
43
|
+
readonly epoch?: number;
|
|
44
|
+
/** True when every witness is canary material — never mixed with real. */
|
|
45
|
+
readonly synthetic?: true;
|
|
46
|
+
/** One plain sentence a person can act on. States the defect, never a verdict on who is right. */
|
|
47
|
+
readonly message: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The identity a finding deduplicates by: the same defect about the same
|
|
51
|
+
* subjects at the same seam is ONE finding however many passes re-detect
|
|
52
|
+
* it — a findings channel that spams recreates the noise problem it
|
|
53
|
+
* exists to prevent.
|
|
54
|
+
*/
|
|
55
|
+
export declare function contextErrorIdentity(e: ContextError): string;
|
|
56
|
+
/** Keep the FIRST filing of each identity, in input order. */
|
|
57
|
+
export declare function dedupeContextErrors(errors: readonly ContextError[]): readonly ContextError[];
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ContextError — the ONE visible finding type, named in the words people
|
|
3
|
+
* already use for these defects.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: plain data + identity-keyed dedup. Pure.
|
|
6
|
+
* Role: everything a Context Integrity check detects is filed as
|
|
7
|
+
* exactly this shape, at every seam — a uniform finding is what
|
|
8
|
+
* makes findings a CORPUS (each one a labelled instance carrying
|
|
9
|
+
* its check, seam, subjects and witnesses) and what keeps the
|
|
10
|
+
* disposition accounting honest across seams.
|
|
11
|
+
*
|
|
12
|
+
* NAMING LAW: the `kind` is the plain software-defect name, never the
|
|
13
|
+
* algebra term — the people reading a finding are not reading the
|
|
14
|
+
* mechanism. The one guardrail that outranks the naming: never use a
|
|
15
|
+
* familiar name that is subtly wrong. ("State loss" for the evicted-
|
|
16
|
+
* identifiers failure would send an engineer hunting a storage bug that
|
|
17
|
+
* does not exist; the ledger held every identifier — they stopped being
|
|
18
|
+
* SERVED. `dangling-reference` is what a linker means and what happened.)
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* The identity a finding deduplicates by: the same defect about the same
|
|
22
|
+
* subjects at the same seam is ONE finding however many passes re-detect
|
|
23
|
+
* it — a findings channel that spams recreates the noise problem it
|
|
24
|
+
* exists to prevent.
|
|
25
|
+
*/
|
|
26
|
+
export function contextErrorIdentity(e) {
|
|
27
|
+
const subjects = e.subjects
|
|
28
|
+
.map((s) => `${s.kind} ${s.id}`)
|
|
29
|
+
.sort()
|
|
30
|
+
.join(' + ');
|
|
31
|
+
const epoch = e.epoch === undefined ? '' : String(e.epoch);
|
|
32
|
+
return `${e.kind} @${e.seam} [${subjects}] ${epoch}`;
|
|
33
|
+
}
|
|
34
|
+
/** Keep the FIRST filing of each identity, in input order. */
|
|
35
|
+
export function dedupeContextErrors(errors) {
|
|
36
|
+
const seen = new Set();
|
|
37
|
+
const kept = [];
|
|
38
|
+
for (const e of errors) {
|
|
39
|
+
const id = contextErrorIdentity(e);
|
|
40
|
+
if (seen.has(id))
|
|
41
|
+
continue;
|
|
42
|
+
seen.add(id);
|
|
43
|
+
kept.push(e);
|
|
44
|
+
}
|
|
45
|
+
return kept;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/integrity/finding/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAuCH;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,CAAe;IAClD,MAAM,QAAQ,GAAG,CAAC,CAAC,QAAQ;SACxB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC;SAC/B,IAAI,EAAE;SACN,IAAI,CAAC,KAAK,CAAC,CAAC;IACf,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC3D,OAAO,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,KAAK,QAAQ,KAAK,KAAK,EAAE,CAAC;AACvD,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,mBAAmB,CAAC,MAA+B;IACjE,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,IAAI,GAAmB,EAAE,CAAC;IAChC,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;QACvB,MAAM,EAAE,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;QACnC,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE,SAAS;QAC3B,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACb,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|