@superdoc-dev/sdk 1.3.0-next.75 → 1.3.0-next.77

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.
@@ -8,6 +8,9 @@ var errors = require('./errors.cjs');
8
8
  const HOST_PROTOCOL_VERSION = '1.0';
9
9
  const REQUIRED_FEATURES = ['cli.invoke', 'host.shutdown'];
10
10
  const CHANGE_MODES = ['direct', 'tracked'];
11
+ const FORWARD_HOST_STDERR = typeof process !== 'undefined' && typeof process.env?.SUPERDOC_DEBUG_TEXT_REWRITE === 'string'
12
+ ? process.env.SUPERDOC_DEBUG_TEXT_REWRITE === '1'
13
+ : false;
11
14
  const JSON_RPC_TIMEOUT_CODE = -32011;
12
15
  /**
13
16
  * Transport that communicates with a long-lived CLI host process over JSON-RPC stdio.
@@ -125,8 +128,11 @@ class HostTransport {
125
128
  stdoutReader.on('line', (line) => {
126
129
  this.onStdoutLine(line);
127
130
  });
128
- child.stderr.on('data', () => {
129
- // stderr intentionally ignored in host mode
131
+ child.stderr.on('data', (chunk) => {
132
+ if (!FORWARD_HOST_STDERR) {
133
+ return;
134
+ }
135
+ process.stderr.write(`[superdoc-host] ${String(chunk)}`);
130
136
  });
131
137
  child.on('error', (error) => {
132
138
  this.handleDisconnect(new errors.SuperDocCliError('Host process failed.', {
@@ -1 +1 @@
1
- {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/runtime/host.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAE3B,MAAM,uBAAuB,CAAC;AA4B/B;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAqC;IAC1D,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;IAC3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
6
  const REQUIRED_FEATURES = ['cli.invoke', 'host.shutdown'];
7
7
  const CHANGE_MODES = ['direct', 'tracked'];
8
+ const FORWARD_HOST_STDERR = typeof process !== 'undefined' && typeof process.env?.SUPERDOC_DEBUG_TEXT_REWRITE === 'string'
9
+ ? process.env.SUPERDOC_DEBUG_TEXT_REWRITE === '1'
10
+ : false;
8
11
  const JSON_RPC_TIMEOUT_CODE = -32011;
9
12
  /**
10
13
  * Transport that communicates with a long-lived CLI host process over JSON-RPC stdio.
@@ -122,8 +125,11 @@ export class HostTransport {
122
125
  stdoutReader.on('line', (line) => {
123
126
  this.onStdoutLine(line);
124
127
  });
125
- child.stderr.on('data', () => {
126
- // stderr intentionally ignored in host mode
128
+ child.stderr.on('data', (chunk) => {
129
+ if (!FORWARD_HOST_STDERR) {
130
+ return;
131
+ }
132
+ process.stderr.write(`[superdoc-host] ${String(chunk)}`);
127
133
  });
128
134
  child.on('error', (error) => {
129
135
  this.handleDisconnect(new SuperDocCliError('Host process failed.', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/sdk",
3
- "version": "1.3.0-next.75",
3
+ "version": "1.3.0-next.77",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -26,11 +26,11 @@
26
26
  "typescript": "^5.9.2"
27
27
  },
28
28
  "optionalDependencies": {
29
- "@superdoc-dev/sdk-darwin-arm64": "1.3.0-next.75",
30
- "@superdoc-dev/sdk-linux-arm64": "1.3.0-next.75",
31
- "@superdoc-dev/sdk-darwin-x64": "1.3.0-next.75",
32
- "@superdoc-dev/sdk-windows-x64": "1.3.0-next.75",
33
- "@superdoc-dev/sdk-linux-x64": "1.3.0-next.75"
29
+ "@superdoc-dev/sdk-darwin-arm64": "1.3.0-next.77",
30
+ "@superdoc-dev/sdk-darwin-x64": "1.3.0-next.77",
31
+ "@superdoc-dev/sdk-linux-x64": "1.3.0-next.77",
32
+ "@superdoc-dev/sdk-linux-arm64": "1.3.0-next.77",
33
+ "@superdoc-dev/sdk-windows-x64": "1.3.0-next.77"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"
@@ -176,6 +176,10 @@ When formatting newly created content, use the right source:
176
176
  - **Signature/form fields**: Use justify or left alignment
177
177
  - When the user says "heading", use `action: "heading"` with a level, even if the document uses styled paragraphs as titles.
178
178
 
179
+ ## Understanding document structure
180
+
181
+ When the user refers to "the first paragraph," they mean the first body text paragraph, NOT the document title or headings. Centered, bold, or ALL-CAPS blocks at the top of a document are titles/headings, not body paragraphs. Identify them correctly before operating.
182
+
179
183
  ## Constraints
180
184
 
181
185
  - **Format calls must be sequential, one per turn.** Each format call bumps the document revision and invalidates all outstanding refs. Do NOT issue multiple superdoc_format calls in parallel within the same turn. Format one block, then re-fetch if needed for the next block.