- Add CalendarScheduler class to manage periodic heartbeat and slot execution - Implement agent wakeup logic when Idle and slots are pending - Handle slot status transitions (attended, ongoing, deferred) - Support both real and virtual slot materialization - Add task context building for different event types (job, system, entertainment) - Integrate scheduler into main plugin index.ts - Add new plugin tools: harborforge_calendar_status, complete, abort
49 lines
2.0 KiB
JavaScript
49 lines
2.0 KiB
JavaScript
"use strict";
|
|
/**
|
|
* HarborForge Calendar — Plugin Module
|
|
*
|
|
* PLG-CAL-001: Calendar heartbeat request/response format definition.
|
|
* PLG-CAL-002: Plugin-side slot execution scheduler and agent wakeup.
|
|
*
|
|
* Exports:
|
|
* • Types for heartbeat request/response and slot update
|
|
* • CalendarBridgeClient — HTTP client for backend communication
|
|
* • createCalendarBridgeClient — factory from plugin API context
|
|
* • CalendarScheduler — manages periodic heartbeat and slot execution
|
|
* • createCalendarScheduler — factory for scheduler
|
|
* • AgentWakeContext — context passed to agent when waking
|
|
*
|
|
* Usage in plugin/index.ts:
|
|
* import { createCalendarBridgeClient, createCalendarScheduler } from './calendar';
|
|
*
|
|
* const agentId = process.env.AGENT_ID || 'unknown';
|
|
* const calendar = createCalendarBridgeClient(api, 'https://monitor.hangman-lab.top', agentId);
|
|
*
|
|
* const scheduler = createCalendarScheduler({
|
|
* bridge: calendar,
|
|
* getAgentStatus: async () => { ... },
|
|
* wakeAgent: async (context) => { ... },
|
|
* logger: api.logger,
|
|
* });
|
|
*
|
|
* scheduler.start();
|
|
*/
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
}
|
|
Object.defineProperty(o, k2, desc);
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
__exportStar(require("./types"), exports);
|
|
__exportStar(require("./calendar-bridge"), exports);
|
|
__exportStar(require("./scheduler"), exports);
|
|
//# sourceMappingURL=index.js.map
|