@polycode-projects/the-mechanical-code-talker 1.11.6 → 2.0.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 +244 -48
- package/ROADMAP.md +23 -34
- package/bin/tmct.mjs +117 -81
- package/corpus/LICENSES.json +118 -0
- package/corpus/README.md +17 -13
- package/corpus/conceptnet/README.md +5 -5
- package/corpus/conceptnet/fetch-slice.mjs +1 -1
- package/corpus/conceptnet/filter-dump.mjs +1 -1
- package/corpus/generated/README.md +9 -10
- package/corpus/namenet/README.md +39 -0
- package/corpus/seon/README.md +2 -2
- package/corpus/tier2/generate.mjs +58 -9
- package/corpus/tier2/manifest.json +44 -0
- package/corpus/wordnet/README.md +37 -0
- package/corpus/wordnet/generate.mjs +1 -1
- package/data/templates/constructions/agent-noun-relations.toml +2 -2
- package/data/templates/grammar-rules.toml +1 -1
- package/package.json +13 -22
- package/src/{ask-nlp.mjs → adapters/ask-nlp.mjs} +1 -1
- package/src/{config.mjs → adapters/config.mjs} +1 -1
- package/src/{corpus → adapters/corpus}/conceptnet-map.toml +4 -4
- package/src/{corpus → adapters/corpus}/conceptnet.mjs +3 -3
- package/src/adapters/corpus/construction-banks.mjs +43 -0
- package/src/{corpus → adapters/corpus}/templates.mjs +1 -1
- package/src/{embed.mjs → adapters/embed.mjs} +1 -11
- package/src/{graph-build.mjs → adapters/graph-build.mjs} +6 -6
- package/src/{memory → adapters/memory}/blocks.mjs +2 -2
- package/src/{memory → adapters/memory}/core.mjs +38 -94
- package/src/adapters/prose-tokens.mjs +98 -0
- package/src/{providers → adapters/providers}/bootstrap.mjs +2 -2
- package/src/{providers → adapters/providers}/fixture.mjs +3 -3
- package/src/{providers → adapters/providers}/graph-service.mjs +9 -4
- package/src/{source-slice.mjs → adapters/source-slice.mjs} +2 -2
- package/src/{source.mjs → adapters/source.mjs} +1 -1
- package/src/{toml-config.mjs → adapters/toml-config.mjs} +1 -1
- package/src/{answer-variants.json → domain/answer-variants.json} +1 -1
- package/src/domain/answer-variants.mjs +23 -0
- package/src/{ask-vocab.mjs → domain/ask-vocab.mjs} +37 -5
- package/src/{ask.mjs → domain/ask.mjs} +216 -52
- package/src/{codegraph.mjs → domain/codegraph.mjs} +31 -315
- package/src/{completions → domain/completions}/complete.mjs +16 -10
- package/src/{completions → domain/completions}/graph-adapter.mjs +10 -4
- package/src/{completions → domain/completions}/group.mjs +14 -6
- package/src/{completions → domain/completions}/infer.mjs +57 -39
- package/src/domain/completions/injected.mjs +21 -0
- package/src/{completions → domain/completions}/rank.mjs +15 -8
- package/src/{completions → domain/completions}/search.mjs +4 -2
- package/src/{grammar → domain/grammar}/ace.mjs +3 -3
- package/src/{grammar → domain/grammar}/assert.mjs +12 -8
- package/src/{grammar → domain/grammar}/lexicon-core.json +1 -1
- package/src/{grammar → domain/grammar}/lexicon.mjs +4 -6
- package/src/domain/hash.mjs +147 -0
- package/src/{interpret → domain/interpret}/fuzzy.mjs +42 -4
- package/src/domain/interpret/nlp-registry.mjs +20 -0
- package/src/{interpret → domain/interpret}/normalize.mjs +35 -5
- package/src/{interpret → domain/interpret}/pipeline.mjs +1 -5
- package/src/{interpret → domain/interpret}/strategies/ace.mjs +1 -1
- package/src/{interpret → domain/interpret}/strategies/constructions.mjs +30 -52
- package/src/{interpret → domain/interpret}/strategies/keywords.mjs +48 -26
- package/src/domain/memory/capability.mjs +235 -0
- package/src/domain/memory/fold.mjs +54 -0
- package/src/domain/memory/session-turns.mjs +7 -0
- package/src/{memory → domain/memory}/trust.mjs +48 -0
- package/src/{paraphrase.mjs → domain/paraphrase.mjs} +2 -2
- package/src/{prose.mjs → domain/prose.mjs} +1 -1
- package/src/domain/real-word-collisions.json +1 -0
- package/src/{router → domain/router}/call-validator.mjs +1 -1
- package/src/{router → domain/router}/drive.mjs +34 -25
- package/src/{router → domain/router}/goal-reasoner.mjs +1 -1
- package/src/{router → domain/router}/guardrail.mjs +1 -1
- package/src/{router → domain/router}/planner.mjs +1 -1
- package/src/{router → domain/router}/registry.mjs +5 -5
- package/src/{router → domain/router}/resolver.mjs +16 -13
- package/src/{router → domain/router}/results.mjs +1 -1
- package/src/{router → domain/router}/set-algebra.mjs +1 -1
- package/src/{router → domain/router}/taught.mjs +10 -9
- package/src/{syllogise.mjs → domain/syllogise.mjs} +21 -4
- package/src/domain/vector.mjs +12 -0
- package/src/services/chat-session.mjs +451 -0
- package/src/{chat.mjs → services/chat.mjs} +1238 -680
- package/src/{cli-args.mjs → services/cli-args.mjs} +2 -2
- package/src/services/completions.mjs +55 -0
- package/src/{extensions.mjs → services/extensions.mjs} +7 -7
- package/src/{finish.mjs → services/finish.mjs} +2 -2
- package/src/{memory → services}/fold.mjs +0 -0
- package/src/{import-file.mjs → services/import-file.mjs} +3 -3
- package/src/{index.mjs → services/index.mjs} +21 -12
- package/src/{init.mjs → services/init.mjs} +9 -9
- package/src/{ledger-viz.mjs → services/ledger-viz.mjs} +38 -7
- package/src/{plan-viz.mjs → services/plan-viz.mjs} +65 -26
- package/src/{sentences.mjs → services/sentences.mjs} +1 -1
- package/src/{sessions.mjs → services/sessions.mjs} +4 -5
- package/src/{telemetry.mjs → services/telemetry.mjs} +1 -1
- package/src/{server-http.mjs → surfaces/http/server-http.mjs} +11 -65
- package/src/{tui → surfaces/tui}/app.mjs +3 -3
- package/src/{memory-ask-browser-entry.mjs → surfaces/web/memory-ask-browser-entry.mjs} +5 -5
- package/src/{memory-ask-browser.bundle.js → surfaces/web/memory-ask-browser.bundle.js} +9465 -6366
- package/src/tools/catalog.mjs +29 -0
- package/src/{conformance.mjs → tools/conformance.mjs} +2 -2
- package/src/tools/definitions.mjs +288 -0
- package/src/tools/graph-load.mjs +20 -0
- package/src/tools/handlers/index.mjs +54 -0
- package/src/tools/handlers/kit.mjs +33 -0
- package/src/tools/handlers/tmct-architecture.mjs +7 -0
- package/src/tools/handlers/tmct-ask.mjs +14 -0
- package/src/tools/handlers/tmct-callees.mjs +6 -0
- package/src/tools/handlers/tmct-callers.mjs +6 -0
- package/src/tools/handlers/tmct-calls.mjs +6 -0
- package/src/tools/handlers/tmct-class-history.mjs +6 -0
- package/src/tools/handlers/tmct-cochanges.mjs +6 -0
- package/src/tools/handlers/tmct-context-more.mjs +9 -0
- package/src/tools/handlers/tmct-context.mjs +163 -0
- package/src/tools/handlers/tmct-describe.mjs +15 -0
- package/src/tools/handlers/tmct-exports.mjs +9 -0
- package/src/tools/handlers/tmct-file-history.mjs +6 -0
- package/src/tools/handlers/tmct-history.mjs +6 -0
- package/src/tools/handlers/tmct-impact.mjs +9 -0
- package/src/tools/handlers/tmct-members.mjs +16 -0
- package/src/tools/handlers/tmct-method-history.mjs +6 -0
- package/src/tools/handlers/tmct-search.mjs +22 -0
- package/src/tools/handlers/tmct-signature.mjs +6 -0
- package/src/tools/handlers/tmct-snippet.mjs +37 -0
- package/src/tools/handlers/tmct-subclasses.mjs +16 -0
- package/src/tools/handlers/tmct-tests-for.mjs +6 -0
- package/src/tools/handlers/tmct-untested.mjs +7 -0
- package/src/tools/memory-fallthrough.mjs +65 -0
- package/src/{schema-docs.mjs → tools/schema-docs.mjs} +1 -1
- package/src/tools/server.mjs +61 -0
- package/src/answer-variants.mjs +0 -39
- package/src/hash.mjs +0 -24
- package/src/server.mjs +0 -501
- /package/src/{corpus → adapters/corpus}/unknown-ingest.mjs +0 -0
- /package/src/{graph-merge.mjs → adapters/graph-merge.mjs} +0 -0
- /package/src/{memory → adapters/memory}/inspect.mjs +0 -0
- /package/src/{memory → adapters/memory}/shacl.mjs +0 -0
- /package/src/{prose-nlp.mjs → adapters/prose-nlp.mjs} +0 -0
- /package/src/{repository-interface.mjs → adapters/repository-interface.mjs} +0 -0
- /package/src/{uuid.mjs → adapters/uuid.mjs} +0 -0
- /package/src/{wink-model.mjs → adapters/wink-model.mjs} +0 -0
- /package/src/{completions → domain/completions}/prune.mjs +0 -0
- /package/src/{concept.mjs → domain/concept.mjs} +0 -0
- /package/src/{domain.mjs → domain/domain.mjs} +0 -0
- /package/src/{interpret → domain/interpret}/merge.mjs +0 -0
- /package/src/{interpret → domain/interpret}/strategies/grammar.mjs +0 -0
- /package/src/{interpret → domain/interpret}/strategies/noise-strip.mjs +0 -0
- /package/src/{memory → domain/memory}/bias.mjs +0 -0
- /package/src/{planning.mjs → domain/planning.mjs} +0 -0
- /package/src/{viz-theme.mjs → services/viz-theme.mjs} +0 -0
package/bin/tmct.mjs
CHANGED
|
@@ -10,16 +10,18 @@
|
|
|
10
10
|
// tmct cli digest '{…json}' → architecture map + per-module context bundles
|
|
11
11
|
// tmct --help → this help
|
|
12
12
|
//
|
|
13
|
-
// On a real terminal, chat is the full-screen Ink TUI (src/tui/app.mjs);
|
|
13
|
+
// On a real terminal, chat is the full-screen Ink TUI (src/surfaces/tui/app.mjs);
|
|
14
14
|
// `--plain` — or a non-TTY stdin/stdout (pipes, scripts, the test suite) —
|
|
15
15
|
// gets the classic readline shell. BOTH run the same session sink
|
|
16
|
-
// (src/chat.mjs createSession), so logs, sidecars and graph memory are
|
|
16
|
+
// (src/services/chat.mjs createSession), so logs, sidecars and graph memory are
|
|
17
17
|
// identical either way.
|
|
18
18
|
//
|
|
19
19
|
// The `cli` arms (digest / tmct_locate / any-tool fallback) are the carried,
|
|
20
20
|
// de-emphasized non-chat modes, folded in here from the former bin/cli.mjs.
|
|
21
21
|
// The graph artifact lives at <repo_path>/.tmct/graph.json; the tools (run
|
|
22
|
-
// with cwd = that repo) load it by default.
|
|
22
|
+
// with cwd = that repo) load it by default. The `cli` arms resolve it through
|
|
23
|
+
// the same --graph/--repo/env/tmct.toml chain every other subcommand shares
|
|
24
|
+
// (src/services/cli-args.mjs resolveRuntimeConfig).
|
|
23
25
|
//
|
|
24
26
|
// tmct began as a whole-package lift of an earlier chat surface (see README
|
|
25
27
|
// provenance): internal module filenames and symbols were kept to preserve the
|
|
@@ -35,7 +37,7 @@ Usage:
|
|
|
35
37
|
tmct interactive chat (the headline surface)
|
|
36
38
|
tmct chat [--repo <abs>] chat over a specific repo's graph
|
|
37
39
|
[--graph <path>] explicit graph file (repeatable — multiple graphs merge;
|
|
38
|
-
see src/graph-merge.mjs); wins over --repo/TMCT_GRAPH_FILE/tmct.toml
|
|
40
|
+
see src/adapters/graph-merge.mjs); wins over --repo/TMCT_GRAPH_FILE/tmct.toml
|
|
39
41
|
[--config <path>] an alternate tmct.toml location (a file or a directory)
|
|
40
42
|
[--ephemeral] read the graph but write nothing back (demo/read-only)
|
|
41
43
|
[--prompt "<text>"] one-shot: run the prompt's sentences as turns and print
|
|
@@ -56,7 +58,8 @@ Usage:
|
|
|
56
58
|
[--config <path>] folded blocks (the /memory chat command, from the shell)
|
|
57
59
|
[--verbose]
|
|
58
60
|
tmct init [--repo <abs>] initialize a repo for tmct (default: cwd): .tmct/,
|
|
59
|
-
[--force] tmct.toml,
|
|
61
|
+
[--force] tmct.toml, .tmct/TOOLS.md (the cold-tool catalog),
|
|
62
|
+
tier-1 corpus seed, provenance record
|
|
60
63
|
[--corpus <id|path>] also seed a corpus — a tier-2 manifest id (aws|python|java|
|
|
61
64
|
general) or a jsonl file path — opt-in, offline, $0
|
|
62
65
|
[--ontology <name|path>] activate+seed an ontology bundle (a recognized name or a path)
|
|
@@ -109,22 +112,26 @@ Usage:
|
|
|
109
112
|
[--repo <abs>] query tool calls for a compound or maintenance-goal
|
|
110
113
|
[--graph <path>] request ("of the modules impacted by X, which are
|
|
111
114
|
[--config <path>] untested", "what most needs a test") — a real STRIPS/
|
|
112
|
-
[--tools <a,b,...>] PDDL planner (src/router/*), never a guessed call.
|
|
115
|
+
[--tools <a,b,...>] PDDL planner (src/domain/router/*), never a guessed call.
|
|
113
116
|
[--json] Prints the grounded step sequence + composed answer,
|
|
114
117
|
or an honest "no plan found". --tools restricts the
|
|
115
118
|
declared toolset; --json prints the full loop result.
|
|
116
119
|
tmct cli <tool> '{…}' invoke a graph tool directly (carry-over, de-emphasized)
|
|
120
|
+
[--repo <abs>] the repo to answer from; the payload's "repo_path" says
|
|
121
|
+
[--graph <path>] the same thing. --graph names the graph file outright
|
|
122
|
+
[--config <path>] (repeatable), --config an alternate tmct.toml
|
|
117
123
|
tmct cli digest '{…}' architecture map + per-module context bundles
|
|
118
124
|
tmct --help show this help
|
|
119
125
|
|
|
120
126
|
On a terminal, chat opens the full-screen TUI; piped input gets the plain shell.
|
|
121
127
|
In chat: /help lists slash-commands; /exit leaves. Session log → <repo>/.tmct/session-<id>.log.
|
|
122
128
|
|
|
123
|
-
Shared graph-path precedence (chat/serve; see src/cli-args.mjs): --graph flag(s) >
|
|
129
|
+
Shared graph-path precedence (chat/serve/cli; see src/services/cli-args.mjs): --graph flag(s) >
|
|
124
130
|
TMCT_GRAPH_FILE env > tmct.toml graph_file/graph_files > --repo-derived
|
|
125
|
-
<repo>/.tmct/graph.json > git-root/cwd default.
|
|
131
|
+
<repo>/.tmct/graph.json > git-root/cwd default. On the \`cli\` route, a payload's
|
|
132
|
+
"repo_path" fills the --repo tier when the flag is absent.
|
|
126
133
|
|
|
127
|
-
Memory-backend precedence (chat; see src/chat.mjs createSession): --memory-backend
|
|
134
|
+
Memory-backend precedence (chat; see src/services/chat.mjs createSession): --memory-backend
|
|
128
135
|
flag > TMCT_MEMORY_BACKEND env > tmct.toml [memory] backend > "default" (the flat
|
|
129
136
|
.tmct/ JSON file). Set it once with \`tmct init --memory-backend <...>\` and every
|
|
130
137
|
later \`tmct chat\` in that repo picks it up with no flag needed.
|
|
@@ -175,7 +182,7 @@ async function runDigest(args, { dispatchTool, buildContextBundle, source, confi
|
|
|
175
182
|
let modules = Array.isArray(args.modules) ? args.modules.slice(0, DIGEST_MODULE_CAP) : [];
|
|
176
183
|
let autoSelected = null; // for the header, when `query` drove selection
|
|
177
184
|
if (!modules.length && args.query) {
|
|
178
|
-
const graph = parseEntities(await source.fetchEntities(configFor(repoPath)));
|
|
185
|
+
const graph = parseEntities(await source.fetchEntities(await configFor(repoPath)));
|
|
179
186
|
// SHIPPED DEFAULT (0.5.0): the digest's query-mode auto-locate resolves literal-mention ON
|
|
180
187
|
// (a fresh invocation with no tmct.toml), disable-able via `literal_mention:false`. Kept in
|
|
181
188
|
// lockstep with the `tmct_locate` handler so `cli digest '{query}'` ≡ `cli tmct_locate` for the
|
|
@@ -196,7 +203,7 @@ async function runDigest(args, { dispatchTool, buildContextBundle, source, confi
|
|
|
196
203
|
// not just the primary + 2 trimmed secondaries. Tests whether maximal injection re-bloats.
|
|
197
204
|
const max = Boolean(args.max);
|
|
198
205
|
const secondaryCap = max ? modules.length : DIGEST_SECONDARY_CAP;
|
|
199
|
-
const config = configFor(repoPath);
|
|
206
|
+
const config = await configFor(repoPath);
|
|
200
207
|
const body = [];
|
|
201
208
|
let effTier = "NONE"; // largest tier emitted across all modules
|
|
202
209
|
let topup = false; // whether any module's auto-sizing escalated above TINY
|
|
@@ -247,18 +254,23 @@ async function runDigest(args, { dispatchTool, buildContextBundle, source, confi
|
|
|
247
254
|
* Imports are lazy so `tmct --help` and chat startup never pay for the tool
|
|
248
255
|
* stack. */
|
|
249
256
|
async function runCliMode() {
|
|
250
|
-
const
|
|
251
|
-
const
|
|
252
|
-
const { dispatchTool, buildContextBundle } = await import("../src/server.mjs");
|
|
253
|
-
const
|
|
254
|
-
const
|
|
255
|
-
const codegraph = await import("../src/codegraph.mjs");
|
|
257
|
+
const rest = process.argv.slice(2);
|
|
258
|
+
const [, sub, payload] = rest;
|
|
259
|
+
const { dispatchTool, buildContextBundle } = await import("../src/tools/server.mjs");
|
|
260
|
+
const source = await import("../src/adapters/source.mjs");
|
|
261
|
+
const codegraph = await import("../src/domain/codegraph.mjs");
|
|
256
262
|
const { parseEntities, searchModulesRanked } = codegraph;
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
263
|
+
const { resolveRuntimeConfig, strFlag } = await import("../src/services/cli-args.mjs");
|
|
264
|
+
|
|
265
|
+
/** Resolve this invocation's graph through the SAME precedence chain every other
|
|
266
|
+
* subcommand uses (--graph flag(s) > TMCT_GRAPH_FILE > tmct.toml > --repo-derived),
|
|
267
|
+
* so a passed --graph/--repo is honoured instead of silently answering from the cwd.
|
|
268
|
+
* A payload's `repo_path` is this route's own way of naming the repo, so it fills the
|
|
269
|
+
* --repo tier when the flag itself is absent. */
|
|
270
|
+
const configFor = async (repoPath) => {
|
|
271
|
+
const argv = repoPath && !strFlag(rest, ["--repo"]) ? [...rest, "--repo", repoPath] : rest;
|
|
272
|
+
return (await resolveRuntimeConfig({ argv })).config;
|
|
273
|
+
};
|
|
262
274
|
|
|
263
275
|
// digest mode: architecture map + per-module context bundles → stdout
|
|
264
276
|
if (sub === "digest") {
|
|
@@ -281,7 +293,7 @@ async function runCliMode() {
|
|
|
281
293
|
process.stderr.write("tmct: tmct_locate expects a JSON arg, e.g. '{\"query\":\"…\",\"repo_path\":\"/abs\"}'\n");
|
|
282
294
|
process.exit(2);
|
|
283
295
|
}
|
|
284
|
-
const config = configFor(args.repo_path);
|
|
296
|
+
const config = await configFor(args.repo_path);
|
|
285
297
|
try {
|
|
286
298
|
const graph = parseEntities(await source.fetchEntities(config));
|
|
287
299
|
// B016 recall-lever flags (LOCATE-phase, per-arm; output byte-identical when absent).
|
|
@@ -320,7 +332,7 @@ async function runCliMode() {
|
|
|
320
332
|
process.stderr.write(`tmct: ${sub} expects a JSON arg, e.g. '{"symbol":"<name>"}'\n`);
|
|
321
333
|
process.exit(2);
|
|
322
334
|
}
|
|
323
|
-
const config = configFor(args.repo_path);
|
|
335
|
+
const config = await configFor(args.repo_path);
|
|
324
336
|
try {
|
|
325
337
|
const text = await dispatchTool(sub, args, { config });
|
|
326
338
|
process.stdout.write(text + "\n");
|
|
@@ -340,7 +352,7 @@ async function runCliMode() {
|
|
|
340
352
|
// Both `tmct init --corpus/--ontology/--lexicon` and the new `tmct import` verb
|
|
341
353
|
// funnel through the SAME two-step seam: resolvePluggableInput (name/id/path →
|
|
342
354
|
// a resolved descriptor) then activatePluggableInput (write tmct.toml + seed via
|
|
343
|
-
// src/extensions.mjs's unified loop) — one seam instead of three near-duplicate
|
|
355
|
+
// src/services/extensions.mjs's unified loop) — one seam instead of three near-duplicate
|
|
344
356
|
// hand-rolled call sites.
|
|
345
357
|
|
|
346
358
|
/** Read `repoRoot`'s current tmct.toml (if any) into the shape init.mjs's
|
|
@@ -348,8 +360,8 @@ async function runCliMode() {
|
|
|
348
360
|
* write it straight back without losing every other already-written key.
|
|
349
361
|
* Mirrors `tmct init --corpus`'s original inline config-merge exactly. */
|
|
350
362
|
async function readConfigForRewrite(repoRoot) {
|
|
351
|
-
const { defaultConfig } = await import("../src/init.mjs");
|
|
352
|
-
const { loadTomlConfig } = await import("../src/toml-config.mjs");
|
|
363
|
+
const { defaultConfig } = await import("../src/services/init.mjs");
|
|
364
|
+
const { loadTomlConfig } = await import("../src/adapters/toml-config.mjs");
|
|
353
365
|
const raw = await loadTomlConfig(repoRoot);
|
|
354
366
|
const cfg = { ...defaultConfig() };
|
|
355
367
|
if (raw?.graph_file !== undefined) cfg.graphFile = String(raw.graph_file);
|
|
@@ -367,7 +379,7 @@ async function readConfigForRewrite(repoRoot) {
|
|
|
367
379
|
}
|
|
368
380
|
|
|
369
381
|
async function writeConfig(repoRoot, cfg) {
|
|
370
|
-
const { renderTomlConfig, CONFIG_FILE } = await import("../src/init.mjs");
|
|
382
|
+
const { renderTomlConfig, CONFIG_FILE } = await import("../src/services/init.mjs");
|
|
371
383
|
const { writeFile } = await import("node:fs/promises");
|
|
372
384
|
const { join: joinPath } = await import("node:path");
|
|
373
385
|
await writeFile(joinPath(repoRoot, CONFIG_FILE), renderTomlConfig(cfg));
|
|
@@ -431,14 +443,14 @@ async function repoRelative(repoRoot, p) {
|
|
|
431
443
|
* disk write — callers resolve every pluggable input BEFORE calling
|
|
432
444
|
* initRepo, so a bad name/path touches nothing. */
|
|
433
445
|
async function resolvePluggableInput(kind, nameOrPath, { repoRoot }) {
|
|
434
|
-
const { BUILTIN_EXTENSIONS } = await import("../src/extensions.mjs");
|
|
446
|
+
const { BUILTIN_EXTENSIONS } = await import("../src/services/extensions.mjs");
|
|
435
447
|
if (Object.prototype.hasOwnProperty.call(BUILTIN_EXTENSIONS, nameOrPath) && BUILTIN_EXTENSIONS[nameOrPath].kind === kind) {
|
|
436
448
|
return { known: true, name: nameOrPath };
|
|
437
449
|
}
|
|
438
450
|
let manifestIds = null;
|
|
439
451
|
if (kind === "corpus") {
|
|
440
452
|
const { readFile } = await import("node:fs/promises");
|
|
441
|
-
const { TIER2_MANIFEST_FILE } = await import("../src/corpus/conceptnet.mjs");
|
|
453
|
+
const { TIER2_MANIFEST_FILE } = await import("../src/adapters/corpus/conceptnet.mjs");
|
|
442
454
|
try {
|
|
443
455
|
const manifest = JSON.parse(await readFile(TIER2_MANIFEST_FILE, "utf8"));
|
|
444
456
|
const corpuses = manifest.corpuses || [];
|
|
@@ -465,7 +477,7 @@ async function resolvePluggableInput(kind, nameOrPath, { repoRoot }) {
|
|
|
465
477
|
/** Activate one resolvePluggableInput() result in `repoRoot`'s tmct.toml and —
|
|
466
478
|
* for corpus/ontology-kind entries (or a pack-kind entry with a corpusPath) —
|
|
467
479
|
* seed it via the SAME unified loop every other bundle uses
|
|
468
|
-
* (src/extensions.mjs's seedActiveCorpusEntries). A lexicon/templates-kind
|
|
480
|
+
* (src/services/extensions.mjs's seedActiveCorpusEntries). A lexicon/templates-kind
|
|
469
481
|
* entry only activates (merged read-time via mergedLexiconExtra, never
|
|
470
482
|
* seeded — matching today's behavior for those kinds). Returns a
|
|
471
483
|
* human-readable status line for stdout. */
|
|
@@ -485,14 +497,14 @@ async function activatePluggableInput(repoRoot, resolved) {
|
|
|
485
497
|
cfg.extensions = { ...(cfg.extensions || {}), [name]: newEntry };
|
|
486
498
|
await writeConfig(repoRoot, cfg);
|
|
487
499
|
|
|
488
|
-
const { resolveExtensions, seedActiveCorpusEntries } = await import("../src/extensions.mjs");
|
|
500
|
+
const { resolveExtensions, seedActiveCorpusEntries } = await import("../src/services/extensions.mjs");
|
|
489
501
|
const { entries } = await resolveExtensions(repoRoot);
|
|
490
502
|
const entry = entries.get(name);
|
|
491
503
|
const seedable = entry.kind === "corpus" || entry.kind === "ontology" || (entry.kind === "pack" && entry.corpusPath);
|
|
492
504
|
if (!seedable) {
|
|
493
505
|
return `activated "${name}" (${entry.kind}) in tmct.toml — no corpus facts to seed for this kind.\n`;
|
|
494
506
|
}
|
|
495
|
-
// Backend-aware seeding (same split-brain bug fix as src/init.mjs's own
|
|
507
|
+
// Backend-aware seeding (same split-brain bug fix as src/services/init.mjs's own
|
|
496
508
|
// corpus seed, found in review): `cfg.memory.backend` already reflects
|
|
497
509
|
// tmct.toml as it stands RIGHT NOW (readConfigForRewrite, above) — which,
|
|
498
510
|
// for a `tmct init --corpus X --memory-backend sqlite` / `tmct import
|
|
@@ -501,7 +513,7 @@ async function activatePluggableInput(repoRoot, resolved) {
|
|
|
501
513
|
// before running any activation). Resolved via the SAME openMemoryBackend
|
|
502
514
|
// createSession/initRepo use, so this bundle's facts land in the store a
|
|
503
515
|
// later `tmct chat` will actually read.
|
|
504
|
-
const { openMemoryBackend } = await import("../src/memory/core.mjs");
|
|
516
|
+
const { openMemoryBackend } = await import("../src/adapters/memory/core.mjs");
|
|
505
517
|
const backendChoice = String(cfg.memory?.backend || "").trim().toLowerCase();
|
|
506
518
|
if (backendChoice === "memory") {
|
|
507
519
|
return `activated "${name}" (${entry.kind}) in tmct.toml — seeding skipped (memory backend is in-process only, nothing would persist past this command).\n`;
|
|
@@ -519,7 +531,7 @@ async function activatePluggableInput(repoRoot, resolved) {
|
|
|
519
531
|
}
|
|
520
532
|
if (resolved.manifestEntry) {
|
|
521
533
|
// Preserve the ORIGINAL `--corpus <tier2-id>` wording byte-for-byte
|
|
522
|
-
// (
|
|
534
|
+
// (e2e/init-cli.test.mjs asserts on this exact shape).
|
|
523
535
|
return `seeded tier-2 corpus "${resolved.manifestEntry.id}" (${resolved.manifestEntry.kind}) — ${seeded.appended} fact(s) added`
|
|
524
536
|
+ `${seeded.skipped ? `, ${seeded.skipped} already present` : ""}. Source: corpus/tier2/${resolved.manifestEntry.file} (${resolved.manifestEntry.license}). `
|
|
525
537
|
+ `Activated in tmct.toml — future \`tmct init\`/chat sessions seed it automatically.\n`;
|
|
@@ -529,6 +541,21 @@ async function activatePluggableInput(repoRoot, resolved) {
|
|
|
529
541
|
+ `Activated in tmct.toml — future \`tmct init\`/chat sessions seed it automatically.\n`;
|
|
530
542
|
}
|
|
531
543
|
|
|
544
|
+
/** Write `repoRoot`/.tmct/TOOLS.md — the cold-tool catalog, rendered from the tool
|
|
545
|
+
* definitions with THIS executable's own absolute path in every worked invocation, so
|
|
546
|
+
* the copied line runs as-is. Returns the path written. */
|
|
547
|
+
async function writeToolsCatalog(repoRoot) {
|
|
548
|
+
const { renderToolsCatalog } = await import("../src/tools/catalog.mjs");
|
|
549
|
+
const { mkdir, writeFile } = await import("node:fs/promises");
|
|
550
|
+
const { resolve: resolvePath } = await import("node:path");
|
|
551
|
+
const { fileURLToPath } = await import("node:url");
|
|
552
|
+
const dir = resolvePath(repoRoot, ".tmct");
|
|
553
|
+
await mkdir(dir, { recursive: true });
|
|
554
|
+
const catalogPath = resolvePath(dir, "TOOLS.md");
|
|
555
|
+
await writeFile(catalogPath, renderToolsCatalog(fileURLToPath(import.meta.url)), "utf8");
|
|
556
|
+
return catalogPath;
|
|
557
|
+
}
|
|
558
|
+
|
|
532
559
|
/** `--graph <path>` (repeatable) APPENDS to `repoRoot`'s tmct.toml
|
|
533
560
|
* `graph_files` array — a DIFFERENT, purely additive operation from
|
|
534
561
|
* activatePluggableInput (no extensions-bundle activation). Each path is
|
|
@@ -574,17 +601,17 @@ async function main() {
|
|
|
574
601
|
// session with the verbose developer/debug narrate mode already on. Default
|
|
575
602
|
// OFF; `/narrate on`/`/narrate off` also toggles it mid-session.
|
|
576
603
|
const narrate = rest.includes("--narrate");
|
|
577
|
-
// `--graph <path>` (repeatable) / `--config <path>` (src/cli-args.mjs): threaded
|
|
604
|
+
// `--graph <path>` (repeatable) / `--config <path>` (src/services/cli-args.mjs): threaded
|
|
578
605
|
// through as the new top tier of createSession's graph-resolution order (above
|
|
579
606
|
// TMCT_GRAPH_FILE — see chat.mjs's own docblock at createSession). Omitted from
|
|
580
607
|
// the call entirely when absent, so a plain `tmct chat [--repo]` invocation is
|
|
581
608
|
// byte-identical to before these flags existed.
|
|
582
|
-
const { repeatedFlag, strFlag, enumFlag } = await import("../src/cli-args.mjs");
|
|
609
|
+
const { repeatedFlag, strFlag, enumFlag } = await import("../src/services/cli-args.mjs");
|
|
583
610
|
const graphPaths = repeatedFlag(rest, ["--graph"]);
|
|
584
611
|
const configPath = strFlag(rest, ["--config"]);
|
|
585
612
|
// `--memory-backend <default|memory|sqlite>`: the CLI's top tier of
|
|
586
613
|
// createSession's memoryBackend precedence (CLI flag > TMCT_MEMORY_BACKEND
|
|
587
|
-
// env > tmct.toml's [memory] backend > built-in default — src/cli-args.mjs's
|
|
614
|
+
// env > tmct.toml's [memory] backend > built-in default — src/services/cli-args.mjs's
|
|
588
615
|
// shared precedence order, resolved inside createSession itself). Omitted
|
|
589
616
|
// when absent so the lower tiers still apply unchanged.
|
|
590
617
|
let memoryBackend;
|
|
@@ -605,7 +632,7 @@ async function main() {
|
|
|
605
632
|
const prompt = strFlag(rest, ["--prompt"]);
|
|
606
633
|
// `--render <archetype> [--output <path>]` — after a one-shot --prompt whose
|
|
607
634
|
// final turn produced a plan, write the self-contained animated plan page
|
|
608
|
-
// (src/plan-viz.mjs). Requires --prompt: interactive chat has no single
|
|
635
|
+
// (src/services/plan-viz.mjs). Requires --prompt: interactive chat has no single
|
|
609
636
|
// final turn to render.
|
|
610
637
|
let renderArchetype;
|
|
611
638
|
try {
|
|
@@ -619,8 +646,8 @@ async function main() {
|
|
|
619
646
|
process.exit(1);
|
|
620
647
|
}
|
|
621
648
|
if (prompt) {
|
|
622
|
-
const { createSession } = await import("../src/chat.mjs");
|
|
623
|
-
const { splitSentences } = await import("../src/sentences.mjs");
|
|
649
|
+
const { createSession } = await import("../src/services/chat.mjs");
|
|
650
|
+
const { splitSentences } = await import("../src/services/sentences.mjs");
|
|
624
651
|
const session = await createSession({ repoPath, ephemeral, narrate, ...extra });
|
|
625
652
|
let finalAnswer = "";
|
|
626
653
|
let finalPlan = null;
|
|
@@ -640,7 +667,7 @@ async function main() {
|
|
|
640
667
|
process.exitCode = 1;
|
|
641
668
|
return;
|
|
642
669
|
}
|
|
643
|
-
const { renderPlanHtml } = await import("../src/plan-viz.mjs");
|
|
670
|
+
const { renderPlanHtml } = await import("../src/services/plan-viz.mjs");
|
|
644
671
|
const { writeFile } = await import("node:fs/promises");
|
|
645
672
|
const { resolve: resolvePath } = await import("node:path");
|
|
646
673
|
const outPath = resolvePath(process.cwd(), strFlag(rest, ["--output", "--out"], "plan.html"));
|
|
@@ -662,10 +689,10 @@ async function main() {
|
|
|
662
689
|
// drive the same createSession sink — only the drawing differs.
|
|
663
690
|
const plain = rest.includes("--plain") || !process.stdin.isTTY || !process.stdout.isTTY;
|
|
664
691
|
if (plain) {
|
|
665
|
-
const { runChat } = await import("../src/chat.mjs");
|
|
692
|
+
const { runChat } = await import("../src/services/chat.mjs");
|
|
666
693
|
await runChat({ repoPath, ephemeral, narrate, ...extra });
|
|
667
694
|
} else {
|
|
668
|
-
const { runTui } = await import("../src/tui/app.mjs");
|
|
695
|
+
const { runTui } = await import("../src/surfaces/tui/app.mjs");
|
|
669
696
|
await runTui({ repoPath, ephemeral, narrate, ...extra });
|
|
670
697
|
}
|
|
671
698
|
return;
|
|
@@ -673,14 +700,14 @@ async function main() {
|
|
|
673
700
|
|
|
674
701
|
if (mode === "memory") {
|
|
675
702
|
// `tmct memory` — the /memory chat command from the shell: same renderer
|
|
676
|
-
// (src/memory/inspect.mjs). Repo resolution now goes through the shared
|
|
677
|
-
// resolveRuntimeConfig (src/cli-args.mjs) — --repo > git root > cwd, same
|
|
703
|
+
// (src/adapters/memory/inspect.mjs). Repo resolution now goes through the shared
|
|
704
|
+
// resolveRuntimeConfig (src/services/cli-args.mjs) — --repo > git root > cwd, same
|
|
678
705
|
// as before, plus a (currently inert but accepted) `--config` for symmetry
|
|
679
706
|
// with every other subcommand. No `--graph`: memory reads no code graph.
|
|
680
707
|
const rest = process.argv.slice(3);
|
|
681
708
|
const verbose = rest.includes("--verbose") || rest.includes("-v");
|
|
682
|
-
const { resolveRuntimeConfig } = await import("../src/cli-args.mjs");
|
|
683
|
-
const { inspectMemory } = await import("../src/memory/inspect.mjs");
|
|
709
|
+
const { resolveRuntimeConfig } = await import("../src/services/cli-args.mjs");
|
|
710
|
+
const { inspectMemory } = await import("../src/adapters/memory/inspect.mjs");
|
|
684
711
|
const { repo } = await resolveRuntimeConfig({ argv: rest });
|
|
685
712
|
process.stdout.write(await inspectMemory(repo, { verbose }) + "\n");
|
|
686
713
|
return;
|
|
@@ -692,7 +719,7 @@ async function main() {
|
|
|
692
719
|
// record provenance. Idempotent; --force rewrites config + re-records.
|
|
693
720
|
//
|
|
694
721
|
// TIERING POLICY: init is OFFLINE, $0 and TIER-1-ONLY by default (seon +
|
|
695
|
-
// conceptnet — src/extensions.mjs's BUILTIN_EXTENSIONS). A tier-2 domain/
|
|
722
|
+
// conceptnet — src/services/extensions.mjs's BUILTIN_EXTENSIONS). A tier-2 domain/
|
|
696
723
|
// language corpus (corpus/tier2/: aws, python, java) is added ONLY when
|
|
697
724
|
// explicitly asked via `--corpus <id>`. The `--detect` auto-detect is a
|
|
698
725
|
// documented STUB: it inspects the repo's manifests (pyproject.toml → python,
|
|
@@ -702,9 +729,9 @@ async function main() {
|
|
|
702
729
|
// subcommand without a --repo flag. It now takes one like every other
|
|
703
730
|
// subcommand, defaulting to cwd exactly as before when absent.
|
|
704
731
|
const rest = process.argv.slice(3);
|
|
705
|
-
const { strFlag, repeatedFlag, enumFlag } = await import("../src/cli-args.mjs");
|
|
732
|
+
const { strFlag, repeatedFlag, enumFlag } = await import("../src/services/cli-args.mjs");
|
|
706
733
|
const { resolve: resolvePath } = await import("node:path");
|
|
707
|
-
const { initRepo, PERSONA_PRESETS } = await import("../src/init.mjs");
|
|
734
|
+
const { initRepo, PERSONA_PRESETS } = await import("../src/services/init.mjs");
|
|
708
735
|
|
|
709
736
|
const repoFlag = strFlag(rest, ["--repo"]);
|
|
710
737
|
const repoRoot = repoFlag ? resolvePath(process.cwd(), repoFlag) : process.cwd();
|
|
@@ -717,9 +744,9 @@ async function main() {
|
|
|
717
744
|
// `--memory-backend <default|memory|sqlite>` (PLAN_SEED.md §6's storage-backend
|
|
718
745
|
// seam, now reachable from `tmct init`): validated BEFORE touching disk, same
|
|
719
746
|
// discipline as every other pluggable input below. Written into tmct.toml's
|
|
720
|
-
// `[memory] backend` (src/init.mjs's renderTomlConfig); chat.mjs's
|
|
747
|
+
// `[memory] backend` (src/services/init.mjs's renderTomlConfig); chat.mjs's
|
|
721
748
|
// createSession reads it back at CLI-flag > TMCT_MEMORY_BACKEND env >
|
|
722
|
-
// tmct.toml > default precedence (src/cli-args.mjs's shared precedence order).
|
|
749
|
+
// tmct.toml > default precedence (src/services/cli-args.mjs's shared precedence order).
|
|
723
750
|
let memoryBackendVal;
|
|
724
751
|
try {
|
|
725
752
|
memoryBackendVal = enumFlag(rest, ["--memory-backend"], ["default", "memory", "sqlite"]);
|
|
@@ -833,6 +860,10 @@ async function main() {
|
|
|
833
860
|
const res = await initRepo(repoRoot, { force: forceFlag, persona: personaPreset, memoryBackend: memoryBackendVal });
|
|
834
861
|
process.stdout.write(res.message + "\n");
|
|
835
862
|
|
|
863
|
+
// The cold tools carry no resident schema, so the initialized repo gets the catalog
|
|
864
|
+
// on disk: one copy-paste Bash invocation per tool, rewritten on every init.
|
|
865
|
+
process.stdout.write(`cold-tool catalog: ${await writeToolsCatalog(repoRoot)}\n`);
|
|
866
|
+
|
|
836
867
|
// `--corpus`/`--ontology`/`--lexicon` now mean "activate this bundle and
|
|
837
868
|
// PERSIST that into tmct.toml" — so a second `tmct init` (or the next chat
|
|
838
869
|
// bootstrap) remembers the choice, unlike the old ad hoc path, which had
|
|
@@ -907,7 +938,7 @@ async function main() {
|
|
|
907
938
|
// additive operation (appendGraphFiles) — it grows tmct.toml's graph_files
|
|
908
939
|
// array, never activates an extensions bundle.
|
|
909
940
|
const rest = process.argv.slice(3);
|
|
910
|
-
const { strFlag, repeatedFlag, enumFlag } = await import("../src/cli-args.mjs");
|
|
941
|
+
const { strFlag, repeatedFlag, enumFlag } = await import("../src/services/cli-args.mjs");
|
|
911
942
|
const { resolve: resolvePath } = await import("node:path");
|
|
912
943
|
|
|
913
944
|
const repoFlag = strFlag(rest, ["--repo"]);
|
|
@@ -982,7 +1013,7 @@ async function main() {
|
|
|
982
1013
|
// Any declined sentence exits non-zero: a half-taught game plans wrongly
|
|
983
1014
|
// or not at all with no visible cause otherwise.
|
|
984
1015
|
if (fileVal) {
|
|
985
|
-
const { importDefinitionFile } = await import("../src/import-file.mjs");
|
|
1016
|
+
const { importDefinitionFile } = await import("../src/services/import-file.mjs");
|
|
986
1017
|
try {
|
|
987
1018
|
const result = await importDefinitionFile(repoRoot, fileVal);
|
|
988
1019
|
process.stdout.write(result.report + "\n");
|
|
@@ -1000,7 +1031,7 @@ async function main() {
|
|
|
1000
1031
|
// (the shape a package like seonix/marginalia ships) BEFORE it's activated
|
|
1001
1032
|
// in any repo's tmct.toml. Reuses existing throw-loudly primitives
|
|
1002
1033
|
// (loadSlice/loadMap/toFacts, loadLexicon, loadTemplates) via
|
|
1003
|
-
// src/extensions.mjs's validateExtensionPack — never invents new
|
|
1034
|
+
// src/services/extensions.mjs's validateExtensionPack — never invents new
|
|
1004
1035
|
// shape-checking logic. `<dir>` must carry its own tmct.toml declaring one
|
|
1005
1036
|
// or more `[extensions.<name>]` host entries (the SAME [extensions] table
|
|
1006
1037
|
// shape a repo's own tmct.toml uses) naming the resource(s) to validate;
|
|
@@ -1014,7 +1045,7 @@ async function main() {
|
|
|
1014
1045
|
process.exit(2);
|
|
1015
1046
|
}
|
|
1016
1047
|
const { resolve: resolvePath } = await import("node:path");
|
|
1017
|
-
const { strFlag } = await import("../src/cli-args.mjs");
|
|
1048
|
+
const { strFlag } = await import("../src/services/cli-args.mjs");
|
|
1018
1049
|
const target = resolvePath(process.cwd(), dirArg);
|
|
1019
1050
|
// `--config <path>` (optional): an alternate tmct.toml to validate against,
|
|
1020
1051
|
// INSTEAD of `<target>/tmct.toml` — `target` still anchors every resource
|
|
@@ -1030,7 +1061,7 @@ async function main() {
|
|
|
1030
1061
|
try { isDir = (await stat(abs)).isDirectory(); } catch { /* missing path — treat as a file target */ }
|
|
1031
1062
|
configFile = isDir ? resolvePath(abs, "tmct.toml") : abs;
|
|
1032
1063
|
}
|
|
1033
|
-
const { resolveExtensions, BUILTIN_EXTENSIONS, validateExtensionPack } = await import("../src/extensions.mjs");
|
|
1064
|
+
const { resolveExtensions, BUILTIN_EXTENSIONS, validateExtensionPack } = await import("../src/services/extensions.mjs");
|
|
1034
1065
|
let entries;
|
|
1035
1066
|
try {
|
|
1036
1067
|
({ entries } = await resolveExtensions(target, configFile ? { configFile } : {}));
|
|
@@ -1064,7 +1095,7 @@ async function main() {
|
|
|
1064
1095
|
// `tmct syllogise` — the explicit speculative-inference batch (never on the chat
|
|
1065
1096
|
// hot path): forward-chain the memory's rdfs:subClassOf closure into bounded,
|
|
1066
1097
|
// low-trust, retractable entailed facts. Same repo resolution as `memory` —
|
|
1067
|
-
// resolveRuntimeConfig (src/cli-args.mjs): --repo > git root > cwd. Also
|
|
1098
|
+
// resolveRuntimeConfig (src/services/cli-args.mjs): --repo > git root > cwd. Also
|
|
1068
1099
|
// accepts `--config` for symmetry (syllogise reads no code graph either).
|
|
1069
1100
|
const rest = process.argv.slice(3);
|
|
1070
1101
|
const numFlag = (name, dflt) => {
|
|
@@ -1072,10 +1103,14 @@ async function main() {
|
|
|
1072
1103
|
const v = j !== -1 ? Number(rest[j + 1]) : NaN;
|
|
1073
1104
|
return Number.isFinite(v) ? v : dflt;
|
|
1074
1105
|
};
|
|
1075
|
-
const { resolveRuntimeConfig } = await import("../src/cli-args.mjs");
|
|
1076
|
-
const { syllogise } = await import("../src/syllogise.mjs");
|
|
1106
|
+
const { resolveRuntimeConfig } = await import("../src/services/cli-args.mjs");
|
|
1107
|
+
const { syllogise } = await import("../src/domain/syllogise.mjs");
|
|
1108
|
+
const { loadMemory, readFactRows, appendFacts } = await import("../src/adapters/memory/core.mjs");
|
|
1077
1109
|
const { repo } = await resolveRuntimeConfig({ argv: rest });
|
|
1078
|
-
const res = await syllogise(repo, {
|
|
1110
|
+
const res = await syllogise(repo, {
|
|
1111
|
+
depth: numFlag("--depth", 32), budget: numFlag("--budget", 50),
|
|
1112
|
+
store: { loadMemory, readFactRows, appendFacts },
|
|
1113
|
+
});
|
|
1079
1114
|
process.stdout.write(
|
|
1080
1115
|
`tmct syllogise — derived ${res.count} entailed fact(s) (subClassOf closure, depth ${res.depth}, budget ${res.budget})`
|
|
1081
1116
|
+ (res.truncated ? " — budget reached, more available" : "") + "\n",
|
|
@@ -1099,8 +1134,8 @@ async function main() {
|
|
|
1099
1134
|
process.exitCode = 1;
|
|
1100
1135
|
return;
|
|
1101
1136
|
}
|
|
1102
|
-
const { strFlag, resolveRuntimeConfig } = await import("../src/cli-args.mjs");
|
|
1103
|
-
const { computeLedgerData, renderLedgerHtml, readMemoryAskBundle } = await import("../src/ledger-viz.mjs");
|
|
1137
|
+
const { strFlag, resolveRuntimeConfig } = await import("../src/services/cli-args.mjs");
|
|
1138
|
+
const { computeLedgerData, renderLedgerHtml, readMemoryAskBundle } = await import("../src/services/ledger-viz.mjs");
|
|
1104
1139
|
const { writeFile } = await import("node:fs/promises");
|
|
1105
1140
|
const { resolve } = await import("node:path");
|
|
1106
1141
|
const limitIdx = rest.indexOf("--limit");
|
|
@@ -1155,12 +1190,12 @@ async function main() {
|
|
|
1155
1190
|
);
|
|
1156
1191
|
return;
|
|
1157
1192
|
}
|
|
1158
|
-
const { strFlag, resolveRuntimeConfig } = await import("../src/cli-args.mjs");
|
|
1193
|
+
const { strFlag, resolveRuntimeConfig } = await import("../src/services/cli-args.mjs");
|
|
1159
1194
|
const host = strFlag(rest, ["--host"], "127.0.0.1");
|
|
1160
1195
|
const portRaw = strFlag(rest, ["--port"]);
|
|
1161
1196
|
const port = portRaw !== undefined && Number.isFinite(Number(portRaw)) ? Number(portRaw) : 8787;
|
|
1162
|
-
const { startServer } = await import("../src/server-http.mjs");
|
|
1163
|
-
// Graph-path precedence (src/cli-args.mjs, shared with `chat`): --graph
|
|
1197
|
+
const { startServer } = await import("../src/surfaces/http/server-http.mjs");
|
|
1198
|
+
// Graph-path precedence (src/services/cli-args.mjs, shared with `chat`): --graph
|
|
1164
1199
|
// flag(s) > TMCT_GRAPH_FILE env > tmct.toml graph_file/graph_files >
|
|
1165
1200
|
// --repo-derived <repo>/.tmct/graph.json > git-root/cwd default. This
|
|
1166
1201
|
// REPLACES serve's old cwd-only default (loadConfig had no git-root
|
|
@@ -1179,7 +1214,7 @@ async function main() {
|
|
|
1179
1214
|
}
|
|
1180
1215
|
|
|
1181
1216
|
if (mode === "plan") {
|
|
1182
|
-
// `tmct plan "<request>"` — the capability router (src/router/*), surfaced
|
|
1217
|
+
// `tmct plan "<request>"` — the capability router (src/domain/router/*), surfaced
|
|
1183
1218
|
// for real: a STRIPS/PDDL-style planner over the SAME read-only graph-query
|
|
1184
1219
|
// tools chat/serve dispatch. A single-shot request ("who calls X") resolves
|
|
1185
1220
|
// directly; a compound request ("of the modules impacted by X, which are
|
|
@@ -1214,7 +1249,7 @@ async function main() {
|
|
|
1214
1249
|
);
|
|
1215
1250
|
return;
|
|
1216
1251
|
}
|
|
1217
|
-
const { strFlag, resolveRuntimeConfig } = await import("../src/cli-args.mjs");
|
|
1252
|
+
const { strFlag, resolveRuntimeConfig } = await import("../src/services/cli-args.mjs");
|
|
1218
1253
|
const toolsFlag = strFlag(rest, ["--tools"]);
|
|
1219
1254
|
const jsonFlag = rest.includes("--json");
|
|
1220
1255
|
// The request is every argv token that isn't a recognized flag or its value,
|
|
@@ -1234,7 +1269,19 @@ async function main() {
|
|
|
1234
1269
|
process.exit(2);
|
|
1235
1270
|
}
|
|
1236
1271
|
const { repo, config } = await resolveRuntimeConfig({ argv: rest });
|
|
1237
|
-
const { buildCapabilityPlanCtx, runCapabilityPlan, declaredCapabilityNames } = await import("../src/router/drive.mjs");
|
|
1272
|
+
const { buildCapabilityPlanCtx, runCapabilityPlan, declaredCapabilityNames } = await import("../src/domain/router/drive.mjs");
|
|
1273
|
+
const { capabilityPlanDeps } = await import("../src/services/chat.mjs");
|
|
1274
|
+
let ctx;
|
|
1275
|
+
try {
|
|
1276
|
+
ctx = await buildCapabilityPlanCtx({ ...capabilityPlanDeps(), config, memoryDir: repo });
|
|
1277
|
+
} catch (e) {
|
|
1278
|
+
process.stderr.write(`tmct plan: could not load the graph — ${e?.message || e}\n`);
|
|
1279
|
+
process.exit(1);
|
|
1280
|
+
}
|
|
1281
|
+
// The toolset is read AFTER the ctx build: the memory store's taught:
|
|
1282
|
+
// capability records only register there, so both the default toolset and
|
|
1283
|
+
// an explicit --tools list (e.g. --tools "taught:move onto") see them —
|
|
1284
|
+
// and a world goal refuses when its taught record is outside the toolset.
|
|
1238
1285
|
const declared = declaredCapabilityNames();
|
|
1239
1286
|
let tools = declared;
|
|
1240
1287
|
if (toolsFlag) {
|
|
@@ -1245,17 +1292,6 @@ async function main() {
|
|
|
1245
1292
|
process.exit(2);
|
|
1246
1293
|
}
|
|
1247
1294
|
}
|
|
1248
|
-
let ctx;
|
|
1249
|
-
try {
|
|
1250
|
-
ctx = await buildCapabilityPlanCtx({ config, memoryDir: repo });
|
|
1251
|
-
} catch (e) {
|
|
1252
|
-
process.stderr.write(`tmct plan: could not load the graph — ${e?.message || e}\n`);
|
|
1253
|
-
process.exit(1);
|
|
1254
|
-
}
|
|
1255
|
-
// The default (no --tools) toolset is re-read AFTER the ctx build: the
|
|
1256
|
-
// memory store's taught: capability records only register there, and a
|
|
1257
|
-
// world goal refuses when its taught record is outside the toolset.
|
|
1258
|
-
if (!toolsFlag) tools = declaredCapabilityNames();
|
|
1259
1295
|
try {
|
|
1260
1296
|
const result = await runCapabilityPlan(request, tools, ctx);
|
|
1261
1297
|
if (jsonFlag) {
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"description": "Machine-readable licence rollup for the committed corpus and data files. One entry per corpus family; `notice` names the human-readable attribution file. Guarded by test/estate/corpus-licences.test.mjs.",
|
|
4
|
+
"entries": [
|
|
5
|
+
{
|
|
6
|
+
"path": "corpus/conceptnet/slice.jsonl",
|
|
7
|
+
"upstream": "ConceptNet 5.7.0 assertions dump (conceptnet.io, Commonsense Computing Initiative)",
|
|
8
|
+
"license": "CC-BY-SA-4.0",
|
|
9
|
+
"shareAlike": true,
|
|
10
|
+
"notice": "corpus/conceptnet/LICENSE-NOTICE"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"path": "corpus/seon/",
|
|
14
|
+
"upstream": "first-party (hand-authored for tmct; named in homage to SEON, no SEON content copied)",
|
|
15
|
+
"license": "MPL-2.0",
|
|
16
|
+
"shareAlike": false,
|
|
17
|
+
"notice": "corpus/seon/LICENSE-NOTICE"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"path": "corpus/wordnet/",
|
|
21
|
+
"upstream": "Open English WordNet (globalwordnet/english-wordnet, a continuation of Princeton WordNet)",
|
|
22
|
+
"license": "CC-BY-4.0",
|
|
23
|
+
"shareAlike": false,
|
|
24
|
+
"notice": "corpus/wordnet/LICENSE-NOTICE"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"path": "corpus/namenet/namenet.jsonl",
|
|
28
|
+
"upstream": "Open English Namenet (globalwordnet/english-namenet; declares no explicit licence of its own — CC-BY-4.0 is this repository's conservative label, see the notice)",
|
|
29
|
+
"license": "CC-BY-4.0",
|
|
30
|
+
"shareAlike": false,
|
|
31
|
+
"notice": "corpus/namenet/LICENSE-NOTICE"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"path": "corpus/tier2/aws.jsonl",
|
|
35
|
+
"upstream": "first-party (curated in corpus/tier2/generate.mjs)",
|
|
36
|
+
"license": "MPL-2.0",
|
|
37
|
+
"shareAlike": false,
|
|
38
|
+
"notice": "corpus/tier2/manifest.json"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"path": "corpus/tier2/python.jsonl",
|
|
42
|
+
"upstream": "first-party (curated in corpus/tier2/generate.mjs)",
|
|
43
|
+
"license": "MPL-2.0",
|
|
44
|
+
"shareAlike": false,
|
|
45
|
+
"notice": "corpus/tier2/manifest.json"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "corpus/tier2/java.jsonl",
|
|
49
|
+
"upstream": "first-party (curated in corpus/tier2/generate.mjs)",
|
|
50
|
+
"license": "MPL-2.0",
|
|
51
|
+
"shareAlike": false,
|
|
52
|
+
"notice": "corpus/tier2/manifest.json"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"path": "corpus/tier2/general.jsonl",
|
|
56
|
+
"upstream": "first-party (curated in corpus/tier2/generate.mjs)",
|
|
57
|
+
"license": "MPL-2.0",
|
|
58
|
+
"shareAlike": false,
|
|
59
|
+
"notice": "corpus/tier2/manifest.json"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"path": "corpus/tier2/human.jsonl",
|
|
63
|
+
"upstream": "first-party fact set (hand-curated; vocabulary informed by Open English WordNet and Schema.org, not a verbatim excerpt)",
|
|
64
|
+
"license": "MPL-2.0",
|
|
65
|
+
"shareAlike": false,
|
|
66
|
+
"notice": "corpus/tier2/manifest.json"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"path": "corpus/tier2/human-medium.jsonl",
|
|
70
|
+
"upstream": "first-party fact set (automatically curated from the same Open English WordNet source as human.jsonl)",
|
|
71
|
+
"license": "MPL-2.0",
|
|
72
|
+
"shareAlike": false,
|
|
73
|
+
"notice": "corpus/tier2/manifest.json"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"path": "corpus/tier2/human-large.jsonl",
|
|
77
|
+
"upstream": "first-party fact set (automatically curated from the same Open English WordNet source as human.jsonl)",
|
|
78
|
+
"license": "MPL-2.0",
|
|
79
|
+
"shareAlike": false,
|
|
80
|
+
"notice": "corpus/tier2/manifest.json"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"path": "corpus/tier2/human-examples.jsonl",
|
|
84
|
+
"upstream": "Open English WordNet inline example sentences, reproduced verbatim",
|
|
85
|
+
"license": "CC-BY-4.0",
|
|
86
|
+
"shareAlike": false,
|
|
87
|
+
"notice": "corpus/tier2/manifest.json"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"path": "corpus/tier2/human-examples-medium.jsonl",
|
|
91
|
+
"upstream": "Open English WordNet inline example sentences, reproduced verbatim",
|
|
92
|
+
"license": "CC-BY-4.0",
|
|
93
|
+
"shareAlike": false,
|
|
94
|
+
"notice": "corpus/tier2/manifest.json"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"path": "corpus/tier2/human-examples-large.jsonl",
|
|
98
|
+
"upstream": "Open English WordNet inline examples plus a SemCor-derived supplement (Brown Corpus text re-tagged to modern OEWN senses)",
|
|
99
|
+
"license": "CC-BY-4.0",
|
|
100
|
+
"shareAlike": false,
|
|
101
|
+
"notice": "corpus/tier2/manifest.json"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"path": "corpus/generated/ace-surface-variants.jsonl",
|
|
105
|
+
"upstream": "mechanically generated from Open English WordNet / SemCor example sentences and this repository's own docs prose",
|
|
106
|
+
"license": "CC-BY-4.0",
|
|
107
|
+
"shareAlike": false,
|
|
108
|
+
"notice": "corpus/generated/manifest.json"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"path": "data/",
|
|
112
|
+
"upstream": "first-party (tmct response templates, phrasebook and game data)",
|
|
113
|
+
"license": "MPL-2.0",
|
|
114
|
+
"shareAlike": false,
|
|
115
|
+
"notice": "LICENSE"
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
}
|