tina4-nodejs 3.13.115 → 3.13.116

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/CLAUDE.md CHANGED
@@ -13,13 +13,13 @@ Even if the skill text is not currently loaded, these are non-negotiable:
13
13
 
14
14
  The full discipline lives in `.claude/skills/tina4-maintainer/SKILL.md`; this block is the always-on floor.
15
15
 
16
- # CLAUDE.md - AI Developer Guide for tina4-nodejs (v3.13.115)
16
+ # CLAUDE.md - AI Developer Guide for tina4-nodejs (v3.13.116)
17
17
 
18
18
  > This file helps AI assistants (Claude, Copilot, Cursor, etc.) understand and work on this codebase effectively.
19
19
 
20
20
  ## What This Project Is
21
21
 
22
- Tina4 for Node.js/TypeScript v3.13.115 - The Intelligent Native Application 4ramework. A convention-over-configuration structural paradigm. The developer writes TypeScript; Tina4 is invisible infrastructure.
22
+ Tina4 for Node.js/TypeScript v3.13.116 - The Intelligent Native Application 4ramework. A convention-over-configuration structural paradigm. The developer writes TypeScript; Tina4 is invisible infrastructure.
23
23
 
24
24
  The philosophy: zero ceremony, batteries included, file system as source of truth.
25
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tina4-nodejs",
3
- "version": "3.13.115",
3
+ "version": "3.13.116",
4
4
  "type": "module",
5
5
  "description": "Tina4 for Node.js/TypeScript - native TypeScript conventions and shared Tina4 contracts",
6
6
  "keywords": [
@@ -38499,6 +38499,7 @@ var registry, watchedFiles, Tina4Service, ServiceRunner;
38499
38499
  var init_service = __esm({
38500
38500
  "../core/src/service.ts"() {
38501
38501
  "use strict";
38502
+ init_logger();
38502
38503
  registry = /* @__PURE__ */ new Map();
38503
38504
  watchedFiles = /* @__PURE__ */ new Set();
38504
38505
  Tina4Service = class {
@@ -38642,6 +38643,17 @@ var init_service = __esm({
38642
38643
  static stop(name) {
38643
38644
  const targets = name ? [registry.get(name)].filter(Boolean) : Array.from(registry.values());
38644
38645
  for (const svc of targets) {
38646
+ const instance = svc.instance;
38647
+ if (instance && typeof instance.stop === "function") {
38648
+ try {
38649
+ instance.stop();
38650
+ } catch (err) {
38651
+ Log.error("Error stopping service instance", {
38652
+ name: svc.name,
38653
+ error: err instanceof Error ? err.message : String(err)
38654
+ });
38655
+ }
38656
+ }
38645
38657
  svc.context.running = false;
38646
38658
  if (svc.timerId) {
38647
38659
  clearInterval(svc.timerId);
@@ -38478,6 +38478,7 @@ var registry, watchedFiles, Tina4Service, ServiceRunner;
38478
38478
  var init_service = __esm({
38479
38479
  "src/service.ts"() {
38480
38480
  "use strict";
38481
+ init_logger();
38481
38482
  registry = /* @__PURE__ */ new Map();
38482
38483
  watchedFiles = /* @__PURE__ */ new Set();
38483
38484
  Tina4Service = class {
@@ -38621,6 +38622,17 @@ var init_service = __esm({
38621
38622
  static stop(name) {
38622
38623
  const targets = name ? [registry.get(name)].filter(Boolean) : Array.from(registry.values());
38623
38624
  for (const svc of targets) {
38625
+ const instance = svc.instance;
38626
+ if (instance && typeof instance.stop === "function") {
38627
+ try {
38628
+ instance.stop();
38629
+ } catch (err) {
38630
+ Log.error("Error stopping service instance", {
38631
+ name: svc.name,
38632
+ error: err instanceof Error ? err.message : String(err)
38633
+ });
38634
+ }
38635
+ }
38624
38636
  svc.context.running = false;
38625
38637
  if (svc.timerId) {
38626
38638
  clearInterval(svc.timerId);
@@ -5,6 +5,7 @@
5
5
  import { readdirSync, statSync, watchFile, unwatchFile } from "node:fs";
6
6
  import { join, extname } from "node:path";
7
7
  import { pathToFileURL } from "node:url";
8
+ import { Log } from "./logger.js";
8
9
 
9
10
  // ─── Types ───────────────────────────────────────────────────────────────────
10
11
 
@@ -40,6 +41,7 @@ interface RegisteredService {
40
41
  context: ServiceContext;
41
42
  timerId: ReturnType<typeof setInterval> | null;
42
43
  retries: number;
44
+ instance?: Tina4Service;
43
45
  }
44
46
 
45
47
  const registry = new Map<string, RegisteredService>();
@@ -266,11 +268,10 @@ export class ServiceRunner {
266
268
  ): void {
267
269
  const merged: ServiceOptions = { daemon: true, ...options };
268
270
  this.register(name, service.asHandler(), merged);
269
- // Stash the instance on the registry entry so future stop() calls
270
- // can route to service.stop().
271
+ // Stash the instance so stop() can route to service.stop().
271
272
  const entry = registry.get(name);
272
273
  if (entry) {
273
- (entry as unknown as Record<string, unknown>).instance = service;
274
+ entry.instance = service;
274
275
  }
275
276
  }
276
277
 
@@ -362,6 +363,17 @@ export class ServiceRunner {
362
363
  : Array.from(registry.values());
363
364
 
364
365
  for (const svc of targets) {
366
+ const instance = svc.instance;
367
+ if (instance && typeof instance.stop === "function") {
368
+ try {
369
+ instance.stop();
370
+ } catch (err) {
371
+ Log.error("Error stopping service instance", {
372
+ name: svc.name,
373
+ error: err instanceof Error ? err.message : String(err),
374
+ });
375
+ }
376
+ }
365
377
  svc.context.running = false;
366
378
  if (svc.timerId) {
367
379
  clearInterval(svc.timerId);
@@ -27305,6 +27305,7 @@ var registry, watchedFiles, Tina4Service, ServiceRunner;
27305
27305
  var init_service = __esm({
27306
27306
  "../core/src/service.ts"() {
27307
27307
  "use strict";
27308
+ init_logger();
27308
27309
  registry = /* @__PURE__ */ new Map();
27309
27310
  watchedFiles = /* @__PURE__ */ new Set();
27310
27311
  Tina4Service = class {
@@ -27448,6 +27449,17 @@ var init_service = __esm({
27448
27449
  static stop(name) {
27449
27450
  const targets = name ? [registry.get(name)].filter(Boolean) : Array.from(registry.values());
27450
27451
  for (const svc of targets) {
27452
+ const instance = svc.instance;
27453
+ if (instance && typeof instance.stop === "function") {
27454
+ try {
27455
+ instance.stop();
27456
+ } catch (err) {
27457
+ Log.error("Error stopping service instance", {
27458
+ name: svc.name,
27459
+ error: err instanceof Error ? err.message : String(err)
27460
+ });
27461
+ }
27462
+ }
27451
27463
  svc.context.running = false;
27452
27464
  if (svc.timerId) {
27453
27465
  clearInterval(svc.timerId);