@prestack/thread 0.1.7 → 0.1.8
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/CHANGELOG.md +84 -0
- package/dist/core/attach.js +40 -6
- package/dist/core/attach.ts +38 -6
- package/dist/core/descend.js +13 -17
- package/dist/core/descend.ts +13 -15
- package/dist/integrations/attach.js +5 -3
- package/dist/integrations/attach.ts +8 -4
- package/dist/integrations/cli.js +18 -2
- package/dist/integrations/cli.ts +19 -2
- package/dist/integrations/disk.js +4 -3
- package/dist/integrations/disk.ts +4 -3
- package/dist/integrations/generators/vault.ts +0 -1
- package/dist/integrations/target.d.ts +1 -1
- package/dist/integrations/target.ts +1 -1
- package/dist/integrity/generators/gate.ts +1 -2
- package/dist/integrity/generators/publish.ts +0 -1
- package/dist/integrity/lint.js +0 -6
- package/dist/integrity/lint.ts +0 -10
- package/dist/integrity/slopnator.ts +1 -1
- package/dist/integrity/slopnators/sl_derived_drift.js +0 -2
- package/dist/integrity/slopnators/sl_derived_drift.ts +0 -3
- package/dist/integrity/slopnators/sl_unthreaded.js +0 -2
- package/dist/integrity/slopnators/sl_unthreaded.ts +0 -5
- package/dist/integrity/sweep.ts +0 -2
- package/dist/knowledge/generators/docsgen.ts +1 -1
- package/dist/operations/generators/capability.js +20 -9
- package/dist/operations/generators/capability.ts +19 -12
- package/dist/operations/generators/compile.js +41 -28
- package/dist/operations/generators/compile.ts +48 -33
- package/dist/operations/generators/permits.js +6 -3
- package/dist/operations/generators/permits.ts +7 -5
- package/dist/operations/generators/trial.ts +1 -1
- package/package.json +1 -1
package/dist/integrations/cli.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { fileURLToPath } from 'node:url'
|
|
|
8
8
|
import { CHANNEL, FOLDER, across, attached, createFileSync, existsSync, here, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from '../integrations/disk.ts'
|
|
9
9
|
import { VAULT_DIR } from '../integrations/vault.ts'
|
|
10
10
|
|
|
11
|
-
import { CALL_PREFIX, LOCKFILES, PACKAGER, REACH, managerOf, programOf, unlisted, type Answer, type Call, type How, type Order, type Ran, type Recorded, type Running, type Target } from '../integrations/target.ts'
|
|
11
|
+
import { CALL_PREFIX, LOCKFILES, ORDERS, PACKAGER, REACH, managerOf, programOf, unlisted, type Answer, type Call, type How, type Order, type Ran, type Recorded, type Running, type Target } from '../integrations/target.ts'
|
|
12
12
|
import { CLI } from '../core/invoked.ts'
|
|
13
13
|
import { valuesIn } from '../core/rows.ts'
|
|
14
14
|
import { THING } from '../core/scope.ts'
|
|
@@ -267,6 +267,8 @@ interface Serving {
|
|
|
267
267
|
parked: Ran[]
|
|
268
268
|
replaying: Recorded[]
|
|
269
269
|
handed: number
|
|
270
|
+
readonly known: Map<string, Answer>
|
|
271
|
+
asking?: Order
|
|
270
272
|
last?: Ran
|
|
271
273
|
stop?: () => void
|
|
272
274
|
watch?: ReturnType<typeof setInterval>
|
|
@@ -282,6 +284,12 @@ const lost = (of: string): Ran => ({ there: true, ok: false, code: -1, out: '',
|
|
|
282
284
|
|
|
283
285
|
const told = (one: Order): string => JSON.stringify([one.order, one.at, one.said ?? null, one.mode ?? null, one.words ?? null])
|
|
284
286
|
|
|
287
|
+
const READS: ReadonlySet<string> = new Set(Object.entries(ORDERS).filter(([order, answer]) => order === answer).map(([order]) => order))
|
|
288
|
+
|
|
289
|
+
function kept(one: Serving, asked: Order, held: Answer): void {
|
|
290
|
+
if (READS.has(asked.order) && held.answered !== 'refused') one.known.set(told(asked), held)
|
|
291
|
+
}
|
|
292
|
+
|
|
285
293
|
const plainly = (one: Order): string => one.order + ' ' + (one.at === '' ? '.' : one.at)
|
|
286
294
|
|
|
287
295
|
const outside = (root: string, at: string): boolean => {
|
|
@@ -328,10 +336,17 @@ function watching(one: Serving): void {
|
|
|
328
336
|
continue
|
|
329
337
|
}
|
|
330
338
|
const asked: Order = { ...order, at: relative(one.root, order.at) }
|
|
339
|
+
const known = one.known.get(told(asked))
|
|
340
|
+
if (known !== undefined) {
|
|
341
|
+
reply(one.dir, short, known)
|
|
342
|
+
continue
|
|
343
|
+
}
|
|
344
|
+
if (!READS.has(asked.order)) one.known.clear()
|
|
331
345
|
const due = one.replaying.shift()
|
|
332
346
|
if (due !== undefined) {
|
|
333
347
|
if (told(due.order) === told(asked)) {
|
|
334
348
|
reply(one.dir, short, due.answered)
|
|
349
|
+
kept(one, asked, due.answered)
|
|
335
350
|
continue
|
|
336
351
|
}
|
|
337
352
|
one.replaying = []
|
|
@@ -343,6 +358,7 @@ function watching(one: Serving): void {
|
|
|
343
358
|
continue
|
|
344
359
|
}
|
|
345
360
|
one.pending = short
|
|
361
|
+
one.asking = asked
|
|
346
362
|
hand(one, still(one, [asked]))
|
|
347
363
|
}
|
|
348
364
|
}, TICK)
|
|
@@ -373,7 +389,7 @@ function begun(word: string, args: readonly string[], root: string, hears?: stri
|
|
|
373
389
|
const of = called ?? randomBytes(6).toString('hex')
|
|
374
390
|
const dir = join(tmpdir(), SERVED, randomBytes(6).toString('hex'))
|
|
375
391
|
writeFileSync(join(dir, 'channel'), '', 'utf8')
|
|
376
|
-
const one: Serving = { of, dir, root, out: '', err: '', why: '', pending: '', waiting: [], parked: [], replaying: [...recording], handed: recording.length }
|
|
392
|
+
const one: Serving = { of, dir, root, out: '', err: '', why: '', pending: '', waiting: [], parked: [], replaying: [...recording], handed: recording.length, known: new Map() }
|
|
377
393
|
const child = spawn(execPath, [...CLI, word, ...args], {
|
|
378
394
|
cwd: OWN,
|
|
379
395
|
shell: false,
|
|
@@ -422,6 +438,7 @@ async function served(word: string, args: readonly string[], within?: number, ho
|
|
|
422
438
|
const given = (how?.answered ?? [])[0]
|
|
423
439
|
if (one.pending !== '' && given !== undefined) {
|
|
424
440
|
reply(one.dir, one.pending, given)
|
|
441
|
+
if (one.asking !== undefined) kept(one, one.asking, given)
|
|
425
442
|
one.pending = ''
|
|
426
443
|
}
|
|
427
444
|
return counted(one, await next(one, within))
|
|
@@ -132,9 +132,9 @@ function overFiles(dir) {
|
|
|
132
132
|
reals.set(at, found);
|
|
133
133
|
return found;
|
|
134
134
|
},
|
|
135
|
-
fetch: (at) => {
|
|
135
|
+
fetch: (at, words) => {
|
|
136
136
|
try {
|
|
137
|
-
return String(took({ order: 'fetch', at }).said);
|
|
137
|
+
return String(took(words === undefined ? { order: 'fetch', at } : { order: 'fetch', at, words }).said);
|
|
138
138
|
}
|
|
139
139
|
finally {
|
|
140
140
|
unknown();
|
|
@@ -308,7 +308,8 @@ export const HERE = {
|
|
|
308
308
|
held = disk.statSync(at, { throwIfNoEntry: false });
|
|
309
309
|
}
|
|
310
310
|
catch (thrown) {
|
|
311
|
-
|
|
311
|
+
const code = thrown.code;
|
|
312
|
+
if (code === 'ERR_ACCESS_DENIED' || code === 'ENAMETOOLONG')
|
|
312
313
|
return 'none';
|
|
313
314
|
throw thrown;
|
|
314
315
|
}
|
|
@@ -146,9 +146,9 @@ function overFiles(dir: string): Attached {
|
|
|
146
146
|
reals.set(at, found)
|
|
147
147
|
return found
|
|
148
148
|
},
|
|
149
|
-
fetch: (at) => {
|
|
149
|
+
fetch: (at, words) => {
|
|
150
150
|
try {
|
|
151
|
-
return String(took({ order: 'fetch', at }).said)
|
|
151
|
+
return String(took(words === undefined ? { order: 'fetch', at } : { order: 'fetch', at, words }).said)
|
|
152
152
|
} finally {
|
|
153
153
|
unknown()
|
|
154
154
|
}
|
|
@@ -349,7 +349,8 @@ export const HERE: Attached = {
|
|
|
349
349
|
try {
|
|
350
350
|
held = disk.statSync(at, { throwIfNoEntry: false })
|
|
351
351
|
} catch (thrown) {
|
|
352
|
-
|
|
352
|
+
const code = (thrown as NodeJS.ErrnoException).code
|
|
353
|
+
if (code === 'ERR_ACCESS_DENIED' || code === 'ENAMETOOLONG') return 'none'
|
|
353
354
|
throw thrown
|
|
354
355
|
}
|
|
355
356
|
if (held === undefined) return 'none'
|
|
@@ -2,7 +2,6 @@ import { existsSync, readFileSync, writeFileSync } from '../disk.ts'
|
|
|
2
2
|
import { valuesIn } from '../../core/rows.ts'
|
|
3
3
|
import { dirname, join, relative } from 'node:path'
|
|
4
4
|
import { argv, stderr, stdout } from 'node:process'
|
|
5
|
-
import { fileURLToPath } from 'node:url'
|
|
6
5
|
|
|
7
6
|
import ts from 'typescript'
|
|
8
7
|
|
|
@@ -48,7 +48,7 @@ export interface Answering {
|
|
|
48
48
|
readonly real: (at: string) => string;
|
|
49
49
|
}
|
|
50
50
|
export interface Attached extends Answering {
|
|
51
|
-
readonly fetch: (at: string) => string;
|
|
51
|
+
readonly fetch: (at: string, words?: readonly string[]) => string;
|
|
52
52
|
readonly run: (at: string, words: readonly string[]) => Ran;
|
|
53
53
|
}
|
|
54
54
|
export declare const ORDERS: {
|
|
@@ -127,7 +127,7 @@ export interface Answering {
|
|
|
127
127
|
|
|
128
128
|
export interface Attached extends Answering {
|
|
129
129
|
|
|
130
|
-
readonly fetch: (at: string) => string
|
|
130
|
+
readonly fetch: (at: string, words?: readonly string[]) => string
|
|
131
131
|
|
|
132
132
|
readonly run: (at: string, words: readonly string[]) => Ran
|
|
133
133
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { starts } from '../../integrations/cli.ts'
|
|
2
2
|
import { createHash } from 'node:crypto'
|
|
3
|
-
import {
|
|
3
|
+
import { join } from 'node:path'
|
|
4
4
|
import { argv, execPath, stderr, stdout } from 'node:process'
|
|
5
|
-
import { fileURLToPath } from 'node:url'
|
|
6
5
|
import { descend } from '../../core/descend.ts'
|
|
7
6
|
import { attached, existsSync, here, readdirSync, readFileSync, rmSync, writeFileSync } from '../../integrations/disk.ts'
|
|
8
7
|
import { LOADER, exit } from '../../core/invoked.ts'
|
|
@@ -3,7 +3,6 @@ import { existsSync, readFileSync } from '../../integrations/disk.ts'
|
|
|
3
3
|
import { valuesIn } from '../../core/rows.ts'
|
|
4
4
|
import { join } from 'node:path'
|
|
5
5
|
import { argv, env, execPath, stderr, stdout } from 'node:process'
|
|
6
|
-
import { pathToFileURL } from 'node:url'
|
|
7
6
|
import { CLI, exit } from '../../core/invoked.ts'
|
|
8
7
|
import { THING as TYPED, named } from '../../core/scope.ts'
|
|
9
8
|
import { findTree, inTree } from '../../core/tree.ts'
|
package/dist/integrity/lint.js
CHANGED
|
@@ -4,12 +4,6 @@ import tseslint from 'typescript-eslint';
|
|
|
4
4
|
import { THING } from '../core/scope.js';
|
|
5
5
|
import { CONSTRAINTS, shown } from './constraint.js';
|
|
6
6
|
import { NOT_WRITTEN, governs, subject, reads, visits, load, ROOT, rules as appRules, slopnatorName, } from './slopnator.js';
|
|
7
|
-
const PROBE = {
|
|
8
|
-
filename: 'probe.ts',
|
|
9
|
-
text: '',
|
|
10
|
-
ancestors: () => [],
|
|
11
|
-
comments: () => [],
|
|
12
|
-
};
|
|
13
7
|
export function ruleMessage(rule) {
|
|
14
8
|
const cites = (rule.cites ?? []).map((cite) => `${cite.on} — ${cite.said}`).join(' · ');
|
|
15
9
|
return cites === '' ? `${rule.bans} — ${rule.because}. Instead: ${rule.instead}.` : `${rule.bans} — ${rule.because}. Instead: ${rule.instead}. (${cites})`;
|
package/dist/integrity/lint.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { starts } from '../integrations/cli.ts'
|
|
2
|
-
import { fileURLToPath } from 'node:url'
|
|
3
2
|
|
|
4
3
|
import { Linter, type Rule } from 'eslint'
|
|
5
4
|
import tseslint from 'typescript-eslint'
|
|
@@ -20,15 +19,6 @@ import {
|
|
|
20
19
|
type SlopnatorContext,
|
|
21
20
|
} from './slopnator.ts'
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const PROBE: SlopnatorContext = {
|
|
26
|
-
filename: 'probe.ts',
|
|
27
|
-
text: '',
|
|
28
|
-
ancestors: () => [],
|
|
29
|
-
comments: () => [],
|
|
30
|
-
}
|
|
31
|
-
|
|
32
22
|
export function ruleMessage(rule: Constraint): string {
|
|
33
23
|
const cites = (rule.cites ?? []).map((cite) => `${cite.on} — ${cite.said}`).join(' · ')
|
|
34
24
|
return cites === '' ? `${rule.bans} — ${rule.because}. Instead: ${rule.instead}.` : `${rule.bans} — ${rule.because}. Instead: ${rule.instead}. (${cites})`
|
|
@@ -8,7 +8,7 @@ import { invoked } from '../core/invoked.ts'
|
|
|
8
8
|
|
|
9
9
|
import { listBounds, quoted, withSeed } from '../core/rows.ts'
|
|
10
10
|
|
|
11
|
-
import { CONSTRAINTS, type Constraint, type Proof
|
|
11
|
+
import { CONSTRAINTS, type Constraint, type Proof } from './constraint.ts'
|
|
12
12
|
import { findTree, inTree } from '../core/tree.ts'
|
|
13
13
|
|
|
14
14
|
export const NOT_WRITTEN = Symbol.for('thread.slopnator.not_written')
|
|
@@ -2,8 +2,6 @@ import { readFileSync } from '../../integrations/disk.js';
|
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
3
|
import { atsIn } from './sl_unthreaded.js';
|
|
4
4
|
import { reached } from '../../core/descend.js';
|
|
5
|
-
import { findTree } from '../../core/tree.js';
|
|
6
|
-
const ROOT = `${findTree().at}/`;
|
|
7
5
|
export function derivations(root) {
|
|
8
6
|
const found = [];
|
|
9
7
|
for (const at of reached()) {
|
|
@@ -4,9 +4,6 @@ import { resolve } from 'node:path'
|
|
|
4
4
|
import type { Slopnator } from '../slopnator.ts'
|
|
5
5
|
import { atsIn } from './sl_unthreaded.ts'
|
|
6
6
|
import { reached } from '../../core/descend.ts'
|
|
7
|
-
import { findTree } from '../../core/tree.ts'
|
|
8
|
-
|
|
9
|
-
const ROOT = `${findTree().at}/`
|
|
10
7
|
|
|
11
8
|
export interface Derivation {
|
|
12
9
|
readonly at: string
|
|
@@ -7,7 +7,6 @@ const TREE = TREE_AT.name;
|
|
|
7
7
|
const THREAD_AT = `${TREE_AT.name}/thread.ts`;
|
|
8
8
|
const FOLLOWABLE = /\.(ts|tsx|mts|cts|mjs|cjs|js)$/;
|
|
9
9
|
const LISTS = new Set(LINEAGE);
|
|
10
|
-
let threaders;
|
|
11
10
|
let tree;
|
|
12
11
|
const parsed = new Map();
|
|
13
12
|
const broke = new Map();
|
|
@@ -233,7 +232,6 @@ export function index() {
|
|
|
233
232
|
export function forget() {
|
|
234
233
|
parsed.clear();
|
|
235
234
|
broke.clear();
|
|
236
|
-
threaders = undefined;
|
|
237
235
|
tree = undefined;
|
|
238
236
|
forgetDescent();
|
|
239
237
|
}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { readFileSync } from '../../integrations/disk.ts'
|
|
2
|
-
import { resolve } from 'node:path'
|
|
3
|
-
|
|
4
1
|
import { parser } from 'typescript-eslint'
|
|
5
2
|
|
|
6
3
|
import type { Slopnator } from '../slopnator.ts'
|
|
@@ -15,7 +12,6 @@ const THREAD_AT = `${TREE_AT.name}/thread.ts`
|
|
|
15
12
|
const FOLLOWABLE = /\.(ts|tsx|mts|cts|mjs|cjs|js)$/
|
|
16
13
|
const LISTS: ReadonlySet<string> = new Set(LINEAGE)
|
|
17
14
|
|
|
18
|
-
let threaders: ReadonlySet<string> | undefined
|
|
19
15
|
let tree: Index | undefined
|
|
20
16
|
const parsed = new Map<string, readonly Reach[]>()
|
|
21
17
|
const broke = new Map<string, string>()
|
|
@@ -295,7 +291,6 @@ export function index(): Index {
|
|
|
295
291
|
export function forget(): void {
|
|
296
292
|
parsed.clear()
|
|
297
293
|
broke.clear()
|
|
298
|
-
threaders = undefined
|
|
299
294
|
tree = undefined
|
|
300
295
|
forgetDescent()
|
|
301
296
|
}
|
package/dist/integrity/sweep.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { starts } from '../integrations/cli.ts'
|
|
|
2
2
|
import { attached, existsSync, readFileSync, readdirSync } from '../integrations/disk.ts'
|
|
3
3
|
import { join } from 'node:path'
|
|
4
4
|
import { argv, stdout } from 'node:process'
|
|
5
|
-
import { pathToFileURL } from 'node:url'
|
|
6
5
|
|
|
7
6
|
import { runChecker, type Finding } from '../core/finding.ts'
|
|
8
7
|
import { exit, invoked } from '../core/invoked.ts'
|
|
@@ -11,7 +10,6 @@ import { parser } from 'typescript-eslint'
|
|
|
11
10
|
|
|
12
11
|
import { CONSTRAINTS, type Constraint, type Proof } from './constraint.ts'
|
|
13
12
|
import { NOT_WRITTEN, ROOT, derivedHere, governs, load, proofsOf, reads, rules, slopnatorName, subject, sweeps, visits, type Reading, type Slopnator, type Spoken, type Visiting } from './slopnator.ts'
|
|
14
|
-
import { ruleMessage } from './lint.ts'
|
|
15
13
|
import { crossed, deriveTrials, runTrials } from './generators/trial.ts'
|
|
16
14
|
|
|
17
15
|
const PARSEABLE = /\.(ts|tsx|mts|cts|mjs|cjs|js|jsx)$/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { existsSync, readFileSync, writeFileSync } from '../../integrations/disk.ts'
|
|
2
|
-
import {
|
|
2
|
+
import { resolve } from 'node:path'
|
|
3
3
|
import { argv, stderr, stdout } from 'node:process'
|
|
4
4
|
|
|
5
5
|
import { exit } from '../../core/invoked.ts'
|
|
@@ -535,6 +535,7 @@ export function reaching(targets, calls, stores, vaulted, carried) {
|
|
|
535
535
|
const file = (one.declares ?? [])[0]?.at;
|
|
536
536
|
return file === undefined ? [] : [{ from: beside(REACHING_AT, file), as: 'c' + String(at), of: one.id }];
|
|
537
537
|
});
|
|
538
|
+
const used = new Set();
|
|
538
539
|
const opened = targets
|
|
539
540
|
.map((one) => {
|
|
540
541
|
const reach = reachOf(one.id);
|
|
@@ -545,32 +546,43 @@ export function reaching(targets, calls, stores, vaulted, carried) {
|
|
|
545
546
|
const each = calls
|
|
546
547
|
.filter((call) => call.of === one.id && one.takes.includes(call.id))
|
|
547
548
|
.map((call) => quoted(call.id.replace(/^cl_/, '')) + ': ' + held.as + '[' + quoted(call.path) + ']');
|
|
549
|
+
if (each.length > 0)
|
|
550
|
+
used.add(held.as);
|
|
548
551
|
return ' ' + one.id + ': { ' + each.join(', ') + ' },';
|
|
549
552
|
}
|
|
550
553
|
if (reach === 'disk') {
|
|
551
554
|
const through = one.requires.find((each) => reachOf(each) !== undefined);
|
|
552
|
-
|
|
555
|
+
if (through !== undefined)
|
|
556
|
+
return '';
|
|
557
|
+
used.add('HERE');
|
|
558
|
+
return ' ' + one.id + ': HERE,';
|
|
553
559
|
}
|
|
554
560
|
if (reach === 'cli') {
|
|
555
561
|
const each = calls
|
|
556
562
|
.filter((call) => call.of === one.id && one.takes.includes(call.id))
|
|
557
563
|
.map((call) => quoted(call.id.replace(/^cl_/, '')) + ': ' + quoted(call.path));
|
|
564
|
+
used.add('running');
|
|
558
565
|
return ' ' + one.id + ': running(' + quoted(one.id.replace(/^cli_/, '')) + ', { ' + each.join(', ') + ' }, process.cwd()),';
|
|
559
566
|
}
|
|
560
|
-
if (reach === 'https')
|
|
567
|
+
if (reach === 'https') {
|
|
568
|
+
used.add('sendingHttp');
|
|
561
569
|
return ' ' + one.id + ': sendingHttp(),';
|
|
570
|
+
}
|
|
562
571
|
const held = named.find((each) => each.of === one.id);
|
|
563
|
-
|
|
572
|
+
if (held === undefined)
|
|
573
|
+
return '';
|
|
574
|
+
used.add(held.as);
|
|
575
|
+
return ' ' + one.id + ': ' + held.as + ',';
|
|
564
576
|
})
|
|
565
577
|
.filter((each) => each !== '');
|
|
566
578
|
return [
|
|
567
|
-
'import { HERE } from ' + quoted(runtime(REACHING_AT, '../../integrations/disk.ts')),
|
|
568
|
-
'import { running } from ' + quoted(runtime(REACHING_AT, '../../integrations/cli.ts')),
|
|
569
|
-
'import { sendingHttp } from ' + quoted(runtime(REACHING_AT, '../../integrations/https.ts')),
|
|
579
|
+
...(used.has('HERE') ? ['import { HERE } from ' + quoted(runtime(REACHING_AT, '../../integrations/disk.ts'))] : []),
|
|
580
|
+
...(used.has('running') ? ['import { running } from ' + quoted(runtime(REACHING_AT, '../../integrations/cli.ts'))] : []),
|
|
581
|
+
...(used.has('sendingHttp') ? ['import { sendingHttp } from ' + quoted(runtime(REACHING_AT, '../../integrations/https.ts'))] : []),
|
|
570
582
|
'import type { Counting } from ' +
|
|
571
583
|
quoted(carried ? packageOf('operations') + '/operations/operations' : runtime(REACHING_AT, '../operations.ts')),
|
|
572
|
-
...named.map((each) => 'import { store as ' + each.as + ' } from ' + quoted(each.from)),
|
|
573
|
-
...adapted.map((each) => 'import { calls as ' + each.as + ' } from ' + quoted(each.from)),
|
|
584
|
+
...named.filter((each) => used.has(each.as)).map((each) => 'import { store as ' + each.as + ' } from ' + quoted(each.from)),
|
|
585
|
+
...adapted.filter((each) => used.has(each.as)).map((each) => 'import { calls as ' + each.as + ' } from ' + quoted(each.from)),
|
|
574
586
|
...(vaulted ? ['import { vault } from ' + quoted(beside(REACHING_AT, VAULT_AT))] : []),
|
|
575
587
|
'',
|
|
576
588
|
'declare module ' +
|
|
@@ -807,7 +819,6 @@ if (invoked(import.meta.url)) {
|
|
|
807
819
|
}
|
|
808
820
|
const checking = argv.includes('--check');
|
|
809
821
|
let adrift = 0;
|
|
810
|
-
const keeping = existsSync(resolve(ROOT, ENTITIES_AT));
|
|
811
822
|
if (found.length === 0 && refusals.length === 0) {
|
|
812
823
|
console.log('capabilities: this app declares no operation, so nothing is reachable through one yet.');
|
|
813
824
|
exit(adrift > 0 ? 1 : 0);
|
|
@@ -11,7 +11,7 @@ import { named as packageOf } from '../../core/scope.ts'
|
|
|
11
11
|
import { PREFIXES } from '../../core/thread.ts'
|
|
12
12
|
|
|
13
13
|
import { secrecyOf, type Secret } from '../../integrations/secret.ts'
|
|
14
|
-
import { reachOf, servesBrowser,
|
|
14
|
+
import { reachOf, servesBrowser, targetOf, type Call, type Target, type Webhook } from '../../integrations/target.ts'
|
|
15
15
|
|
|
16
16
|
import {
|
|
17
17
|
CAPABILITIES_AT,
|
|
@@ -33,7 +33,6 @@ import {
|
|
|
33
33
|
type Surface,
|
|
34
34
|
} from '../capabilities.ts'
|
|
35
35
|
import { ANONYMOUS, ENVIRONMENT } from '../../core/actor.ts'
|
|
36
|
-
import { PERMITS_AT } from '../access.ts'
|
|
37
36
|
import { DISPATCH_AT } from '../dispatch.ts'
|
|
38
37
|
import { STREAMED, TOLD } from '../../integrations/https.ts'
|
|
39
38
|
import { holdsRow, listBounds, marked, nestedBounds, rowsIn, valuesIn, withField, withRow, withTopField, withoutRow } from '../../core/rows.ts'
|
|
@@ -642,6 +641,7 @@ export function reaching(
|
|
|
642
641
|
return file === undefined ? [] : [{ from: beside(REACHING_AT, file), as: 'c' + String(at), of: one.id }]
|
|
643
642
|
})
|
|
644
643
|
|
|
644
|
+
const used = new Set<string>()
|
|
645
645
|
const opened = targets
|
|
646
646
|
.map((one) => {
|
|
647
647
|
const reach = reachOf(one.id)
|
|
@@ -651,32 +651,41 @@ export function reaching(
|
|
|
651
651
|
const each = calls
|
|
652
652
|
.filter((call) => call.of === one.id && one.takes.includes(call.id))
|
|
653
653
|
.map((call) => quoted(call.id.replace(/^cl_/, '')) + ': ' + held.as + '[' + quoted(call.path) + ']')
|
|
654
|
+
if (each.length > 0) used.add(held.as)
|
|
654
655
|
return ' ' + one.id + ': { ' + each.join(', ') + ' },'
|
|
655
656
|
}
|
|
656
657
|
if (reach === 'disk') {
|
|
657
658
|
const through = one.requires.find((each) => reachOf(each) !== undefined)
|
|
658
|
-
|
|
659
|
+
if (through !== undefined) return ''
|
|
660
|
+
used.add('HERE')
|
|
661
|
+
return ' ' + one.id + ': HERE,'
|
|
659
662
|
}
|
|
660
663
|
if (reach === 'cli') {
|
|
661
664
|
const each = calls
|
|
662
665
|
.filter((call) => call.of === one.id && one.takes.includes(call.id))
|
|
663
666
|
.map((call) => quoted(call.id.replace(/^cl_/, '')) + ': ' + quoted(call.path))
|
|
667
|
+
used.add('running')
|
|
664
668
|
return ' ' + one.id + ': running(' + quoted(one.id.replace(/^cli_/, '')) + ', { ' + each.join(', ') + ' }, process.cwd()),'
|
|
665
669
|
}
|
|
666
|
-
if (reach === 'https')
|
|
670
|
+
if (reach === 'https') {
|
|
671
|
+
used.add('sendingHttp')
|
|
672
|
+
return ' ' + one.id + ': sendingHttp(),'
|
|
673
|
+
}
|
|
667
674
|
const held = named.find((each) => each.of === one.id)
|
|
668
|
-
|
|
675
|
+
if (held === undefined) return ''
|
|
676
|
+
used.add(held.as)
|
|
677
|
+
return ' ' + one.id + ': ' + held.as + ','
|
|
669
678
|
})
|
|
670
679
|
.filter((each) => each !== '')
|
|
671
680
|
|
|
672
681
|
return [
|
|
673
|
-
'import { HERE } from ' + quoted(runtime(REACHING_AT, '../../integrations/disk.ts')),
|
|
674
|
-
'import { running } from ' + quoted(runtime(REACHING_AT, '../../integrations/cli.ts')),
|
|
675
|
-
'import { sendingHttp } from ' + quoted(runtime(REACHING_AT, '../../integrations/https.ts')),
|
|
682
|
+
...(used.has('HERE') ? ['import { HERE } from ' + quoted(runtime(REACHING_AT, '../../integrations/disk.ts'))] : []),
|
|
683
|
+
...(used.has('running') ? ['import { running } from ' + quoted(runtime(REACHING_AT, '../../integrations/cli.ts'))] : []),
|
|
684
|
+
...(used.has('sendingHttp') ? ['import { sendingHttp } from ' + quoted(runtime(REACHING_AT, '../../integrations/https.ts'))] : []),
|
|
676
685
|
'import type { Counting } from ' +
|
|
677
686
|
quoted(carried ? packageOf('operations') + '/operations/operations' : runtime(REACHING_AT, '../operations.ts')),
|
|
678
|
-
...named.map((each) => 'import { store as ' + each.as + ' } from ' + quoted(each.from)),
|
|
679
|
-
...adapted.map((each) => 'import { calls as ' + each.as + ' } from ' + quoted(each.from)),
|
|
687
|
+
...named.filter((each) => used.has(each.as)).map((each) => 'import { store as ' + each.as + ' } from ' + quoted(each.from)),
|
|
688
|
+
...adapted.filter((each) => used.has(each.as)).map((each) => 'import { calls as ' + each.as + ' } from ' + quoted(each.from)),
|
|
680
689
|
...(vaulted ? ['import { vault } from ' + quoted(beside(REACHING_AT, VAULT_AT))] : []),
|
|
681
690
|
'',
|
|
682
691
|
'declare module ' +
|
|
@@ -951,8 +960,6 @@ if (invoked(import.meta.url)) {
|
|
|
951
960
|
const checking = argv.includes('--check')
|
|
952
961
|
let adrift = 0
|
|
953
962
|
|
|
954
|
-
const keeping = existsSync(resolve(ROOT, ENTITIES_AT))
|
|
955
|
-
|
|
956
963
|
if (found.length === 0 && refusals.length === 0) {
|
|
957
964
|
console.log('capabilities: this app declares no operation, so nothing is reachable through one yet.')
|
|
958
965
|
exit(adrift > 0 ? 1 : 0)
|