@miruzero/zgpt 0.1.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/README.md +38 -0
- package/docs/architecture.md +51 -0
- package/package.json +29 -0
- package/src/api/catalog.json +17002 -0
- package/src/api/index.js +153 -0
- package/src/auth/index.js +87 -0
- package/src/cli/formatter.js +111 -0
- package/src/cli.js +117 -0
- package/src/config/paths.js +19 -0
- package/src/connector/index.js +6 -0
- package/src/connector/read.js +56 -0
- package/src/connector/write.js +26 -0
- package/src/conversation/attachments.js +77 -0
- package/src/conversation/index.js +65 -0
- package/src/conversation/model.js +117 -0
- package/src/conversation/read.js +378 -0
- package/src/conversation/temp-state.js +43 -0
- package/src/conversation/temporary.js +59 -0
- package/src/conversation/write.js +508 -0
- package/src/index.js +8 -0
- package/src/project/index.js +6 -0
- package/src/project/read.js +91 -0
- package/src/project/write.js +50 -0
- package/src/protocol/conduit.js +26 -0
- package/src/protocol/conversation-payload.js +214 -0
- package/src/protocol/sentinel-client.js +35 -0
- package/src/protocol/sentinel-proof.js +19 -0
- package/src/protocol/sentinel-requirements.js +25 -0
- package/src/protocol/sse.js +56 -0
- package/src/session/exchange.js +12 -0
- package/src/session/index.js +70 -0
- package/src/session/local-storage.js +75 -0
- package/src/transport/direct/http-client.js +166 -0
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Zero ChatGPT
|
|
2
|
+
|
|
3
|
+
`M:\Zero_ChatGPT` is the standalone ChatGPT runtime and the only default owner of ChatGPT state.
|
|
4
|
+
|
|
5
|
+
## Scope
|
|
6
|
+
|
|
7
|
+
This package contains only ChatGPT-specific runtime code:
|
|
8
|
+
|
|
9
|
+
- authentication and session bootstrap
|
|
10
|
+
- conversation read/write operations
|
|
11
|
+
- ChatGPT project operations
|
|
12
|
+
- ChatGPT connector operations
|
|
13
|
+
- ChatGPT Web protocol mechanics
|
|
14
|
+
- direct HTTP/SSE transport
|
|
15
|
+
- ChatGPT mutable state under `M:\Zero_ChatGPT\state`
|
|
16
|
+
|
|
17
|
+
It contains no Zero Core, MCP, Agent orchestration, CLI adapter, or generic device/task runtime.
|
|
18
|
+
|
|
19
|
+
## Public API
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
const chatgpt = require('M:/Zero_ChatGPT');
|
|
23
|
+
|
|
24
|
+
await chatgpt.auth.ensure();
|
|
25
|
+
await chatgpt.session.acquire();
|
|
26
|
+
await chatgpt.conversation.get(id);
|
|
27
|
+
await chatgpt.conversation.send(id, message);
|
|
28
|
+
await chatgpt.project.listProjects(options);
|
|
29
|
+
await chatgpt.connector.listConnectors(options);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Runtime rules
|
|
33
|
+
|
|
34
|
+
- Direct ChatGPT Web transport is the only conversation transport.
|
|
35
|
+
- Session exchange transport must be supplied explicitly; no browser/CDP transport is implicit.
|
|
36
|
+
- 429 opens shared cooldown and is not amplified by retries.
|
|
37
|
+
- No hardcoded credentials or secret-bearing diagnostics.
|
|
38
|
+
- Default writable state lives only under `M:\Zero_ChatGPT\state`.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Zero ChatGPT Architecture
|
|
2
|
+
|
|
3
|
+
## Ownership
|
|
4
|
+
|
|
5
|
+
`M:\Zero_ChatGPT` owns only ChatGPT-specific runtime behavior and ChatGPT state.
|
|
6
|
+
|
|
7
|
+
## Runtime
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
auth / session / conversation / project / connector
|
|
11
|
+
|
|
|
12
|
+
protocol
|
|
13
|
+
sentinel / proof / conduit / payload / SSE
|
|
14
|
+
|
|
|
15
|
+
transport
|
|
16
|
+
direct HTTP/SSE
|
|
17
|
+
|
|
|
18
|
+
chatgpt.com
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Only ChatGPT runtime concerns belong in this package. Zero Core, MCP, Agent orchestration, devices, task routing, and adapter layers stay outside it.
|
|
22
|
+
|
|
23
|
+
## State
|
|
24
|
+
|
|
25
|
+
Default mutable state is under `M:\Zero_ChatGPT\state`:
|
|
26
|
+
|
|
27
|
+
- `auth-context.json`
|
|
28
|
+
- `session-context.json`
|
|
29
|
+
- `temp-conversations.json` when temporary-chat cursor state exists
|
|
30
|
+
- rate-limit state
|
|
31
|
+
|
|
32
|
+
The state directory is the only default writer for ChatGPT runtime state.
|
|
33
|
+
|
|
34
|
+
## Boundaries
|
|
35
|
+
|
|
36
|
+
- `conversation` owns conversation lifecycle and message/stream behavior.
|
|
37
|
+
- `project` owns project CRUD and project conversation grouping.
|
|
38
|
+
- `connector` owns ChatGPT connector discovery, actions, refresh, and mention resolution.
|
|
39
|
+
- `protocol` owns ChatGPT Web payload, Sentinel, conduit, and SSE mechanics.
|
|
40
|
+
- `transport` owns HTTP, headers, retries, cooldown, and session-cookie persistence.
|
|
41
|
+
- `session` owns ChatGPT session acquisition/exchange; it has no implicit browser/CDP transport.
|
|
42
|
+
|
|
43
|
+
## Invariants
|
|
44
|
+
|
|
45
|
+
1. Direct transport is the only conversation transport.
|
|
46
|
+
2. Session exchange transport is explicit.
|
|
47
|
+
3. Missing auth fails closed.
|
|
48
|
+
4. Secrets are never embedded in source or diagnostics.
|
|
49
|
+
5. External ChatGPT responses are validated before state mutation.
|
|
50
|
+
6. This package owns only ChatGPT runtime state.
|
|
51
|
+
7. No Zero Core, MCP, Agent, device, task, or adapter implementation lives here.
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@miruzero/zgpt",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"zgpt": "src/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "node --test"
|
|
11
|
+
},
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=20"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"classic-level": "^3.0.0"
|
|
17
|
+
},
|
|
18
|
+
"allowScripts": {
|
|
19
|
+
"classic-level@3.0.0": true
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"src",
|
|
23
|
+
"README.md",
|
|
24
|
+
"docs/architecture.md"
|
|
25
|
+
],
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
}
|
|
29
|
+
}
|