mirror of
https://github.com/harivansh-afk/clanker-agent.git
synced 2026-04-19 17:04:45 +00:00
fix(companion-os): address grind mode review feedback
Restore the bedrock provider import through an explicit workspace path mapping, align pi-grind package metadata with the existing package manifests, remove the unused controller-failure state path, and parse bare ISO dates in local time. Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
parent
8c92f479d6
commit
48fa514e7e
7 changed files with 38 additions and 19 deletions
|
|
@ -52,7 +52,6 @@ export function createRunState(input: {
|
|||
lastNextAction: null,
|
||||
pendingRepair: false,
|
||||
consecutiveParseFailures: 0,
|
||||
consecutiveControllerFailures: 0,
|
||||
updatedAt: now,
|
||||
};
|
||||
}
|
||||
|
|
@ -75,7 +74,6 @@ export function isValidRunState(value: unknown): value is GrindRunState {
|
|||
isNullableString(value.lastNextAction) &&
|
||||
typeof value.pendingRepair === "boolean" &&
|
||||
typeof value.consecutiveParseFailures === "number" &&
|
||||
typeof value.consecutiveControllerFailures === "number" &&
|
||||
typeof value.updatedAt === "string"
|
||||
);
|
||||
}
|
||||
|
|
@ -114,19 +112,6 @@ export function withLoopStatus(state: GrindRunState, payload: GrindStatusPayload
|
|||
lastNextAction: payload.nextAction ?? null,
|
||||
pendingRepair: false,
|
||||
consecutiveParseFailures: 0,
|
||||
consecutiveControllerFailures: 0,
|
||||
updatedAt: new Date().toISOString(),
|
||||
};
|
||||
}
|
||||
|
||||
export function withControllerFailure(state: GrindRunState, note: string): GrindRunState {
|
||||
return {
|
||||
...state,
|
||||
status: "blocked",
|
||||
lastCheckpoint: note,
|
||||
lastNextAction: null,
|
||||
pendingRepair: false,
|
||||
consecutiveControllerFailures: state.consecutiveControllerFailures + 1,
|
||||
updatedAt: new Date().toISOString(),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,27 @@ function stripTrailingContinuation(text: string): string {
|
|||
.trim();
|
||||
}
|
||||
|
||||
function parseLocalDateOnly(candidate: string): Date | null {
|
||||
const match = candidate.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
||||
if (!match) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const year = Number(match[1]);
|
||||
const month = Number(match[2]);
|
||||
const day = Number(match[3]);
|
||||
const local = new Date(year, month - 1, day, 0, 0, 0, 0);
|
||||
if (
|
||||
local.getFullYear() !== year ||
|
||||
local.getMonth() !== month - 1 ||
|
||||
local.getDate() !== day
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return local;
|
||||
}
|
||||
|
||||
export function parseDeadline(raw: string, now: Date = new Date()): Date | null {
|
||||
const candidate = raw.trim();
|
||||
if (!candidate) {
|
||||
|
|
@ -85,6 +106,10 @@ export function parseDeadline(raw: string, now: Date = new Date()): Date | null
|
|||
|
||||
const time = parseClockValue(stripTrailingContinuation(normalized));
|
||||
if (!time) {
|
||||
const localDateOnly = parseLocalDateOnly(candidate);
|
||||
if (localDateOnly) {
|
||||
return localDateOnly;
|
||||
}
|
||||
const direct = new Date(candidate);
|
||||
if (!Number.isNaN(direct.getTime())) {
|
||||
return direct;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ export interface ParsedStopCondition {
|
|||
}
|
||||
|
||||
export interface ParsedAutoActivation {
|
||||
matchedCue: string | null;
|
||||
matchedCue: string;
|
||||
stopCondition: ParsedStopCondition;
|
||||
}
|
||||
|
||||
|
|
@ -48,6 +48,5 @@ export interface GrindRunState {
|
|||
lastNextAction: string | null;
|
||||
pendingRepair: boolean;
|
||||
consecutiveParseFailures: number;
|
||||
consecutiveControllerFailures: number;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue