@zortexhq/install 0.1.23

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 ADDED
@@ -0,0 +1,127 @@
1
+ # Zortex for Windows
2
+
3
+ This package installs the Windows x64 Zortex CLI and its bundled Bun runtime.
4
+
5
+ ## Quick start
6
+
7
+ **Requirements:** Windows x64, Node.js 18 or newer, and a local `codex`
8
+ command on `PATH`. Install Zortex from npm:
9
+
10
+ ```powershell
11
+ npm install --global @zortexhq/install
12
+ ```
13
+
14
+ The preferred experience is to tell Codex to install and connect Zortex:
15
+
16
+ > Install Zortex and connect my available apps.
17
+
18
+ Codex runs the explicit, non-interactive route:
19
+
20
+ ```powershell
21
+ zortex onboard --agent --host codex --json
22
+ ```
23
+
24
+ The installer-owned Codex skill refreshes `@zortexhq/install@latest` before
25
+ onboarding, so an old or stale `zortex` shim cannot silently keep an
26
+ older release active.
27
+ Its Bun runtime runs from a versioned copy under `%LOCALAPPDATA%\Zortex`, so a
28
+ live local gateway does not lock the npm package directory during a later update.
29
+
30
+ For a Zortex connection request, the installed skill uses this local CLI route
31
+ instead of Codex's already-authenticated Gmail or Google Drive apps. Say
32
+ explicitly that you want a built-in Codex app only when that is the intended
33
+ connector.
34
+
35
+ Onboarding automatically selects all released Windows recipes: Gmail, Google
36
+ Drive, and Outlook. For an application outside that roster, inspect the
37
+ installed connection recipes first:
38
+
39
+ ```powershell
40
+ zortex autopilot recipes --json
41
+ ```
42
+
43
+ The recipe aliases state whether Zortex has a released automatic route. If no recipe matches, use `zortex connect <kebab-id>` to
44
+ file or join the existing connector-skill fabrication order; it is not a false
45
+ claim that the unknown app is already connected. In a Codex-launched terminal,
46
+ a bare `zortex` starts the same automatic agent onboarding.
47
+
48
+ ### What happens next
49
+
50
+ 1. Zortex checks the inherited Codex/Terminal Windows token. It does not ask
51
+ for broad elevation and does not use a model on the normal path.
52
+ 2. It records a reversible Autopilot receipt, configures its own read-only
53
+ Codex MCP bridge, and automatically starts the existing full sync for every
54
+ released source in the background. Users do not select sources or request
55
+ a preliminary sample.
56
+ 3. If a provider needs OAuth, Zortex opens the provider page itself. The user
57
+ completes only password entry, MFA, consent, CAPTCHA, hardware-key touch, or
58
+ account-risk confirmation in that provider surface. Zortex never asks the
59
+ user to run a shell command or paste a credential.
60
+ 4. The user may ask a question as soon as authorization is connected. Codex
61
+ checks the receipt while background synchronization runs:
62
+
63
+ ```powershell
64
+ zortex autopilot connect-status <receipt-id>
65
+ ```
66
+
67
+ The result includes each source's synchronized count and `backfill` state.
68
+ A scoped question uses matching synchronized data and reports incomplete
69
+ coverage if catch-up is still running. A question without a range waits for
70
+ `caught_up` and analyzes the complete connected corpus.
71
+ 5. Codex uses the read-only `indra.context` bridge and cites the returned
72
+ Zortex references.
73
+
74
+ There is no ten-item onboarding sample. Full coverage is claimed only when a
75
+ source reports `backfill: caught_up`.
76
+
77
+ ### Supported Windows Autopilot sources
78
+
79
+ | Source | Sync target | Notes |
80
+ | --- | --- | --- |
81
+ | `gmail` | Full connected mailbox | Uses the existing read-only Gmail connector and its declared exclusions. |
82
+ | `google-drive` | Full connected Drive corpus | Uses the existing read-only Drive connector and its declared exclusions. |
83
+ | `outlook` | Full connected mailbox | Uses the unchanged 0.1.19/0.1.20 Outlook connector. |
84
+ | `notion` | Connector fabrication | No released automatic authorization route yet; request files or joins a D29 build order. |
85
+ | `posthog` | Connector fabrication | No released automatic authorization route yet; request files or joins a D29 build order. |
86
+ | `whatsapp` | Deferred | Not part of this Windows Preview. |
87
+
88
+ `chrome-history` and `computer-files` need a bounded user selection before
89
+ Autopilot may read them. `github` is currently blocked by its clone-credential
90
+ rail, and WeChat is deliberately excluded from this Windows release path.
91
+
92
+ ### Undo a connection
93
+
94
+ To revoke the exact host grant and owned MCP configuration associated with a
95
+ receipt, run:
96
+
97
+ ```powershell
98
+ zortex autopilot connect-rollback <receipt-id>
99
+ ```
100
+
101
+ This disables that connection; it does not claim to erase append-only local
102
+ records. Use the product's audited privacy-erasure path for data deletion.
103
+
104
+ ### Troubleshooting
105
+
106
+ - `NEEDS_ATTENTION`: let Codex inspect the receipt and perform its own bounded
107
+ repair. Do not paste a credential or run a repair command yourself.
108
+ - `codex` not found: install/start the local Codex CLI first, then rerun the
109
+ explicit onboarding command.
110
+ - Incomplete all-data answer: wait for each requested source to report
111
+ `backfill: caught_up`.
112
+
113
+ When Codex invokes the npm launcher with no command, it starts
114
+ `zortex onboard --agent --host codex`. That scripted onboarding first proves
115
+ what the inherited Codex/Terminal Windows token can access; it does not open a
116
+ broad permission prompt or call a model. Only a real source-specific access,
117
+ UAC, or provider boundary becomes a typed `NEEDS_ATTENTION` item. Connector
118
+ workers inherit that same host token; they do not use MCP as a permission or
119
+ execution channel.
120
+
121
+ After installation/onboarding, Zortex provides a local, read-only MCP context
122
+ gateway. Connectors do not depend on MCP: Autopilot runs from the onboarding CLI
123
+ and records its own reversible receipts. A signed local content pack can be
124
+ installed with `zortex bootstrap --pack <pack.indrapack>`; that command adds
125
+ only its owned Codex MCP entry and Skill, and leaves pack skills as unexecuted
126
+ candidates. It does not install a local model, send user data to a provider, or
127
+ enable action tools.
package/bin/zortex.js ADDED
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { spawnSync } = require("node:child_process");
5
+ const { copyFileSync, existsSync, mkdirSync, statSync } = require("node:fs");
6
+ const { homedir } = require("node:os");
7
+ const { delimiter, join } = require("node:path");
8
+
9
+ const ROOT = join(__dirname, "..");
10
+ const BUNDLE = join(ROOT, "dist", "zortex.js");
11
+
12
+ function isFile(path) {
13
+ try {
14
+ return statSync(path).isFile();
15
+ } catch {
16
+ return false;
17
+ }
18
+ }
19
+
20
+ function bunPath(appRoot) {
21
+ let bundled;
22
+ try {
23
+ bundled = require.resolve("@oven/bun-windows-x64/bin/bun.exe");
24
+ } catch {
25
+ // Optional platform runtime absent: an existing Bun installation is still valid.
26
+ }
27
+ if (bundled !== undefined) {
28
+ const version = require(join(ROOT, "package.json")).optionalDependencies["@oven/bun-windows-x64"];
29
+ if (typeof version !== "string" || !/^[A-Za-z0-9._-]+$/.test(version)) throw new Error("bundled Bun runtime version is invalid");
30
+ const runtime = join(appRoot, "runtime", `bun-${version}.exe`);
31
+ if (!isFile(runtime)) {
32
+ mkdirSync(join(appRoot, "runtime"), { recursive: true });
33
+ copyFileSync(bundled, runtime);
34
+ }
35
+ return runtime;
36
+ }
37
+ const executable = "bun.exe";
38
+ for (const directory of (process.env.PATH || "").split(delimiter)) {
39
+ const candidate = join(directory, executable);
40
+ if (directory && isFile(candidate)) return candidate;
41
+ }
42
+ return undefined;
43
+ }
44
+
45
+ function hasAppRoot(args) {
46
+ return args.some((arg, index) => arg === "--app-root" ? args[index + 1] !== undefined : arg.startsWith("--app-root="));
47
+ }
48
+
49
+ /** A no-argument npm invocation is the start of onboarding. Codex exposes a
50
+ * stable session/thread marker to its child processes, so it can use the
51
+ * noninteractive agent flow while an ordinary terminal keeps the human flow. */
52
+ function defaultInvocationArgs(args, env = process.env) {
53
+ if (args.length > 0) return args;
54
+ return env.CODEX_SESSION_ID || env.CODEX_THREAD_ID
55
+ ? ["onboard", "--agent", "--host", "codex"]
56
+ : ["onboard"];
57
+ }
58
+
59
+ function main() {
60
+ if (!isFile(BUNDLE)) {
61
+ process.stderr.write("zortex: packaged bundle is missing; reinstall @zortexhq/install\n");
62
+ return 1;
63
+ }
64
+ const appRoot = process.env.ZORTEX_APP_ROOT || join(process.env.LOCALAPPDATA || join(homedir(), "AppData", "Local"), "Zortex");
65
+ let bun;
66
+ try {
67
+ bun = bunPath(appRoot);
68
+ } catch (error) {
69
+ process.stderr.write(`zortex: could not prepare the package-owned Bun runtime: ${error.message}\n`);
70
+ return 1;
71
+ }
72
+ if (bun === undefined) {
73
+ process.stderr.write("zortex: no Bun runtime found; reinstall @zortexhq/install without omitting optional dependencies\n");
74
+ return 1;
75
+ }
76
+ const args = defaultInvocationArgs(process.argv.slice(2));
77
+ const forwarded = hasAppRoot(args) ? args : ["--app-root", appRoot, ...args];
78
+ const child = spawnSync(bun, [BUNDLE, ...forwarded], { stdio: "inherit", env: process.env });
79
+ if (child.error) {
80
+ process.stderr.write(`zortex: could not start Bun: ${child.error.message}\n`);
81
+ return 1;
82
+ }
83
+ return child.status === null ? 1 : child.status;
84
+ }
85
+
86
+ module.exports = { defaultInvocationArgs };
87
+
88
+ if (require.main === module) process.exitCode = main();