@astryxdesign/cli 0.7.3-canary.cde6233 → 0.7.3-canary.da1020b

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.
Files changed (55) hide show
  1. package/api/build/_adapter.mjs +37 -25
  2. package/api/build/blocks/blocks.d.mts +68 -20
  3. package/api/build/blocks/blocks.mjs +472 -196
  4. package/api/build/blocks/blocks.test.mjs +185 -168
  5. package/api/build/blocks/blocks.weights.json +1 -1
  6. package/api/build/build.type.mjs +1 -1
  7. package/api/build/kit/answer.d.mts +4 -1
  8. package/api/build/kit/answer.mjs +11 -3
  9. package/api/build/kit/signals.d.mts +11 -0
  10. package/api/build/kit/signals.mjs +8 -7
  11. package/api/build/tree.mjs +2 -1
  12. package/api/build/tree.test.mjs +27 -27
  13. package/api/component/_adapter.mjs +39 -5
  14. package/api/discover/_adapter.d.mts +1 -2
  15. package/api/discover/_adapter.mjs +6 -8
  16. package/api/discover/discover.mjs +0 -1
  17. package/api/docs/_adapter.mjs +4 -0
  18. package/api/doctor/_adapter.d.mts +33 -13
  19. package/api/doctor/_adapter.mjs +55 -25
  20. package/api/doctor/doctor.d.mts +23 -5
  21. package/api/doctor/doctor.mjs +81 -16
  22. package/api/doctor/doctor.test.mjs +58 -0
  23. package/api/integration/validate-integration-gaps.test.mjs +3 -0
  24. package/api/integration/validateIntegration.doc.mjs +1 -1
  25. package/api/search/_gather-templates.d.mts +0 -1
  26. package/api/search/_gather-templates.mjs +25 -0
  27. package/api/search/search.integration-block.test.mjs +100 -0
  28. package/api/template/template.mjs +5 -1
  29. package/assets/docs/tree/checks.doc.mjs +1 -1
  30. package/assets/docs/tree/ci-and-containers.doc.mjs +13 -0
  31. package/clients/cli/commands/doctor.doc.mjs +1 -1
  32. package/clients/cli/commands/outside-project.test.mjs +99 -0
  33. package/clients/cli/commands/setup-nudge.test.mjs +17 -0
  34. package/clients/cli/index.mjs +25 -8
  35. package/foundation/agent-docs/agent-doc-state.d.mts +12 -0
  36. package/foundation/agent-docs/agent-doc-state.mjs +24 -2
  37. package/foundation/agent-docs/agent-docs.mjs +5 -5
  38. package/foundation/agent-docs/computer-agent-text.d.mts +39 -2
  39. package/foundation/agent-docs/computer-agent-text.mjs +135 -8
  40. package/foundation/agent-docs/computer-agent-text.test.mjs +99 -2
  41. package/foundation/integrations/public-imports.d.mts +37 -0
  42. package/foundation/integrations/public-imports.mjs +839 -46
  43. package/foundation/integrations/public-imports.test.mjs +971 -46
  44. package/foundation/release/cache.test.mjs +24 -21
  45. package/foundation/release/global-state.d.mts +8 -4
  46. package/foundation/release/global-state.mjs +4 -2
  47. package/foundation/release/notices.d.mts +62 -8
  48. package/foundation/release/notices.mjs +136 -25
  49. package/foundation/release/notices.test.mjs +21 -0
  50. package/foundation/text/string-utils.d.mts +2 -1
  51. package/foundation/text/string-utils.mjs +16 -5
  52. package/foundation/text/suggest-order.d.mts +72 -0
  53. package/foundation/text/suggest-order.mjs +363 -0
  54. package/foundation/text/suggest-order.test.mjs +259 -0
  55. package/package.json +9 -9
@@ -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 weight per word, a bias per block, sparse rows of
241
- * [block index, weight] pairs, and five combiner numbers.
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?.classes) ? w.classes.length : 0;
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.classes.every((/** @type {unknown} */ c) => typeof c === 'string') &&
250
- Array.isArray(w.bias) &&
251
- w.bias.length === n &&
252
- w.bias.every((/** @type {unknown} */ b) => Number.isFinite(b)) &&
253
- !!w.vocab &&
254
- typeof w.vocab === 'object' &&
255
- Object.values(w.vocab).every(v => Number.isFinite(v)) &&
256
- !!w.words &&
257
- typeof w.words === 'object' &&
258
- Object.values(w.words).every(
259
- row =>
260
- Array.isArray(row) &&
261
- row.length % 2 === 0 &&
262
- row.every(
263
- (/** @type {number} */ x, /** @type {number} */ i) =>
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
- * The blocks build names for a request, re-ranked by the picker.
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[], blockText: Map<string, string>}} signals
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[]} as many blocks as build's own list: a block the request
13
- * names, one the weights do not know, or one an integration ships keeps its
14
- * slot; the picker's best, from build's blocks and search's, fill the others
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
- blockText: Map<string, string>;
21
- }, weights: BlockPickerWeights): string[];
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
- * word or word pair -> weight x1024
46
+ * stemmed words and `a_b` word pairs
25
47
  */
26
- vocab: Record<string, number>;
48
+ vocab: string[];
27
49
  /**
28
- * the block ids the words score
50
+ * one per vocab entry, x1024
29
51
  */
30
- classes: string[];
52
+ idf: number[];
31
53
  /**
32
- * one per class, x64
54
+ * the width of the shared space
33
55
  */
34
- bias: number[];
56
+ dims: number;
35
57
  /**
36
- * word -> [class index, weight x64, ...]
58
+ * base64 bytes, vocab.length x dims, row-major, each a signed weight offset by 128
37
59
  */
38
- words: Record<string, number[]>;
60
+ request: string;
61
+ requestScale: number;
39
62
  /**
40
- * the five combiner numbers
63
+ * base64 bytes, vocab.length x dims, row-major, each a signed weight offset by 128
41
64
  */
42
- theta: number[];
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;