@lapxo/head 0.1.4 → 0.1.5
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 +1 -1
- package/TARGET.bound +161 -17
- package/dist/src/ahead/budget.d.ts +6 -0
- package/dist/src/ahead/budget.js +11 -0
- package/dist/src/ahead/fold.d.ts +2 -0
- package/dist/src/ahead/fold.js +19 -0
- package/dist/src/ahead/read.d.ts +10 -0
- package/dist/src/ahead/read.js +18 -0
- package/dist/src/claims/claim.d.ts +9 -0
- package/dist/src/claims/claim.js +40 -0
- package/dist/src/core/answer.d.ts +1 -0
- package/dist/src/core/package.js +4 -3
- package/dist/src/flows/call.js +1 -1
- package/dist/src/flows/read.js +24 -23
- package/dist/src/index.js +10 -6
- package/dist/src/kept/kept.d.ts +30 -0
- package/dist/src/kept/kept.js +20 -0
- package/dist/src/links/inspect.d.ts +8 -0
- package/dist/src/links/inspect.js +41 -0
- package/dist/src/links/link.d.ts +7 -0
- package/dist/src/links/link.js +25 -0
- package/dist/src/marks/compare.d.ts +9 -0
- package/dist/src/marks/compare.js +48 -0
- package/dist/src/ports/bound.d.ts +1 -0
- package/dist/src/ports/bound.js +15 -3
- package/dist/src/ports/documents.js +1 -1
- package/dist/src/ports/reading.d.ts +8 -0
- package/dist/src/ports/reading.js +14 -0
- package/dist/src/ports/spare.js +1 -1
- package/dist/src/ports/warm.js +1 -2
- package/dist/src/sources/connect.js +3 -1
- package/dist/src/tools/claim.d.ts +1 -0
- package/dist/src/tools/claim.js +1 -0
- package/dist/src/verbs/ask.d.ts +1 -1
- package/dist/src/verbs/ask.js +3 -2
- package/package.json +3 -3
|
@@ -32,7 +32,7 @@ export const fetchedAs = async (context, at, via, got, named, accept) => {
|
|
|
32
32
|
return { said: [say('fetch-redirect', { document: at })] };
|
|
33
33
|
return ((bytes) => (bytes ? { bytes, kind: kindOf(at) } : { said: [say('document-unread', { document: at })] }))(await transport.published(new URL(answer.location, at).href, named, most, wait));
|
|
34
34
|
}
|
|
35
|
-
return answer.status < 300 ? { bytes: answer.bytes, kind: kindOf(at, answer.type) } : { said: [say('fetch-status', { document: at, via, status: String(answer.status) })] };
|
|
35
|
+
return answer.status < 300 ? { bytes: answer.bytes, kind: kindOf(at, answer.type) } : { said: [say('fetch-status', { document: at, via, status: String(answer.status), at: new Date(context.now()).toISOString() })] };
|
|
36
36
|
};
|
|
37
37
|
/**
|
|
38
38
|
* Every byte a package's lines name, by the path each names: read where a line of the same scope says — an encrypted
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Printed } from './process.ts';
|
|
2
|
+
/** Only the installed instrument names a view's identity and the result bound to it. */
|
|
3
|
+
export declare const readingOf: (printed: Printed | undefined, view: string, expected?: string) => {
|
|
4
|
+
readonly identity: string;
|
|
5
|
+
readonly text?: string;
|
|
6
|
+
} | {
|
|
7
|
+
readonly refused: string;
|
|
8
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Only the installed instrument names a view's identity and the result bound to it. */
|
|
2
|
+
export const readingOf = (printed, view, expected) => {
|
|
3
|
+
if (!printed || printed.code !== 0)
|
|
4
|
+
return { refused: printed?.refusal?.['code'] ?? 'reading-identity/unavailable' };
|
|
5
|
+
try {
|
|
6
|
+
const value = printed.out.length === 1 ? JSON.parse(printed.out[0]) : undefined;
|
|
7
|
+
if (value?.['kind'] !== 'fact' || value['view'] !== view || typeof value['identity'] !== 'string' || !/^sha256:[0-9a-f]{64}$/.test(value['identity']) || (expected !== undefined && (value['identity'] !== expected || typeof value['text'] !== 'string')))
|
|
8
|
+
return { refused: 'reading-identity/context' };
|
|
9
|
+
return { identity: value['identity'], ...(expected === undefined ? {} : { text: value['text'] }) };
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return { refused: 'reading-identity/format' };
|
|
13
|
+
}
|
|
14
|
+
};
|
package/dist/src/ports/spare.js
CHANGED
|
@@ -18,7 +18,7 @@ import { pathToFileURL } from 'node:url';
|
|
|
18
18
|
const [program] = process.argv.slice(2);
|
|
19
19
|
const url = pathToFileURL(program), pipe = new Socket({ fd: 3, readable: true, writable: true });
|
|
20
20
|
const asked = new Promise((resolve) => { let text = ''; pipe.setEncoding('utf8').on('data', (chunk) => { text += chunk; }).on('error', () => undefined).on('close', () => resolve(text)); });
|
|
21
|
-
await Promise.all([...readFileSync(program, 'utf8').matchAll(
|
|
21
|
+
await Promise.all([...readFileSync(program, 'utf8').matchAll(/(?:^|[;\n])\s*import\s*(?:(?:[^'";]*?)\s*from\s*)?['"](\.{1,2}\/[^'"]+)['"]/g)].map(([, path]) => import(__rewriteRelativeImportExtension(new URL(path, url).href)).catch(() => undefined)));
|
|
22
22
|
pipe.write('ready\n');
|
|
23
23
|
const text = await asked;
|
|
24
24
|
if (!text)
|
package/dist/src/ports/warm.js
CHANGED
|
@@ -40,7 +40,6 @@ export const warmed = (program, args, at, bounds) => {
|
|
|
40
40
|
const spare = index < 0 ? undefined : live.splice(index, 1)[0];
|
|
41
41
|
if (spare === undefined)
|
|
42
42
|
return undefined;
|
|
43
|
-
void kept(program);
|
|
44
43
|
spare.child.stdio[3].end(`${JSON.stringify({ cwd: at.cwd, args, env: at.env })}\n`);
|
|
45
|
-
return watched(spare.child, bounds);
|
|
44
|
+
return watched(spare.child, bounds).finally(() => { void kept(program); });
|
|
46
45
|
};
|
|
@@ -9,6 +9,7 @@ import { paidBy, pinIn } from "../compile/pin.js";
|
|
|
9
9
|
import { adopted } from "../adopt/adopt.js";
|
|
10
10
|
import { firstRun } from "../onboard/first.js";
|
|
11
11
|
import { resolved } from "../onboard/site.js";
|
|
12
|
+
import { linked } from "../links/inspect.js";
|
|
12
13
|
import { rootIn } from "../flows/device.js";
|
|
13
14
|
import { attachedFor } from "./access.js";
|
|
14
15
|
/**
|
|
@@ -22,7 +23,8 @@ import { attachedFor } from "./access.js";
|
|
|
22
23
|
* its pins rest in, its pin held to the package's; one that differs is refused by name, and the place holds what it
|
|
23
24
|
* compiled. Nothing the sharing place was granted comes with it: access is asked here, issuer by issuer.
|
|
24
25
|
*/
|
|
25
|
-
export const connected = async (asked, context, covered = false) => ((
|
|
26
|
+
export const connected = async (asked, context, covered = false) => ((asked['document'] ?? '').startsWith(valueOf(context.lock, 'link/prefix')) ? linked(asked, context)
|
|
27
|
+
: ((got) => ('said' in got ? got.said : connectedAs(got.asked, context, covered)))(await resolved(asked, context)));
|
|
26
28
|
const connectedAs = async (asked, context, covered = false) => (asked['source'] && !(await placeOf(asked, context)) ? firstRun(asked, context, (dir, covered) => connected({ ...asked, place: dir }, context, covered))
|
|
27
29
|
: ((started) => inPlace(asked, context, async (place) => {
|
|
28
30
|
const say = sayIn(context.lock), digest = digestIn(context.lock), { documentOf, fetchedAs, kindOf } = context.files.read;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { claimed as answer } from '../claims/claim.ts';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { claimed as answer } from "../claims/claim.js";
|
package/dist/src/verbs/ask.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Answer } from '../core/answer.ts';
|
|
|
2
2
|
/**
|
|
3
3
|
* What a person asks, answered by the question it is. A view, or the region of a source or of one operation in it (what
|
|
4
4
|
* it offers, one read of it, why that answer stands, what was kept of it), is answered by look; drafted lines by plan;
|
|
5
|
-
* what is open by card; anything else by places. Each form is read with no resolution unless the lock declares one for a
|
|
5
|
+
* what is open by card; one question of several sources at once, by comparing what each said; anything else by places. Each form is read with no resolution unless the lock declares one for a
|
|
6
6
|
* person; asked why, at the one it declares to explain, and where it declares none, the same answer, said so. Nothing
|
|
7
7
|
* here writes one. An answer about one place ends with its card, taken off the fold the answer reads, valid from it.
|
|
8
8
|
* With no place at all, nothing is founded: it says so, and that connecting an API founds the person's place, the question
|
package/dist/src/verbs/ask.js
CHANGED
|
@@ -5,11 +5,12 @@ import { valueOf } from "../core/lock.js";
|
|
|
5
5
|
import { sayIn } from "../core/surface.js";
|
|
6
6
|
import { paidIn } from "../onboard/owed.js";
|
|
7
7
|
import { pendingIn } from "../sources/refused.js";
|
|
8
|
+
import { compared } from "../marks/compare.js";
|
|
8
9
|
import { cardAt } from "./card.js";
|
|
9
10
|
/**
|
|
10
11
|
* What a person asks, answered by the question it is. A view, or the region of a source or of one operation in it (what
|
|
11
12
|
* it offers, one read of it, why that answer stands, what was kept of it), is answered by look; drafted lines by plan;
|
|
12
|
-
* what is open by card; anything else by places. Each form is read with no resolution unless the lock declares one for a
|
|
13
|
+
* what is open by card; one question of several sources at once, by comparing what each said; anything else by places. Each form is read with no resolution unless the lock declares one for a
|
|
13
14
|
* person; asked why, at the one it declares to explain, and where it declares none, the same answer, said so. Nothing
|
|
14
15
|
* here writes one. An answer about one place ends with its card, taken off the fold the answer reads, valid from it.
|
|
15
16
|
* With no place at all, nothing is founded: it says so, and that connecting an API founds the person's place, the question
|
|
@@ -28,7 +29,7 @@ export const asked = async (asked, context) => {
|
|
|
28
29
|
const owed = asked['source'] && founded ? await paidIn(asked, context, place) : undefined;
|
|
29
30
|
if (owed !== undefined && !owed.answer)
|
|
30
31
|
return owed.said;
|
|
31
|
-
const answer = asked['lines'] ? await read('plan', 'plan') : asked['view'] ? await read('view', 'look') : asked['source'] ? await read('offers', 'look')
|
|
32
|
+
const answer = asked['sources'] && founded ? await compared(asked, context, place) : asked['lines'] ? await read('plan', 'plan') : asked['view'] ? await read('view', 'look') : asked['source'] ? await read('offers', 'look')
|
|
32
33
|
: !carded ? await read('places', 'places') : founded ? [...await read('card', 'card', { place }), ...await pendingIn(context, place)] : [];
|
|
33
34
|
const after = held === undefined || 'said' in held || place === undefined || !context.moved(place) ? held : await cardAt(context, place);
|
|
34
35
|
return [...(owed?.said ?? []), ...answer, ...(after === undefined || 'said' in after ? [] : [sayIn(context.lock)('card', { place: place ?? '', card: after.card, from: 'ask' })])];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lapxo/head",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "An MCP server that folds: it runs bound as a process, hands a model what bound printed, and lands what it read as receipts.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"test": "node --test test/*.test.ts && node --test --test-concurrency=1 test/time/*.test.ts"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@lapxo/bound": "0.2.
|
|
30
|
-
"@lapxo/topos": "0.2.
|
|
29
|
+
"@lapxo/bound": "0.2.5",
|
|
30
|
+
"@lapxo/topos": "0.2.1",
|
|
31
31
|
"@modelcontextprotocol/sdk": "1.32.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|