@wrongstack/sdd 0.303.0 → 0.305.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/dist/index.js CHANGED
@@ -1964,6 +1964,7 @@ var AISpecBuilder = class {
1964
1964
  maxQuestions;
1965
1965
  sessionPath;
1966
1966
  sessionPersistence;
1967
+ pendingSessionWrite = Promise.resolve();
1967
1968
  constructor(opts) {
1968
1969
  this.store = opts.store;
1969
1970
  this.minQuestions = opts.minQuestions ?? 2;
@@ -1987,27 +1988,31 @@ var AISpecBuilder = class {
1987
1988
  /** Save session state to the configured durable owner. */
1988
1989
  async saveSession() {
1989
1990
  if (!this.sessionPersistence && !this.sessionPath) return;
1990
- try {
1991
- if (this.sessionPersistence) {
1992
- await this.sessionPersistence.save(structuredClone(this.session));
1993
- return;
1991
+ const snapshot = structuredClone(this.session);
1992
+ this.pendingSessionWrite = this.pendingSessionWrite.then(async () => {
1993
+ try {
1994
+ if (this.sessionPersistence) {
1995
+ await this.sessionPersistence.save(snapshot);
1996
+ return;
1997
+ }
1998
+ const fsp7 = await import("node:fs/promises");
1999
+ const path6 = await import("node:path");
2000
+ const { atomicWrite: atomicWrite4 } = await import("@wrongstack/core/utils");
2001
+ const sessionPath = expectDefined2(this.sessionPath);
2002
+ await fsp7.mkdir(path6.dirname(sessionPath), { recursive: true });
2003
+ await atomicWrite4(sessionPath, JSON.stringify(snapshot, null, 2));
2004
+ } catch (error) {
2005
+ console.warn(
2006
+ JSON.stringify({
2007
+ level: "warn",
2008
+ event: "sdd.persist.failed",
2009
+ message: String(error),
2010
+ timestamp: Date.now()
2011
+ })
2012
+ );
1994
2013
  }
1995
- const fsp7 = await import("node:fs/promises");
1996
- const path6 = await import("node:path");
1997
- const { atomicWrite: atomicWrite4 } = await import("@wrongstack/core/utils");
1998
- const sessionPath = expectDefined2(this.sessionPath);
1999
- await fsp7.mkdir(path6.dirname(sessionPath), { recursive: true });
2000
- await atomicWrite4(sessionPath, JSON.stringify(this.session, null, 2));
2001
- } catch (error) {
2002
- console.warn(
2003
- JSON.stringify({
2004
- level: "warn",
2005
- event: "sdd.persist.failed",
2006
- message: String(error),
2007
- timestamp: Date.now()
2008
- })
2009
- );
2010
- }
2014
+ });
2015
+ await this.pendingSessionWrite;
2011
2016
  }
2012
2017
  /** Load session state from the configured durable owner. */
2013
2018
  async loadSession() {
@@ -2034,6 +2039,7 @@ var AISpecBuilder = class {
2034
2039
  }
2035
2040
  /** Delete the saved session from the configured durable owner. */
2036
2041
  async deleteSession() {
2042
+ await this.pendingSessionWrite;
2037
2043
  if (this.sessionPersistence) {
2038
2044
  await this.sessionPersistence.delete();
2039
2045
  return;
@@ -27,6 +27,7 @@ export declare class AISpecBuilder {
27
27
  private readonly maxQuestions;
28
28
  private readonly sessionPath?;
29
29
  private readonly sessionPersistence?;
30
+ private pendingSessionWrite;
30
31
  constructor(opts: AISpecBuilderOptions);
31
32
  /** Save session state to the configured durable owner. */
32
33
  saveSession(): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/sdd",
3
- "version": "0.303.0",
3
+ "version": "0.305.1",
4
4
  "license": "MIT",
5
5
  "description": "WrongStack Spec-Driven Development engine — standalone package extracted from @wrongstack/core. Task graph generation, tracking, execution, lifecycle management, and AI-driven spec building for SDD workflows.",
6
6
  "repository": {
@@ -27,9 +27,9 @@
27
27
  "!dist/**/*.map"
28
28
  ],
29
29
  "dependencies": {
30
- "@wrongstack/core": "0.303.0",
31
- "@wrongstack/kanban": "0.303.0",
32
- "@wrongstack/requirement-intake": "0.303.0"
30
+ "@wrongstack/core": "0.305.1",
31
+ "@wrongstack/requirement-intake": "0.305.1",
32
+ "@wrongstack/kanban": "0.305.1"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/node": "^26.1.2",