tina4-nodejs 3.13.149 → 3.13.150

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.
@@ -830,6 +830,7 @@ export class DevAdmin {
830
830
  { method: "GET", pattern: "/__dev/api/docs/.well-known.json", handler: handleDocsWellKnown },
831
831
  // JS asset
832
832
  { method: "GET", pattern: "/__dev/js/tina4-dev-admin.min.js", handler: handleDevAdminJs },
833
+ { method: "GET", pattern: "/__dev/split", handler: handleDevAdminSplit },
833
834
  // Dev-toolbar assets — served as external CSS/JS so the injected toolbar is
834
835
  // CSP-clean (no inline style=, onclick=, or <script>) under a strict
835
836
  // `default-src 'self'`. Parity with PHP's /__dev/toolbar.css + toolbar.js.
@@ -3139,6 +3140,38 @@ const handleDevAdminJs: RouteHandler = async (_req, res) => {
3139
3140
  res.raw.end("tina4-dev-admin.min.js not found");
3140
3141
  };
3141
3142
 
3143
+ // ---------------------------------------------------------------------------
3144
+ // Dev Admin split view — the shared asset (same file python/php/ruby serve)
3145
+ // ---------------------------------------------------------------------------
3146
+
3147
+ const handleDevAdminSplit: RouteHandler = async (_req, res) => {
3148
+ const { readFileSync, existsSync } = await import("node:fs");
3149
+ const { dirname, join, resolve } = await import("node:path");
3150
+ const { fileURLToPath } = await import("node:url");
3151
+ const dir = dirname(fileURLToPath(import.meta.url));
3152
+
3153
+ const candidates = [
3154
+ join(dir, "..", "public", "js", "tina4-dev-admin-split.html"),
3155
+ join(dir, "..", "..", "public", "js", "tina4-dev-admin-split.html"),
3156
+ resolve(process.cwd(), "node_modules", "tina4-nodejs", "packages", "core", "public", "js", "tina4-dev-admin-split.html"),
3157
+ resolve(process.cwd(), "public", "js", "tina4-dev-admin-split.html"),
3158
+ ];
3159
+
3160
+ for (const path of candidates) {
3161
+ if (existsSync(path)) {
3162
+ try {
3163
+ const content = readFileSync(path, "utf-8");
3164
+ res.raw.writeHead(200, { "Content-Type": "text/html; charset=utf-8", "Cache-Control": "no-cache" });
3165
+ res.raw.end(content);
3166
+ return;
3167
+ } catch { /* try next */ }
3168
+ }
3169
+ }
3170
+
3171
+ res.raw.writeHead(404, { "Content-Type": "text/plain" });
3172
+ res.raw.end("tina4-dev-admin-split.html not found");
3173
+ };
3174
+
3142
3175
  // ---------------------------------------------------------------------------
3143
3176
  // Overlay script — floating Tina4 button
3144
3177
  // ---------------------------------------------------------------------------
@@ -69,7 +69,11 @@ export function enginePath(): string | null {
69
69
  function runEngine(target: string): Record<string, any> {
70
70
  const binary = enginePath();
71
71
  if (!binary) throw new MetricsEngineError(`tina4 not found on PATH - ${INSTALL_HINT}`);
72
- const processResult = spawnSync(binary, ["metrics", "--path", target, "--json"], {
72
+ // --no-history: a dashboard READ must never write .tina4-metrics.json.
73
+ // Without it every scan records history, the file watcher sees the write and
74
+ // reloads the page, which re-scans - a self-inflicted ~2-second reload loop
75
+ // that makes the dashboard unusable.
76
+ const processResult = spawnSync(binary, ["metrics", "--path", target, "--json", "--no-history"], {
73
77
  encoding: "utf8",
74
78
  timeout: 60_000,
75
79
  maxBuffer: 64 * 1024 * 1024,
@@ -533,7 +533,7 @@ export const Plan = {
533
533
  const title = currentPlan.title || target;
534
534
  const goal = currentPlan.goal || "";
535
535
 
536
- const aiUrl = process.env.TINA4_AI_URL || "http://localhost:11437/api/chat";
536
+ const aiUrl = process.env.TINA4_AI_URL || "http://localhost:11435/api/chat";
537
537
  const aiModel = process.env.TINA4_AI_MODEL || "qwen2.5-coder:14b";
538
538
  const prompts = fleshPrompt(title, goal, existing, prompt);
539
539
  const fetched = await fetchFleshReply(aiUrl, aiModel, prompts);
@@ -13512,7 +13512,7 @@ function enginePath() {
13512
13512
  function runEngine(target) {
13513
13513
  const binary = enginePath();
13514
13514
  if (!binary) throw new MetricsEngineError(`tina4 not found on PATH - ${INSTALL_HINT}`);
13515
- const processResult = spawnSync(binary, ["metrics", "--path", target, "--json"], {
13515
+ const processResult = spawnSync(binary, ["metrics", "--path", target, "--json", "--no-history"], {
13516
13516
  encoding: "utf8",
13517
13517
  timeout: 6e4,
13518
13518
  maxBuffer: 64 * 1024 * 1024
@@ -22690,7 +22690,7 @@ var init_plan = __esm({
22690
22690
  const existing = (currentPlan.steps || []).map((s) => s.text || "");
22691
22691
  const title = currentPlan.title || target;
22692
22692
  const goal = currentPlan.goal || "";
22693
- const aiUrl = process.env.TINA4_AI_URL || "http://localhost:11437/api/chat";
22693
+ const aiUrl = process.env.TINA4_AI_URL || "http://localhost:11435/api/chat";
22694
22694
  const aiModel = process.env.TINA4_AI_MODEL || "qwen2.5-coder:14b";
22695
22695
  const prompts = fleshPrompt(title, goal, existing, prompt);
22696
22696
  const fetched = await fetchFleshReply(aiUrl, aiModel, prompts);
@@ -25127,7 +25127,7 @@ function toolbarJs() {
25127
25127
  connect();
25128
25128
  })();`;
25129
25129
  }
25130
- var cpuCount, DEV_MCP_PREFIXES, DEV_PUBLIC_ASSETS, DEV_SECRET_BASENAMES, DEV_SECRET_SUFFIXES, MessageLog, RequestInspector, ErrorTracker, DevMailboxStore, DevQueue, WsTracker, DevAdmin, handleDashboard, _reloadMtime, _reloadFile, handleMtime, handleReload, handleMessages, handleMessagesClear, handleRequests, handleRequestsClear, handleSystem, handleMessagesSearch, handleQueue, handleQueueTopics, handleQueueDeadLetters, handleQueueRetry, handleQueuePurge, handleQueueReplay, handleMailbox, handleMailboxRead, handleMailboxSeed, handleMailboxClear, handleTable, handleTables, handleSeed, handleQuery, handleBroken, handleBrokenResolve, handleBrokenClear, handleWebsockets, handleWebsocketsDisconnect, handleTool, DEFAULT_MCP_URL, handleGroundingStatus, handleGroundingToken, handleMigrate, handleSeedRun, handleTest, handleThreads, handleThreadsSub, handleConnections, handleConnectionsTest, handleConnectionsSave, __devAdminFilename, __devAdminDirname, handleGalleryList, handleVersionCheck, handleThoughts, handleSuperviseStub, DEV_FILES_IGNORED, handleFiles, DEV_ADMIN_LANG_MAP, handleFileRead, handleFileSave, handleFileRaw, handleFileRename, handleFileDelete, handleDepsSearch, handleDepsInstall, handleGitStatus, handleMcpTools, handleMcpCall, handleMcpStreamable, handleMcpDelete, handleMcpGet405, handleMcpLegacyMessage, handleMcpSse, handleScaffoldList, handleScaffoldRun, handlePlanCurrent, handlePlanList, handlePlanCreate, handlePlanSwitch, handlePlanCompleteStep, handlePlanAddStep, handlePlanNote, handlePlanArchive, handlePlanRead, handlePlanFlesh, handleIndexRebuild, handleIndexSearch, handleIndexFile, handleIndexOverview, handleDocsSearch, handleDocsClass, handleDocsMethod, handleDocsIndex, handleDocsWellKnown, handleDevAdminJs, handleToolbarCss, handleToolbarJs;
25130
+ var cpuCount, DEV_MCP_PREFIXES, DEV_PUBLIC_ASSETS, DEV_SECRET_BASENAMES, DEV_SECRET_SUFFIXES, MessageLog, RequestInspector, ErrorTracker, DevMailboxStore, DevQueue, WsTracker, DevAdmin, handleDashboard, _reloadMtime, _reloadFile, handleMtime, handleReload, handleMessages, handleMessagesClear, handleRequests, handleRequestsClear, handleSystem, handleMessagesSearch, handleQueue, handleQueueTopics, handleQueueDeadLetters, handleQueueRetry, handleQueuePurge, handleQueueReplay, handleMailbox, handleMailboxRead, handleMailboxSeed, handleMailboxClear, handleTable, handleTables, handleSeed, handleQuery, handleBroken, handleBrokenResolve, handleBrokenClear, handleWebsockets, handleWebsocketsDisconnect, handleTool, DEFAULT_MCP_URL, handleGroundingStatus, handleGroundingToken, handleMigrate, handleSeedRun, handleTest, handleThreads, handleThreadsSub, handleConnections, handleConnectionsTest, handleConnectionsSave, __devAdminFilename, __devAdminDirname, handleGalleryList, handleVersionCheck, handleThoughts, handleSuperviseStub, DEV_FILES_IGNORED, handleFiles, DEV_ADMIN_LANG_MAP, handleFileRead, handleFileSave, handleFileRaw, handleFileRename, handleFileDelete, handleDepsSearch, handleDepsInstall, handleGitStatus, handleMcpTools, handleMcpCall, handleMcpStreamable, handleMcpDelete, handleMcpGet405, handleMcpLegacyMessage, handleMcpSse, handleScaffoldList, handleScaffoldRun, handlePlanCurrent, handlePlanList, handlePlanCreate, handlePlanSwitch, handlePlanCompleteStep, handlePlanAddStep, handlePlanNote, handlePlanArchive, handlePlanRead, handlePlanFlesh, handleIndexRebuild, handleIndexSearch, handleIndexFile, handleIndexOverview, handleDocsSearch, handleDocsClass, handleDocsMethod, handleDocsIndex, handleDocsWellKnown, handleDevAdminJs, handleDevAdminSplit, handleToolbarCss, handleToolbarJs;
25131
25131
  var init_devAdmin = __esm({
25132
25132
  "../core/src/devAdmin.ts"() {
25133
25133
  "use strict";
@@ -25597,6 +25597,7 @@ var init_devAdmin = __esm({
25597
25597
  { method: "GET", pattern: "/__dev/api/docs/.well-known.json", handler: handleDocsWellKnown },
25598
25598
  // JS asset
25599
25599
  { method: "GET", pattern: "/__dev/js/tina4-dev-admin.min.js", handler: handleDevAdminJs },
25600
+ { method: "GET", pattern: "/__dev/split", handler: handleDevAdminSplit },
25600
25601
  // Dev-toolbar assets — served as external CSS/JS so the injected toolbar is
25601
25602
  // CSP-clean (no inline style=, onclick=, or <script>) under a strict
25602
25603
  // `default-src 'self'`. Parity with PHP's /__dev/toolbar.css + toolbar.js.
@@ -27035,6 +27036,31 @@ var init_devAdmin = __esm({
27035
27036
  res.raw.writeHead(404, { "Content-Type": "text/plain" });
27036
27037
  res.raw.end("tina4-dev-admin.min.js not found");
27037
27038
  };
27039
+ handleDevAdminSplit = async (_req, res) => {
27040
+ const { readFileSync: readFileSync27, existsSync: existsSync29 } = await import("node:fs");
27041
+ const { dirname: dirname17, join: join33, resolve: resolve21 } = await import("node:path");
27042
+ const { fileURLToPath: fileURLToPath10 } = await import("node:url");
27043
+ const dir = dirname17(fileURLToPath10(import.meta.url));
27044
+ const candidates = [
27045
+ join33(dir, "..", "public", "js", "tina4-dev-admin-split.html"),
27046
+ join33(dir, "..", "..", "public", "js", "tina4-dev-admin-split.html"),
27047
+ resolve21(process.cwd(), "node_modules", "tina4-nodejs", "packages", "core", "public", "js", "tina4-dev-admin-split.html"),
27048
+ resolve21(process.cwd(), "public", "js", "tina4-dev-admin-split.html")
27049
+ ];
27050
+ for (const path10 of candidates) {
27051
+ if (existsSync29(path10)) {
27052
+ try {
27053
+ const content = readFileSync27(path10, "utf-8");
27054
+ res.raw.writeHead(200, { "Content-Type": "text/html; charset=utf-8", "Cache-Control": "no-cache" });
27055
+ res.raw.end(content);
27056
+ return;
27057
+ } catch {
27058
+ }
27059
+ }
27060
+ }
27061
+ res.raw.writeHead(404, { "Content-Type": "text/plain" });
27062
+ res.raw.end("tina4-dev-admin-split.html not found");
27063
+ };
27038
27064
  handleToolbarCss = (_req, res) => {
27039
27065
  res.raw.writeHead(200, { "Content-Type": "text/css; charset=utf-8", "Cache-Control": "no-cache" });
27040
27066
  res.raw.end(toolbarCss());