nofax 0.2.2 → 0.2.3
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/package.json +1 -1
- package/src/mcp-server.mjs +1 -1
- package/src/requests.mjs +4 -6
package/package.json
CHANGED
package/src/mcp-server.mjs
CHANGED
|
@@ -32,7 +32,7 @@ function result(value) {
|
|
|
32
32
|
|
|
33
33
|
export function buildMcpServer({ handlers = createMcpToolHandlers() } = {}) {
|
|
34
34
|
const server = new McpServer(
|
|
35
|
-
{ name: 'nofax', version: '0.2.
|
|
35
|
+
{ name: 'nofax', version: '0.2.3' },
|
|
36
36
|
{ instructions: SERVER_INSTRUCTIONS }
|
|
37
37
|
);
|
|
38
38
|
|
package/src/requests.mjs
CHANGED
|
@@ -103,11 +103,10 @@ export async function savePendingRequest({ home, env, request }) {
|
|
|
103
103
|
|
|
104
104
|
export async function loadRequest({ home, env, requestId }) {
|
|
105
105
|
const { file, terminal } = paths({ home, env, requestId });
|
|
106
|
+
const claimed = await loadTerminalClaim(terminal);
|
|
107
|
+
if (claimed !== null) return claimed;
|
|
106
108
|
try {
|
|
107
|
-
|
|
108
|
-
if (current.status === 'resolved') return current;
|
|
109
|
-
const claimed = await loadTerminalClaim(terminal);
|
|
110
|
-
return claimed ?? current;
|
|
109
|
+
return validateRequest(JSON.parse(await readFile(file, 'utf8')));
|
|
111
110
|
} catch (error) {
|
|
112
111
|
if (error?.code === 'ENOENT') throw new Error('NOFAX_REQUEST_NOT_FOUND');
|
|
113
112
|
if (error instanceof SyntaxError) throw new Error('NOFAX_REQUEST_INVALID_JSON');
|
|
@@ -126,11 +125,10 @@ export async function resolveRequest({ home, env, requestId, response, resolvedA
|
|
|
126
125
|
decision: response.decision,
|
|
127
126
|
...(response.text === undefined ? {} : { text: response.text })
|
|
128
127
|
});
|
|
129
|
-
const {
|
|
128
|
+
const { terminal } = paths({ home, env, requestId });
|
|
130
129
|
if (!await claimTerminal(terminal, resolved)) {
|
|
131
130
|
return loadRequest({ home, env, requestId });
|
|
132
131
|
}
|
|
133
|
-
await atomicWrite(file, resolved);
|
|
134
132
|
return resolved;
|
|
135
133
|
}
|
|
136
134
|
|