pi-oracle 0.1.12 → 0.2.1
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 +46 -0
- package/README.md +26 -10
- package/docs/ORACLE_DESIGN.md +593 -0
- package/docs/ORACLE_RECOVERY_DRILL.md +127 -0
- package/extensions/oracle/index.ts +15 -4
- package/extensions/oracle/lib/commands.ts +39 -12
- package/extensions/oracle/lib/config.ts +2 -2
- package/extensions/oracle/lib/jobs.ts +510 -73
- package/extensions/oracle/lib/locks.ts +99 -13
- package/extensions/oracle/lib/poller.ts +224 -38
- package/extensions/oracle/lib/queue.ts +193 -0
- package/extensions/oracle/lib/runtime.ts +70 -16
- package/extensions/oracle/lib/tools.ts +313 -64
- 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 +330 -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 +2 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.1 - 2026-04-07
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- wake-up guidance now tells receivers to use `oracle_read(jobId)` as the canonical way to consume completion results
|
|
7
|
+
- manual inspection before the first wake-up no longer suppresses the initial reminder attempt
|
|
8
|
+
- wake-up settlement now records provenance so suppressed/settled delivery can be explained in postmortems
|
|
9
|
+
- queued archive cleanup retries now retry queued archive deletion and keep warnings until cleanup succeeds
|
|
10
|
+
- queued archive byte-pressure accounting now includes retained pre-submit archives instead of only currently queued jobs
|
|
11
|
+
|
|
12
|
+
## 0.2.0 - 2026-04-06
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- workerless queued oracle jobs with automatic promotion when capacity is available
|
|
16
|
+
- queue position/status reporting and queued-job cancellation
|
|
17
|
+
- durable wake-up target leasing for cross-process completion notification routing
|
|
18
|
+
- oracle now requires a persisted pi session identity instead of collapsing in-memory/no-session contexts onto a shared project-level wake-up target
|
|
19
|
+
- 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
|
|
20
|
+
- 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
|
|
21
|
+
- metadata-less lock/lease state directories left behind by crashes are now reclaimed after a bounded grace instead of wedging future operations forever
|
|
22
|
+
- expanded oracle sanity coverage for queueing, recovery, cancellation, promotion, and notification edge cases
|
|
23
|
+
- a real TypeScript typecheck gate via `npm run typecheck` and `npm run verify:oracle`
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
- queued jobs now promote using their persisted config snapshot
|
|
27
|
+
- runtime admission now stays blocked when cleanup warnings indicate teardown is incomplete
|
|
28
|
+
- cleanup-driven promotion only advances the queue after a clean runtime teardown
|
|
29
|
+
- orphaned completion wake-ups can be adopted safely when the original session is no longer live
|
|
30
|
+
- 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
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
- PID-safe worker cancellation and stale-worker recovery paths
|
|
34
|
+
- same-job conversation lease reuse during queued follow-up retries
|
|
35
|
+
- cleanup-warning handling across submit, promotion, cancellation, and terminal cleanup flows
|
|
36
|
+
- queue advancement after cancellation now requires clean teardown
|
|
37
|
+
- cleanup failures no longer silently drop warning state or remove terminal job records prematurely
|
|
38
|
+
- stale notification claimants can no longer finalize completion delivery after ownership handoff
|
|
39
|
+
- best-effort wake-up retries remain bounded without creating synthetic completion messages in session history, including stale cross-session claimant races
|
|
40
|
+
- completed and cancelled jobs now prune on explicit terminal-job retention policy instead of depending on synthetic notification state
|
|
41
|
+
- stale live terminal cleanup workers are now terminated and recovered automatically so cleanup-pending jobs do not wedge capacity indefinitely
|
|
42
|
+
- 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
|
|
43
|
+
- `/oracle-clean` now refuses terminal jobs whose worker is still live instead of deleting around active cleanup
|
|
44
|
+
- live and off-session completion handling no longer risks corrupting active session history with extension-authored assistant appends
|
|
45
|
+
- `oracle_read` now reports artifact paths from the configured oracle jobs directory instead of hard-coding `/tmp`
|
|
46
|
+
- 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,15 +32,16 @@ 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
|
|
40
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
|
|
41
|
-
|
|
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
|
|
42
45
|
|
|
43
46
|
## Example
|
|
44
47
|
|
|
@@ -61,6 +64,7 @@ Currently validated for:
|
|
|
61
64
|
- local ChatGPT web login in Chrome
|
|
62
65
|
- isolated auth seed profile + per-job runtime profile clones
|
|
63
66
|
- concurrent jobs across different projects/sessions
|
|
67
|
+
- workerless queued jobs when the global concurrency limit is full
|
|
64
68
|
- same-conversation exclusion for follow-ups
|
|
65
69
|
- plain-text responses
|
|
66
70
|
- artifact capture, including multi-artifact runs
|
|
@@ -119,21 +123,30 @@ Common settings:
|
|
|
119
123
|
Project config should only override safe, non-privileged settings.
|
|
120
124
|
|
|
121
125
|
Cleanup behavior:
|
|
122
|
-
- terminal job directories under
|
|
123
|
-
- 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
|
|
124
128
|
- failed jobs are pruned after `cleanup.failedJobRetentionMs`
|
|
125
|
-
- `/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
|
|
126
131
|
|
|
127
132
|
Detailed design and maintainer docs:
|
|
128
133
|
- `docs/ORACLE_DESIGN.md`
|
|
129
134
|
- `docs/ORACLE_RECOVERY_DRILL.md`
|
|
130
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
|
+
- wake-up content tells the receiving assistant to call `oracle_read(jobId)` as the canonical completion-consumption path, with saved file paths included as secondary context
|
|
140
|
+
- manual `oracle_read` or `/oracle-status` inspection settles further reminder retries once the terminal job has been opened, and now persists settlement provenance for postmortems
|
|
141
|
+
- manual inspection before the first wake-up attempt is recorded as observation only and does not suppress the first reminder send
|
|
142
|
+
- if a wake-up does not land, the job remains available via its saved response/artifacts and status commands
|
|
143
|
+
|
|
131
144
|
## Privacy / local data
|
|
132
145
|
|
|
133
146
|
This extension is local-first, but it does read and persist local data:
|
|
134
147
|
- `/oracle-auth` reads ChatGPT cookies from a local Chrome profile
|
|
135
148
|
- job archives are uploaded to ChatGPT.com
|
|
136
|
-
- responses and artifacts are written under
|
|
149
|
+
- responses and artifacts are written under the configured oracle jobs dir (`${PI_ORACLE_JOBS_DIR:-/tmp}/oracle-<job-id>/` by default)
|
|
137
150
|
|
|
138
151
|
Review the code and design docs before using it with sensitive material.
|
|
139
152
|
|
|
@@ -141,8 +154,11 @@ Review the code and design docs before using it with sensitive material.
|
|
|
141
154
|
|
|
142
155
|
```bash
|
|
143
156
|
npm run check:oracle-extension
|
|
157
|
+
npm run typecheck
|
|
144
158
|
npm run sanity:oracle
|
|
145
159
|
npm run pack:check
|
|
160
|
+
# or all at once
|
|
161
|
+
npm run verify:oracle
|
|
146
162
|
```
|
|
147
163
|
|
|
148
164
|
## Beta caveats
|