@tempoxyz/mercator 0.0.626 → 0.0.636
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/dist/agents.d.ts +1 -1
- package/dist/agents.js +5 -5
- package/dist/codex-marketplace.d.ts +3 -0
- package/dist/codex-marketplace.js +30 -0
- package/dist/codex-marketplace.js.map +1 -1
- package/dist/command-render.d.ts +2 -0
- package/dist/command-render.js +7 -0
- package/dist/command-render.js.map +1 -1
- package/dist/index.d.ts +19 -0
- package/dist/index.js +53 -3
- package/dist/index.js.map +1 -1
- package/dist/plugin-bundle/README.md +3 -3
- package/dist/plugin-bundle/skills/mercator/SKILL.md +12 -88
- package/dist/plugin-bundle/skills/mercator/references/examples.md +8 -155
- package/dist/plugin-bundle/skills/mercator-setup/SKILL.md +23 -54
- package/dist/refresh.d.ts +21 -0
- package/dist/refresh.js +61 -0
- package/dist/refresh.js.map +1 -0
- package/dist/release.d.ts +21 -0
- package/dist/release.js +67 -0
- package/dist/release.js.map +1 -0
- package/dist/setup-preferences.d.ts +36 -0
- package/dist/setup-preferences.js +90 -0
- package/dist/setup-preferences.js.map +1 -0
- package/dist/setup-render.js +14 -2
- package/dist/setup-render.js.map +1 -1
- package/dist/setup-update.d.ts +26 -0
- package/dist/setup-update.js +107 -0
- package/dist/setup-update.js.map +1 -0
- package/dist/setup.d.ts +4 -1
- package/dist/setup.js +25 -11
- package/dist/setup.js.map +1 -1
- package/dist/update.js +2 -0
- package/dist/update.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,157 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Routing examples
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
- “Compare current company filings, news, and on-chain activity.” Search Mercator for the complete
|
|
4
|
+
research outcome; follow the live tools for planning and execution.
|
|
5
|
+
- “Find replacement flights under $1,200.” Research options. Finding flights does not authorize booking.
|
|
6
|
+
- “Fix this repository's tests” or “Summarize the attached PDF.” Work locally with the supplied material.
|
|
7
|
+
- A direct installed tool fully covers the outcome: use that tool.
|
|
5
8
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
**Request:** “Compare today's weather in Boston and New York.”
|
|
9
|
-
|
|
10
|
-
Use an installed weather tool when it fully covers this request. Use Mercator when the outcome adds
|
|
11
|
-
capabilities the direct tool cannot satisfy—for example, combining weather, flight disruption data,
|
|
12
|
-
and traveler notifications in one workflow.
|
|
13
|
-
|
|
14
|
-
## Compound research
|
|
15
|
-
|
|
16
|
-
**Request:** “Investigate unusual AAVE activity across smart-money flows, holders, price, news, and
|
|
17
|
-
regulation; return a sourced chart. Budget: $5.”
|
|
18
|
-
|
|
19
|
-
Search with the entire outcome. Build a bounded DAG whose independent data nodes can run in parallel
|
|
20
|
-
and whose final node consumes only the outputs it needs. Quote the whole DAG. If the total is at most
|
|
21
|
-
$5 and the plan contains only the requested research, the supplied budget authorizes execution.
|
|
22
|
-
|
|
23
|
-
Use Mercator's dependency expressions inside the cataloged node inputs. For example, a downstream
|
|
24
|
-
summary node that depends on `holders`, `news`, and `price` can contain:
|
|
25
|
-
|
|
26
|
-
```json
|
|
27
|
-
{
|
|
28
|
-
"id": "summarize",
|
|
29
|
-
"dependsOn": ["holders", "news", "price"],
|
|
30
|
-
"input": {
|
|
31
|
-
"addresses": {
|
|
32
|
-
"$map": {
|
|
33
|
-
"from": "flow://holders/output#/rows",
|
|
34
|
-
"path": "/address"
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
"headline": "flow://news/output#/items/0/title",
|
|
38
|
-
"label": {
|
|
39
|
-
"$concat": ["Asset: ", "flow://price/output#/symbol"]
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Merge that input with the exact `serviceId`, `method`, and `path` returned by discovery. A plain
|
|
46
|
-
`flow://node/output` reference may include an RFC 6901 JSON Pointer suffix. `$map` projects each item
|
|
47
|
-
from an upstream array; `$concat` combines values only when they resolve to all strings or all arrays.
|
|
48
|
-
|
|
49
|
-
Before submission, a useful confirmation is:
|
|
50
|
-
|
|
51
|
-
> I found a five-source research plan covering flows, holders, price, news, and regulation. The
|
|
52
|
-
> Mercator quote is $3.80, within your $5 budget. I’ll run it and return the requested sourced chart.
|
|
53
|
-
|
|
54
|
-
With hosted OAuth, the connected access key authorizes spending within its signed limits. Do not ask for per-job spend
|
|
55
|
-
approval; respect the explicit $5 budget and the requested scope. Legacy challenge clients can also
|
|
56
|
-
proceed within that explicit budget; without one, show the quote and obtain approval before paying.
|
|
57
|
-
|
|
58
|
-
## Research versus action
|
|
59
|
-
|
|
60
|
-
**Request:** “Find replacement Boston-to-London flights under $1,200.”
|
|
61
|
-
|
|
62
|
-
Search and quote a research plan. Do not book a flight: the user asked to find options.
|
|
63
|
-
|
|
64
|
-
**Request:** “Book the best refundable replacement under $1,200 and email me the itinerary.”
|
|
65
|
-
|
|
66
|
-
The requested workflow may include booking and email actions. Before execution, show the selected
|
|
67
|
-
plan and Mercator quote. Keep the fare within the $1,200 travel limit and Mercator's separate workflow
|
|
68
|
-
charge within the connected access-key limits and any explicit workflow budget.
|
|
69
|
-
|
|
70
|
-
A useful confirmation is:
|
|
71
|
-
|
|
72
|
-
> The refundable fare is $1,146 and Mercator’s workflow charge is $0.42. The plan will purchase the
|
|
73
|
-
> ticket and email the itinerary. I’ll run it using the connected wallet.
|
|
74
|
-
|
|
75
|
-
## Missing required input
|
|
76
|
-
|
|
77
|
-
If `search_services` returns an endpoint without a ready suggested plan node, use
|
|
78
|
-
`describe_service` to learn its exact schema. Ask the user only for required information that cannot
|
|
79
|
-
be inferred safely. Then quote the completed plan.
|
|
80
|
-
|
|
81
|
-
For example, an email action may require a recipient address that is absent from the conversation.
|
|
82
|
-
Ask for that address; do not invent it or quietly remove the email step.
|
|
83
|
-
|
|
84
|
-
## MCP submission and status
|
|
85
|
-
|
|
86
|
-
1. Generate and persist an 8–200 character `idempotency_key` before submission; a UUID works.
|
|
87
|
-
2. Call `create_job` once with the unchanged quoted plan, that key, and the quoted `totalAmount` as
|
|
88
|
-
`approved_total`.
|
|
89
|
-
3. After a timeout or lost response, retry with the same plan, key, and approved total.
|
|
90
|
-
|
|
91
|
-
- Use a new key for a new logical job. A new key during recovery can create a second paid job.
|
|
92
|
-
- Omitting the key fails validation. Never reuse a key with a changed plan.
|
|
93
|
-
- OAuth-connected hosts charge the bounded wallet inside Mercator.
|
|
94
|
-
- Legacy challenge clients require quote approval or a sufficient explicit budget, including after
|
|
95
|
-
a price change.
|
|
96
|
-
- Never install a CLI or translate MCP submission into a REST request.
|
|
97
|
-
|
|
98
|
-
For an illustrative quote with `totalAmount: "0.007"`, pass `approved_total: "0.007"`.
|
|
99
|
-
Preserve the exact decimal string; never guess a total or infer it from a discovery estimate.
|
|
100
|
-
Hosted OAuth spending is authorized by the signed access-key limits, subject to explicit user
|
|
101
|
-
budgets. Legacy clients need quote approval or a sufficient explicit budget. If `validUntil`
|
|
102
|
-
has elapsed, refresh the quote before submitting and apply the same authorization rules to any
|
|
103
|
-
changed price. An `approval_required` response means the quoted total was not supplied and no
|
|
104
|
-
charge was made: supply the actual quote total with the same plan and idempotency key.
|
|
105
|
-
|
|
106
|
-
A successful submission returns either a terminal job or a pending response:
|
|
107
|
-
|
|
108
|
-
```json
|
|
109
|
-
{"jobId":"4d9ea616-4223-4b9d-bd19-2d3f74c9fa4c","ready":false}
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
Persist the job ID and start a status listener with:
|
|
113
|
-
|
|
114
|
-
```json
|
|
115
|
-
{"job_id":"4d9ea616-4223-4b9d-bd19-2d3f74c9fa4c"}
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
- `ready:false`: wait with bounded backoff, then call `get_job` again.
|
|
119
|
-
- `ready:true`: stop; return the cached success result or stable failure.
|
|
120
|
-
- Caller wait limit reached: return the job ID and last known status so listening can resume later.
|
|
121
|
-
- Request timeout or lost response: call `create_job` with the identical plan and idempotency key to
|
|
122
|
-
recover the job, then listen on its returned job ID.
|
|
123
|
-
|
|
124
|
-
In summary mode (`"result_mode":"summary"`), an empty `job.result` means payloads were omitted.
|
|
125
|
-
Use each returned `result_node_ids` value with `get_job_details`:
|
|
126
|
-
|
|
127
|
-
```json
|
|
128
|
-
{"job_id":"4d9ea616-4223-4b9d-bd19-2d3f74c9fa4c","node_id":"search1"}
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
Use the actual returned node ID. Alternatively, call `get_job` with `result_mode: "inline"`.
|
|
132
|
-
Both reads use cached outputs and do not charge again. Failed jobs may retain successful outputs.
|
|
133
|
-
|
|
134
|
-
Do not model completion as a webhook or SSE subscription: the public status interface is polling.
|
|
135
|
-
|
|
136
|
-
## Existing local wallet fallback
|
|
137
|
-
|
|
138
|
-
Use REST only when MCP submission fails, one identical retry also fails, and the host already has a
|
|
139
|
-
ready local Mercator wallet. Submit the same plan to `POST https://mercator.sh/v1/jobs` with
|
|
140
|
-
the same idempotency key and a maximum spend equal to `approved_total`. Never install, create, or
|
|
141
|
-
connect a wallet for fallback. A local fallback wallet needs quote approval or a sufficient explicit
|
|
142
|
-
budget; the hosted OAuth grant does not authorize a separate local wallet. Resume job polling through MCP `get_job` with the returned job ID.
|
|
143
|
-
|
|
144
|
-
## No result or stale endpoint
|
|
145
|
-
|
|
146
|
-
- Unconstrained search with no result: broaden the outcome once while preserving user constraints.
|
|
147
|
-
- Required service with no result: report that the constraint cannot currently be satisfied.
|
|
148
|
-
- Stale endpoint or quote failure: search again for a current alternative, rebuild the plan, and
|
|
149
|
-
quote it again before submitting within the access-key limits and any explicit user budget.
|
|
150
|
-
|
|
151
|
-
## Do not activate
|
|
152
|
-
|
|
153
|
-
- “Fix the failing test in this repository.”
|
|
154
|
-
- “Summarize the attached PDF.”
|
|
155
|
-
- “Analyze this pasted JSON without calling external services.”
|
|
156
|
-
- “Use only free local tools.”
|
|
157
|
-
- A simple lookup already fully covered by a suitable installed direct tool.
|
|
9
|
+
Use current tool schemas and returned next steps; provider IDs, execution recipes, and payment
|
|
10
|
+
instructions are served by the connected MCP server.
|
|
@@ -6,64 +6,33 @@ license: MIT
|
|
|
6
6
|
|
|
7
7
|
# Mercator setup
|
|
8
8
|
|
|
9
|
-
Connect the user's chosen
|
|
10
|
-
|
|
9
|
+
Connect the user's chosen client and verify readiness with free checks. Setup does not require a
|
|
10
|
+
paid job or a local payment wallet.
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## Connect or repair
|
|
13
13
|
|
|
14
|
-
- **Plugin
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- **
|
|
21
|
-
|
|
22
|
-
- **
|
|
23
|
-
agent container does not configure the user's desktop client.
|
|
24
|
-
- **Other MCP client:** `mercator setup --manual` prints configuration guidance without modifying
|
|
25
|
-
integrations. Configure Streamable HTTP at `https://mercator.sh/mcp/auth` and finish
|
|
26
|
-
OAuth in that client. If client registration is required, read
|
|
27
|
-
[Mercator authentication](https://mercator.sh/auth.md).
|
|
14
|
+
- **Plugin installed:** inspect native MCP status and complete the client's **Authorize** action.
|
|
15
|
+
Reload the plugin or start a new session if tools are missing; avoid installing a duplicate.
|
|
16
|
+
- **Local client:** run `mercator status`, then `mercator setup` to install or repair. Consult
|
|
17
|
+
`mercator setup --help` and honor the user's client choice with `--client`.
|
|
18
|
+
- **CLI absent:** install and start setup with the canonical command below. Append setup arguments
|
|
19
|
+
with `sh -s -- --client <client>` when the user selected a client.
|
|
20
|
+
- **Managed or cloud host:** use native plugin and OAuth controls. A CLI inside an agent container
|
|
21
|
+
does not configure the user's desktop.
|
|
22
|
+
- **Other MCP client:** run `mercator setup --manual` for current connection instructions.
|
|
28
23
|
|
|
29
24
|
```bash
|
|
30
25
|
curl -fsSL https://mercator.sh/install.sh | sh
|
|
31
26
|
```
|
|
32
27
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
3. On the connected server, call the free `search_services` tool with a simple data lookup to
|
|
45
|
-
verify discovery. Do not submit a job as a connection test.
|
|
46
|
-
4. Call `get_connection_status` to inspect hosted authorization, token balances, access-key
|
|
47
|
-
expiry/status, and remaining limits. Unavailable chain reads mean unknown, not zero. A `ready`
|
|
48
|
-
key can make its first payment using its signed grant ceiling before live limits activate.
|
|
49
|
-
`oauthAuthenticated: false` identifies the legacy payment-challenge path, not a hosted grant.
|
|
50
|
-
|
|
51
|
-
Report what was verified and what still needs user action. Zero funding or zero spending authority
|
|
52
|
-
can coexist with successful connection and discovery. Once connected, use the `mercator` skill for
|
|
53
|
-
requested research or API execution.
|
|
54
|
-
|
|
55
|
-
## Troubleshoot the failed layer
|
|
56
|
-
|
|
57
|
-
| Symptom | Next action |
|
|
58
|
-
| --- | --- |
|
|
59
|
-
| Plugin or server missing | Check the selected client's registration with native controls or `mercator status`; rerun targeted setup when absent. |
|
|
60
|
-
| Tools missing after install | Reload the plugin or start a fresh session; inspect the client's MCP status. |
|
|
61
|
-
| HTTP 401 or authorization pending | Complete native browser authorization; for Grok CLI, rerun its targeted setup. |
|
|
62
|
-
| Discovery not verified | Resolve transport or OAuth first, then retry the free search probe. |
|
|
63
|
-
| Search works, paid execution unavailable | Inspect connection status for funding, expiry, revocation, and token limits. |
|
|
64
|
-
| Unfunded authorized token | Open `https://mercator.sh/account` or use `fund_wallet` when available; the user chooses the funding amount. |
|
|
65
|
-
| Expired/revoked key or insufficient authority | Manage the grant in Account and reconnect through OAuth for user-selected limits. |
|
|
66
|
-
| Setup failure persists | Run `mercator setup --client <client> --verbose` for the affected client and inspect its bounded diagnostics. |
|
|
67
|
-
|
|
68
|
-
Do not install or create a local payment wallet to repair hosted OAuth. Never include credentials,
|
|
69
|
-
OAuth codes, payment material, or raw provider data in diagnostics shared with others.
|
|
28
|
+
## Verify and recover
|
|
29
|
+
|
|
30
|
+
- Run `mercator doctor` when available and follow its diagnostics. Use targeted
|
|
31
|
+
`mercator setup --client <client> --verbose` for persistent setup failures.
|
|
32
|
+
- On the connected server, inspect live tool descriptions and call `search_services` and
|
|
33
|
+
`get_connection_status` for free discovery and payment-readiness checks. Follow their returned
|
|
34
|
+
next steps. An OAuth challenge alone does not prove authorization or paid readiness.
|
|
35
|
+
- Report verified readiness and remaining user actions. Never create a paid job as a connection test.
|
|
36
|
+
- The user chooses wallet access limits, expiry, and funding. Never request private keys, copy tokens
|
|
37
|
+
into chat, or install a local payment wallet to repair hosted OAuth.
|
|
38
|
+
- Exclude credentials, OAuth codes, payment material, and raw provider data from shared diagnostics.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type configurationState, type installedClients } from './clients.js';
|
|
2
|
+
import type { inspectCodexPlugin } from './codex-plugin.js';
|
|
3
|
+
import type { SetupOptions } from './setup.js';
|
|
4
|
+
import type { readSetupPreferences } from './setup-preferences.js';
|
|
5
|
+
/** Effects used to identify an existing installation without modifying registrations. */
|
|
6
|
+
type RefreshDependencies = {
|
|
7
|
+
readSetupPreferences: typeof readSetupPreferences;
|
|
8
|
+
installedClients: typeof installedClients;
|
|
9
|
+
configurationState: typeof configurationState;
|
|
10
|
+
inspectCodexPlugin: typeof inspectCodexPlugin;
|
|
11
|
+
hasManagedAgents: typeof hasManagedAgents;
|
|
12
|
+
};
|
|
13
|
+
/** Detects only installer-owned activation guidance, preserving user-authored instructions. */
|
|
14
|
+
export declare function hasManagedAgents(codexHome?: string): Promise<boolean>;
|
|
15
|
+
/** Resolves saved choices or conservatively adopts an older setup's existing registrations. */
|
|
16
|
+
export declare function refreshOptions(controls: {
|
|
17
|
+
dryRun: boolean;
|
|
18
|
+
color: boolean;
|
|
19
|
+
verbose: boolean;
|
|
20
|
+
}, dependencies: RefreshDependencies): Promise<SetupOptions>;
|
|
21
|
+
export {};
|
package/dist/refresh.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { MERCATOR_AGENTS_BEGIN } from './agents.js';
|
|
5
|
+
import { clientEndpoint } from './client-endpoint.js';
|
|
6
|
+
import { setupPlan } from './clients.js';
|
|
7
|
+
/** Detects only installer-owned activation guidance, preserving user-authored instructions. */
|
|
8
|
+
export async function hasManagedAgents(codexHome = process.env.CODEX_HOME ?? join(homedir(), '.codex')) {
|
|
9
|
+
for (const name of ['AGENTS.md', 'AGENTS.override.md']) {
|
|
10
|
+
try {
|
|
11
|
+
if ((await readFile(join(codexHome, name), 'utf8')).includes(MERCATOR_AGENTS_BEGIN))
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
if (!(error instanceof Error && 'code' in error && error.code === 'ENOENT'))
|
|
16
|
+
throw error;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
/** Resolves saved choices or conservatively adopts an older setup's existing registrations. */
|
|
22
|
+
export async function refreshOptions(controls, dependencies) {
|
|
23
|
+
let preferences = await dependencies.readSetupPreferences();
|
|
24
|
+
if (!preferences) {
|
|
25
|
+
const url = 'https://mercator.sh/mcp/auth';
|
|
26
|
+
const [installed, plugin, agents] = await Promise.all([
|
|
27
|
+
dependencies.installedClients(),
|
|
28
|
+
dependencies.inspectCodexPlugin(),
|
|
29
|
+
dependencies.hasManagedAgents(),
|
|
30
|
+
]);
|
|
31
|
+
if (plugin.status === 'conflict')
|
|
32
|
+
throw new Error('Existing plugin is not CLI-managed. Refresh it through its marketplace, or run targeted setup.');
|
|
33
|
+
const states = await Promise.all(installed.map(async (client) => ({
|
|
34
|
+
client,
|
|
35
|
+
state: await dependencies.configurationState(setupPlan(client, clientEndpoint(client, url))),
|
|
36
|
+
})));
|
|
37
|
+
if (states.some(({ state }) => ['different', 'unknown'].includes(state)))
|
|
38
|
+
throw new Error('An existing registration needs explicit setup choices. Run mercator setup --client <client> with its intended endpoint before refreshing.');
|
|
39
|
+
preferences = {
|
|
40
|
+
schemaVersion: 1,
|
|
41
|
+
client: states
|
|
42
|
+
.filter(({ state }) => state === 'current' || state === 'legacy')
|
|
43
|
+
.map(({ client }) => client),
|
|
44
|
+
plugin: plugin.registered || plugin.installedVersion !== undefined,
|
|
45
|
+
skill: plugin.skillInstalled ?? true,
|
|
46
|
+
agents,
|
|
47
|
+
url,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
if (!preferences.plugin && !preferences.agents && preferences.client.length === 0)
|
|
51
|
+
throw new Error('No managed installation found. Run mercator setup for your chosen client, or refresh the plugin through its marketplace.');
|
|
52
|
+
return {
|
|
53
|
+
...preferences,
|
|
54
|
+
...controls,
|
|
55
|
+
force: false,
|
|
56
|
+
removeAgents: false,
|
|
57
|
+
yes: true,
|
|
58
|
+
refresh: true,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=refresh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refresh.js","sourceRoot":"","sources":["../src/refresh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAkD,SAAS,EAAE,MAAM,cAAc,CAAA;AAaxF,+FAA+F;AAC/F,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACrC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC;IAE/D,KAAK,MAAM,IAAI,IAAI,CAAC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CAAC,CACH,CAAA;QACD,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACvE,MAAM,IAAI,KAAK,CACd,2IAA2I,CAC3I,CAAA;QACF,WAAW,GAAG;YACb,aAAa,EAAE,CAAC;YAChB,MAAM,EAAE,MAAM;iBACZ,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,QAAQ,CAAC;iBAChE,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC;YAC7B,MAAM,EAAE,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,gBAAgB,KAAK,SAAS;YAClE,KAAK,EAAE,MAAM,CAAC,cAAc,IAAI,IAAI;YACpC,MAAM;YACN,GAAG;SACwB,CAAA;IAC7B,CAAC;IACD,IAAI,CAAC,WAAW,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,IAAI,WAAW,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC;QAChF,MAAM,IAAI,KAAK,CACd,0HAA0H,CAC1H,CAAA;IACF,OAAO;QACN,GAAG,WAAW;QACd,GAAG,QAAQ;QACX,KAAK,EAAE,KAAK;QACZ,YAAY,EAAE,KAAK;QACnB,GAAG,EAAE,IAAI;QACT,OAAO,EAAE,IAAI;KACb,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'incur';
|
|
2
|
+
/** Public release pointer; it contains metadata, never executable URLs or commands. */
|
|
3
|
+
export declare const ReleaseManifestSchema: z.ZodObject<{
|
|
4
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
5
|
+
latestVersion: z.ZodString;
|
|
6
|
+
minimumSetupVersion: z.ZodString;
|
|
7
|
+
guidanceRevision: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
/** Validated public release metadata. */
|
|
10
|
+
type ReleaseManifest = z.infer<typeof ReleaseManifestSchema>;
|
|
11
|
+
/** Published freshness is independent of MCP connection readiness. */
|
|
12
|
+
export type ReleaseStatus = {
|
|
13
|
+
currentVersion: string;
|
|
14
|
+
status: 'current' | 'outdated' | 'unsupported' | 'unavailable' | 'development';
|
|
15
|
+
manifest?: ReleaseManifest;
|
|
16
|
+
};
|
|
17
|
+
/** Compares the stable numeric release components without floating-point truncation. */
|
|
18
|
+
export declare function compareReleaseVersions(left: string, right: string): number;
|
|
19
|
+
/** Reads a bounded official release pointer; an unavailable read never means current. */
|
|
20
|
+
export declare function inspectRelease(currentVersion: string, fetcher?: typeof fetch): Promise<ReleaseStatus>;
|
|
21
|
+
export {};
|
package/dist/release.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { z } from 'incur';
|
|
2
|
+
/** Stable numeric versions published by the Mercator release workflow. */
|
|
3
|
+
const ReleaseVersion = z.string().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/);
|
|
4
|
+
/** Public release pointer; it contains metadata, never executable URLs or commands. */
|
|
5
|
+
export const ReleaseManifestSchema = z
|
|
6
|
+
.object({
|
|
7
|
+
schemaVersion: z.literal(1),
|
|
8
|
+
latestVersion: ReleaseVersion,
|
|
9
|
+
minimumSetupVersion: ReleaseVersion,
|
|
10
|
+
guidanceRevision: z.string().regex(/^[a-f0-9]{64}$/),
|
|
11
|
+
})
|
|
12
|
+
.refine((value) => compareReleaseVersions(value.minimumSetupVersion, value.latestVersion) <= 0);
|
|
13
|
+
/** Compares the stable numeric release components without floating-point truncation. */
|
|
14
|
+
export function compareReleaseVersions(left, right) {
|
|
15
|
+
const a = left.split('.').map(BigInt);
|
|
16
|
+
const b = right.split('.').map(BigInt);
|
|
17
|
+
for (let index = 0; index < 3; index++) {
|
|
18
|
+
if (a[index] < b[index])
|
|
19
|
+
return -1;
|
|
20
|
+
if (a[index] > b[index])
|
|
21
|
+
return 1;
|
|
22
|
+
}
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
/** Reads a bounded official release pointer; an unavailable read never means current. */
|
|
26
|
+
export async function inspectRelease(currentVersion, fetcher = fetch) {
|
|
27
|
+
if (currentVersion === '0.0.0')
|
|
28
|
+
return { currentVersion, status: 'development' };
|
|
29
|
+
try {
|
|
30
|
+
const response = await fetcher('https://mercator.sh/downloads/latest/release.json', {
|
|
31
|
+
cache: 'no-store',
|
|
32
|
+
redirect: 'error',
|
|
33
|
+
signal: AbortSignal.timeout(5_000),
|
|
34
|
+
});
|
|
35
|
+
if (!response.ok || !response.body)
|
|
36
|
+
throw new Error('Release unavailable');
|
|
37
|
+
const reader = response.body.getReader();
|
|
38
|
+
const chunks = [];
|
|
39
|
+
let size = 0;
|
|
40
|
+
try {
|
|
41
|
+
while (true) {
|
|
42
|
+
const { done, value } = await reader.read();
|
|
43
|
+
if (done)
|
|
44
|
+
break;
|
|
45
|
+
size += value.byteLength;
|
|
46
|
+
if (size > 4_096)
|
|
47
|
+
throw new Error('Release metadata too large');
|
|
48
|
+
chunks.push(value);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
finally {
|
|
52
|
+
await reader.cancel().catch(() => undefined);
|
|
53
|
+
}
|
|
54
|
+
const manifest = ReleaseManifestSchema.parse(JSON.parse(Buffer.concat(chunks).toString('utf8')));
|
|
55
|
+
ReleaseVersion.parse(currentVersion);
|
|
56
|
+
const status = compareReleaseVersions(currentVersion, manifest.minimumSetupVersion) < 0
|
|
57
|
+
? 'unsupported'
|
|
58
|
+
: compareReleaseVersions(currentVersion, manifest.latestVersion) < 0
|
|
59
|
+
? 'outdated'
|
|
60
|
+
: 'current';
|
|
61
|
+
return { currentVersion, manifest, status };
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return { currentVersion, status: 'unavailable' };
|
|
65
|
+
}
|
|
66
|
+
}
|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AM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAClD,CAAA;QACD,cAAc,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;QACpC,MAAM,MAAM,GACX,sBAAsB,CAAC,cAAc,EAAE,QAAQ,CAAC,mBAAmB,CAAC,GAAG,CAAC;YACvE,CAAC,CAAC,aAAa;YACf,CAAC,CAAC,sBAAsB,CAAC,cAAc,EAAE,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC;gBACnE,CAAC,CAAC,UAAU;gBACZ,CAAC,CAAC,SAAS,CAAA;QACd,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;IAC5C,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,aAAa,EAAE,CAAA;IACjD,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from 'incur';
|
|
2
|
+
import type { SetupOptions, SetupResult } from './setup.js';
|
|
3
|
+
/** Persist only installation choices; credentials and transient repair controls never belong here. */
|
|
4
|
+
declare const PreferencesSchema: z.ZodObject<{
|
|
5
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
6
|
+
client: z.ZodArray<z.ZodEnum<{
|
|
7
|
+
claude: "claude";
|
|
8
|
+
cline: "cline";
|
|
9
|
+
codex: "codex";
|
|
10
|
+
continue: "continue";
|
|
11
|
+
cursor: "cursor";
|
|
12
|
+
gemini: "gemini";
|
|
13
|
+
grok: "grok";
|
|
14
|
+
hermes: "hermes";
|
|
15
|
+
kiro: "kiro";
|
|
16
|
+
lmstudio: "lmstudio";
|
|
17
|
+
muse: "muse";
|
|
18
|
+
openclaw: "openclaw";
|
|
19
|
+
vscode: "vscode";
|
|
20
|
+
windsurf: "windsurf";
|
|
21
|
+
zed: "zed";
|
|
22
|
+
}>>;
|
|
23
|
+
agents: z.ZodBoolean;
|
|
24
|
+
plugin: z.ZodBoolean;
|
|
25
|
+
skill: z.ZodBoolean;
|
|
26
|
+
url: z.ZodURL;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
/** Choices reapplied by refresh without discovering or enabling new client installations. */
|
|
29
|
+
export type SetupPreferences = z.infer<typeof PreferencesSchema>;
|
|
30
|
+
/** Missing state is a legacy installation; malformed state must never silently widen setup. */
|
|
31
|
+
export declare function readSetupPreferences(home?: string): Promise<SetupPreferences | undefined>;
|
|
32
|
+
/** Records the selected scope only after setup actually applied work; previews and cancellations do not persist. */
|
|
33
|
+
export declare function saveSetupPreferences(options: SetupOptions, result: SetupResult, home?: string): Promise<void>;
|
|
34
|
+
/** Removes preferences after uninstall so a later refresh cannot reinstall removed integrations. */
|
|
35
|
+
export declare function removeSetupPreferences(home?: string): Promise<void>;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
import { z } from 'incur';
|
|
6
|
+
import { CLIENT_IDS } from './clients.js';
|
|
7
|
+
/** Persist only installation choices; credentials and transient repair controls never belong here. */
|
|
8
|
+
const PreferencesSchema = z.object({
|
|
9
|
+
schemaVersion: z.literal(1),
|
|
10
|
+
client: z.array(z.enum(CLIENT_IDS)),
|
|
11
|
+
agents: z.boolean(),
|
|
12
|
+
plugin: z.boolean(),
|
|
13
|
+
skill: z.boolean(),
|
|
14
|
+
url: z.url().refine((value) => {
|
|
15
|
+
const url = new URL(value);
|
|
16
|
+
return (['https:', 'http:'].includes(url.protocol) &&
|
|
17
|
+
!url.username &&
|
|
18
|
+
!url.password &&
|
|
19
|
+
!url.search &&
|
|
20
|
+
!url.hash);
|
|
21
|
+
}),
|
|
22
|
+
});
|
|
23
|
+
function preferencesPath(home) {
|
|
24
|
+
return join(home, '.local', 'share', 'mercator', 'setup.json');
|
|
25
|
+
}
|
|
26
|
+
/** Missing state is a legacy installation; malformed state must never silently widen setup. */
|
|
27
|
+
export async function readSetupPreferences(home = homedir()) {
|
|
28
|
+
try {
|
|
29
|
+
const source = await readFile(preferencesPath(home), 'utf8');
|
|
30
|
+
if (source.length > 16_384)
|
|
31
|
+
throw new Error('Preferences too large');
|
|
32
|
+
return PreferencesSchema.parse(JSON.parse(source));
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT')
|
|
36
|
+
return undefined;
|
|
37
|
+
throw new Error('Saved Mercator setup choices are unreadable. Run targeted mercator setup to replace them.');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** Records the selected scope only after setup actually applied work; previews and cancellations do not persist. */
|
|
41
|
+
export async function saveSetupPreferences(options, result, home = homedir()) {
|
|
42
|
+
if (options.dryRun || options.manual || ('cancelled' in result && result.cancelled))
|
|
43
|
+
return;
|
|
44
|
+
if (options.removeAgents) {
|
|
45
|
+
const previous = await readSetupPreferences(home);
|
|
46
|
+
if (previous)
|
|
47
|
+
await writePreferences({ ...previous, agents: false }, home);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (!('plugin' in result && result.plugin) &&
|
|
51
|
+
!result.agents &&
|
|
52
|
+
!result.clients.some((client) => ['configured', 'already_configured', 'reconfigured'].includes(client.status)) &&
|
|
53
|
+
!('marketplacePlugins' in result &&
|
|
54
|
+
result.marketplacePlugins?.some((plugin) => plugin.status === 'configured')))
|
|
55
|
+
return;
|
|
56
|
+
const preferences = PreferencesSchema.safeParse({
|
|
57
|
+
schemaVersion: 1,
|
|
58
|
+
client: [...new Set(result.clients.map(({ client }) => client))],
|
|
59
|
+
agents: options.agents &&
|
|
60
|
+
(options.refresh === true ||
|
|
61
|
+
options.plugin ||
|
|
62
|
+
result.clients.some(({ client }) => client === 'codex')),
|
|
63
|
+
plugin: options.plugin,
|
|
64
|
+
skill: options.skill,
|
|
65
|
+
url: options.url,
|
|
66
|
+
});
|
|
67
|
+
if (!preferences.success)
|
|
68
|
+
throw new Error('Setup choices were not saved: endpoint must not contain credentials, query parameters, or fragments.');
|
|
69
|
+
await writePreferences(preferences.data, home);
|
|
70
|
+
}
|
|
71
|
+
async function writePreferences(preferences, home) {
|
|
72
|
+
const path = preferencesPath(home);
|
|
73
|
+
await mkdir(dirname(path), { recursive: true });
|
|
74
|
+
const temporary = `${path}.${randomUUID()}.tmp`;
|
|
75
|
+
try {
|
|
76
|
+
await writeFile(temporary, `${JSON.stringify(preferences, null, 2)}\n`, {
|
|
77
|
+
mode: 0o600,
|
|
78
|
+
flag: 'wx',
|
|
79
|
+
});
|
|
80
|
+
await rename(temporary, path);
|
|
81
|
+
}
|
|
82
|
+
finally {
|
|
83
|
+
await rm(temporary, { force: true });
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/** Removes preferences after uninstall so a later refresh cannot reinstall removed integrations. */
|
|
87
|
+
export async function removeSetupPreferences(home = homedir()) {
|
|
88
|
+
await rm(preferencesPath(home), { force: true });
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=setup-preferences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-preferences.js","sourceRoot":"","sources":["../src/setup-preferences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAGzC,sGAAsG;AACtG,MAAM,iBAAiB,GAAG,CAAC,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,CAAC,CAAA;IACrC,CAAC;AACF,CAAC;AAED,oGAAoG;AACpG,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,IAAI,GAAG,OAAO,EAAE;IAC5D,MAAM,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;AACjD,CAAC"}
|
package/dist/setup-render.js
CHANGED
|
@@ -74,7 +74,9 @@ export function formatSetupResult(result, color = false, debug, suggestedQueries
|
|
|
74
74
|
? '○'
|
|
75
75
|
: '✓';
|
|
76
76
|
const status = marketplacePlugin.status === 'planned'
|
|
77
|
-
?
|
|
77
|
+
? marketplacePlugin.action === 'refresh'
|
|
78
|
+
? 'would be updated'
|
|
79
|
+
: 'would be installed'
|
|
78
80
|
: humanizeStatus(marketplacePlugin.status);
|
|
79
81
|
integrations.push(formatSetupRow(glyph, `${clientLabel(marketplacePlugin.client)} plugin`, status, color));
|
|
80
82
|
if (marketplacePlugin.error)
|
|
@@ -153,6 +155,12 @@ export function formatSetupResult(result, color = false, debug, suggestedQueries
|
|
|
153
155
|
lines.push('', 'Your completed setup was preserved.', '', 'Retry readiness checks:', ' mercator doctor');
|
|
154
156
|
return appendDebugContext(lines.join('\n'), result, debug, color);
|
|
155
157
|
}
|
|
158
|
+
if ('marketplacePlugins' in result) {
|
|
159
|
+
for (const plugin of result.marketplacePlugins ?? []) {
|
|
160
|
+
if (plugin.reloadRequired)
|
|
161
|
+
lines.push(`Restart ${clientLabel(plugin.client)} to load the updated Mercator plugin.`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
156
164
|
const nativePaymentsReady = 'nativePayments' in result &&
|
|
157
165
|
result.nativePayments.every((payment) => payment.status === 'ready');
|
|
158
166
|
const pluginReload = 'plugin' in result && result.plugin ? result.plugin.reloadRequired : false;
|
|
@@ -171,7 +179,11 @@ export function formatSetupResult(result, color = false, debug, suggestedQueries
|
|
|
171
179
|
lines.push('Restart Codex to load the updated guidance.');
|
|
172
180
|
}
|
|
173
181
|
}
|
|
174
|
-
const everythingCurrent =
|
|
182
|
+
const everythingCurrent = (!('marketplacePlugins' in result) ||
|
|
183
|
+
!result.marketplacePlugins?.some((plugin) => plugin.reloadRequired ||
|
|
184
|
+
plugin.action === 'refresh' ||
|
|
185
|
+
plugin.status !== 'configured')) &&
|
|
186
|
+
result.clients.every((client) => client.status === 'already_configured') &&
|
|
175
187
|
(!('plugin' in result) || result.plugin?.status === 'already_configured') &&
|
|
176
188
|
(!('agents' in result) || result.agents?.state === 'current') &&
|
|
177
189
|
nativePaymentsReady &&
|