llms-ink 0.8.1 → 0.8.2

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/README.md CHANGED
@@ -307,7 +307,7 @@ JavaScript uses a 65-second total request deadline; pass `{ signal }` to cancel
307
307
  `llms-ink/guard/claude` binds one Claude Agent SDK conversation to one authenticated local Guard session. Install the optional peer separately:
308
308
 
309
309
  ```sh
310
- npm install llms-ink@0.8.1 @anthropic-ai/claude-agent-sdk@0.3.319
310
+ npm install llms-ink@0.8.2 @anthropic-ai/claude-agent-sdk@0.3.319
311
311
  ```
312
312
 
313
313
  First [start the Python 0.14.0 local service](https://llms.ink/guard/service/) with a reviewed gateway configuration and existing Claude authentication. Then try the bundled terminal host:
@@ -319,7 +319,7 @@ node node_modules/llms-ink/examples/guard-claude.mjs \
319
319
  --cwd /absolute/path/to/workspace
320
320
  ```
321
321
 
322
- It requires an interactive terminal and displays the complete review for each permitted action. Type `approve` to send that call once; Enter declines. `/exit`, terminal close and handled termination revoke the session. The example escapes terminal control characters rather than interpreting them. `--model` and `--claude-executable` are optional.
322
+ It requires an interactive terminal and displays the complete review for each permitted action. Type `approve` to send that call once; Enter declines. `/exit`, terminal close and handled termination revoke the session. Model prose is prefixed with `Claude:`. Actual SDK tool responses appear separately under `Tool response`, with an error label for tool errors, the tool-use identifier and complete returned content. A response shows what the tool reported; it does not independently prove an external effect. Terminal and directional controls are escaped rather than interpreted. `--model` and `--claude-executable` are optional.
323
323
 
324
324
  For application hosts, import `createGuardedClaude` and pass absolute `ownerFile`, `python` and `cwd` paths plus `review: async ({message, signal}) => boolean`. Render `message` completely as plain text; abort the UI on `signal`. Only a fresh literal `true` accepts. The returned object exposes the non-secret `sessionId`, sequential `run(prompt, onMessage?)` and `close()`. Always await close in a finally block. Create a new instance for each independent conversation; there is no resume/fork interface. The owner file never enters the SDK's MCP configuration.
325
325
 
package/dist/index.d.ts CHANGED
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { type InspectionReceipt } from './inspect.ts';
17
17
  export type { InspectionReceipt } from './inspect.ts';
18
- export declare const VERSION = "0.8.1";
18
+ export declare const VERSION = "0.8.2";
19
19
  export declare const DEFAULT_BASE_URL = "https://llms.ink";
20
20
  /** `llms` for the index (llms.txt), `full` for llms-full.txt. */
21
21
  export type Mode = 'llms' | 'full';
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { prepareInspection, inspectionJson, inspectionReceipt } from "./inspect.js";
17
17
  import { env } from "./env.js";
18
- export const VERSION = '0.8.1';
18
+ export const VERSION = '0.8.2';
19
19
  export const DEFAULT_BASE_URL = 'https://llms.ink';
20
20
  /**
21
21
  * An API error, or llms.ink couldn't be reached (then `status` and `code` are undefined).
@@ -8,7 +8,7 @@ if(!process.stdin.isTTY || !process.stdout.isTTY) throw Error('This example requ
8
8
  if(!values['owner-file'] || !values.python || !values.cwd) throw Error('Pass --owner-file, --python and --cwd with absolute paths.');
9
9
  const terminal=createInterface({input:process.stdin,output:process.stdout});
10
10
  // Preserve complete text while making terminal controls and bidi controls visible.
11
- const plain=text=>text.replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/g,c=>'\\u'+c.charCodeAt(0).toString(16).padStart(4,'0'));
11
+ const plain=text=>text.replace(/[\u0000-\u0008\u000b-\u001f\u007f-\u009f\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g,c=>'\\u'+c.charCodeAt(0).toString(16).padStart(4,'0'));
12
12
  let conversation,stopping=false;
13
13
  const report=error=>{
14
14
  console.error(error instanceof GuardHostError?error.message:'The terminal conversation did not complete.');
@@ -33,7 +33,13 @@ try{
33
33
  if(prompt.trim()==='/exit')break;
34
34
  if(!prompt.trim())continue;
35
35
  await conversation.run(prompt,message=>{
36
- if(message.type==='assistant')for(const part of message.message.content)if(part.type==='text')process.stdout.write(plain(part.text)+'\n');
36
+ if(message.type==='assistant')for(const part of message.message.content)if(part.type==='text'){
37
+ for(const line of plain(part.text).split('\n'))process.stdout.write('Claude: '+line+'\n');
38
+ }
39
+ if(message.type==='user' && Array.isArray(message.message.content))for(const part of message.message.content)if(part.type==='tool_result'){
40
+ process.stdout.write('\nTool response'+(part.is_error===true?' (error)':'')+'\n');
41
+ process.stdout.write(plain(JSON.stringify({toolUseId:part.tool_use_id,content:part.content},null,2))+'\n');
42
+ }
37
43
  });
38
44
  }
39
45
  }catch(error){if(!stopping){report(error);process.exitCode=1;}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "llms-ink",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "Turn any link \u2014 site, docs section, page, GitHub repo, PDF or video \u2014 into llms.txt and llms-full.txt. Typed client for llms.ink, plus a Vite plugin, an Astro integration and middleware that serve the files from your site, and Vercel AI SDK tools. No dependencies.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -51,7 +51,7 @@
51
51
  "test:live": "npm run build && node --test test/live.test.mjs",
52
52
  "test:bun": "npm run build && bun test ./test/client.test.mjs ./test/plugins.test.mjs ./test/middleware.test.mjs ./test/traffic.test.mjs ./test/inspect.test.mjs ./test/ai.test.mjs",
53
53
  "test:bun:live": "npm run build && bun test --timeout 300000 ./test/live.test.mjs",
54
- "test:guard": "node --experimental-test-module-mocks --test test/guard-claude.test.mjs",
54
+ "test:guard": "node --experimental-test-module-mocks --test test/guard-claude.test.mjs test/guard-terminal.test.mjs",
55
55
  "test:guard:live": "node --test test/guard-claude-live.test.mjs"
56
56
  },
57
57
  "keywords": [