Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* This estimates only explicitly recorded LoopX Turn packets. It never labels
* arbitrary prose, a quoted packet, tool output or all compaction as LoopX. */
import type {TrajectoryLoopXInput, TrajectoryRequestCoverage} from './trajectory_assessment_types.ts';
import {BARE_SHA256_PATTERN} from '../content_digest.ts';

const method = 'tiktoken_o200k_base_input_estimate_v1';
class InputObservationError extends Error {}
Expand All @@ -21,7 +22,7 @@ function count(value: unknown): number {
? value : fail('Invalid input token estimate.');
}
function digest(value: unknown): string {
return typeof value === 'string' && /^[a-f0-9]{64}$/.test(value) ? value : fail('Missing input source digest.');
return typeof value === 'string' && BARE_SHA256_PATTERN.test(value) ? value : fail('Missing input source digest.');
}

export function estimateTrajectoryLoopXInput(value: unknown, session: string, goal: unknown,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ const CANONICAL_CONSUMERS = [
"control_plane/capabilities/external_evidence.ts",
"control_plane/capabilities/goal_capability_organization.ts",
"control_plane/capabilities/trajectory_assessment.ts",
"control_plane/capabilities/trajectory_input_usage.ts",
"control_plane/collaboration/chat_mode.ts",
"control_plane/collaboration/delegation.ts",
"control_plane/collaboration/delegation_result_use.ts",
Expand Down
Loading