pi-harness-runtime 0.9.14 → 0.9.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/harness/auto-quota-resume.ts +129 -0
- package/harness/e2e/minimax-quota-scraper.ts +10 -4
- package/harness/index.ts +8 -0
- package/harness/loop-runtime.ts +57 -0
- package/index.ts +47 -11
- package/mirror.ts +40 -18
- package/package.json +1 -1
- package/packages/a2a-adapter/package.json +1 -1
- package/packages/auth/package.json +1 -1
- package/packages/autonomous-refactor/package.json +1 -1
- package/packages/autonomous-runtime/README.md +48 -0
- package/packages/autonomous-runtime/dist/inbox.d.ts +75 -0
- package/packages/autonomous-runtime/dist/inbox.d.ts.map +1 -0
- package/packages/autonomous-runtime/dist/inbox.js +212 -0
- package/packages/autonomous-runtime/dist/inbox.js.map +1 -0
- package/packages/autonomous-runtime/dist/index.d.ts +17 -0
- package/packages/autonomous-runtime/dist/index.d.ts.map +1 -0
- package/packages/autonomous-runtime/dist/index.js +17 -0
- package/packages/autonomous-runtime/dist/index.js.map +1 -0
- package/packages/autonomous-runtime/dist/lease.d.ts +78 -0
- package/packages/autonomous-runtime/dist/lease.d.ts.map +1 -0
- package/packages/autonomous-runtime/dist/lease.js +273 -0
- package/packages/autonomous-runtime/dist/lease.js.map +1 -0
- package/packages/autonomous-runtime/dist/types.d.ts +160 -0
- package/packages/autonomous-runtime/dist/types.d.ts.map +1 -0
- package/packages/autonomous-runtime/dist/types.js +31 -0
- package/packages/autonomous-runtime/dist/types.js.map +1 -0
- package/packages/autonomous-runtime/dist/worker.d.ts +63 -0
- package/packages/autonomous-runtime/dist/worker.d.ts.map +1 -0
- package/packages/autonomous-runtime/dist/worker.js +133 -0
- package/packages/autonomous-runtime/dist/worker.js.map +1 -0
- package/packages/autonomous-runtime/package.json +34 -0
- package/packages/autonomous-runtime/src/inbox.ts +266 -0
- package/packages/autonomous-runtime/src/index.ts +22 -0
- package/packages/autonomous-runtime/src/lease.ts +318 -0
- package/packages/autonomous-runtime/src/types.ts +257 -0
- package/packages/autonomous-runtime/test/autonomous-runtime.test.ts +194 -0
- package/packages/autonomous-runtime/test/inbox.test.mjs +266 -0
- package/packages/autonomous-runtime/test/inbox.test.ts +80 -0
- package/packages/autonomous-runtime/test/types.test.ts +68 -0
- package/packages/autonomous-runtime/tsconfig.json +22 -0
- package/packages/autonomous-runtime/tsconfig.tsbuildinfo +1 -0
- package/packages/cache-strategy/package.json +1 -1
- package/packages/capability-registry/package.json +1 -1
- package/packages/checkpoint/package.json +1 -1
- package/packages/cli-plugin-sdk/package.json +1 -1
- package/packages/code-generation/package.json +1 -1
- package/packages/code-review/package.json +1 -1
- package/packages/codex-adapter/package.json +1 -1
- package/packages/context-compiler/package.json +1 -1
- package/packages/context-manager/package.json +1 -1
- package/packages/cookie-sanitizer/package.json +1 -1
- package/packages/cost-optimizer/package.json +1 -1
- package/packages/django-plugin/package.json +1 -1
- package/packages/doc-generator/package.json +1 -1
- package/packages/evaluation-engine/package.json +1 -1
- package/packages/evaluation-runner/package.json +1 -1
- package/packages/experience-replay/package.json +1 -1
- package/packages/feedback-collector/package.json +1 -1
- package/packages/framework-detector/package.json +1 -1
- package/packages/framework-plugin-sdk/package.json +1 -1
- package/packages/frappe-plugin/package.json +1 -1
- package/packages/generic-web-plugin/package.json +1 -1
- package/packages/health-monitor/package.json +1 -1
- package/packages/laravel-plugin/package.json +1 -1
- package/packages/learning-engine/package.json +1 -1
- package/packages/mcp-adapter/package.json +1 -1
- package/packages/memory-engine/package.json +1 -1
- package/packages/model-registry/package.json +1 -1
- package/packages/nextjs-plugin/package.json +1 -1
- package/packages/notification/package.json +1 -1
- package/packages/observability/package.json +1 -1
- package/packages/performance-optimizer/package.json +1 -1
- package/packages/privilege-broker/README.md +45 -0
- package/packages/privilege-broker/config/privileges.yaml.example +172 -0
- package/packages/privilege-broker/dist/approval.d.ts +23 -0
- package/packages/privilege-broker/dist/approval.d.ts.map +1 -0
- package/packages/privilege-broker/dist/approval.js +45 -0
- package/packages/privilege-broker/dist/approval.js.map +1 -0
- package/packages/privilege-broker/dist/audit.d.ts +38 -0
- package/packages/privilege-broker/dist/audit.d.ts.map +1 -0
- package/packages/privilege-broker/dist/audit.js +125 -0
- package/packages/privilege-broker/dist/audit.js.map +1 -0
- package/packages/privilege-broker/dist/executor.d.ts +25 -0
- package/packages/privilege-broker/dist/executor.d.ts.map +1 -0
- package/packages/privilege-broker/dist/executor.js +83 -0
- package/packages/privilege-broker/dist/executor.js.map +1 -0
- package/packages/privilege-broker/dist/index.d.ts +30 -0
- package/packages/privilege-broker/dist/index.d.ts.map +1 -0
- package/packages/privilege-broker/dist/index.js +5 -0
- package/packages/privilege-broker/dist/index.js.map +1 -0
- package/packages/privilege-broker/dist/registry.d.ts +15 -0
- package/packages/privilege-broker/dist/registry.d.ts.map +1 -0
- package/packages/privilege-broker/dist/registry.js +76 -0
- package/packages/privilege-broker/dist/registry.js.map +1 -0
- package/packages/privilege-broker/dist/types.d.ts +77 -0
- package/packages/privilege-broker/dist/types.d.ts.map +1 -0
- package/packages/privilege-broker/dist/types.js +11 -0
- package/packages/privilege-broker/dist/types.js.map +1 -0
- package/packages/privilege-broker/package.json +35 -0
- package/packages/privilege-broker/src/approval.ts +70 -0
- package/packages/privilege-broker/src/audit.ts +142 -0
- package/packages/privilege-broker/src/executor.ts +110 -0
- package/packages/privilege-broker/src/index.ts +46 -0
- package/packages/privilege-broker/src/registry.ts +98 -0
- package/packages/privilege-broker/src/types.ts +105 -0
- package/packages/privilege-broker/tsconfig.json +22 -0
- package/packages/privilege-broker/tsconfig.tsbuildinfo +1 -0
- package/packages/project-analyzer/package.json +1 -1
- package/packages/prompt-compiler/package.json +1 -1
- package/packages/prompt-versioning/package.json +1 -1
- package/packages/provider-adapter-sdk/package.json +1 -1
- package/packages/provider-router/package.json +1 -1
- package/packages/provider-selector/package.json +1 -1
- package/packages/providers/dist/provider-id.d.ts +2 -0
- package/packages/providers/dist/provider-id.d.ts.map +1 -1
- package/packages/providers/dist/provider-id.js +9 -0
- package/packages/providers/dist/provider-id.js.map +1 -1
- package/packages/providers/package.json +1 -1
- package/packages/providers/src/provider-id.ts +12 -0
- package/packages/quota-manager/package.json +1 -1
- package/packages/rate-limiter/package.json +1 -1
- package/packages/react-vite-plugin/package.json +1 -1
- package/packages/release-manager/package.json +1 -1
- package/packages/requirement-compiler/package.json +1 -1
- package/packages/runtime/package.json +1 -1
- package/packages/scheduler/package.json +1 -1
- package/packages/scheduler-adapter/README.md +36 -0
- package/packages/scheduler-adapter/dist/cron.d.ts +21 -0
- package/packages/scheduler-adapter/dist/cron.d.ts.map +1 -0
- package/packages/scheduler-adapter/dist/cron.js +116 -0
- package/packages/scheduler-adapter/dist/cron.js.map +1 -0
- package/packages/scheduler-adapter/dist/index.d.ts +9 -0
- package/packages/scheduler-adapter/dist/index.d.ts.map +1 -0
- package/packages/scheduler-adapter/dist/index.js +8 -0
- package/packages/scheduler-adapter/dist/index.js.map +1 -0
- package/packages/scheduler-adapter/dist/interface.d.ts +61 -0
- package/packages/scheduler-adapter/dist/interface.d.ts.map +1 -0
- package/packages/scheduler-adapter/dist/interface.js +2 -0
- package/packages/scheduler-adapter/dist/interface.js.map +1 -0
- package/packages/scheduler-adapter/dist/internal.d.ts +30 -0
- package/packages/scheduler-adapter/dist/internal.d.ts.map +1 -0
- package/packages/scheduler-adapter/dist/internal.js +82 -0
- package/packages/scheduler-adapter/dist/internal.js.map +1 -0
- package/packages/scheduler-adapter/dist/systemd.d.ts +31 -0
- package/packages/scheduler-adapter/dist/systemd.d.ts.map +1 -0
- package/packages/scheduler-adapter/dist/systemd.js +203 -0
- package/packages/scheduler-adapter/dist/systemd.js.map +1 -0
- package/packages/scheduler-adapter/package.json +32 -0
- package/packages/scheduler-adapter/src/cron.ts +123 -0
- package/packages/scheduler-adapter/src/index.ts +9 -0
- package/packages/scheduler-adapter/src/interface.ts +61 -0
- package/packages/scheduler-adapter/src/internal.ts +99 -0
- package/packages/scheduler-adapter/src/systemd.ts +221 -0
- package/packages/scheduler-adapter/tsconfig.json +22 -0
- package/packages/scheduler-adapter/tsconfig.tsbuildinfo +1 -0
- package/packages/session/package.json +1 -1
- package/packages/shared-context/package.json +1 -1
- package/packages/skill-registry/package.json +1 -1
- package/packages/sprint-planner/package.json +1 -1
- package/packages/task-compiler/package.json +1 -1
- package/packages/test-data-generator/package.json +1 -1
- package/packages/test-generator/package.json +1 -1
- package/packages/token-estimation/package.json +1 -1
- package/packages/token-optimizer/package.json +1 -1
- package/packages/tui/package.json +1 -1
- package/packages/types/dist/runtime-types.d.ts +6 -0
- package/packages/types/dist/runtime-types.d.ts.map +1 -1
- package/packages/types/dist/runtime-types.js +2 -1
- package/packages/types/dist/runtime-types.js.map +1 -1
- package/packages/types/package.json +1 -1
- package/packages/types/src/ai-providers.ts +73 -0
- package/packages/types/src/runtime-types.ts +15 -0
- package/packages/types/tsconfig.tsbuildinfo +1 -1
- package/packages/worktree/package.json +1 -1
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/** A named capability that the privilege broker may grant. */
|
|
2
|
+
export type CapabilityName = "files.read" | "files.write" | "files.exec" | "git.commit" | "git.push" | "git.pull" | "system.restart" | "system.restart-service" | "system.logs" | "bench.migrate" | "bench.build" | "bench.restart" | "okf.promote-pattern" | "okf.promote-lesson" | "notify.send" | "llm.invoke";
|
|
3
|
+
/** What approval class a capability requires. */
|
|
4
|
+
export type ApprovalClass = "automatic_read_only" | "automatic_reversible" | "human_approval_required" | "forbidden";
|
|
5
|
+
export type TaskStatus = "queued" | "claimed" | "running" | "waiting_approval" | "waiting_quota" | "retrying" | "completed" | "failed" | "dead_letter";
|
|
6
|
+
/** Immutable log of what happened to a task. */
|
|
7
|
+
export type TaskEvent = {
|
|
8
|
+
ts: string;
|
|
9
|
+
kind: "claimed" | "started" | "checkpointed" | "progress" | "blocked" | "approval_requested" | "approved" | "denied" | "failed" | "completed" | "recovered" | "dead_lettered" | "transitioned";
|
|
10
|
+
payload?: Record<string, unknown>;
|
|
11
|
+
};
|
|
12
|
+
/** The primary durable record for a task. */
|
|
13
|
+
export interface TaskRecord {
|
|
14
|
+
id: string;
|
|
15
|
+
objective: string;
|
|
16
|
+
acceptanceCriteria: string[];
|
|
17
|
+
source: {
|
|
18
|
+
kind: "chat";
|
|
19
|
+
userId: string;
|
|
20
|
+
} | {
|
|
21
|
+
kind: "schedule";
|
|
22
|
+
scheduleId: string;
|
|
23
|
+
} | {
|
|
24
|
+
kind: "webhook";
|
|
25
|
+
url: string;
|
|
26
|
+
} | {
|
|
27
|
+
kind: "subagent";
|
|
28
|
+
parentTaskId: string;
|
|
29
|
+
} | {
|
|
30
|
+
kind: "manual";
|
|
31
|
+
createdBy: string;
|
|
32
|
+
};
|
|
33
|
+
priority: 0 | 1 | 2 | 3 | 4;
|
|
34
|
+
capabilities: CapabilityName[];
|
|
35
|
+
approvalClass: ApprovalClass;
|
|
36
|
+
status: TaskStatus;
|
|
37
|
+
attempts: number;
|
|
38
|
+
maxAttempts: number;
|
|
39
|
+
context?: ExecutionContext;
|
|
40
|
+
createdAt: string;
|
|
41
|
+
updatedAt: string;
|
|
42
|
+
leaseId?: string;
|
|
43
|
+
result?: TaskResult;
|
|
44
|
+
failureReason?: string;
|
|
45
|
+
history: TaskEvent[];
|
|
46
|
+
}
|
|
47
|
+
/** A lease held by a worker on a specific task. */
|
|
48
|
+
export interface TaskLease {
|
|
49
|
+
taskId: string;
|
|
50
|
+
workerId: string;
|
|
51
|
+
acquiredAt: string;
|
|
52
|
+
expiresAt: string;
|
|
53
|
+
heartbeatAt: string;
|
|
54
|
+
attempt: number;
|
|
55
|
+
}
|
|
56
|
+
/** Heartbeat emitted by a worker every 5 s to worker-registry.json. */
|
|
57
|
+
export interface WorkerHeartbeat {
|
|
58
|
+
workerId: string;
|
|
59
|
+
startedAt: string;
|
|
60
|
+
lastBeatAt: string;
|
|
61
|
+
capacity: number;
|
|
62
|
+
inflightTaskIds: string[];
|
|
63
|
+
}
|
|
64
|
+
/** A resolved grant from the privilege broker. */
|
|
65
|
+
export interface CapabilityGrant {
|
|
66
|
+
name: CapabilityName;
|
|
67
|
+
argv: string[];
|
|
68
|
+
envWhitelist?: string[];
|
|
69
|
+
user: string;
|
|
70
|
+
cwd?: string;
|
|
71
|
+
timeoutMs: number;
|
|
72
|
+
}
|
|
73
|
+
/** An in-flight human approval request. */
|
|
74
|
+
export interface ApprovalRequest {
|
|
75
|
+
id: string;
|
|
76
|
+
taskId: string;
|
|
77
|
+
capability: CapabilityName;
|
|
78
|
+
rationale: string;
|
|
79
|
+
signedBy?: {
|
|
80
|
+
keyFingerprint: string;
|
|
81
|
+
ts: string;
|
|
82
|
+
};
|
|
83
|
+
decision?: "approved" | "denied";
|
|
84
|
+
decidedAt?: string;
|
|
85
|
+
expiresAt: string;
|
|
86
|
+
}
|
|
87
|
+
/** A scheduled recurring task. */
|
|
88
|
+
export interface ScheduledTask {
|
|
89
|
+
id: string;
|
|
90
|
+
taskTemplate: Omit<TaskRecord, "id" | "status" | "attempts" | "createdAt" | "updatedAt" | "history">;
|
|
91
|
+
schedule: ScheduleSpec;
|
|
92
|
+
enabled: boolean;
|
|
93
|
+
lastFiredAt?: string;
|
|
94
|
+
nextFireAt?: string;
|
|
95
|
+
}
|
|
96
|
+
export type ScheduleSpec = {
|
|
97
|
+
kind: "cron";
|
|
98
|
+
expression: string;
|
|
99
|
+
} | {
|
|
100
|
+
kind: "interval";
|
|
101
|
+
intervalMs: number;
|
|
102
|
+
} | {
|
|
103
|
+
kind: "once";
|
|
104
|
+
at: string;
|
|
105
|
+
};
|
|
106
|
+
export type RuntimeNotificationEvent = "task.claimed" | "task.started" | "task.completed" | "task.failed" | "task.waiting_approval" | "task.dead_lettered" | "lease.expired" | "worker.started" | "worker.stopped" | "approval.approved" | "approval.denied" | "approval.expired";
|
|
107
|
+
export interface NotificationEvent {
|
|
108
|
+
kind: RuntimeNotificationEvent;
|
|
109
|
+
ts: string;
|
|
110
|
+
taskId?: string;
|
|
111
|
+
workerId?: string;
|
|
112
|
+
payload: Record<string, unknown>;
|
|
113
|
+
}
|
|
114
|
+
export interface Checkpoint {
|
|
115
|
+
taskId: string;
|
|
116
|
+
attempt: number;
|
|
117
|
+
state: Record<string, unknown>;
|
|
118
|
+
savedAt: string;
|
|
119
|
+
}
|
|
120
|
+
/** The context given to the loop runtime when executing a task. */
|
|
121
|
+
export interface ExecutionContext {
|
|
122
|
+
taskId: string;
|
|
123
|
+
workerId: string;
|
|
124
|
+
inputs: Record<string, unknown>;
|
|
125
|
+
capabilitiesGranted: CapabilityName[];
|
|
126
|
+
approvalClass: ApprovalClass;
|
|
127
|
+
lease: TaskLease;
|
|
128
|
+
checkpoint?: Checkpoint;
|
|
129
|
+
okfBundles: string[];
|
|
130
|
+
}
|
|
131
|
+
export interface TaskResult {
|
|
132
|
+
taskId: string;
|
|
133
|
+
status: "completed" | "failed" | "dead_letter";
|
|
134
|
+
deliverables?: {
|
|
135
|
+
path: string;
|
|
136
|
+
mime: string;
|
|
137
|
+
}[];
|
|
138
|
+
acceptanceCriteriaMet: {
|
|
139
|
+
criterion: string;
|
|
140
|
+
passed: boolean;
|
|
141
|
+
evidence?: string;
|
|
142
|
+
}[];
|
|
143
|
+
durationMs: number;
|
|
144
|
+
modelUsage?: {
|
|
145
|
+
inputTokens: number;
|
|
146
|
+
outputTokens: number;
|
|
147
|
+
provider: string;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/** Returns the standard storage root for the runtime. */
|
|
151
|
+
export declare function getRuntimeRoot(): string;
|
|
152
|
+
/** Returns the inbox directory path. */
|
|
153
|
+
export declare function getInboxDir(): string;
|
|
154
|
+
/** Returns the claimed leases directory path. */
|
|
155
|
+
export declare function getLeasesDir(): string;
|
|
156
|
+
/** Returns the task JSONL file path. */
|
|
157
|
+
export declare function getTasksPath(): string;
|
|
158
|
+
/** Returns the worker registry path. */
|
|
159
|
+
export declare function getWorkerRegistryPath(): string;
|
|
160
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAWA,8DAA8D;AAC9D,MAAM,MAAM,cAAc,GACvB,YAAY,GACZ,aAAa,GACb,YAAY,GACZ,YAAY,GACZ,UAAU,GACV,UAAU,GACV,gBAAgB,GAChB,wBAAwB,GACxB,aAAa,GACb,eAAe,GACf,aAAa,GACb,eAAe,GACf,qBAAqB,GACrB,oBAAoB,GACpB,aAAa,GACb,YAAY,CAAC;AAEhB,iDAAiD;AACjD,MAAM,MAAM,aAAa,GACtB,qBAAqB,GACrB,sBAAsB,GACtB,yBAAyB,GACzB,WAAW,CAAC;AAIf,MAAM,MAAM,UAAU,GACnB,QAAQ,GACR,SAAS,GACT,SAAS,GACT,kBAAkB,GAClB,eAAe,GACf,UAAU,GACV,WAAW,GACX,QAAQ,GACR,aAAa,CAAC;AAEjB,gDAAgD;AAChD,MAAM,MAAM,SAAS,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EACD,SAAS,GACT,SAAS,GACT,cAAc,GACd,UAAU,GACV,SAAS,GACT,oBAAoB,GACpB,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,WAAW,GACX,WAAW,GACX,eAAe,GACf,cAAc,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,CAAC;AAIF,6CAA6C;AAC7C,MAAM,WAAW,UAAU;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,MAAM,EACH;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAChC;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GACxC;QAAE,IAAI,EAAE,SAAS,CAAC;QA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M,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7E;AAMD,yDAAyD;AACzD,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,wCAAwC;AACxC,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED,iDAAiD;AACjD,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED,wCAAwC;AACxC,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED,wCAAwC;AACxC,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Autonomous Operations Runtime — TypeScript Contracts
|
|
3
|
+
* Based on RFC-0101 §14
|
|
4
|
+
*
|
|
5
|
+
* Consumers: LoopRuntime, privilege-broker, scheduler-adapter, notification-runtime.
|
|
6
|
+
* These types are the canonical contracts. Do not re-define them in other packages.
|
|
7
|
+
*/
|
|
8
|
+
import { env } from "node:process";
|
|
9
|
+
// ─── Storage paths ────────────────────────────────────────────────────────────
|
|
10
|
+
const DEFAULT_ROOT = `${env["HOME"] ?? "."}/.pi/harness`;
|
|
11
|
+
/** Returns the standard storage root for the runtime. */
|
|
12
|
+
export function getRuntimeRoot() {
|
|
13
|
+
return env["PI_HARNESS_RUNTIME_ROOT"] ?? DEFAULT_ROOT;
|
|
14
|
+
}
|
|
15
|
+
/** Returns the inbox directory path. */
|
|
16
|
+
export function getInboxDir() {
|
|
17
|
+
return `${getRuntimeRoot()}/inbox`;
|
|
18
|
+
}
|
|
19
|
+
/** Returns the claimed leases directory path. */
|
|
20
|
+
export function getLeasesDir() {
|
|
21
|
+
return `${getInboxDir()}/claimed`;
|
|
22
|
+
}
|
|
23
|
+
/** Returns the task JSONL file path. */
|
|
24
|
+
export function getTasksPath() {
|
|
25
|
+
return `${getInboxDir()}/tasks.jsonl`;
|
|
26
|
+
}
|
|
27
|
+
/** Returns the worker registry path. */
|
|
28
|
+
export function getWorkerRegistryPath() {
|
|
29
|
+
return `${getRuntimeRoot()}/worker-registry.json`;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AA8NnC,iFAAiF;AAEjF,MAAM,YAAY,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,cAAc,CAAC;AAEzD,yDAAyD;AACzD,MAAM,UAAU,cAAc;IAC7B,OAAO,GAAG,CAAC,yBAAyB,CAAC,IAAI,YAAY,CAAC;AACvD,CAAC;AAED,wCAAwC;AACxC,MAAM,UAAU,WAAW;IAC1B,OAAO,GAAG,cAAc,EAAE,QAAQ,CAAC;AACpC,CAAC;AAED,iDAAiD;AACjD,MAAM,UAAU,YAAY;IAC3B,OAAO,GAAG,WAAW,EAAE,UAAU,CAAC;AACnC,CAAC;AAED,wCAAwC;AACxC,MAAM,UAAU,YAAY;IAC3B,OAAO,GAAG,WAAW,EAAE,cAAc,CAAC;AACvC,CAAC;AAED,wCAAwC;AACxC,MAAM,UAAU,qBAAqB;IACpC,OAAO,GAAG,cAAc,EAAE,uBAAuB,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Worker Stub — RFC-0101 §4
|
|
3
|
+
*
|
|
4
|
+
* A worker is a pi session that owns tasks from the inbox.
|
|
5
|
+
* This is the lightweight worker-side of the lease protocol.
|
|
6
|
+
*
|
|
7
|
+
* The worker picks up work via the inbox's `claim()` method
|
|
8
|
+
* and reports results via `complete()`.
|
|
9
|
+
*/
|
|
10
|
+
import type { TaskResult, WorkerStatus } from "./types.js";
|
|
11
|
+
import type { TaskInbox } from "./inbox.js";
|
|
12
|
+
import type { TaskLease } from "./lease.js";
|
|
13
|
+
export interface WorkerConfig {
|
|
14
|
+
inbox: TaskInbox;
|
|
15
|
+
workerId: string;
|
|
16
|
+
heartbeatIntervalMs?: number;
|
|
17
|
+
onError?: (taskId: string, error: unknown) => void;
|
|
18
|
+
}
|
|
19
|
+
export interface WorkerEvents {
|
|
20
|
+
onLease: (lease: TaskLease) => void;
|
|
21
|
+
onLeaseExpired: (taskId: string) => void;
|
|
22
|
+
onComplete: (taskId: string, result: TaskResult) => void;
|
|
23
|
+
onError: (taskId: string, error: unknown) => void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Worker — picks up tasks from the inbox and processes them.
|
|
27
|
+
*
|
|
28
|
+
* Lifecycle:
|
|
29
|
+
* 1. Construct with inbox + workerId
|
|
30
|
+
* 2. `start()` — begins polling/claiming tasks
|
|
31
|
+
* 3. `stop()` — stops claiming, expires held leases
|
|
32
|
+
*
|
|
33
|
+
* The worker does NOT run tasks itself — it delegates to the harness
|
|
34
|
+
* loop runtime. It just manages the lease lifecycle.
|
|
35
|
+
*/
|
|
36
|
+
export declare class Worker {
|
|
37
|
+
private readonly config;
|
|
38
|
+
private readonly events;
|
|
39
|
+
private running;
|
|
40
|
+
private heartbeatTimer;
|
|
41
|
+
constructor(config: WorkerConfig);
|
|
42
|
+
on<K extends keyof WorkerEvents>(event: K, handler: WorkerEvents[K]): void;
|
|
43
|
+
/**
|
|
44
|
+
* Start the worker — begins polling for available tasks.
|
|
45
|
+
*/
|
|
46
|
+
start(): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Stop the worker — stops polling and expires any held leases.
|
|
49
|
+
*/
|
|
50
|
+
stop(): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Status of this worker.
|
|
53
|
+
*/
|
|
54
|
+
status(): WorkerStatus;
|
|
55
|
+
private _poll;
|
|
56
|
+
private _processTask;
|
|
57
|
+
/**
|
|
58
|
+
* Run a single task. Stub — replaces with actual harness loop integration.
|
|
59
|
+
*/
|
|
60
|
+
private _runTask;
|
|
61
|
+
private _heartbeat;
|
|
62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E;IAED;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAY3B;IAED;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAW1B;IAED;;OAEG;IACH,MAAM,IAAI,YAAY,CAMrB;YAEa,KAAK;YAmBL,YAAY;IAuB1B;;OAEG;YACW,QAAQ;YAUR,UAAU;CASxB"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Worker Stub — RFC-0101 §4
|
|
3
|
+
*
|
|
4
|
+
* A worker is a pi session that owns tasks from the inbox.
|
|
5
|
+
* This is the lightweight worker-side of the lease protocol.
|
|
6
|
+
*
|
|
7
|
+
* The worker picks up work via the inbox's `claim()` method
|
|
8
|
+
* and reports results via `complete()`.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Worker — picks up tasks from the inbox and processes them.
|
|
12
|
+
*
|
|
13
|
+
* Lifecycle:
|
|
14
|
+
* 1. Construct with inbox + workerId
|
|
15
|
+
* 2. `start()` — begins polling/claiming tasks
|
|
16
|
+
* 3. `stop()` — stops claiming, expires held leases
|
|
17
|
+
*
|
|
18
|
+
* The worker does NOT run tasks itself — it delegates to the harness
|
|
19
|
+
* loop runtime. It just manages the lease lifecycle.
|
|
20
|
+
*/
|
|
21
|
+
export class Worker {
|
|
22
|
+
config;
|
|
23
|
+
events = {};
|
|
24
|
+
running = false;
|
|
25
|
+
heartbeatTimer = null;
|
|
26
|
+
constructor(config) {
|
|
27
|
+
this.config = {
|
|
28
|
+
heartbeatIntervalMs: 30_000,
|
|
29
|
+
...config,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
on(event, handler) {
|
|
33
|
+
this.events[event] = handler;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Start the worker — begins polling for available tasks.
|
|
37
|
+
*/
|
|
38
|
+
async start() {
|
|
39
|
+
if (this.running)
|
|
40
|
+
return;
|
|
41
|
+
this.running = true;
|
|
42
|
+
// Start heartbeat
|
|
43
|
+
this.heartbeatTimer = setInterval(() => this._heartbeat(), this.config.heartbeatIntervalMs);
|
|
44
|
+
// Claim any immediately available tasks
|
|
45
|
+
await this._poll();
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Stop the worker — stops polling and expires any held leases.
|
|
49
|
+
*/
|
|
50
|
+
async stop() {
|
|
51
|
+
if (!this.running)
|
|
52
|
+
return;
|
|
53
|
+
this.running = false;
|
|
54
|
+
if (this.heartbeatTimer) {
|
|
55
|
+
clearInterval(this.heartbeatTimer);
|
|
56
|
+
this.heartbeatTimer = null;
|
|
57
|
+
}
|
|
58
|
+
// Expire all leases held by this worker
|
|
59
|
+
// (inbox.expireLease is idempotent — safe to call repeatedly)
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Status of this worker.
|
|
63
|
+
*/
|
|
64
|
+
status() {
|
|
65
|
+
return {
|
|
66
|
+
workerId: this.config.workerId,
|
|
67
|
+
running: this.running,
|
|
68
|
+
heartbeatIntervalMs: this.config.heartbeatIntervalMs ?? 30_000,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
async _poll() {
|
|
72
|
+
if (!this.running)
|
|
73
|
+
return;
|
|
74
|
+
try {
|
|
75
|
+
// Try to claim one task
|
|
76
|
+
const lease = await this.config.inbox.claim({
|
|
77
|
+
workerId: this.config.workerId,
|
|
78
|
+
heartbeatIntervalMs: this.config.heartbeatIntervalMs ?? 30_000,
|
|
79
|
+
});
|
|
80
|
+
if (lease) {
|
|
81
|
+
this.events.onLease?.(lease);
|
|
82
|
+
await this._processTask(lease);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
this.config.onError?.("__poll__", err);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async _processTask(lease) {
|
|
90
|
+
const task = lease.task;
|
|
91
|
+
try {
|
|
92
|
+
// Delegate to harness loop runtime (stub — will be wired in Phase 2)
|
|
93
|
+
const result = await this._runTask(task);
|
|
94
|
+
// Report completion
|
|
95
|
+
await this.config.inbox.complete(lease.taskId, result);
|
|
96
|
+
this.events.onComplete?.(lease.taskId, result);
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
this.events.onError?.(lease.taskId, err);
|
|
100
|
+
await this.config.inbox.complete(lease.taskId, {
|
|
101
|
+
ok: false,
|
|
102
|
+
error: String(err),
|
|
103
|
+
completedAt: new Date().toISOString(),
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
// Continue polling for more work
|
|
107
|
+
if (this.running)
|
|
108
|
+
void this._poll();
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Run a single task. Stub — replaces with actual harness loop integration.
|
|
112
|
+
*/
|
|
113
|
+
async _runTask(task) {
|
|
114
|
+
// TODO(Phase 2): Wire to harness loop runtime
|
|
115
|
+
// For now, return a stub result so the lease protocol works end-to-end.
|
|
116
|
+
return {
|
|
117
|
+
ok: true,
|
|
118
|
+
summary: `[stub] Processed ${task.id}`,
|
|
119
|
+
completedAt: new Date().toISOString(),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
async _heartbeat() {
|
|
123
|
+
// Refresh leases held by this worker
|
|
124
|
+
// The inbox tracks which leases this worker holds and refreshes them.
|
|
125
|
+
try {
|
|
126
|
+
await this.config.inbox.refreshLeases(this.config.workerId);
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
// Non-fatal — lease will expire naturally
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAwBH;;;;;;;;;;GAUG;AACH,MAAM,OAAO,MAAM;IACD,MAAM,CAAe;IACrB,MAAM,GAA0B,EAAE,CAAC;IAC5C,OAAO,GAAG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AAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aACrC,CAAC,CAAC;QACJ,CAAC;QAED,iCAAiC;QACjC,IAAI,IAAI,CAAC,OAAO;YAAE,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC;IACrC,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,QAAQ,CAAC,IAAc;QACpC,8CAA8C;QAC9C,wEAAwE;QACxE,OAAO;YACN,EAAE,EAAE,IAAI;YACR,OAAO,EAAE,oBAAoB,IAAI,CAAC,EAAE,EAAE;YACtC,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACrC,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,UAAU;QACvB,qCAAqC;QACrC,sEAAsE;QACtE,IAAI,CAAC;YACJ,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC7D,CAAC;QAAC,MAAM,CAAC;YACR,0CAA0C;QAC3C,CAAC;IACF,CAAC;CACD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pi/autonomous-runtime",
|
|
3
|
+
"version": "0.9.15",
|
|
4
|
+
"description": "Autonomous Operations Runtime — task inbox, lease management, and worker lifecycle (RFC-0101)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"test": "bun test",
|
|
17
|
+
"test:watch": "bun test --watch",
|
|
18
|
+
"clean": "rm -rf dist"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"autonomous",
|
|
22
|
+
"runtime",
|
|
23
|
+
"task-queue",
|
|
24
|
+
"lease",
|
|
25
|
+
"worker",
|
|
26
|
+
"rfc-0101"
|
|
27
|
+
],
|
|
28
|
+
"author": "",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^20.11.0",
|
|
32
|
+
"typescript": "^7.0.2"
|
|
33
|
+
}
|
|
34
|
+
}
|