@polycode-projects/the-mechanical-code-talker 1.9.2 → 1.10.1
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 +441 -202
- package/bin/tmct.mjs +126 -1
- package/package.json +4 -2
- package/src/answer-variants.mjs +8 -36
- package/src/ask-browser-entry.mjs +5 -23
- package/src/ask-browser.bundle.js +1 -2
- package/src/ask-nlp.mjs +9 -23
- package/src/ask-vocab.mjs +139 -589
- package/src/ask.mjs +627 -1729
- package/src/chat.mjs +1684 -2872
- package/src/cli-args.mjs +14 -28
- package/src/codegraph.mjs +236 -644
- package/src/completions/complete.mjs +18 -62
- package/src/completions/graph-adapter.mjs +14 -60
- package/src/completions/group.mjs +12 -68
- package/src/completions/infer.mjs +38 -126
- package/src/completions/prune.mjs +17 -70
- package/src/completions/rank.mjs +16 -69
- package/src/completions/search.mjs +8 -31
- package/src/concept.mjs +32 -88
- package/src/conformance.mjs +11 -15
- package/src/corpus/conceptnet.mjs +31 -89
- package/src/corpus/templates.mjs +19 -45
- package/src/corpus/unknown-ingest.mjs +31 -92
- package/src/embed.mjs +10 -22
- package/src/extensions.mjs +50 -154
- package/src/finish.mjs +35 -91
- package/src/grammar/ace.mjs +16 -40
- package/src/grammar/assert.mjs +1 -1
- package/src/grammar/lexicon-core.json +1 -1
- package/src/grammar/lexicon.mjs +9 -27
- package/src/graph-merge.mjs +2 -3
- package/src/hash.mjs +6 -14
- package/src/index.mjs +6 -10
- package/src/init.mjs +38 -125
- package/src/interpret/fuzzy.mjs +10 -29
- package/src/interpret/merge.mjs +9 -27
- package/src/interpret/normalize.mjs +137 -585
- package/src/interpret/pipeline.mjs +23 -71
- package/src/interpret/strategies/ace.mjs +7 -31
- package/src/interpret/strategies/constructions.mjs +14 -41
- package/src/interpret/strategies/grammar.mjs +21 -60
- package/src/interpret/strategies/keywords.mjs +42 -131
- package/src/interpret/strategies/noise-strip.mjs +18 -89
- package/src/memory/bias.mjs +11 -54
- package/src/memory/blocks.mjs +18 -69
- package/src/memory/core.mjs +171 -591
- package/src/memory/fold.mjs +0 -0
- package/src/memory/inspect.mjs +7 -25
- package/src/memory/shacl.mjs +10 -39
- package/src/memory/trust.mjs +26 -127
- package/src/memory-ask-browser-entry.mjs +7 -30
- package/src/memory-ask-browser.bundle.js +1 -1
- package/src/paraphrase.mjs +20 -53
- package/src/planning.mjs +15 -157
- package/src/prose-nlp.mjs +4 -17
- package/src/prose.mjs +19 -67
- package/src/providers/bootstrap.mjs +1 -2
- package/src/providers/fixture.mjs +1 -2
- package/src/providers/graph-service.mjs +28 -59
- package/src/repository-interface.mjs +6 -8
- package/src/router/drive.mjs +183 -0
- package/src/router/goal-reasoner.mjs +66 -231
- package/src/router/guardrail.mjs +20 -58
- package/src/router/planner.mjs +15 -46
- package/src/router/registry.mjs +13 -43
- package/src/router/resolver.mjs +46 -131
- package/src/router/results.mjs +231 -0
- package/src/schema-docs.mjs +10 -27
- package/src/server-http.mjs +10 -19
- package/src/server.mjs +22 -28
- package/src/sessions.mjs +15 -30
- package/src/source-slice.mjs +5 -7
- package/src/source.mjs +10 -20
- package/src/syllogise.mjs +187 -575
- package/src/telemetry.mjs +3 -3
- package/src/toml-config.mjs +4 -4
- package/src/tui/app.mjs +9 -19
- package/src/viz.mjs +66 -123
- package/src/wink-model.mjs +10 -24
package/src/cli-args.mjs
CHANGED
|
@@ -1,28 +1,21 @@
|
|
|
1
|
-
// cli-args.mjs — the ONE shared argv/config resolver for bin/tmct.mjs's
|
|
2
|
-
//
|
|
3
|
-
// (
|
|
4
|
-
// 4-tier version inlined in chat.mjs's createSession) with a single, tested
|
|
5
|
-
// precedence chain — built on top of toml-config.mjs's already-tested
|
|
6
|
-
// mergeEffective/normalizeConfig (arg > toml > default), not a rebuild of it.
|
|
1
|
+
// cli-args.mjs — the ONE shared argv/config resolver for bin/tmct.mjs's subcommands: a
|
|
2
|
+
// single, tested precedence chain built on toml-config.mjs's mergeEffective/
|
|
3
|
+
// normalizeConfig (arg > toml > default).
|
|
7
4
|
//
|
|
8
5
|
// Four tiny flag helpers (pure, no I/O) plus the one async resolver:
|
|
9
6
|
// strFlag(rest, names, dflt) → single value, last flag occurrence wins
|
|
10
7
|
// repeatedFlag(rest, names) → every value for a repeatable flag (e.g. --graph)
|
|
11
8
|
// boolFlag(rest, names) → true if any of `names` appears at all
|
|
12
9
|
// enumFlag(rest, names, choices) → strFlag, validated against a closed set
|
|
13
|
-
// (throws a clear error naming the flag + the choices — the shared shape
|
|
14
|
-
// for a closed-choice option like `--memory-backend default|memory|sqlite`,
|
|
15
|
-
// matching `--with-persona`'s own "unknown name" error style)
|
|
16
10
|
// resolveRuntimeConfig({argv, cwd, env, gitRoot}) → the resolved repo/config
|
|
17
11
|
//
|
|
18
|
-
// Graph-path precedence (
|
|
12
|
+
// Graph-path precedence (every subcommand shares it):
|
|
19
13
|
// 1. --graph <path> (repeatable; --graph wins outright, even over env)
|
|
20
14
|
// 2. TMCT_GRAPH_FILE (env)
|
|
21
15
|
// 3. tmct.toml's `graph_file` / `graph_files`
|
|
22
16
|
// 4. <repo>/.tmct/graph.json, where repo is --repo, else git root, else cwd
|
|
23
17
|
//
|
|
24
|
-
// Deliberately does NOT import chat.mjs (
|
|
25
|
-
// itself is rewired to call resolveRuntimeConfig) — the git-root lookup below
|
|
18
|
+
// Deliberately does NOT import chat.mjs (would be circular) — the git-root lookup below
|
|
26
19
|
// is a small, self-contained copy of chat.mjs's own gitToplevel().
|
|
27
20
|
|
|
28
21
|
import { spawnSync } from "node:child_process";
|
|
@@ -73,12 +66,9 @@ export function boolFlag(rest, names) {
|
|
|
73
66
|
return rest.some((r) => list.includes(r));
|
|
74
67
|
}
|
|
75
68
|
|
|
76
|
-
/** Closed-choice single-value flag: `strFlag` plus validation against
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* clear, user-facing error naming the flag and the valid choices when a
|
|
80
|
-
* value IS given but isn't one of them — validate-before-any-disk-write,
|
|
81
|
-
* the same discipline `tmct init --with-persona <unknown>` already uses. */
|
|
69
|
+
/** Closed-choice single-value flag: `strFlag` plus validation against `choices`.
|
|
70
|
+
* Returns `undefined` when absent. Throws a clear, user-facing error naming the flag
|
|
71
|
+
* and the valid choices when a value is given but isn't one of them. */
|
|
82
72
|
export function enumFlag(rest, names, choices) {
|
|
83
73
|
const val = strFlag(rest, names, undefined);
|
|
84
74
|
if (val !== undefined && !choices.includes(val)) {
|
|
@@ -89,20 +79,16 @@ export function enumFlag(rest, names, choices) {
|
|
|
89
79
|
}
|
|
90
80
|
|
|
91
81
|
/**
|
|
92
|
-
* Resolve one subcommand invocation's repo root, tmct.toml, and graph
|
|
93
|
-
*
|
|
94
|
-
* import/syllogise/serve) now funnels through instead of re-deriving it.
|
|
82
|
+
* Resolve one subcommand invocation's repo root, tmct.toml, and graph path(s) — the
|
|
83
|
+
* shared precedence chain every subcommand funnels through.
|
|
95
84
|
*
|
|
96
85
|
* @param {object} opts
|
|
97
|
-
* @param {string[]} [opts.argv] the subcommand's own argv tail (already past
|
|
98
|
-
* `tmct <mode>` — the same slice each subcommand hand-parses today).
|
|
86
|
+
* @param {string[]} [opts.argv] the subcommand's own argv tail (already past `tmct <mode>`)
|
|
99
87
|
* @param {string} [opts.cwd]
|
|
100
88
|
* @param {object} [opts.env]
|
|
101
|
-
* @param {(cwd:string)=>string|null} [opts.gitRoot] injectable for tests
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* mergeEffective's "arg" tier (e.g. a subcommand's own flags) — optional,
|
|
105
|
-
* defaults to {}.
|
|
89
|
+
* @param {(cwd:string)=>string|null} [opts.gitRoot] injectable for tests
|
|
90
|
+
* @param {object} [opts.args] extra already-parsed args folded into mergeEffective's
|
|
91
|
+
* "arg" tier; defaults to {}
|
|
106
92
|
* @returns {Promise<{
|
|
107
93
|
* repo: string, configPath: string, toml: object,
|
|
108
94
|
* config: {graphFile: string, graphFiles: string[]},
|