@skillstate/core 2.0.5 → 2.0.7

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.
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Resolve the per-project state file for a working directory —
3
+ * `<cwd>/.skillstate/skillstate.json`, or the global bucket
4
+ * `<home>/.skillstate/global/skillstate.json` when cwd equals home
5
+ * (`home` defaults to `os.homedir()`).
6
+ */
7
+ export declare function resolveHostStateForCwd(cwd: string, home?: string): string;
8
+ //# sourceMappingURL=host-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-state.d.ts","sourceRoot":"","sources":["../src/host-state.ts"],"names":[],"mappings":"AAiBA;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAOzE"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @non-paper Wave-4 DX helper — the canonical per-project state resolver
3
+ * shared by every host adapter (OpenCode plugin, Codex hooks/fork-trim,
4
+ * Claude Code hooks).
5
+ *
6
+ * Semantics: the state file for a working directory is
7
+ * `<cwd>/.skillstate/skillstate.json`; a session opened directly in the
8
+ * user's home resolves to the global bucket
9
+ * `<home>/.skillstate/global/skillstate.json`. Pure path arithmetic — no
10
+ * filesystem access. Host-embedded hook scripts (self-contained `.cjs`)
11
+ * keep a byte-equivalent copy of this logic because they must run without
12
+ * importing `@skillstate/*`; this function is the single source of truth
13
+ * the copies mirror.
14
+ */
15
+ import * as os from 'node:os';
16
+ import * as path from 'node:path';
17
+ /**
18
+ * Resolve the per-project state file for a working directory —
19
+ * `<cwd>/.skillstate/skillstate.json`, or the global bucket
20
+ * `<home>/.skillstate/global/skillstate.json` when cwd equals home
21
+ * (`home` defaults to `os.homedir()`).
22
+ */
23
+ export function resolveHostStateForCwd(cwd, home) {
24
+ const resolvedCwd = path.resolve(cwd);
25
+ const resolvedHome = path.resolve(home ?? os.homedir());
26
+ if (resolvedCwd === resolvedHome) {
27
+ return path.join(resolvedHome, '.skillstate', 'global', 'skillstate.json');
28
+ }
29
+ return path.join(resolvedCwd, '.skillstate', 'skillstate.json');
30
+ }
31
+ //# sourceMappingURL=host-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-state.js","sourceRoot":"","sources":["../src/host-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAAW,EAAE,IAAa;IAC/D,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;IACxD,IAAI,WAAW,KAAK,YAAY,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,aAAa,EAAE,iBAAiB,CAAC,CAAC;AAClE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -15,6 +15,7 @@ export * from './events.js';
15
15
  export * from './logger.js';
16
16
  export * from './provider.js';
17
17
  export * from './config.js';
18
+ export * from './host-state.js';
18
19
  export * from './shutdown.js';
19
20
  export * from './schemas/index.js';
20
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AAErC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAElC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAE5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AAErC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAElC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAE5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -23,6 +23,7 @@ export * from './logger.js';
23
23
  // @non-paper Wave-4 DX helpers (additive, opt-in).
24
24
  export * from './provider.js';
25
25
  export * from './config.js';
26
+ export * from './host-state.js';
26
27
  export * from './shutdown.js';
27
28
  export * from './schemas/index.js';
28
29
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.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c,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skillstate/core",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "Paper-exact skillstate runtime core (A.4 byte-verbatim formatPaper, §4.3 token tracker).",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",