UNPKG

@mondaydotcomorg/atp-runtime

Version:

Runtime SDK injected into sandbox for Agent Tool Protocol

62 lines 2.33 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; /** * Progress API - Clean refactored version with decorators * * Benefits: * - No duplication between implementation and metadata * - Types auto-detected from TypeScript signatures */ import { RuntimeAPI, RuntimeMethod } from '../metadata/decorators.js'; import { log } from '../log/index.js'; /** * Global progress callback (set by executor) */ let progressCallback = null; /** * Set the progress callback handler */ export function setProgressCallback(callback) { progressCallback = callback; } /** * Progress Runtime API * * Allows reporting execution progress to clients */ let ProgressAPI = class ProgressAPI { /** * Report progress with message and completion fraction */ report(message, fraction) { if (progressCallback) { try { progressCallback(message, fraction); } catch (error) { log.error('Progress callback error', { error }); } } } }; __decorate([ RuntimeMethod('Report progress with message and completion fraction', { message: { description: 'Progress message' }, fraction: { description: 'Completion fraction (0-1)' }, }), __metadata("design:type", Function), __metadata("design:paramtypes", [String, Number]), __metadata("design:returntype", void 0) ], ProgressAPI.prototype, "report", null); ProgressAPI = __decorate([ RuntimeAPI('progress', 'Progress API - Report execution progress to clients') ], ProgressAPI); export const progress = new ProgressAPI(); //# sourceMappingURL=index.js.map