pi-oracle 0.1.11 → 0.2.0
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/CHANGELOG.md +37 -0
- package/README.md +27 -11
- package/docs/ORACLE_DESIGN.md +583 -0
- package/docs/ORACLE_RECOVERY_DRILL.md +127 -0
- package/extensions/oracle/index.ts +15 -4
- package/extensions/oracle/lib/commands.ts +35 -12
- package/extensions/oracle/lib/config.ts +2 -2
- package/extensions/oracle/lib/jobs.ts +438 -72
- package/extensions/oracle/lib/locks.ts +99 -13
- package/extensions/oracle/lib/poller.ts +223 -38
- package/extensions/oracle/lib/queue.ts +193 -0
- package/extensions/oracle/lib/runtime.ts +69 -15
- package/extensions/oracle/lib/tools.ts +514 -123
- package/extensions/oracle/worker/artifact-heuristics.d.mts +29 -0
- package/extensions/oracle/worker/auth-bootstrap.mjs +2 -72
- package/extensions/oracle/worker/auth-cookie-policy.d.mts +31 -0
- package/extensions/oracle/worker/run-job.mjs +333 -71
- package/extensions/oracle/worker/state-locks.d.mts +45 -0
- package/extensions/oracle/worker/state-locks.mjs +235 -0
- package/package.json +13 -4
- package/prompts/oracle.md +9 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.0 - 2026-04-06
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- workerless queued oracle jobs with automatic promotion when capacity is available
|
|
7
|
+
- queue position/status reporting and queued-job cancellation
|
|
8
|
+
- durable wake-up target leasing for cross-process completion notification routing
|
|
9
|
+
- oracle now requires a persisted pi session identity instead of collapsing in-memory/no-session contexts onto a shared project-level wake-up target
|
|
10
|
+
- legacy project-scoped jobs from the older no-session model now stay manual/status-only on upgrade instead of being adopted by another persisted session for wake-up delivery
|
|
11
|
+
- lock and lease metadata publication is now atomic on both first publish and rewrites so concurrent wake-up-target reads cannot transiently hide live sessions
|
|
12
|
+
- metadata-less lock/lease state directories left behind by crashes are now reclaimed after a bounded grace instead of wedging future operations forever
|
|
13
|
+
- expanded oracle sanity coverage for queueing, recovery, cancellation, promotion, and notification edge cases
|
|
14
|
+
- a real TypeScript typecheck gate via `npm run typecheck` and `npm run verify:oracle`
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
- queued jobs now promote using their persisted config snapshot
|
|
18
|
+
- runtime admission now stays blocked when cleanup warnings indicate teardown is incomplete
|
|
19
|
+
- cleanup-driven promotion only advances the queue after a clean runtime teardown
|
|
20
|
+
- orphaned completion wake-ups can be adopted safely when the original session is no longer live
|
|
21
|
+
- oracle completion notifications now avoid synthetic assistant session-history writes entirely and rely on durable job-state response/artifact persistence plus best-effort wake-ups
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
- PID-safe worker cancellation and stale-worker recovery paths
|
|
25
|
+
- same-job conversation lease reuse during queued follow-up retries
|
|
26
|
+
- cleanup-warning handling across submit, promotion, cancellation, and terminal cleanup flows
|
|
27
|
+
- queue advancement after cancellation now requires clean teardown
|
|
28
|
+
- cleanup failures no longer silently drop warning state or remove terminal job records prematurely
|
|
29
|
+
- stale notification claimants can no longer finalize completion delivery after ownership handoff
|
|
30
|
+
- best-effort wake-up retries remain bounded without creating synthetic completion messages in session history, including stale cross-session claimant races
|
|
31
|
+
- completed and cancelled jobs now prune on explicit terminal-job retention policy instead of depending on synthetic notification state
|
|
32
|
+
- stale live terminal cleanup workers are now terminated and recovered automatically so cleanup-pending jobs do not wedge capacity indefinitely
|
|
33
|
+
- prune/clean paths now coordinate with in-flight wake-up delivery so already-prunable jobs are skipped, claimed jobs are not deleted before their reminder send path resolves, and just-sent wake-ups keep their response/artifact files briefly retained
|
|
34
|
+
- `/oracle-clean` now refuses terminal jobs whose worker is still live instead of deleting around active cleanup
|
|
35
|
+
- live and off-session completion handling no longer risks corrupting active session history with extension-authored assistant appends
|
|
36
|
+
- `oracle_read` now reports artifact paths from the configured oracle jobs directory instead of hard-coding `/tmp`
|
|
37
|
+
- manual `oracle_read` and `/oracle-status` inspection now settles further wake-up retries so live sessions do not get repeated reminder turns after the job has already been opened
|
package/README.md
CHANGED
|
@@ -6,7 +6,9 @@ It exists for the hard cases where you want:
|
|
|
6
6
|
- the user’s real ChatGPT account
|
|
7
7
|
- web-model behavior instead of API usage
|
|
8
8
|
- large project-context uploads
|
|
9
|
-
- async background execution
|
|
9
|
+
- async background execution with durable job-state/response artifacts plus best-effort wake-ups for the originating `pi` session
|
|
10
|
+
- oracle requires a persisted `pi` session identity; in-memory/no-session contexts are rejected instead of risking wrong-session wake-ups
|
|
11
|
+
- legacy project-scoped jobs created before that change remain readable via project status/read commands, but skip best-effort wake-up routing after upgrade
|
|
10
12
|
|
|
11
13
|
Normal oracle jobs run in an isolated browser profile, not in the user’s active Chrome window.
|
|
12
14
|
|
|
@@ -30,18 +32,21 @@ The extension adds:
|
|
|
30
32
|
|
|
31
33
|
An oracle job:
|
|
32
34
|
1. gathers a project archive
|
|
33
|
-
2.
|
|
34
|
-
3.
|
|
35
|
-
4.
|
|
36
|
-
5.
|
|
35
|
+
2. if runtime capacity is full, persists as `queued` and starts automatically later
|
|
36
|
+
3. otherwise opens ChatGPT in an isolated runtime profile
|
|
37
|
+
4. uploads the archive and sends the prompt
|
|
38
|
+
5. waits in the background
|
|
39
|
+
6. persists the response and any artifacts under the oracle job directory (`${PI_ORACLE_JOBS_DIR:-/tmp}/oracle-<job-id>/` by default)
|
|
37
40
|
- old terminal jobs are later pruned according to cleanup retention settings
|
|
38
41
|
- when directory inputs are expanded, project archives automatically skip common bulky generated caches and top-level build outputs such as `node_modules/`, `target/`, virtualenv caches, coverage outputs, and `dist/`/`build/`/`out/`, unless you explicitly pass those directories
|
|
39
|
-
|
|
42
|
+
- whole-repo archive defaults also skip obvious credentials/private data such as `.env` files, key material, credential dotfiles, local database files, and root `secrets/` directories unless you explicitly pass them
|
|
43
|
+
- if a whole-repo archive is still too large after default exclusions, submit automatically prunes the largest nested directories with generic generated-output names like `build/`, `dist/`, `out/`, `coverage/`, and `tmp/` outside obvious source roots like `src/` and `lib/`, and successful submissions report what was pruned
|
|
44
|
+
7. persists the response/artifacts durably in oracle job state and issues best-effort wake-ups to whichever matching `pi` session is currently live
|
|
40
45
|
|
|
41
46
|
## Example
|
|
42
47
|
|
|
43
48
|
```text
|
|
44
|
-
/oracle Invoke the Oracle to have it generate a thorough code review of the current pending changes.
|
|
49
|
+
/oracle Invoke the Oracle to have it generate a thorough code review of the current pending changes. By default include the whole repo archive unless the request clearly needs a narrower scope. Use the Pro Model with Extended effort.
|
|
45
50
|
```
|
|
46
51
|
|
|
47
52
|
## Why this exists
|
|
@@ -59,6 +64,7 @@ Currently validated for:
|
|
|
59
64
|
- local ChatGPT web login in Chrome
|
|
60
65
|
- isolated auth seed profile + per-job runtime profile clones
|
|
61
66
|
- concurrent jobs across different projects/sessions
|
|
67
|
+
- workerless queued jobs when the global concurrency limit is full
|
|
62
68
|
- same-conversation exclusion for follow-ups
|
|
63
69
|
- plain-text responses
|
|
64
70
|
- artifact capture, including multi-artifact runs
|
|
@@ -117,21 +123,28 @@ Common settings:
|
|
|
117
123
|
Project config should only override safe, non-privileged settings.
|
|
118
124
|
|
|
119
125
|
Cleanup behavior:
|
|
120
|
-
- terminal job directories under
|
|
121
|
-
- completed/cancelled jobs are pruned after `cleanup.completeJobRetentionMs`
|
|
126
|
+
- terminal job directories under the configured oracle jobs dir (`${PI_ORACLE_JOBS_DIR:-/tmp}/oracle-<job-id>/` by default) are retained for inspection, then pruned conservatively
|
|
127
|
+
- completed/cancelled jobs are pruned after `cleanup.completeJobRetentionMs` based on terminal-job age, but recent wake-up sends keep response/artifact files retained briefly so follow-up turns do not point at deleted paths
|
|
122
128
|
- failed jobs are pruned after `cleanup.failedJobRetentionMs`
|
|
123
|
-
- `/oracle-
|
|
129
|
+
- `/oracle-cancel` can cancel queued or active jobs
|
|
130
|
+
- `/oracle-clean` refuses non-terminal jobs, including queued ones, refuses terminal jobs whose worker is still live, also refuses recently woken jobs during a short post-send retention grace window, performs runtime cleanup before removing terminal job directories, and reports cleanup warnings if any residual cleanup step fails
|
|
124
131
|
|
|
125
132
|
Detailed design and maintainer docs:
|
|
126
133
|
- `docs/ORACLE_DESIGN.md`
|
|
127
134
|
- `docs/ORACLE_RECOVERY_DRILL.md`
|
|
128
135
|
|
|
136
|
+
Completion notification semantics:
|
|
137
|
+
- oracle responses and artifacts are always persisted durably in oracle job state under the configured oracle jobs dir (`${PI_ORACLE_JOBS_DIR:-/tmp}/oracle-<job-id>/` by default)
|
|
138
|
+
- completion delivery into pi sessions is best-effort wake-up based; the extension no longer appends synthetic assistant completion messages into session history
|
|
139
|
+
- manual `oracle_read` or `/oracle-status` inspection settles further reminder retries once the terminal job has been opened
|
|
140
|
+
- if a wake-up does not land, the job remains available via its saved response/artifacts and status commands
|
|
141
|
+
|
|
129
142
|
## Privacy / local data
|
|
130
143
|
|
|
131
144
|
This extension is local-first, but it does read and persist local data:
|
|
132
145
|
- `/oracle-auth` reads ChatGPT cookies from a local Chrome profile
|
|
133
146
|
- job archives are uploaded to ChatGPT.com
|
|
134
|
-
- responses and artifacts are written under
|
|
147
|
+
- responses and artifacts are written under the configured oracle jobs dir (`${PI_ORACLE_JOBS_DIR:-/tmp}/oracle-<job-id>/` by default)
|
|
135
148
|
|
|
136
149
|
Review the code and design docs before using it with sensitive material.
|
|
137
150
|
|
|
@@ -139,8 +152,11 @@ Review the code and design docs before using it with sensitive material.
|
|
|
139
152
|
|
|
140
153
|
```bash
|
|
141
154
|
npm run check:oracle-extension
|
|
155
|
+
npm run typecheck
|
|
142
156
|
npm run sanity:oracle
|
|
143
157
|
npm run pack:check
|
|
158
|
+
# or all at once
|
|
159
|
+
npm run verify:oracle
|
|
144
160
|
```
|
|
145
161
|
|
|
146
162
|
## Beta caveats
|