Feat/sys tool/wait sleep - #10
Draft
ConnorIllingworth wants to merge 25 commits into
Draft
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Collaborator
Author
|
Modified scheduled_wakeups schema to not be reliant on llm/agent knowing the date. |
Added Route Comments to working files. This allows easier use with website-based chat agents. Due to them naming files the same thing. EX: Claude will named them just index.ts index.ts. This allows you to open it and read the top and see what file it is without looking at the actual file. scheduled_wakeups
Added routes to working files so it's easier to chat with.
Introduces a new wakeup scheduling contract to kernl, including types and store interface. Adds PostgreSQL-backed implementation (PGWakeupStore) with codecs and SQL helpers for persisting, updating, and claiming scheduled wakeups. Updates package exports to expose the new API.
Introduces the WakeupStore interface to KernlStorage and implements an in-memory version (InMemoryWakeupStore) for managing scheduled wakeups. Updates the in-memory storage class to include wakeup management, supporting creation, retrieval, update, deletion, and claiming of due wakeups.
Introduces a new 'wakeup' system tool for scheduling thread wakeups, exposes it via the toolkit system, and ensures it is initialized and bound in the Agent class. Updates the wait tool's parameter schema and documentation for clarity, and exports the wakeup toolkit alongside memory in the tool index.
Updated the wait_until tool to require the runtime to pass an explicit thread_id parameter, rather than relying on agent-level scheduling for the current thread. The tool now schedules wakeups directly via the storage-backed wakeup store, improving clarity and decoupling from agent internals. Documentation and parameter schema were updated accordingly.
Scheduled wakeup records now use generated IDs, camelCase field names, and store runAt in epoch milliseconds to align with the NewScheduledWakeup domain type.
Refactored the system toolkit previously named 'wakeup' to 'sleep' for improved semantic clarity. Updated all relevant imports, exports, and documentation to reflect the new naming.
Updated the sleep tool to obtain threadId from the context instead of requiring it in parameters. Adjusted documentation and assertions accordingly, and ensured threadId is set in context during thread execution.
Introduces a new agent called 'Sleeper' that uses the wait_until tool to pause and wait as instructed. The agent is configured with OpenAI's GPT-5.1 model and has memory enabled.
Added the sleeper agent to the Kernl application by importing it and registering it alongside other agents. Also commented out the unused turbopuffer import.
Sleep saying Running.
Improves thread state management to distinguish between INTERRUPTIBLE and STOPPED states, ensuring correct behavior when threads are paused (e.g., sleeping). Updates the sleep system tool to use execute() for scheduling wakeups and reporting status, rather than requiresApproval, and enhances the thread event processing logic to better handle system tool interrupts and sleep events.
Introduces the WakeupScheduler class and related types to enable automated polling and processing of due wakeups. Integrates the scheduler into Kernl, allowing configuration via KernlOptions and exposing scheduler state and controls. This facilitates automatic resumption of sleeping threads based on scheduled wakeups.
Updated kernl dependency in package.json to use workspace reference. Enabled and started the scheduler in app.ts, and performed minor formatting cleanup in sleeper.ts.
Replaces the boolean scheduler option with an object specifying autoStart. Also comments out the explicit scheduler start call, likely to rely on the new autoStart behavior.
Deleted a TODO comment from packages/kernl/src/agent/index.ts, leaving the file empty.
Moved AGENTS.md to the .codex directory for better organization or to follow project structure conventions.
Renames `run_at_s` to `wakeup_at`, adds `sleep_for` to scheduled wakeups, and updates all related codecs, SQL, and store logic for consistency. Adds a migration to handle schema changes, backfill data, and update indexes. All timestamps are now stored in epoch seconds for stability and consistency.
Updated wakeup scheduling logic to prefer a new `sleepFor` (seconds) field over the legacy `runAt` (epoch ms) for specifying wakeup times. Adjusted in-memory store, sleep tool, and types to support both fields for backward compatibility, with `sleepFor` as the primary method going forward.
Removed support for run_at_s in the WaitParamsSchema and related logic, making delay_s a required parameter for specifying sleep duration. This streamlines the wait tool's interface and reduces complexity.
Introduces a new migration (000_enable_vector) that ensures the 'vector' extension is enabled in the database before other migrations are applied.
When a thread wakes up, a user message is appended to the thread indicating the sleep period is complete and the task should continue. This provides clearer context for thread resumption.
ConnorIllingworth
force-pushed
the
feat/sys-tool/wait-sleep
branch
from
December 12, 2025 06:18
4964511 to
5f0fd8c
Compare
Collaborator
Author
|
Rebased, up to date with main |
Collaborator
Author
|
Oh also recursive waits, did via user command for now |
dremnik
force-pushed
the
master
branch
4 times, most recently
from
January 23, 2026 20:12
b65724a to
4f909ce
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Type of Change
Checklist
pnpm test)pnpm build)pnpm changeset)Notes