Add Epiphany watcher invalidation inputs

This commit is contained in:
Meta Vens 2026-04-26 07:51:25 +01:00
commit 52732cb2dc
45 changed files with 2613 additions and 50 deletions

View file

@ -1093,6 +1093,72 @@
],
"type": "object"
},
"EpiphanyInvestigationCheckpoint": {
"properties": {
"captured_at_turn_id": {
"type": [
"string",
"null"
]
},
"checkpoint_id": {
"type": "string"
},
"code_refs": {
"items": {
"$ref": "#/definitions/EpiphanyCodeRef"
},
"type": "array"
},
"disposition": {
"$ref": "#/definitions/EpiphanyInvestigationDisposition"
},
"evidence_ids": {
"items": {
"type": "string"
},
"type": "array"
},
"focus": {
"type": "string"
},
"kind": {
"type": "string"
},
"next_action": {
"type": [
"string",
"null"
]
},
"open_questions": {
"items": {
"type": "string"
},
"type": "array"
},
"summary": {
"type": [
"string",
"null"
]
}
},
"required": [
"checkpoint_id",
"disposition",
"focus",
"kind"
],
"type": "object"
},
"EpiphanyInvestigationDisposition": {
"enum": [
"resume_ready",
"regather_required"
],
"type": "string"
},
"EpiphanyModeState": {
"properties": {
"kind": {
@ -3773,6 +3839,16 @@
"null"
]
},
"investigationCheckpoint": {
"anyOf": [
{
"$ref": "#/definitions/EpiphanyInvestigationCheckpoint"
},
{
"type": "null"
}
]
},
"mode": {
"anyOf": [
{

View file

@ -1353,6 +1353,72 @@
],
"type": "object"
},
"EpiphanyInvestigationCheckpoint": {
"properties": {
"captured_at_turn_id": {
"type": [
"string",
"null"
]
},
"checkpoint_id": {
"type": "string"
},
"code_refs": {
"items": {
"$ref": "#/definitions/EpiphanyCodeRef"
},
"type": "array"
},
"disposition": {
"$ref": "#/definitions/EpiphanyInvestigationDisposition"
},
"evidence_ids": {
"items": {
"type": "string"
},
"type": "array"
},
"focus": {
"type": "string"
},
"kind": {
"type": "string"
},
"next_action": {
"type": [
"string",
"null"
]
},
"open_questions": {
"items": {
"type": "string"
},
"type": "array"
},
"summary": {
"type": [
"string",
"null"
]
}
},
"required": [
"checkpoint_id",
"disposition",
"focus",
"kind"
],
"type": "object"
},
"EpiphanyInvestigationDisposition": {
"enum": [
"resume_ready",
"regather_required"
],
"type": "string"
},
"EpiphanyModeState": {
"properties": {
"kind": {
@ -1627,6 +1693,16 @@
},
"type": "array"
},
"investigation_checkpoint": {
"anyOf": [
{
"$ref": "#/definitions/EpiphanyInvestigationCheckpoint"
},
{
"type": "null"
}
]
},
"last_updated_turn_id": {
"type": [
"string",
@ -3722,6 +3798,7 @@
"graphFrontier",
"graphCheckpoint",
"scratch",
"investigationCheckpoint",
"observations",
"evidence",
"churn",

View file

@ -8202,6 +8202,72 @@
],
"type": "object"
},
"EpiphanyInvestigationCheckpoint": {
"properties": {
"captured_at_turn_id": {
"type": [
"string",
"null"
]
},
"checkpoint_id": {
"type": "string"
},
"code_refs": {
"items": {
"$ref": "#/definitions/v2/EpiphanyCodeRef"
},
"type": "array"
},
"disposition": {
"$ref": "#/definitions/v2/EpiphanyInvestigationDisposition"
},
"evidence_ids": {
"items": {
"type": "string"
},
"type": "array"
},
"focus": {
"type": "string"
},
"kind": {
"type": "string"
},
"next_action": {
"type": [
"string",
"null"
]
},
"open_questions": {
"items": {
"type": "string"
},
"type": "array"
},
"summary": {
"type": [
"string",
"null"
]
}
},
"required": [
"checkpoint_id",
"disposition",
"focus",
"kind"
],
"type": "object"
},
"EpiphanyInvestigationDisposition": {
"enum": [
"resume_ready",
"regather_required"
],
"type": "string"
},
"EpiphanyModeState": {
"properties": {
"kind": {
@ -8476,6 +8542,16 @@
},
"type": "array"
},
"investigation_checkpoint": {
"anyOf": [
{
"$ref": "#/definitions/v2/EpiphanyInvestigationCheckpoint"
},
{
"type": "null"
}
]
},
"last_updated_turn_id": {
"type": [
"string",
@ -14842,6 +14918,16 @@
"graph": {
"$ref": "#/definitions/v2/ThreadEpiphanyGraphContext"
},
"investigationCheckpoint": {
"anyOf": [
{
"$ref": "#/definitions/v2/EpiphanyInvestigationCheckpoint"
},
{
"type": "null"
}
]
},
"observations": {
"items": {
"$ref": "#/definitions/v2/EpiphanyObservation"
@ -14897,6 +14983,13 @@
],
"type": "string"
},
"ThreadEpiphanyFreshnessSource": {
"enum": [
"stored",
"live"
],
"type": "string"
},
"ThreadEpiphanyGraphContext": {
"properties": {
"architectureEdges": {
@ -14932,6 +15025,125 @@
},
"type": "object"
},
"ThreadEpiphanyGraphFreshness": {
"properties": {
"checkpointId": {
"type": [
"string",
"null"
]
},
"dirtyPathCount": {
"format": "uint32",
"minimum": 0.0,
"type": "integer"
},
"dirtyPaths": {
"items": {
"type": "string"
},
"type": "array"
},
"graphFreshness": {
"type": [
"string",
"null"
]
},
"note": {
"type": "string"
},
"openGapCount": {
"format": "uint32",
"minimum": 0.0,
"type": "integer"
},
"openQuestionCount": {
"format": "uint32",
"minimum": 0.0,
"type": "integer"
},
"status": {
"$ref": "#/definitions/v2/ThreadEpiphanyGraphFreshnessStatus"
}
},
"required": [
"dirtyPathCount",
"note",
"openGapCount",
"openQuestionCount",
"status"
],
"type": "object"
},
"ThreadEpiphanyGraphFreshnessStatus": {
"enum": [
"missing",
"ready",
"stale"
],
"type": "string"
},
"ThreadEpiphanyInvalidationInput": {
"properties": {
"activeFrontierNodeIds": {
"items": {
"type": "string"
},
"type": "array"
},
"changedPathCount": {
"format": "uint32",
"minimum": 0.0,
"type": "integer"
},
"changedPaths": {
"items": {
"type": "string"
},
"type": "array"
},
"graphNodeIds": {
"items": {
"type": "string"
},
"type": "array"
},
"note": {
"type": "string"
},
"observedAtUnixSeconds": {
"format": "int64",
"type": [
"integer",
"null"
]
},
"status": {
"$ref": "#/definitions/v2/ThreadEpiphanyInvalidationStatus"
},
"watchedRoot": {
"type": [
"string",
"null"
]
}
},
"required": [
"changedPathCount",
"note",
"status"
],
"type": "object"
},
"ThreadEpiphanyInvalidationStatus": {
"enum": [
"unavailable",
"clean",
"changed"
],
"type": "string"
},
"ThreadEpiphanyJob": {
"properties": {
"blockingReason": {
@ -15127,6 +15339,66 @@
],
"type": "string"
},
"ThreadEpiphanyRetrievalFreshness": {
"properties": {
"dirtyPaths": {
"items": {
"type": "string"
},
"type": "array"
},
"indexedChunkCount": {
"format": "uint32",
"minimum": 0.0,
"type": [
"integer",
"null"
]
},
"indexedFileCount": {
"format": "uint32",
"minimum": 0.0,
"type": [
"integer",
"null"
]
},
"lastIndexedAtUnixSeconds": {
"format": "int64",
"type": [
"integer",
"null"
]
},
"note": {
"type": "string"
},
"semanticAvailable": {
"type": [
"boolean",
"null"
]
},
"status": {
"$ref": "#/definitions/v2/ThreadEpiphanyRetrievalFreshnessStatus"
}
},
"required": [
"note",
"status"
],
"type": "object"
},
"ThreadEpiphanyRetrievalFreshnessStatus": {
"enum": [
"missing",
"ready",
"stale",
"indexing",
"unavailable"
],
"type": "string"
},
"ThreadEpiphanyRetrieveIndexSummary": {
"properties": {
"dirtyPaths": {
@ -15322,6 +15594,16 @@
},
"type": "array"
},
"investigationCheckpoint": {
"anyOf": [
{
"$ref": "#/definitions/v2/ThreadEpiphanySceneInvestigationCheckpoint"
},
{
"type": "null"
}
]
},
"objective": {
"type": [
"string",
@ -15378,6 +15660,7 @@
"distill",
"context",
"jobs",
"freshness",
"pressure",
"propose",
"promote",
@ -15499,6 +15782,65 @@
],
"type": "object"
},
"ThreadEpiphanySceneInvestigationCheckpoint": {
"properties": {
"capturedAtTurnId": {
"type": [
"string",
"null"
]
},
"checkpointId": {
"type": "string"
},
"codeRefCount": {
"format": "uint32",
"minimum": 0.0,
"type": "integer"
},
"disposition": {
"$ref": "#/definitions/v2/EpiphanyInvestigationDisposition"
},
"evidenceCount": {
"format": "uint32",
"minimum": 0.0,
"type": "integer"
},
"focus": {
"type": "string"
},
"kind": {
"type": "string"
},
"nextAction": {
"type": [
"string",
"null"
]
},
"openQuestionCount": {
"format": "uint32",
"minimum": 0.0,
"type": "integer"
},
"summary": {
"type": [
"string",
"null"
]
}
},
"required": [
"checkpointId",
"codeRefCount",
"disposition",
"evidenceCount",
"focus",
"kind",
"openQuestionCount"
],
"type": "object"
},
"ThreadEpiphanySceneRecord": {
"properties": {
"codeRefCount": {
@ -15670,6 +16012,7 @@
"graphFrontier",
"graphCheckpoint",
"scratch",
"investigationCheckpoint",
"observations",
"evidence",
"churn",
@ -15781,6 +16124,16 @@
"null"
]
},
"investigationCheckpoint": {
"anyOf": [
{
"$ref": "#/definitions/v2/EpiphanyInvestigationCheckpoint"
},
{
"type": "null"
}
]
},
"mode": {
"anyOf": [
{

View file

@ -4762,6 +4762,72 @@
],
"type": "object"
},
"EpiphanyInvestigationCheckpoint": {
"properties": {
"captured_at_turn_id": {
"type": [
"string",
"null"
]
},
"checkpoint_id": {
"type": "string"
},
"code_refs": {
"items": {
"$ref": "#/definitions/EpiphanyCodeRef"
},
"type": "array"
},
"disposition": {
"$ref": "#/definitions/EpiphanyInvestigationDisposition"
},
"evidence_ids": {
"items": {
"type": "string"
},
"type": "array"
},
"focus": {
"type": "string"
},
"kind": {
"type": "string"
},
"next_action": {
"type": [
"string",
"null"
]
},
"open_questions": {
"items": {
"type": "string"
},
"type": "array"
},
"summary": {
"type": [
"string",
"null"
]
}
},
"required": [
"checkpoint_id",
"disposition",
"focus",
"kind"
],
"type": "object"
},
"EpiphanyInvestigationDisposition": {
"enum": [
"resume_ready",
"regather_required"
],
"type": "string"
},
"EpiphanyModeState": {
"properties": {
"kind": {
@ -5036,6 +5102,16 @@
},
"type": "array"
},
"investigation_checkpoint": {
"anyOf": [
{
"$ref": "#/definitions/EpiphanyInvestigationCheckpoint"
},
{
"type": "null"
}
]
},
"last_updated_turn_id": {
"type": [
"string",
@ -12729,6 +12805,16 @@
"graph": {
"$ref": "#/definitions/ThreadEpiphanyGraphContext"
},
"investigationCheckpoint": {
"anyOf": [
{
"$ref": "#/definitions/EpiphanyInvestigationCheckpoint"
},
{
"type": "null"
}
]
},
"observations": {
"items": {
"$ref": "#/definitions/EpiphanyObservation"
@ -12784,6 +12870,13 @@
],
"type": "string"
},
"ThreadEpiphanyFreshnessSource": {
"enum": [
"stored",
"live"
],
"type": "string"
},
"ThreadEpiphanyGraphContext": {
"properties": {
"architectureEdges": {
@ -12819,6 +12912,125 @@
},
"type": "object"
},
"ThreadEpiphanyGraphFreshness": {
"properties": {
"checkpointId": {
"type": [
"string",
"null"
]
},
"dirtyPathCount": {
"format": "uint32",
"minimum": 0.0,
"type": "integer"
},
"dirtyPaths": {
"items": {
"type": "string"
},
"type": "array"
},
"graphFreshness": {
"type": [
"string",
"null"
]
},
"note": {
"type": "string"
},
"openGapCount": {
"format": "uint32",
"minimum": 0.0,
"type": "integer"
},
"openQuestionCount": {
"format": "uint32",
"minimum": 0.0,
"type": "integer"
},
"status": {
"$ref": "#/definitions/ThreadEpiphanyGraphFreshnessStatus"
}
},
"required": [
"dirtyPathCount",
"note",
"openGapCount",
"openQuestionCount",
"status"
],
"type": "object"
},
"ThreadEpiphanyGraphFreshnessStatus": {
"enum": [
"missing",
"ready",
"stale"
],
"type": "string"
},
"ThreadEpiphanyInvalidationInput": {
"properties": {
"activeFrontierNodeIds": {
"items": {
"type": "string"
},
"type": "array"
},
"changedPathCount": {
"format": "uint32",
"minimum": 0.0,
"type": "integer"
},
"changedPaths": {
"items": {
"type": "string"
},
"type": "array"
},
"graphNodeIds": {
"items": {
"type": "string"
},
"type": "array"
},
"note": {
"type": "string"
},
"observedAtUnixSeconds": {
"format": "int64",
"type": [
"integer",
"null"
]
},
"status": {
"$ref": "#/definitions/ThreadEpiphanyInvalidationStatus"
},
"watchedRoot": {
"type": [
"string",
"null"
]
}
},
"required": [
"changedPathCount",
"note",
"status"
],
"type": "object"
},
"ThreadEpiphanyInvalidationStatus": {
"enum": [
"unavailable",
"clean",
"changed"
],
"type": "string"
},
"ThreadEpiphanyJob": {
"properties": {
"blockingReason": {
@ -13014,6 +13226,66 @@
],
"type": "string"
},
"ThreadEpiphanyRetrievalFreshness": {
"properties": {
"dirtyPaths": {
"items": {
"type": "string"
},
"type": "array"
},
"indexedChunkCount": {
"format": "uint32",
"minimum": 0.0,
"type": [
"integer",
"null"
]
},
"indexedFileCount": {
"format": "uint32",
"minimum": 0.0,
"type": [
"integer",
"null"
]
},
"lastIndexedAtUnixSeconds": {
"format": "int64",
"type": [
"integer",
"null"
]
},
"note": {
"type": "string"
},
"semanticAvailable": {
"type": [
"boolean",
"null"
]
},
"status": {
"$ref": "#/definitions/ThreadEpiphanyRetrievalFreshnessStatus"
}
},
"required": [
"note",
"status"
],
"type": "object"
},
"ThreadEpiphanyRetrievalFreshnessStatus": {
"enum": [
"missing",
"ready",
"stale",
"indexing",
"unavailable"
],
"type": "string"
},
"ThreadEpiphanyRetrieveIndexSummary": {
"properties": {
"dirtyPaths": {
@ -13209,6 +13481,16 @@
},
"type": "array"
},
"investigationCheckpoint": {
"anyOf": [
{
"$ref": "#/definitions/ThreadEpiphanySceneInvestigationCheckpoint"
},
{
"type": "null"
}
]
},
"objective": {
"type": [
"string",
@ -13265,6 +13547,7 @@
"distill",
"context",
"jobs",
"freshness",
"pressure",
"propose",
"promote",
@ -13386,6 +13669,65 @@
],
"type": "object"
},
"ThreadEpiphanySceneInvestigationCheckpoint": {
"properties": {
"capturedAtTurnId": {
"type": [
"string",
"null"
]
},
"checkpointId": {
"type": "string"
},
"codeRefCount": {
"format": "uint32",
"minimum": 0.0,
"type": "integer"
},
"disposition": {
"$ref": "#/definitions/EpiphanyInvestigationDisposition"
},
"evidenceCount": {
"format": "uint32",
"minimum": 0.0,
"type": "integer"
},
"focus": {
"type": "string"
},
"kind": {
"type": "string"
},
"nextAction": {
"type": [
"string",
"null"
]
},
"openQuestionCount": {
"format": "uint32",
"minimum": 0.0,
"type": "integer"
},
"summary": {
"type": [
"string",
"null"
]
}
},
"required": [
"checkpointId",
"codeRefCount",
"disposition",
"evidenceCount",
"focus",
"kind",
"openQuestionCount"
],
"type": "object"
},
"ThreadEpiphanySceneRecord": {
"properties": {
"codeRefCount": {
@ -13557,6 +13899,7 @@
"graphFrontier",
"graphCheckpoint",
"scratch",
"investigationCheckpoint",
"observations",
"evidence",
"churn",
@ -13668,6 +14011,16 @@
"null"
]
},
"investigationCheckpoint": {
"anyOf": [
{
"$ref": "#/definitions/EpiphanyInvestigationCheckpoint"
},
{
"type": "null"
}
]
},
"mode": {
"anyOf": [
{

View file

@ -352,6 +352,72 @@
],
"type": "object"
},
"EpiphanyInvestigationCheckpoint": {
"properties": {
"captured_at_turn_id": {
"type": [
"string",
"null"
]
},
"checkpoint_id": {
"type": "string"
},
"code_refs": {
"items": {
"$ref": "#/definitions/EpiphanyCodeRef"
},
"type": "array"
},
"disposition": {
"$ref": "#/definitions/EpiphanyInvestigationDisposition"
},
"evidence_ids": {
"items": {
"type": "string"
},
"type": "array"
},
"focus": {
"type": "string"
},
"kind": {
"type": "string"
},
"next_action": {
"type": [
"string",
"null"
]
},
"open_questions": {
"items": {
"type": "string"
},
"type": "array"
},
"summary": {
"type": [
"string",
"null"
]
}
},
"required": [
"checkpoint_id",
"disposition",
"focus",
"kind"
],
"type": "object"
},
"EpiphanyInvestigationDisposition": {
"enum": [
"resume_ready",
"regather_required"
],
"type": "string"
},
"EpiphanyModeState": {
"properties": {
"kind": {
@ -626,6 +692,16 @@
},
"type": "array"
},
"investigation_checkpoint": {
"anyOf": [
{
"$ref": "#/definitions/EpiphanyInvestigationCheckpoint"
},
{
"type": "null"
}
]
},
"last_updated_turn_id": {
"type": [
"string",
@ -715,6 +791,7 @@
"graphFrontier",
"graphCheckpoint",
"scratch",
"investigationCheckpoint",
"observations",
"evidence",
"churn",

View file

@ -800,6 +800,72 @@
],
"type": "object"
},
"EpiphanyInvestigationCheckpoint": {
"properties": {
"captured_at_turn_id": {
"type": [
"string",
"null"
]
},
"checkpoint_id": {
"type": "string"
},
"code_refs": {
"items": {
"$ref": "#/definitions/EpiphanyCodeRef"
},
"type": "array"
},
"disposition": {
"$ref": "#/definitions/EpiphanyInvestigationDisposition"
},
"evidence_ids": {
"items": {
"type": "string"
},
"type": "array"
},
"focus": {
"type": "string"
},
"kind": {
"type": "string"
},
"next_action": {
"type": [
"string",
"null"
]
},
"open_questions": {
"items": {
"type": "string"
},
"type": "array"
},
"summary": {
"type": [
"string",
"null"
]
}
},
"required": [
"checkpoint_id",
"disposition",
"focus",
"kind"
],
"type": "object"
},
"EpiphanyInvestigationDisposition": {
"enum": [
"resume_ready",
"regather_required"
],
"type": "string"
},
"EpiphanyModeState": {
"properties": {
"kind": {
@ -1074,6 +1140,16 @@
},
"type": "array"
},
"investigation_checkpoint": {
"anyOf": [
{
"$ref": "#/definitions/EpiphanyInvestigationCheckpoint"
},
{
"type": "null"
}
]
},
"last_updated_turn_id": {
"type": [
"string",

View file

@ -741,6 +741,72 @@
],
"type": "object"
},
"EpiphanyInvestigationCheckpoint": {
"properties": {
"captured_at_turn_id": {
"type": [
"string",
"null"
]
},
"checkpoint_id": {
"type": "string"
},
"code_refs": {
"items": {
"$ref": "#/definitions/EpiphanyCodeRef"
},
"type": "array"
},
"disposition": {
"$ref": "#/definitions/EpiphanyInvestigationDisposition"
},
"evidence_ids": {
"items": {
"type": "string"
},
"type": "array"
},
"focus": {
"type": "string"
},
"kind": {
"type": "string"
},
"next_action": {
"type": [
"string",
"null"
]
},
"open_questions": {
"items": {
"type": "string"
},
"type": "array"
},
"summary": {
"type": [
"string",
"null"
]
}
},
"required": [
"checkpoint_id",
"disposition",
"focus",
"kind"
],
"type": "object"
},
"EpiphanyInvestigationDisposition": {
"enum": [
"resume_ready",
"regather_required"
],
"type": "string"
},
"EpiphanyModeState": {
"properties": {
"kind": {
@ -1015,6 +1081,16 @@
},
"type": "array"
},
"investigation_checkpoint": {
"anyOf": [
{
"$ref": "#/definitions/EpiphanyInvestigationCheckpoint"
},
{
"type": "null"
}
]
},
"last_updated_turn_id": {
"type": [
"string",

View file

@ -741,6 +741,72 @@
],
"type": "object"
},
"EpiphanyInvestigationCheckpoint": {
"properties": {
"captured_at_turn_id": {
"type": [
"string",
"null"
]
},
"checkpoint_id": {
"type": "string"
},
"code_refs": {
"items": {
"$ref": "#/definitions/EpiphanyCodeRef"
},
"type": "array"
},
"disposition": {
"$ref": "#/definitions/EpiphanyInvestigationDisposition"
},
"evidence_ids": {
"items": {
"type": "string"
},
"type": "array"
},
"focus": {
"type": "string"
},
"kind": {
"type": "string"
},
"next_action": {
"type": [
"string",
"null"
]
},
"open_questions": {
"items": {
"type": "string"
},
"type": "array"
},
"summary": {
"type": [
"string",
"null"
]
}
},
"required": [
"checkpoint_id",
"disposition",
"focus",
"kind"
],
"type": "object"
},
"EpiphanyInvestigationDisposition": {
"enum": [
"resume_ready",
"regather_required"
],
"type": "string"
},
"EpiphanyModeState": {
"properties": {
"kind": {
@ -1015,6 +1081,16 @@
},
"type": "array"
},
"investigation_checkpoint": {
"anyOf": [
{
"$ref": "#/definitions/EpiphanyInvestigationCheckpoint"
},
{
"type": "null"
}
]
},
"last_updated_turn_id": {
"type": [
"string",

View file

@ -741,6 +741,72 @@
],
"type": "object"
},
"EpiphanyInvestigationCheckpoint": {
"properties": {
"captured_at_turn_id": {
"type": [
"string",
"null"
]
},
"checkpoint_id": {
"type": "string"
},
"code_refs": {
"items": {
"$ref": "#/definitions/EpiphanyCodeRef"
},
"type": "array"
},
"disposition": {
"$ref": "#/definitions/EpiphanyInvestigationDisposition"
},
"evidence_ids": {
"items": {
"type": "string"
},
"type": "array"
},
"focus": {
"type": "string"
},
"kind": {
"type": "string"
},
"next_action": {
"type": [
"string",
"null"
]
},
"open_questions": {
"items": {
"type": "string"
},
"type": "array"
},
"summary": {
"type": [
"string",
"null"
]
}
},
"required": [
"checkpoint_id",
"disposition",
"focus",
"kind"
],
"type": "object"
},
"EpiphanyInvestigationDisposition": {
"enum": [
"resume_ready",
"regather_required"
],
"type": "string"
},
"EpiphanyModeState": {
"properties": {
"kind": {
@ -1015,6 +1081,16 @@
},
"type": "array"
},
"investigation_checkpoint": {
"anyOf": [
{
"$ref": "#/definitions/EpiphanyInvestigationCheckpoint"
},
{
"type": "null"
}
]
},
"last_updated_turn_id": {
"type": [
"string",

View file

@ -800,6 +800,72 @@
],
"type": "object"
},
"EpiphanyInvestigationCheckpoint": {
"properties": {
"captured_at_turn_id": {
"type": [
"string",
"null"
]
},
"checkpoint_id": {
"type": "string"
},
"code_refs": {
"items": {
"$ref": "#/definitions/EpiphanyCodeRef"
},
"type": "array"
},
"disposition": {
"$ref": "#/definitions/EpiphanyInvestigationDisposition"
},
"evidence_ids": {
"items": {
"type": "string"
},
"type": "array"
},
"focus": {
"type": "string"
},
"kind": {
"type": "string"
},
"next_action": {
"type": [
"string",
"null"
]
},
"open_questions": {
"items": {
"type": "string"
},
"type": "array"
},
"summary": {
"type": [
"string",
"null"
]
}
},
"required": [
"checkpoint_id",
"disposition",
"focus",
"kind"
],
"type": "object"
},
"EpiphanyInvestigationDisposition": {
"enum": [
"resume_ready",
"regather_required"
],
"type": "string"
},
"EpiphanyModeState": {
"properties": {
"kind": {
@ -1074,6 +1140,16 @@
},
"type": "array"
},
"investigation_checkpoint": {
"anyOf": [
{
"$ref": "#/definitions/EpiphanyInvestigationCheckpoint"
},
{
"type": "null"
}
]
},
"last_updated_turn_id": {
"type": [
"string",

View file

@ -741,6 +741,72 @@
],
"type": "object"
},
"EpiphanyInvestigationCheckpoint": {
"properties": {
"captured_at_turn_id": {
"type": [
"string",
"null"
]
},
"checkpoint_id": {
"type": "string"
},
"code_refs": {
"items": {
"$ref": "#/definitions/EpiphanyCodeRef"
},
"type": "array"
},
"disposition": {
"$ref": "#/definitions/EpiphanyInvestigationDisposition"
},
"evidence_ids": {
"items": {
"type": "string"
},
"type": "array"
},
"focus": {
"type": "string"
},
"kind": {
"type": "string"
},
"next_action": {
"type": [
"string",
"null"
]
},
"open_questions": {
"items": {
"type": "string"
},
"type": "array"
},
"summary": {
"type": [
"string",
"null"
]
}
},
"required": [
"checkpoint_id",
"disposition",
"focus",
"kind"
],
"type": "object"
},
"EpiphanyInvestigationDisposition": {
"enum": [
"resume_ready",
"regather_required"
],
"type": "string"
},
"EpiphanyModeState": {
"properties": {
"kind": {
@ -1015,6 +1081,16 @@
},
"type": "array"
},
"investigation_checkpoint": {
"anyOf": [
{
"$ref": "#/definitions/EpiphanyInvestigationCheckpoint"
},
{
"type": "null"
}
]
},
"last_updated_turn_id": {
"type": [
"string",

View file

@ -800,6 +800,72 @@
],
"type": "object"
},
"EpiphanyInvestigationCheckpoint": {
"properties": {
"captured_at_turn_id": {
"type": [
"string",
"null"
]
},
"checkpoint_id": {
"type": "string"
},
"code_refs": {
"items": {
"$ref": "#/definitions/EpiphanyCodeRef"
},
"type": "array"
},
"disposition": {
"$ref": "#/definitions/EpiphanyInvestigationDisposition"
},
"evidence_ids": {
"items": {
"type": "string"
},
"type": "array"
},
"focus": {
"type": "string"
},
"kind": {
"type": "string"
},
"next_action": {
"type": [
"string",
"null"
]
},
"open_questions": {
"items": {
"type": "string"
},
"type": "array"
},
"summary": {
"type": [
"string",
"null"
]
}
},
"required": [
"checkpoint_id",
"disposition",
"focus",
"kind"
],
"type": "object"
},
"EpiphanyInvestigationDisposition": {
"enum": [
"resume_ready",
"regather_required"
],
"type": "string"
},
"EpiphanyModeState": {
"properties": {
"kind": {
@ -1074,6 +1140,16 @@
},
"type": "array"
},
"investigation_checkpoint": {
"anyOf": [
{
"$ref": "#/definitions/EpiphanyInvestigationCheckpoint"
},
{
"type": "null"
}
]
},
"last_updated_turn_id": {
"type": [
"string",

View file

@ -741,6 +741,72 @@
],
"type": "object"
},
"EpiphanyInvestigationCheckpoint": {
"properties": {
"captured_at_turn_id": {
"type": [
"string",
"null"
]
},
"checkpoint_id": {
"type": "string"
},
"code_refs": {
"items": {
"$ref": "#/definitions/EpiphanyCodeRef"
},
"type": "array"
},
"disposition": {
"$ref": "#/definitions/EpiphanyInvestigationDisposition"
},
"evidence_ids": {
"items": {
"type": "string"
},
"type": "array"
},
"focus": {
"type": "string"
},
"kind": {
"type": "string"
},
"next_action": {
"type": [
"string",
"null"
]
},
"open_questions": {
"items": {
"type": "string"
},
"type": "array"
},
"summary": {
"type": [
"string",
"null"
]
}
},
"required": [
"checkpoint_id",
"disposition",
"focus",
"kind"
],
"type": "object"
},
"EpiphanyInvestigationDisposition": {
"enum": [
"resume_ready",
"regather_required"
],
"type": "string"
},
"EpiphanyModeState": {
"properties": {
"kind": {
@ -1015,6 +1081,16 @@
},
"type": "array"
},
"investigation_checkpoint": {
"anyOf": [
{
"$ref": "#/definitions/EpiphanyInvestigationCheckpoint"
},
{
"type": "null"
}
]
},
"last_updated_turn_id": {
"type": [
"string",

View file

@ -741,6 +741,72 @@
],
"type": "object"
},
"EpiphanyInvestigationCheckpoint": {
"properties": {
"captured_at_turn_id": {
"type": [
"string",
"null"
]
},
"checkpoint_id": {
"type": "string"
},
"code_refs": {
"items": {
"$ref": "#/definitions/EpiphanyCodeRef"
},
"type": "array"
},
"disposition": {
"$ref": "#/definitions/EpiphanyInvestigationDisposition"
},
"evidence_ids": {
"items": {
"type": "string"
},
"type": "array"
},
"focus": {
"type": "string"
},
"kind": {
"type": "string"
},
"next_action": {
"type": [
"string",
"null"
]
},
"open_questions": {
"items": {
"type": "string"
},
"type": "array"
},
"summary": {
"type": [
"string",
"null"
]
}
},
"required": [
"checkpoint_id",
"disposition",
"focus",
"kind"
],
"type": "object"
},
"EpiphanyInvestigationDisposition": {
"enum": [
"resume_ready",
"regather_required"
],
"type": "string"
},
"EpiphanyModeState": {
"properties": {
"kind": {
@ -1015,6 +1081,16 @@
},
"type": "array"
},
"investigation_checkpoint": {
"anyOf": [
{
"$ref": "#/definitions/EpiphanyInvestigationCheckpoint"
},
{
"type": "null"
}
]
},
"last_updated_turn_id": {
"type": [
"string",

View file

@ -0,0 +1,6 @@
// GENERATED CODE! DO NOT MODIFY BY HAND!
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { EpiphanyInvestigationDisposition } from "./EpiphanyInvestigationDisposition";
export type EpiphanyInvestigationCheckpoint = { checkpoint_id: string, kind: string, disposition: EpiphanyInvestigationDisposition, focus: string, summary?: string | null, next_action?: string | null, captured_at_turn_id?: string | null, open_questions?: Array<string>, code_refs?: Array<EpiphanyCodeRef>, evidence_ids?: Array<string>, };

View file

@ -0,0 +1,5 @@
// GENERATED CODE! DO NOT MODIFY BY HAND!
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type EpiphanyInvestigationDisposition = "resume_ready" | "regather_required";

View file

@ -2,4 +2,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type EpiphanyThreadState = { revision: bigint, objective?: string | null, active_subgoal_id?: string | null, subgoals?: Array<EpiphanySubgoal>, invariants?: Array<EpiphanyInvariant>, graphs?: EpiphanyGraphs, graph_frontier?: EpiphanyGraphFrontier | null, graph_checkpoint?: EpiphanyGraphCheckpoint | null, retrieval?: EpiphanyRetrievalState | null, scratch?: EpiphanyScratchPad | null, observations?: Array<EpiphanyObservation>, recent_evidence?: Array<EpiphanyEvidenceRecord>, churn?: EpiphanyChurnState | null, mode?: EpiphanyModeState | null, last_updated_turn_id?: string | null, };
export type EpiphanyThreadState = { revision: bigint, objective?: string | null, active_subgoal_id?: string | null, subgoals?: Array<EpiphanySubgoal>, invariants?: Array<EpiphanyInvariant>, graphs?: EpiphanyGraphs, graph_frontier?: EpiphanyGraphFrontier | null, graph_checkpoint?: EpiphanyGraphCheckpoint | null, retrieval?: EpiphanyRetrievalState | null, scratch?: EpiphanyScratchPad | null, investigation_checkpoint?: EpiphanyInvestigationCheckpoint | null, observations?: Array<EpiphanyObservation>, recent_evidence?: Array<EpiphanyEvidenceRecord>, churn?: EpiphanyChurnState | null, mode?: EpiphanyModeState | null, last_updated_turn_id?: string | null, };

View file

@ -23,6 +23,8 @@ export type { EpiphanyGraphLink } from "./EpiphanyGraphLink";
export type { EpiphanyGraphNode } from "./EpiphanyGraphNode";
export type { EpiphanyGraphs } from "./EpiphanyGraphs";
export type { EpiphanyInvariant } from "./EpiphanyInvariant";
export type { EpiphanyInvestigationCheckpoint } from "./EpiphanyInvestigationCheckpoint";
export type { EpiphanyInvestigationDisposition } from "./EpiphanyInvestigationDisposition";
export type { EpiphanyModeState } from "./EpiphanyModeState";
export type { EpiphanyObservation } from "./EpiphanyObservation";
export type { EpiphanyRetrievalStatus } from "./EpiphanyRetrievalStatus";

View file

@ -4,7 +4,8 @@
import type { EpiphanyEvidenceRecord } from "../EpiphanyEvidenceRecord";
import type { EpiphanyGraphCheckpoint } from "../EpiphanyGraphCheckpoint";
import type { EpiphanyGraphFrontier } from "../EpiphanyGraphFrontier";
import type { EpiphanyInvestigationCheckpoint } from "../EpiphanyInvestigationCheckpoint";
import type { EpiphanyObservation } from "../EpiphanyObservation";
import type { ThreadEpiphanyGraphContext } from "./ThreadEpiphanyGraphContext";
export type ThreadEpiphanyContext = { graph: ThreadEpiphanyGraphContext, frontier?: EpiphanyGraphFrontier | null, checkpoint?: EpiphanyGraphCheckpoint | null, observations?: Array<EpiphanyObservation>, evidence?: Array<EpiphanyEvidenceRecord>, };
export type ThreadEpiphanyContext = { graph: ThreadEpiphanyGraphContext, frontier?: EpiphanyGraphFrontier | null, checkpoint?: EpiphanyGraphCheckpoint | null, investigationCheckpoint?: EpiphanyInvestigationCheckpoint | null, observations?: Array<EpiphanyObservation>, evidence?: Array<EpiphanyEvidenceRecord>, };

View file

@ -0,0 +1,5 @@
// GENERATED CODE! DO NOT MODIFY BY HAND!
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ThreadEpiphanyFreshnessSource = "stored" | "live";

View file

@ -0,0 +1,6 @@
// GENERATED CODE! DO NOT MODIFY BY HAND!
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ThreadEpiphanyGraphFreshnessStatus } from "./ThreadEpiphanyGraphFreshnessStatus";
export type ThreadEpiphanyGraphFreshness = { status: ThreadEpiphanyGraphFreshnessStatus, graphFreshness?: string | null, checkpointId?: string | null, dirtyPathCount: number, dirtyPaths?: Array<string>, openQuestionCount: number, openGapCount: number, note: string, };

View file

@ -0,0 +1,5 @@
// GENERATED CODE! DO NOT MODIFY BY HAND!
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ThreadEpiphanyGraphFreshnessStatus = "missing" | "ready" | "stale";

View file

@ -0,0 +1,6 @@
// GENERATED CODE! DO NOT MODIFY BY HAND!
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ThreadEpiphanyInvalidationStatus } from "./ThreadEpiphanyInvalidationStatus";
export type ThreadEpiphanyInvalidationInput = { status: ThreadEpiphanyInvalidationStatus, watchedRoot?: string | null, observedAtUnixSeconds?: bigint | null, changedPathCount: number, changedPaths?: Array<string>, graphNodeIds?: Array<string>, activeFrontierNodeIds?: Array<string>, note: string, };

View file

@ -0,0 +1,5 @@
// GENERATED CODE! DO NOT MODIFY BY HAND!
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ThreadEpiphanyInvalidationStatus = "unavailable" | "clean" | "changed";

View file

@ -0,0 +1,6 @@
// GENERATED CODE! DO NOT MODIFY BY HAND!
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ThreadEpiphanyRetrievalFreshnessStatus } from "./ThreadEpiphanyRetrievalFreshnessStatus";
export type ThreadEpiphanyRetrievalFreshness = { status: ThreadEpiphanyRetrievalFreshnessStatus, semanticAvailable?: boolean | null, lastIndexedAtUnixSeconds?: bigint | null, indexedFileCount?: number | null, indexedChunkCount?: number | null, dirtyPaths?: Array<string>, note: string, };

View file

@ -0,0 +1,5 @@
// GENERATED CODE! DO NOT MODIFY BY HAND!
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ThreadEpiphanyRetrievalFreshnessStatus = "missing" | "ready" | "stale" | "indexing" | "unavailable";

View file

@ -4,6 +4,7 @@
import type { ThreadEpiphanySceneAction } from "./ThreadEpiphanySceneAction";
import type { ThreadEpiphanySceneChurn } from "./ThreadEpiphanySceneChurn";
import type { ThreadEpiphanySceneGraph } from "./ThreadEpiphanySceneGraph";
import type { ThreadEpiphanySceneInvestigationCheckpoint } from "./ThreadEpiphanySceneInvestigationCheckpoint";
import type { ThreadEpiphanySceneRecords } from "./ThreadEpiphanySceneRecords";
import type { ThreadEpiphanySceneRetrieval } from "./ThreadEpiphanySceneRetrieval";
import type { ThreadEpiphanySceneSource } from "./ThreadEpiphanySceneSource";
@ -11,4 +12,4 @@ import type { ThreadEpiphanySceneStateStatus } from "./ThreadEpiphanySceneStateS
import type { ThreadEpiphanySceneStatusCount } from "./ThreadEpiphanySceneStatusCount";
import type { ThreadEpiphanySceneSubgoal } from "./ThreadEpiphanySceneSubgoal";
export type ThreadEpiphanyScene = { stateStatus: ThreadEpiphanySceneStateStatus, source: ThreadEpiphanySceneSource, revision?: bigint | null, objective?: string | null, activeSubgoal?: ThreadEpiphanySceneSubgoal | null, subgoals?: Array<ThreadEpiphanySceneSubgoal>, invariantStatusCounts?: Array<ThreadEpiphanySceneStatusCount>, graph: ThreadEpiphanySceneGraph, retrieval?: ThreadEpiphanySceneRetrieval | null, observations: ThreadEpiphanySceneRecords, evidence: ThreadEpiphanySceneRecords, churn?: ThreadEpiphanySceneChurn | null, availableActions?: Array<ThreadEpiphanySceneAction>, };
export type ThreadEpiphanyScene = { stateStatus: ThreadEpiphanySceneStateStatus, source: ThreadEpiphanySceneSource, revision?: bigint | null, objective?: string | null, activeSubgoal?: ThreadEpiphanySceneSubgoal | null, subgoals?: Array<ThreadEpiphanySceneSubgoal>, invariantStatusCounts?: Array<ThreadEpiphanySceneStatusCount>, graph: ThreadEpiphanySceneGraph, retrieval?: ThreadEpiphanySceneRetrieval | null, investigationCheckpoint?: ThreadEpiphanySceneInvestigationCheckpoint | null, observations: ThreadEpiphanySceneRecords, evidence: ThreadEpiphanySceneRecords, churn?: ThreadEpiphanySceneChurn | null, availableActions?: Array<ThreadEpiphanySceneAction>, };

View file

@ -2,4 +2,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ThreadEpiphanySceneAction = "index" | "retrieve" | "distill" | "context" | "jobs" | "pressure" | "propose" | "promote" | "update";
export type ThreadEpiphanySceneAction = "index" | "retrieve" | "distill" | "context" | "jobs" | "freshness" | "pressure" | "propose" | "promote" | "update";

View file

@ -0,0 +1,6 @@
// GENERATED CODE! DO NOT MODIFY BY HAND!
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { EpiphanyInvestigationDisposition } from "../EpiphanyInvestigationDisposition";
export type ThreadEpiphanySceneInvestigationCheckpoint = { checkpointId: string, kind: string, disposition: EpiphanyInvestigationDisposition, focus: string, summary?: string | null, nextAction?: string | null, capturedAtTurnId?: string | null, openQuestionCount: number, codeRefCount: number, evidenceCount: number, };

View file

@ -2,4 +2,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ThreadEpiphanyStateUpdatedField = "objective" | "activeSubgoalId" | "subgoals" | "invariants" | "graphs" | "graphFrontier" | "graphCheckpoint" | "scratch" | "observations" | "evidence" | "churn" | "mode";
export type ThreadEpiphanyStateUpdatedField = "objective" | "activeSubgoalId" | "subgoals" | "invariants" | "graphs" | "graphFrontier" | "graphCheckpoint" | "scratch" | "investigationCheckpoint" | "observations" | "evidence" | "churn" | "mode";

View file

@ -7,9 +7,10 @@ import type { EpiphanyGraphCheckpoint } from "../EpiphanyGraphCheckpoint";
import type { EpiphanyGraphFrontier } from "../EpiphanyGraphFrontier";
import type { EpiphanyGraphs } from "../EpiphanyGraphs";
import type { EpiphanyInvariant } from "../EpiphanyInvariant";
import type { EpiphanyInvestigationCheckpoint } from "../EpiphanyInvestigationCheckpoint";
import type { EpiphanyModeState } from "../EpiphanyModeState";
import type { EpiphanyObservation } from "../EpiphanyObservation";
import type { EpiphanyScratchPad } from "../EpiphanyScratchPad";
import type { EpiphanySubgoal } from "../EpiphanySubgoal";
export type ThreadEpiphanyUpdatePatch = { objective?: string | null, activeSubgoalId?: string | null, subgoals?: Array<EpiphanySubgoal> | null, invariants?: Array<EpiphanyInvariant> | null, graphs?: EpiphanyGraphs | null, graphFrontier?: EpiphanyGraphFrontier | null, graphCheckpoint?: EpiphanyGraphCheckpoint | null, scratch?: EpiphanyScratchPad | null, observations?: Array<EpiphanyObservation>, evidence?: Array<EpiphanyEvidenceRecord>, churn?: EpiphanyChurnState | null, mode?: EpiphanyModeState | null, };
export type ThreadEpiphanyUpdatePatch = { objective?: string | null, activeSubgoalId?: string | null, subgoals?: Array<EpiphanySubgoal> | null, invariants?: Array<EpiphanyInvariant> | null, graphs?: EpiphanyGraphs | null, graphFrontier?: EpiphanyGraphFrontier | null, graphCheckpoint?: EpiphanyGraphCheckpoint | null, scratch?: EpiphanyScratchPad | null, investigationCheckpoint?: EpiphanyInvestigationCheckpoint | null, observations?: Array<EpiphanyObservation>, evidence?: Array<EpiphanyEvidenceRecord>, churn?: EpiphanyChurnState | null, mode?: EpiphanyModeState | null, };

View file

@ -321,7 +321,12 @@ export type { ThreadEpiphanyContext } from "./ThreadEpiphanyContext";
export type { ThreadEpiphanyContextMissing } from "./ThreadEpiphanyContextMissing";
export type { ThreadEpiphanyContextSource } from "./ThreadEpiphanyContextSource";
export type { ThreadEpiphanyContextStateStatus } from "./ThreadEpiphanyContextStateStatus";
export type { ThreadEpiphanyFreshnessSource } from "./ThreadEpiphanyFreshnessSource";
export type { ThreadEpiphanyGraphContext } from "./ThreadEpiphanyGraphContext";
export type { ThreadEpiphanyGraphFreshness } from "./ThreadEpiphanyGraphFreshness";
export type { ThreadEpiphanyGraphFreshnessStatus } from "./ThreadEpiphanyGraphFreshnessStatus";
export type { ThreadEpiphanyInvalidationInput } from "./ThreadEpiphanyInvalidationInput";
export type { ThreadEpiphanyInvalidationStatus } from "./ThreadEpiphanyInvalidationStatus";
export type { ThreadEpiphanyJob } from "./ThreadEpiphanyJob";
export type { ThreadEpiphanyJobKind } from "./ThreadEpiphanyJobKind";
export type { ThreadEpiphanyJobStatus } from "./ThreadEpiphanyJobStatus";
@ -331,6 +336,8 @@ export type { ThreadEpiphanyPressureBasis } from "./ThreadEpiphanyPressureBasis"
export type { ThreadEpiphanyPressureLevel } from "./ThreadEpiphanyPressureLevel";
export type { ThreadEpiphanyPressureSource } from "./ThreadEpiphanyPressureSource";
export type { ThreadEpiphanyPressureStatus } from "./ThreadEpiphanyPressureStatus";
export type { ThreadEpiphanyRetrievalFreshness } from "./ThreadEpiphanyRetrievalFreshness";
export type { ThreadEpiphanyRetrievalFreshnessStatus } from "./ThreadEpiphanyRetrievalFreshnessStatus";
export type { ThreadEpiphanyRetrieveIndexSummary } from "./ThreadEpiphanyRetrieveIndexSummary";
export type { ThreadEpiphanyRetrieveResult } from "./ThreadEpiphanyRetrieveResult";
export type { ThreadEpiphanyRetrieveResultKind } from "./ThreadEpiphanyRetrieveResultKind";
@ -339,6 +346,7 @@ export type { ThreadEpiphanyScene } from "./ThreadEpiphanyScene";
export type { ThreadEpiphanySceneAction } from "./ThreadEpiphanySceneAction";
export type { ThreadEpiphanySceneChurn } from "./ThreadEpiphanySceneChurn";
export type { ThreadEpiphanySceneGraph } from "./ThreadEpiphanySceneGraph";
export type { ThreadEpiphanySceneInvestigationCheckpoint } from "./ThreadEpiphanySceneInvestigationCheckpoint";
export type { ThreadEpiphanySceneRecord } from "./ThreadEpiphanySceneRecord";
export type { ThreadEpiphanySceneRecords } from "./ThreadEpiphanySceneRecords";
export type { ThreadEpiphanySceneRetrieval } from "./ThreadEpiphanySceneRetrieval";

View file

@ -1886,6 +1886,17 @@ mod tests {
note: "Graph freshness is stale; frontier has 1 dirty path(s), 1 open question id(s), and 0 open gap id(s)."
.to_string(),
},
watcher: v2::ThreadEpiphanyInvalidationInput {
status: v2::ThreadEpiphanyInvalidationStatus::Changed,
watched_root: Some(PathBuf::from("/repo")),
observed_at_unix_seconds: Some(1_744_500_123),
changed_path_count: 1,
changed_paths: vec![PathBuf::from("src/router.rs")],
graph_node_ids: vec!["router-flow".to_string()],
active_frontier_node_ids: vec!["router-flow".to_string()],
note: "Watcher observed 1 recent changed path(s) touching 1 mapped graph node(s), including 1 active frontier node(s)."
.to_string(),
},
},
};
@ -1917,6 +1928,16 @@ mod tests {
"openQuestionCount": 1,
"openGapCount": 0,
"note": "Graph freshness is stale; frontier has 1 dirty path(s), 1 open question id(s), and 0 open gap id(s)."
},
"watcher": {
"status": "changed",
"watchedRoot": "/repo",
"observedAtUnixSeconds": 1744500123,
"changedPathCount": 1,
"changedPaths": ["src/router.rs"],
"graphNodeIds": ["router-flow"],
"activeFrontierNodeIds": ["router-flow"],
"note": "Watcher observed 1 recent changed path(s) touching 1 mapped graph node(s), including 1 active frontier node(s)."
}
}
}),

View file

@ -4172,6 +4172,7 @@ pub struct ThreadEpiphanyFreshnessResponse {
pub state_revision: Option<u64>,
pub retrieval: ThreadEpiphanyRetrievalFreshness,
pub graph: ThreadEpiphanyGraphFreshness,
pub watcher: ThreadEpiphanyInvalidationInput,
}
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
@ -4243,6 +4244,36 @@ pub struct ThreadEpiphanyGraphFreshness {
pub note: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub enum ThreadEpiphanyInvalidationStatus {
Unavailable,
Clean,
Changed,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadEpiphanyInvalidationInput {
pub status: ThreadEpiphanyInvalidationStatus,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional = nullable)]
pub watched_root: Option<PathBuf>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional = nullable)]
pub observed_at_unix_seconds: Option<i64>,
pub changed_path_count: u32,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub changed_paths: Vec<PathBuf>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub graph_node_ids: Vec<String>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub active_frontier_node_ids: Vec<String>,
pub note: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]

View file

@ -146,7 +146,7 @@ Experimental Epiphany retrieval:
- `thread/epiphany/promote` is an explicit loaded-thread-only promotion gate. It evaluates a patch plus verifier evidence, rejects with reasons without mutating state when policy fails, and applies the patch through the durable update path when accepted. Accepted responses include the landed `revision` and `changedFields`.
- `thread/epiphany/update` is the explicit loaded-thread-only control-plane write path for Epiphany state. It can append observations/evidence and replace bounded typed state fields such as objective, subgoals, graph frontier/checkpoint, scratch, churn, and mode; it bumps the Epiphany revision, returns `revision` plus `changedFields`, and persists a rollout snapshot immediately.
- `thread/epiphany/stateUpdated` is an experimental server notification emitted after successful `thread/epiphany/update` and accepted `thread/epiphany/promote`. It carries the updated typed `epiphanyState`, a `source` of `update` or `promote`, event-level `revision`, and typed `changedFields`; rejected promotions do not emit it.
- `thread/epiphany/freshness` is a read-only reflection surface for retrieval and graph staleness. It reports revision/source identity, retrieval freshness, graph freshness, and exact dirty-path pressure without mutating state, scheduling refresh work, or pretending watcher-driven invalidation already exists.
- `thread/epiphany/freshness` is a read-only reflection surface for retrieval and graph staleness. It reports revision/source identity, retrieval freshness, graph freshness, and exact dirty-path pressure, and for loaded threads now also reports watcher-backed invalidation inputs with watched root, changed paths, mapped graph-node hits, and active-frontier hits. It still does not mutate state, schedule refresh work, or perform automatic watcher-driven semantic invalidation.
The request envelope is camelCase, but nested reused Epiphany core DTOs currently keep their core snake_case fields, such as `source_kind`, `understanding_status`, and `diff_pressure`.
- `thread/start` — create a new thread; emits `thread/started` (including the current `thread.status`) and auto-subscribes you to turn/item events for that thread. When the request includes a `cwd` and the resolved sandbox is `workspace-write` or full access, app-server also marks that project as trusted in the user `config.toml`. Pass `sessionStartSource: "clear"` when starting a replacement thread after clearing the current session so `SessionStart` hooks receive `source: "clear"` instead of the default `"startup"`. For permissions, prefer `permissionProfile`; the legacy `sandbox` shorthand is still accepted but cannot be combined with `permissionProfile`.

View file

@ -3,6 +3,8 @@ use crate::bespoke_event_handling::maybe_emit_hook_prompt_item_completed;
use crate::command_exec::CommandExecManager;
use crate::command_exec::StartCommandExecParams;
use crate::config_manager::ConfigManager;
use crate::epiphany_invalidation::EpiphanyInvalidationManager;
use crate::epiphany_invalidation::EpiphanyInvalidationSnapshot;
use crate::error_code::INPUT_TOO_LARGE_ERROR_CODE;
use crate::error_code::INTERNAL_ERROR_CODE;
use crate::error_code::INVALID_PARAMS_ERROR_CODE;
@ -162,6 +164,8 @@ use codex_app_server_protocol::ThreadEpiphanyGraphFreshness;
use codex_app_server_protocol::ThreadEpiphanyGraphFreshnessStatus;
use codex_app_server_protocol::ThreadEpiphanyIndexParams;
use codex_app_server_protocol::ThreadEpiphanyIndexResponse;
use codex_app_server_protocol::ThreadEpiphanyInvalidationInput;
use codex_app_server_protocol::ThreadEpiphanyInvalidationStatus;
use codex_app_server_protocol::ThreadEpiphanyJob;
use codex_app_server_protocol::ThreadEpiphanyJobKind;
use codex_app_server_protocol::ThreadEpiphanyJobStatus;
@ -569,6 +573,7 @@ pub(crate) struct CodexMessageProcessor {
pending_thread_unloads: Arc<Mutex<HashSet<ThreadId>>>,
thread_state_manager: ThreadStateManager,
thread_watch_manager: ThreadWatchManager,
epiphany_invalidation_manager: EpiphanyInvalidationManager,
command_exec_manager: CommandExecManager,
pending_fuzzy_searches: Arc<Mutex<HashMap<String, Arc<AtomicBool>>>>,
fuzzy_search_sessions: Arc<Mutex<HashMap<String, FuzzyFileSearchSession>>>,
@ -594,6 +599,7 @@ struct ListenerTaskContext {
analytics_events_client: AnalyticsEventsClient,
general_analytics_enabled: bool,
thread_watch_manager: ThreadWatchManager,
epiphany_invalidation_manager: EpiphanyInvalidationManager,
fallback_model_provider: String,
codex_home: PathBuf,
}
@ -826,6 +832,7 @@ impl CodexMessageProcessor {
pending_thread_unloads: Arc::new(Mutex::new(HashSet::new())),
thread_state_manager: ThreadStateManager::new(),
thread_watch_manager: ThreadWatchManager::new_with_outgoing(outgoing),
epiphany_invalidation_manager: EpiphanyInvalidationManager::new(),
command_exec_manager: CommandExecManager::default(),
pending_fuzzy_searches: Arc::new(Mutex::new(HashMap::new())),
fuzzy_search_sessions: Arc::new(Mutex::new(HashMap::new())),
@ -2518,6 +2525,7 @@ impl CodexMessageProcessor {
analytics_events_client: self.analytics_events_client.clone(),
general_analytics_enabled: self.config.features.enabled(Feature::GeneralAnalytics),
thread_watch_manager: self.thread_watch_manager.clone(),
epiphany_invalidation_manager: self.epiphany_invalidation_manager.clone(),
fallback_model_provider: self.config.model_provider_id.clone(),
codex_home: self.config.codex_home.to_path_buf(),
};
@ -4242,8 +4250,24 @@ impl CodexMessageProcessor {
} else {
None
};
let (state_revision, retrieval, graph) =
map_epiphany_freshness(thread.epiphany_state.as_ref(), retrieval_override.as_ref());
let watcher_snapshot = if let Some(loaded_thread) = loaded_thread.as_ref() {
let config_snapshot = loaded_thread.config_snapshot().await;
self.epiphany_invalidation_manager
.ensure_thread_watch(&thread_id, &config_snapshot.cwd)
.await;
Some(
self.epiphany_invalidation_manager
.snapshot(&thread_id)
.await,
)
} else {
None
};
let (state_revision, retrieval, graph, watcher) = map_epiphany_freshness(
thread.epiphany_state.as_ref(),
retrieval_override.as_ref(),
watcher_snapshot.as_ref(),
);
let response = ThreadEpiphanyFreshnessResponse {
thread_id,
source: if loaded_thread.is_some() {
@ -4254,6 +4278,7 @@ impl CodexMessageProcessor {
state_revision,
retrieval,
graph,
watcher,
};
self.outgoing.send_response(request_id, response).await;
}
@ -7046,6 +7071,9 @@ impl CodexMessageProcessor {
self.thread_state_manager
.remove_thread_state(thread_id)
.await;
self.epiphany_invalidation_manager
.remove_thread(&thread_id.to_string())
.await;
self.thread_watch_manager
.remove_thread(&thread_id.to_string())
.await;
@ -7057,6 +7085,7 @@ impl CodexMessageProcessor {
pending_thread_unloads: Arc<Mutex<HashSet<ThreadId>>>,
thread_state_manager: ThreadStateManager,
thread_watch_manager: ThreadWatchManager,
epiphany_invalidation_manager: EpiphanyInvalidationManager,
thread_id: ThreadId,
thread: Arc<CodexThread>,
) {
@ -7068,18 +7097,27 @@ impl CodexMessageProcessor {
.cancel_requests_for_thread(thread_id, /*error*/ None)
.await;
thread_state_manager.remove_thread_state(thread_id).await;
epiphany_invalidation_manager
.remove_thread(&thread_id.to_string())
.await;
tokio::spawn(async move {
match Self::wait_for_thread_shutdown(&thread).await {
ThreadShutdownResult::Complete => {
if thread_manager.remove_thread(&thread_id).await.is_none() {
info!("thread {thread_id} was already removed before teardown finalized");
epiphany_invalidation_manager
.remove_thread(&thread_id.to_string())
.await;
thread_watch_manager
.remove_thread(&thread_id.to_string())
.await;
pending_thread_unloads.lock().await.remove(&thread_id);
return;
}
epiphany_invalidation_manager
.remove_thread(&thread_id.to_string())
.await;
thread_watch_manager
.remove_thread(&thread_id.to_string())
.await;
@ -8579,6 +8617,7 @@ impl CodexMessageProcessor {
analytics_events_client: self.analytics_events_client.clone(),
general_analytics_enabled: self.config.features.enabled(Feature::GeneralAnalytics),
thread_watch_manager: self.thread_watch_manager.clone(),
epiphany_invalidation_manager: self.epiphany_invalidation_manager.clone(),
fallback_model_provider: self.config.model_provider_id.clone(),
codex_home: self.config.codex_home.to_path_buf(),
},
@ -8697,6 +8736,7 @@ impl CodexMessageProcessor {
analytics_events_client: self.analytics_events_client.clone(),
general_analytics_enabled: self.config.features.enabled(Feature::GeneralAnalytics),
thread_watch_manager: self.thread_watch_manager.clone(),
epiphany_invalidation_manager: self.epiphany_invalidation_manager.clone(),
fallback_model_provider: self.config.model_provider_id.clone(),
codex_home: self.config.codex_home.to_path_buf(),
},
@ -8746,6 +8786,7 @@ impl CodexMessageProcessor {
analytics_events_client: _,
general_analytics_enabled: _,
thread_watch_manager,
epiphany_invalidation_manager,
fallback_model_provider,
codex_home,
} = listener_task_context;
@ -8859,6 +8900,7 @@ impl CodexMessageProcessor {
pending_thread_unloads.clone(),
thread_state_manager.clone(),
thread_watch_manager.clone(),
epiphany_invalidation_manager.clone(),
conversation_id,
conversation.clone(),
)
@ -10892,16 +10934,19 @@ fn epiphany_scene_available_actions(
fn map_epiphany_freshness(
state: Option<&EpiphanyThreadState>,
retrieval_override: Option<&EpiphanyRetrievalState>,
watcher_snapshot: Option<&EpiphanyInvalidationSnapshot>,
) -> (
Option<u64>,
ThreadEpiphanyRetrievalFreshness,
ThreadEpiphanyGraphFreshness,
ThreadEpiphanyInvalidationInput,
) {
let retrieval = epiphany_retrieval_state_for_reflection(state, retrieval_override);
(
state.map(|state| state.revision),
map_epiphany_retrieval_freshness(retrieval),
map_epiphany_graph_freshness(state),
map_epiphany_invalidation_input(state, watcher_snapshot),
)
}
@ -11025,6 +11070,180 @@ fn map_epiphany_graph_freshness(
}
}
fn map_epiphany_invalidation_input(
state: Option<&EpiphanyThreadState>,
watcher_snapshot: Option<&EpiphanyInvalidationSnapshot>,
) -> ThreadEpiphanyInvalidationInput {
let Some(watcher_snapshot) = watcher_snapshot else {
return ThreadEpiphanyInvalidationInput {
status: ThreadEpiphanyInvalidationStatus::Unavailable,
watched_root: None,
observed_at_unix_seconds: None,
changed_path_count: 0,
changed_paths: Vec::new(),
graph_node_ids: Vec::new(),
active_frontier_node_ids: Vec::new(),
note: "Watcher-backed invalidation inputs are only available for loaded threads."
.to_string(),
};
};
if !watcher_snapshot.available {
return ThreadEpiphanyInvalidationInput {
status: ThreadEpiphanyInvalidationStatus::Unavailable,
watched_root: None,
observed_at_unix_seconds: None,
changed_path_count: 0,
changed_paths: Vec::new(),
graph_node_ids: Vec::new(),
active_frontier_node_ids: Vec::new(),
note: "The workspace watcher is unavailable for this app-server process.".to_string(),
};
}
let changed_paths = watcher_snapshot.changed_paths.clone();
let changed_path_count = changed_paths.len() as u32;
let watched_root = watcher_snapshot
.workspace_root
.as_ref()
.map(|root| root.to_path_buf());
if changed_paths.is_empty() {
return ThreadEpiphanyInvalidationInput {
status: ThreadEpiphanyInvalidationStatus::Clean,
watched_root,
observed_at_unix_seconds: watcher_snapshot.observed_at_unix_seconds,
changed_path_count,
changed_paths,
graph_node_ids: Vec::new(),
active_frontier_node_ids: Vec::new(),
note: "Watcher has not observed recent filesystem changes under the workspace root."
.to_string(),
};
}
let graph_node_ids = state
.map(|state| {
graph_node_ids_for_changed_paths(
state,
&changed_paths,
watcher_snapshot
.workspace_root
.as_ref()
.map(|root| root.as_path()),
)
})
.unwrap_or_default();
let active_frontier_node_ids = state
.map(|state| {
active_frontier_node_ids_for_changed_paths(
state,
&changed_paths,
watcher_snapshot
.workspace_root
.as_ref()
.map(|root| root.as_path()),
)
})
.unwrap_or_default();
let note = if graph_node_ids.is_empty() {
format!(
"Watcher observed {changed_path_count} recent changed path(s), but no mapped graph node code refs matched yet."
)
} else if active_frontier_node_ids.is_empty() {
format!(
"Watcher observed {changed_path_count} recent changed path(s) touching {} mapped graph node(s).",
graph_node_ids.len()
)
} else {
format!(
"Watcher observed {changed_path_count} recent changed path(s) touching {} mapped graph node(s), including {} active frontier node(s).",
graph_node_ids.len(),
active_frontier_node_ids.len()
)
};
ThreadEpiphanyInvalidationInput {
status: ThreadEpiphanyInvalidationStatus::Changed,
watched_root,
observed_at_unix_seconds: watcher_snapshot.observed_at_unix_seconds,
changed_path_count,
changed_paths,
graph_node_ids,
active_frontier_node_ids,
note,
}
}
fn graph_node_ids_for_changed_paths(
state: &EpiphanyThreadState,
changed_paths: &[PathBuf],
workspace_root: Option<&Path>,
) -> Vec<String> {
let changed_path_keys: HashSet<String> = changed_paths
.iter()
.map(|path| epiphany_path_key(path.as_path()))
.collect();
let mut node_ids = Vec::new();
let mut seen = HashSet::new();
for node in state
.graphs
.architecture
.nodes
.iter()
.chain(state.graphs.dataflow.nodes.iter())
{
let matches_changed_path = node.code_refs.iter().any(|code_ref| {
changed_path_keys.contains(&code_ref_path_key(
Path::new(&code_ref.path),
workspace_root,
))
});
if matches_changed_path && seen.insert(node.id.as_str()) {
node_ids.push(node.id.clone());
}
}
node_ids
}
fn active_frontier_node_ids_for_changed_paths(
state: &EpiphanyThreadState,
changed_paths: &[PathBuf],
workspace_root: Option<&Path>,
) -> Vec<String> {
let graph_node_ids = graph_node_ids_for_changed_paths(state, changed_paths, workspace_root);
let frontier_node_ids = state
.graph_frontier
.as_ref()
.map(|frontier| frontier.active_node_ids.as_slice())
.unwrap_or_default();
let graph_node_ids: HashSet<&str> = graph_node_ids.iter().map(String::as_str).collect();
frontier_node_ids
.iter()
.filter(|node_id| graph_node_ids.contains(node_id.as_str()))
.cloned()
.collect()
}
fn epiphany_path_key(path: &Path) -> String {
path.to_string_lossy()
.replace('\\', "/")
.trim_start_matches("./")
.to_string()
}
fn code_ref_path_key(path: &Path, workspace_root: Option<&Path>) -> String {
if let Some(workspace_root) = workspace_root
&& let Ok(relative_path) = path.strip_prefix(workspace_root)
{
return epiphany_path_key(relative_path);
}
epiphany_path_key(path)
}
fn map_epiphany_pressure(info: Option<&CoreTokenUsageInfo>) -> ThreadEpiphanyPressure {
let Some(info) = info else {
return ThreadEpiphanyPressure {
@ -13210,7 +13429,8 @@ mod tests {
..Default::default()
};
let (state_revision, retrieval, graph) = map_epiphany_freshness(None, Some(&retrieval));
let (state_revision, retrieval, graph, watcher) =
map_epiphany_freshness(None, Some(&retrieval), None);
assert_eq!(state_revision, None);
assert_eq!(
@ -13220,12 +13440,35 @@ mod tests {
assert_eq!(retrieval.semantic_available, Some(true));
assert_eq!(graph.status, ThreadEpiphanyGraphFreshnessStatus::Missing);
assert_eq!(graph.dirty_path_count, 0);
assert_eq!(
watcher.status,
ThreadEpiphanyInvalidationStatus::Unavailable
);
}
#[test]
fn map_epiphany_freshness_marks_graph_and_retrieval_stale() {
let state = EpiphanyThreadState {
revision: 7,
graphs: codex_protocol::protocol::EpiphanyGraphs {
architecture: codex_protocol::protocol::EpiphanyGraph {
nodes: vec![codex_protocol::protocol::EpiphanyGraphNode {
id: "state-spine".to_string(),
title: "State spine".to_string(),
purpose: "Typed state".to_string(),
code_refs: vec![codex_protocol::protocol::EpiphanyCodeRef {
path: test_path_buf("/workspace/src/router.rs"),
start_line: None,
end_line: None,
symbol: None,
note: None,
}],
..Default::default()
}],
..Default::default()
},
..Default::default()
},
graph_frontier: Some(codex_protocol::protocol::EpiphanyGraphFrontier {
active_node_ids: vec!["state-spine".to_string()],
dirty_paths: vec![PathBuf::from("src/router.rs")],
@ -13255,9 +13498,15 @@ mod tests {
dirty_paths: vec![PathBuf::from("src/router.rs")],
..Default::default()
};
let watcher_snapshot = EpiphanyInvalidationSnapshot {
available: true,
workspace_root: Some(test_path_buf("/workspace").abs()),
observed_at_unix_seconds: Some(1_744_600_000),
changed_paths: vec![PathBuf::from("src/router.rs")],
};
let (state_revision, retrieval, graph) =
map_epiphany_freshness(Some(&state), Some(&retrieval));
let (state_revision, retrieval, graph, watcher) =
map_epiphany_freshness(Some(&state), Some(&retrieval), Some(&watcher_snapshot));
assert_eq!(state_revision, Some(7));
assert_eq!(
@ -13270,6 +13519,75 @@ mod tests {
assert_eq!(graph.dirty_path_count, 1);
assert_eq!(graph.open_question_count, 1);
assert_eq!(graph.open_gap_count, 0);
assert_eq!(watcher.status, ThreadEpiphanyInvalidationStatus::Changed);
assert_eq!(
watcher.watched_root,
Some(test_path_buf("/workspace").abs().to_path_buf())
);
assert_eq!(watcher.changed_paths, vec![PathBuf::from("src/router.rs")]);
assert_eq!(watcher.graph_node_ids, vec!["state-spine".to_string()]);
assert_eq!(
watcher.active_frontier_node_ids,
vec!["state-spine".to_string()]
);
}
#[test]
fn map_epiphany_freshness_reports_clean_watcher_when_no_changes_were_seen() {
let watcher_snapshot = EpiphanyInvalidationSnapshot {
available: true,
workspace_root: Some(test_path_buf("/workspace").abs()),
observed_at_unix_seconds: None,
changed_paths: Vec::new(),
};
let (_, _, _, watcher) = map_epiphany_freshness(None, None, Some(&watcher_snapshot));
assert_eq!(watcher.status, ThreadEpiphanyInvalidationStatus::Clean);
assert_eq!(watcher.changed_path_count, 0);
assert_eq!(
watcher.watched_root,
Some(test_path_buf("/workspace").abs().to_path_buf())
);
}
#[test]
fn map_epiphany_freshness_reports_unmatched_changed_paths_without_inventing_nodes() {
let state = EpiphanyThreadState {
graphs: codex_protocol::protocol::EpiphanyGraphs {
architecture: codex_protocol::protocol::EpiphanyGraph {
nodes: vec![codex_protocol::protocol::EpiphanyGraphNode {
id: "scene".to_string(),
title: "Scene".to_string(),
purpose: "Reflection".to_string(),
code_refs: vec![codex_protocol::protocol::EpiphanyCodeRef {
path: test_path_buf("/workspace/src/scene.rs"),
start_line: None,
end_line: None,
symbol: None,
note: None,
}],
..Default::default()
}],
..Default::default()
},
..Default::default()
},
..Default::default()
};
let watcher_snapshot = EpiphanyInvalidationSnapshot {
available: true,
workspace_root: Some(test_path_buf("/workspace").abs()),
observed_at_unix_seconds: Some(1_744_600_001),
changed_paths: vec![PathBuf::from("src/other.rs")],
};
let (_, _, _, watcher) =
map_epiphany_freshness(Some(&state), None, Some(&watcher_snapshot));
assert_eq!(watcher.status, ThreadEpiphanyInvalidationStatus::Changed);
assert!(watcher.graph_node_ids.is_empty());
assert!(watcher.active_frontier_node_ids.is_empty());
}
#[test]

View file

@ -0,0 +1,210 @@
use codex_core::file_watcher::FileWatcher;
use codex_core::file_watcher::FileWatcherSubscriber;
use codex_core::file_watcher::ThrottledWatchReceiver;
use codex_core::file_watcher::WatchPath;
use codex_core::file_watcher::WatchRegistration;
use codex_utils_absolute_path::AbsolutePathBuf;
use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::Arc;
use std::time::Duration;
use std::time::SystemTime;
use std::time::UNIX_EPOCH;
use tokio::sync::Mutex as AsyncMutex;
use tokio::sync::oneshot;
use tracing::warn;
const INVALIDATION_WATCH_DEBOUNCE: Duration = Duration::from_millis(200);
#[derive(Clone, Debug, PartialEq, Eq)]
pub(crate) struct EpiphanyInvalidationSnapshot {
pub available: bool,
pub workspace_root: Option<AbsolutePathBuf>,
pub observed_at_unix_seconds: Option<i64>,
pub changed_paths: Vec<PathBuf>,
}
#[derive(Clone)]
pub(crate) struct EpiphanyInvalidationManager {
available: bool,
file_watcher: Arc<FileWatcher>,
state: Arc<AsyncMutex<HashMap<String, WatchEntry>>>,
}
struct WatchEntry {
workspace_root: AbsolutePathBuf,
latest: Arc<AsyncMutex<LatestInvalidation>>,
terminate_tx: oneshot::Sender<oneshot::Sender<()>>,
_subscriber: FileWatcherSubscriber,
_registration: WatchRegistration,
}
#[derive(Clone, Debug, Default, PartialEq, Eq)]
struct LatestInvalidation {
observed_at_unix_seconds: Option<i64>,
changed_paths: Vec<PathBuf>,
}
impl EpiphanyInvalidationManager {
pub(crate) fn new() -> Self {
match FileWatcher::new() {
Ok(file_watcher) => Self {
available: true,
file_watcher: Arc::new(file_watcher),
state: Arc::new(AsyncMutex::new(HashMap::new())),
},
Err(err) => {
warn!("epiphany invalidation manager falling back to noop core watcher: {err}");
Self {
available: false,
file_watcher: Arc::new(FileWatcher::noop()),
state: Arc::new(AsyncMutex::new(HashMap::new())),
}
}
}
}
pub(crate) async fn ensure_thread_watch(
&self,
thread_id: &str,
workspace_root: &AbsolutePathBuf,
) {
if !self.available {
return;
}
let existing_entry = {
let mut state = self.state.lock().await;
match state.get(thread_id) {
Some(entry) if &entry.workspace_root == workspace_root => return,
Some(_) => state.remove(thread_id),
None => None,
}
};
if let Some(entry) = existing_entry {
stop_watch_entry(entry).await;
}
let (subscriber, rx) = self.file_watcher.add_subscriber();
let registration = subscriber.register_paths(vec![WatchPath {
path: workspace_root.to_path_buf(),
recursive: true,
}]);
let latest = Arc::new(AsyncMutex::new(LatestInvalidation::default()));
let (terminate_tx, terminate_rx) = oneshot::channel();
let workspace_root_path = workspace_root.to_path_buf();
let entry = WatchEntry {
workspace_root: workspace_root.clone(),
latest: Arc::clone(&latest),
terminate_tx,
_subscriber: subscriber,
_registration: registration,
};
self.state.lock().await.insert(thread_id.to_string(), entry);
tokio::spawn(async move {
let mut rx = ThrottledWatchReceiver::new(rx, INVALIDATION_WATCH_DEBOUNCE);
let mut terminate_rx = terminate_rx;
let mut done_tx = None;
loop {
let event = tokio::select! {
biased;
result = &mut terminate_rx => {
done_tx = result.ok();
break;
}
event = rx.recv() => match event {
Some(event) => event,
None => break,
},
};
let observed_at_unix_seconds = unix_now();
let mut latest = latest.lock().await;
latest.observed_at_unix_seconds = Some(observed_at_unix_seconds);
latest.changed_paths =
normalize_changed_paths(event.paths, workspace_root_path.as_path());
}
if let Some(done_tx) = done_tx {
let _ = done_tx.send(());
}
});
}
pub(crate) async fn snapshot(&self, thread_id: &str) -> EpiphanyInvalidationSnapshot {
if !self.available {
return EpiphanyInvalidationSnapshot {
available: false,
workspace_root: None,
observed_at_unix_seconds: None,
changed_paths: Vec::new(),
};
}
let (workspace_root, latest) = {
let state = self.state.lock().await;
match state.get(thread_id) {
Some(entry) => (
Some(entry.workspace_root.clone()),
Some(Arc::clone(&entry.latest)),
),
None => (None, None),
}
};
let Some(latest) = latest else {
return EpiphanyInvalidationSnapshot {
available: false,
workspace_root: None,
observed_at_unix_seconds: None,
changed_paths: Vec::new(),
};
};
let latest = latest.lock().await.clone();
EpiphanyInvalidationSnapshot {
available: true,
workspace_root,
observed_at_unix_seconds: latest.observed_at_unix_seconds,
changed_paths: latest.changed_paths,
}
}
pub(crate) async fn remove_thread(&self, thread_id: &str) {
let entry = self.state.lock().await.remove(thread_id);
if let Some(entry) = entry {
stop_watch_entry(entry).await;
}
}
}
async fn stop_watch_entry(entry: WatchEntry) {
let (done_tx, done_rx) = oneshot::channel();
let _ = entry.terminate_tx.send(done_tx);
let _ = done_rx.await;
}
fn unix_now() -> i64 {
SystemTime::now()
.duration_since(UNIX_EPOCH)
.map(|duration| duration.as_secs() as i64)
.unwrap_or_default()
}
fn normalize_changed_paths(paths: Vec<PathBuf>, workspace_root: &std::path::Path) -> Vec<PathBuf> {
let mut normalized = paths
.into_iter()
.filter_map(|path| match path.strip_prefix(workspace_root) {
Ok(relative) if relative.as_os_str().is_empty() => None,
Ok(relative) => Some(relative.to_path_buf()),
Err(_) => Some(path),
})
.collect::<Vec<_>>();
normalized.sort();
normalized.dedup();
normalized
}

View file

@ -75,6 +75,7 @@ mod config_manager;
mod config_manager_service;
mod device_key_api;
mod dynamic_tools;
mod epiphany_invalidation;
mod error_code;
mod external_agent_config_api;
mod filters;