@astryxdesign/cli 0.7.3-canary.f8fad28 → 0.7.3-canary.fba04ed
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/api/build/_adapter.mjs +37 -25
- package/api/build/blocks/blocks.d.mts +68 -20
- package/api/build/blocks/blocks.mjs +472 -196
- package/api/build/blocks/blocks.test.mjs +185 -168
- package/api/build/blocks/blocks.weights.json +1 -1
- package/api/build/build.type.mjs +1 -1
- package/api/build/kit/answer.d.mts +4 -1
- package/api/build/kit/answer.mjs +11 -3
- package/api/build/kit/signals.d.mts +11 -0
- package/api/build/kit/signals.mjs +8 -7
- package/api/build/tree.mjs +2 -1
- package/api/build/tree.test.mjs +27 -27
- package/api/component/_adapter.mjs +39 -5
- package/api/discover/_adapter.d.mts +1 -2
- package/api/discover/_adapter.mjs +6 -8
- package/api/discover/discover.mjs +0 -1
- package/api/docs/_adapter.mjs +4 -0
- package/api/doctor/_adapter.d.mts +33 -13
- package/api/doctor/_adapter.mjs +55 -25
- package/api/doctor/doctor.d.mts +23 -5
- package/api/doctor/doctor.mjs +81 -16
- package/api/doctor/doctor.test.mjs +58 -0
- package/api/integration/validate-integration-gaps.test.mjs +3 -0
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/search/_gather-templates.d.mts +0 -1
- package/api/search/_gather-templates.mjs +25 -0
- package/api/search/search.integration-block.test.mjs +100 -0
- package/api/template/template.mjs +5 -1
- package/assets/docs/tree/checks.doc.mjs +1 -1
- package/assets/docs/tree/ci-and-containers.doc.mjs +13 -0
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/outside-project.test.mjs +99 -0
- package/clients/cli/commands/setup-nudge.test.mjs +17 -0
- package/clients/cli/index.mjs +25 -8
- package/foundation/agent-docs/agent-doc-state.d.mts +12 -0
- package/foundation/agent-docs/agent-doc-state.mjs +24 -2
- package/foundation/agent-docs/agent-docs.mjs +5 -5
- package/foundation/agent-docs/computer-agent-text.d.mts +39 -2
- package/foundation/agent-docs/computer-agent-text.mjs +135 -8
- package/foundation/agent-docs/computer-agent-text.test.mjs +99 -2
- package/foundation/integrations/public-imports.d.mts +37 -0
- package/foundation/integrations/public-imports.mjs +839 -46
- package/foundation/integrations/public-imports.test.mjs +971 -46
- package/foundation/release/cache.test.mjs +24 -21
- package/foundation/release/global-state.d.mts +8 -4
- package/foundation/release/global-state.mjs +4 -2
- package/foundation/release/notices.d.mts +62 -8
- package/foundation/release/notices.mjs +136 -25
- package/foundation/release/notices.test.mjs +21 -0
- package/foundation/text/string-utils.d.mts +2 -1
- package/foundation/text/string-utils.mjs +16 -5
- package/foundation/text/suggest-order.d.mts +72 -0
- package/foundation/text/suggest-order.mjs +363 -0
- package/foundation/text/suggest-order.test.mjs +259 -0
- package/package.json +9 -9
package/api/build/_adapter.mjs
CHANGED
|
@@ -235,39 +235,51 @@ export function isWeightsFile(file) {
|
|
|
235
235
|
);
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
+
/** The ranking coefficients the picker reads. */
|
|
239
|
+
const PICKER_THETA = [
|
|
240
|
+
'g',
|
|
241
|
+
'grank',
|
|
242
|
+
'gmargin',
|
|
243
|
+
'seen',
|
|
244
|
+
'lex',
|
|
245
|
+
'sscore',
|
|
246
|
+
'scov',
|
|
247
|
+
'srank',
|
|
248
|
+
'inkit',
|
|
249
|
+
'kitpos',
|
|
250
|
+
'mention',
|
|
251
|
+
'show',
|
|
252
|
+
];
|
|
253
|
+
|
|
238
254
|
/**
|
|
239
255
|
* Whether a parsed block picker file has the shape the picker reads: a
|
|
240
|
-
* vocabulary
|
|
241
|
-
*
|
|
256
|
+
* vocabulary with an idf per entry, two signed byte matrices of vocabulary x
|
|
257
|
+
* dims (base64) with their scales, the lexical weight, the known blocks, and
|
|
258
|
+
* the ranking coefficients.
|
|
242
259
|
* @param {any} w
|
|
243
260
|
* @returns {w is import('./blocks/blocks.mjs').BlockPickerWeights}
|
|
244
261
|
*/
|
|
245
262
|
function isBlockPickerWeights(w) {
|
|
246
|
-
const n = Array.isArray(w?.
|
|
263
|
+
const n = Array.isArray(w?.vocab) ? w.vocab.length : 0;
|
|
264
|
+
const size = (/** @type {unknown} */ s) =>
|
|
265
|
+
typeof s === 'string' ? Buffer.from(s, 'base64').length : -1;
|
|
247
266
|
return (
|
|
248
267
|
n > 0 &&
|
|
249
|
-
w.
|
|
250
|
-
Array.isArray(w.
|
|
251
|
-
w.
|
|
252
|
-
w.
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
Number.isFinite(x) &&
|
|
265
|
-
(i % 2 === 1 || (Number.isInteger(x) && x >= 0 && x < n)),
|
|
266
|
-
),
|
|
267
|
-
) &&
|
|
268
|
-
Array.isArray(w.theta) &&
|
|
269
|
-
w.theta.length === 5 &&
|
|
270
|
-
w.theta.every((/** @type {unknown} */ x) => Number.isFinite(x))
|
|
268
|
+
w.vocab.every((/** @type {unknown} */ t) => typeof t === 'string') &&
|
|
269
|
+
Array.isArray(w.idf) &&
|
|
270
|
+
w.idf.length === n &&
|
|
271
|
+
w.idf.every((/** @type {unknown} */ x) => Number.isFinite(x)) &&
|
|
272
|
+
Number.isInteger(w.dims) &&
|
|
273
|
+
w.dims > 0 &&
|
|
274
|
+
size(w.request) === n * w.dims &&
|
|
275
|
+
size(w.doc) === n * w.dims &&
|
|
276
|
+
Number.isFinite(w.requestScale) &&
|
|
277
|
+
Number.isFinite(w.docScale) &&
|
|
278
|
+
Number.isFinite(w.lexical) &&
|
|
279
|
+
Array.isArray(w.known) &&
|
|
280
|
+
w.known.every((/** @type {unknown} */ b) => typeof b === 'string') &&
|
|
281
|
+
!!w.theta &&
|
|
282
|
+
PICKER_THETA.every(k => Number.isFinite(w.theta[k]))
|
|
271
283
|
);
|
|
272
284
|
}
|
|
273
285
|
|
|
@@ -2,43 +2,91 @@
|
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* A word with a plural or verb ending removed (words over four letters):
|
|
6
|
+
* "-ies" becomes "-y"; "-es" goes only after s, x, z, ch, or sh; otherwise a
|
|
7
|
+
* final "s" goes, but never after another "s"; then "-ing" or "-ed".
|
|
8
|
+
* @param {string} w
|
|
9
|
+
* @returns {string}
|
|
10
|
+
*/
|
|
11
|
+
export function stemOf(w: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* An identifier's words, lowercase: "SideNavNestedItems" -> side, nav,
|
|
14
|
+
* nested, items.
|
|
15
|
+
* @param {string} text
|
|
16
|
+
* @returns {string[]}
|
|
17
|
+
*/
|
|
18
|
+
export function wordsOf(text: string): string[];
|
|
19
|
+
/**
|
|
20
|
+
* A text's stemmed content words, then its adjacent pairs as `a_b`.
|
|
21
|
+
* @param {string} text
|
|
22
|
+
* @returns {string[]}
|
|
23
|
+
*/
|
|
24
|
+
export function termsOf(text: string): string[];
|
|
25
|
+
/**
|
|
26
|
+
* The blocks build names for a request, ranked by the picker.
|
|
6
27
|
* @param {string} request
|
|
7
|
-
* @param {{kitBlocks: string[], searched: BlockScore[], foreign: string[],
|
|
8
|
-
* build's signals: the kit's blocks, search's block results [id, score,
|
|
9
|
-
* matched, total] in order, the blocks whose package is not Core's, and
|
|
10
|
-
* each searched block's display name and description
|
|
28
|
+
* @param {{kitBlocks: string[], searched: BlockScore[], foreign: string[], catalog: CatalogBlock[], components: CatalogComponent[]}} signals
|
|
11
29
|
* @param {BlockPickerWeights} weights
|
|
12
|
-
* @returns {string[]
|
|
13
|
-
* names
|
|
14
|
-
*
|
|
30
|
+
* @returns {{names: string[], entries: Map<string, SearchResultEntry>}} as
|
|
31
|
+
* many names as build's own list, best first; an entry for each listed
|
|
32
|
+
* block search did not return
|
|
15
33
|
*/
|
|
16
34
|
export function pickBlocks(request: string, signals: {
|
|
17
35
|
kitBlocks: string[];
|
|
18
36
|
searched: BlockScore[];
|
|
19
37
|
foreign: string[];
|
|
20
|
-
|
|
21
|
-
|
|
38
|
+
catalog: CatalogBlock[];
|
|
39
|
+
components: CatalogComponent[];
|
|
40
|
+
}, weights: BlockPickerWeights): {
|
|
41
|
+
names: string[];
|
|
42
|
+
entries: Map<string, SearchResultEntry>;
|
|
43
|
+
};
|
|
22
44
|
export type BlockPickerWeights = {
|
|
23
45
|
/**
|
|
24
|
-
*
|
|
46
|
+
* stemmed words and `a_b` word pairs
|
|
25
47
|
*/
|
|
26
|
-
vocab:
|
|
48
|
+
vocab: string[];
|
|
27
49
|
/**
|
|
28
|
-
*
|
|
50
|
+
* one per vocab entry, x1024
|
|
29
51
|
*/
|
|
30
|
-
|
|
52
|
+
idf: number[];
|
|
31
53
|
/**
|
|
32
|
-
*
|
|
54
|
+
* the width of the shared space
|
|
33
55
|
*/
|
|
34
|
-
|
|
56
|
+
dims: number;
|
|
35
57
|
/**
|
|
36
|
-
*
|
|
58
|
+
* base64 bytes, vocab.length x dims, row-major, each a signed weight offset by 128
|
|
37
59
|
*/
|
|
38
|
-
|
|
60
|
+
request: string;
|
|
61
|
+
requestScale: number;
|
|
39
62
|
/**
|
|
40
|
-
*
|
|
63
|
+
* base64 bytes, vocab.length x dims, row-major, each a signed weight offset by 128
|
|
41
64
|
*/
|
|
42
|
-
|
|
65
|
+
doc: string;
|
|
66
|
+
docScale: number;
|
|
67
|
+
/**
|
|
68
|
+
* the weight of the plain overlap
|
|
69
|
+
*/
|
|
70
|
+
lexical: number;
|
|
71
|
+
/**
|
|
72
|
+
* the blocks the matrices were fitted with
|
|
73
|
+
*/
|
|
74
|
+
known: string[];
|
|
75
|
+
/**
|
|
76
|
+
* the ranking coefficients
|
|
77
|
+
*/
|
|
78
|
+
theta: Record<string, number>;
|
|
43
79
|
};
|
|
44
80
|
export type BlockScore = import("../kit/signals.mjs").BlockScore;
|
|
81
|
+
export type CatalogBlock = {
|
|
82
|
+
name: string;
|
|
83
|
+
package?: string;
|
|
84
|
+
displayName?: string;
|
|
85
|
+
description?: string;
|
|
86
|
+
command?: string;
|
|
87
|
+
};
|
|
88
|
+
export type CatalogComponent = {
|
|
89
|
+
name: string;
|
|
90
|
+
keywords?: string[];
|
|
91
|
+
};
|
|
92
|
+
export type SearchResultEntry = import("../../search/search.type.mjs").SearchResultEntry;
|