neoctl 0.2.61 → 0.2.63

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.
@@ -2,28 +2,28 @@ import localFs from "node:fs/promises";
2
2
  import { existsSync as localExistsSync, readFileSync as localReadFileSync, statSync as localStatSync } from "node:fs";
3
3
  import { dockerArgs, dockerEnabled, dockerRun, dockerRunSync } from "./docker.js";
4
4
  // This small transport program is sent over stdin; no host paths or application code are mounted.
5
- const program = String.raw `
6
- const fs = require('node:fs/promises');
7
- const chunks = [];
8
- process.stdin.on('data', c => chunks.push(c));
9
- process.stdin.on('end', async () => {
10
- const encode = v => {
11
- if (Buffer.isBuffer(v)) return { $buffer: v.toString('base64') };
12
- if (v && typeof v.isFile === 'function') return {
13
- name: v.name, size: v.size, mode: v.mode, mtimeMs: v.mtimeMs,
14
- $kind: v.isFile() ? 'file' : v.isDirectory() ? 'directory' : v.isSymbolicLink() ? 'symlink' : 'other'
15
- };
16
- if (Array.isArray(v)) return v.map(encode);
17
- return v;
18
- };
19
- try {
20
- const { op, args } = JSON.parse(Buffer.concat(chunks).toString());
21
- const allowed = ['stat','lstat','readFile','writeFile','appendFile','mkdir','readdir','access','realpath','rename','rm','rmdir','unlink','copyFile','truncate'];
22
- if (!allowed.includes(op)) throw new Error('Unsupported file operation');
23
- const decoded = args.map(v => v && v.$buffer !== undefined ? Buffer.from(v.$buffer,'base64') : v);
24
- const result = await fs[op](...decoded);
25
- process.stdout.write(JSON.stringify({ value: encode(result) }));
26
- } catch (e) { process.stdout.write(JSON.stringify({ error: e.message, code: e.code })); }
5
+ const program = String.raw `
6
+ const fs = require('node:fs/promises');
7
+ const chunks = [];
8
+ process.stdin.on('data', c => chunks.push(c));
9
+ process.stdin.on('end', async () => {
10
+ const encode = v => {
11
+ if (Buffer.isBuffer(v)) return { $buffer: v.toString('base64') };
12
+ if (v && typeof v.isFile === 'function') return {
13
+ name: v.name, size: v.size, mode: v.mode, mtimeMs: v.mtimeMs,
14
+ $kind: v.isFile() ? 'file' : v.isDirectory() ? 'directory' : v.isSymbolicLink() ? 'symlink' : 'other'
15
+ };
16
+ if (Array.isArray(v)) return v.map(encode);
17
+ return v;
18
+ };
19
+ try {
20
+ const { op, args } = JSON.parse(Buffer.concat(chunks).toString());
21
+ const allowed = ['stat','lstat','readFile','writeFile','appendFile','mkdir','readdir','access','realpath','rename','rm','rmdir','unlink','copyFile','truncate'];
22
+ if (!allowed.includes(op)) throw new Error('Unsupported file operation');
23
+ const decoded = args.map(v => v && v.$buffer !== undefined ? Buffer.from(v.$buffer,'base64') : v);
24
+ const result = await fs[op](...decoded);
25
+ process.stdout.write(JSON.stringify({ value: encode(result) }));
26
+ } catch (e) { process.stdout.write(JSON.stringify({ error: e.message, code: e.code })); }
27
27
  });`;
28
28
  function request(op, args) {
29
29
  return JSON.stringify({ op, args: args.map(value => Buffer.isBuffer(value) ? { $buffer: value.toString("base64") } : value) });
@@ -1,50 +1,50 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import { dockerArgs, dockerEnabled, dockerHostEnv, dockerRun } from "./docker.js";
3
- const runner = String.raw `
4
- import os,sys,subprocess,signal,pty,select,tty,termios
5
- marker=sys.argv[1]
6
- use_pty=sys.argv[2]=='pty'
7
- del sys.argv[2]
8
- if use_pty:
9
- pid,master=pty.fork()
10
- if pid==0: os.execvp(sys.argv[2],sys.argv[2:])
11
- with open(marker,'x') as f: f.write(str(pid))
12
- previous=termios.tcgetattr(0) if os.isatty(0) else None
13
- try:
14
- if previous: tty.setraw(0)
15
- while True:
16
- ready,_,_=select.select([0,master],[],[])
17
- if master in ready:
18
- try: data=os.read(master,65536)
19
- except OSError: break
20
- if not data: break
21
- os.write(1,data)
22
- if 0 in ready:
23
- data=os.read(0,65536)
24
- if not data: break
25
- os.write(master,data)
26
- _,status=os.waitpid(pid,0)
27
- code=os.waitstatus_to_exitcode(status)
28
- finally:
29
- if previous: termios.tcsetattr(0,termios.TCSADRAIN,previous)
30
- os.close(master)
31
- try: os.unlink(marker)
32
- except FileNotFoundError: pass
33
- else:
34
- child=subprocess.Popen(sys.argv[2:],start_new_session=True)
35
- with open(marker,'x') as f: f.write(str(child.pid))
36
- try: code=child.wait()
37
- finally:
38
- try: os.unlink(marker)
39
- except FileNotFoundError: pass
40
- sys.exit(code if code>=0 else 128-code)
3
+ const runner = String.raw `
4
+ import os,sys,subprocess,signal,pty,select,tty,termios
5
+ marker=sys.argv[1]
6
+ use_pty=sys.argv[2]=='pty'
7
+ del sys.argv[2]
8
+ if use_pty:
9
+ pid,master=pty.fork()
10
+ if pid==0: os.execvp(sys.argv[2],sys.argv[2:])
11
+ with open(marker,'x') as f: f.write(str(pid))
12
+ previous=termios.tcgetattr(0) if os.isatty(0) else None
13
+ try:
14
+ if previous: tty.setraw(0)
15
+ while True:
16
+ ready,_,_=select.select([0,master],[],[])
17
+ if master in ready:
18
+ try: data=os.read(master,65536)
19
+ except OSError: break
20
+ if not data: break
21
+ os.write(1,data)
22
+ if 0 in ready:
23
+ data=os.read(0,65536)
24
+ if not data: break
25
+ os.write(master,data)
26
+ _,status=os.waitpid(pid,0)
27
+ code=os.waitstatus_to_exitcode(status)
28
+ finally:
29
+ if previous: termios.tcsetattr(0,termios.TCSADRAIN,previous)
30
+ os.close(master)
31
+ try: os.unlink(marker)
32
+ except FileNotFoundError: pass
33
+ else:
34
+ child=subprocess.Popen(sys.argv[2:],start_new_session=True)
35
+ with open(marker,'x') as f: f.write(str(child.pid))
36
+ try: code=child.wait()
37
+ finally:
38
+ try: os.unlink(marker)
39
+ except FileNotFoundError: pass
40
+ sys.exit(code if code>=0 else 128-code)
41
41
  `;
42
- const killer = String.raw `
43
- import os,sys,signal
44
- try:
45
- with open(sys.argv[1]) as f: pid=int(f.read())
46
- if pid>1: os.killpg(pid,getattr(signal,sys.argv[2]))
47
- except (FileNotFoundError,ProcessLookupError): pass
42
+ const killer = String.raw `
43
+ import os,sys,signal
44
+ try:
45
+ with open(sys.argv[1]) as f: pid=int(f.read())
46
+ if pid>1: os.killpg(pid,getattr(signal,sys.argv[2]))
47
+ except (FileNotFoundError,ProcessLookupError): pass
48
48
  `;
49
49
  export function executionLaunch(file, args, cwd, env, tty = false) {
50
50
  if (!dockerEnabled())
@@ -1,144 +1,144 @@
1
- {
2
- "updatedAt": "2026-11-03",
3
- "notes": [
4
- "Bundled metadata for current mainstream Claude models and supported OpenAI models.",
5
- "Claude contextWindowTokens is neo's configured 256000-token usage ceiling, not the upstream model maximum or a pricing guarantee.",
6
- "MODEL_CONTEXT_WINDOW_TOKENS or OPENAI_CONTEXT_WINDOW_TOKENS overrides contextWindowTokens at runtime.",
7
- "Model IDs and aliases are matched case-insensitively. Availability depends on the connected API and account."
8
- ],
9
- "sources": {
10
- "claude-models": "https://platform.claude.com/docs/en/models/overview",
11
- "claude-effort": "https://platform.claude.com/docs/en/build-with-claude/effort",
12
- "openai-models": "https://developers.openai.com/api/docs/models",
13
- "openai-reasoning": "https://developers.openai.com/api/docs/guides/reasoning"
14
- },
15
- "models": [
16
- {"id": "claude-fable-5-1", "provider": "anthropic", "protocols": ["anthropic"], "modelIds": ["claude-fable-5-1"], "contextWindowTokens": 256000, "maxOutputTokens": 128000, "knowledgeCutoff": "2026-06", "reasoning": true, "reasoningEfforts": ["low", "medium", "high", "xhigh", "max"], "imageInput": true, "source": "claude-models", "notes": "Adaptive thinking; thinking cannot be disabled."},
17
- {"id": "claude-haiku-5-5", "provider": "anthropic", "protocols": ["anthropic"], "modelIds": ["claude-haiku-5-5"], "contextWindowTokens": 256000, "maxOutputTokens": 128000, "knowledgeCutoff": "2026-06", "reasoning": true, "reasoningEfforts": ["none", "low", "medium", "high", "xhigh", "max"], "imageInput": true, "source": "claude-models", "notes": "none disables thinking; other efforts use adaptive thinking."},
18
- {"id": "claude-opus-5-5", "provider": "anthropic", "protocols": ["anthropic"], "modelIds": ["claude-opus-5-5"], "contextWindowTokens": 256000, "maxOutputTokens": 128000, "knowledgeCutoff": "2026-06", "reasoning": true, "reasoningEfforts": ["low", "medium", "high", "xhigh", "max"], "imageInput": true, "source": "claude-models", "notes": "Adaptive thinking; thinking cannot be disabled."},
19
- {"id": "claude-sonnet-5-5", "provider": "anthropic", "protocols": ["anthropic"], "modelIds": ["claude-sonnet-5-5"], "contextWindowTokens": 256000, "maxOutputTokens": 128000, "knowledgeCutoff": "2026-06", "reasoning": true, "reasoningEfforts": ["low", "medium", "high", "xhigh", "max"], "imageInput": true, "source": "claude-models", "notes": "Adaptive thinking; thinking cannot be disabled."},
20
- {
21
- "id": "gpt-5.6-sol",
22
- "provider": "openai",
23
- "modelIds": [
24
- "gpt-5.6-sol"
25
- ],
26
- "contextWindowTokens": 256000,
27
- "maxOutputTokens": 128000,
28
- "knowledgeCutoff": "2026-02-16",
29
- "reasoning": true,
30
- "imageInput": true,
31
- "source": "openai-models",
32
- "reasoningEfforts": [
33
- "none",
34
- "low",
35
- "medium",
36
- "high",
37
- "xhigh",
38
- "max"
39
- ]
40
- },
41
- {
42
- "id": "gpt-5.6-terra",
43
- "provider": "openai",
44
- "modelIds": [
45
- "gpt-5.6-terra"
46
- ],
47
- "contextWindowTokens": 256000,
48
- "maxOutputTokens": 128000,
49
- "knowledgeCutoff": "2026-02-16",
50
- "reasoning": true,
51
- "imageInput": true,
52
- "source": "openai-models",
53
- "reasoningEfforts": [
54
- "none",
55
- "low",
56
- "medium",
57
- "high",
58
- "xhigh",
59
- "max"
60
- ]
61
- },
62
- {
63
- "id": "gpt-5.6-luna",
64
- "provider": "openai",
65
- "modelIds": [
66
- "gpt-5.6-luna"
67
- ],
68
- "contextWindowTokens": 256000,
69
- "maxOutputTokens": 128000,
70
- "knowledgeCutoff": "2026-02-16",
71
- "reasoning": true,
72
- "imageInput": true,
73
- "source": "openai-models",
74
- "reasoningEfforts": [
75
- "none",
76
- "low",
77
- "medium",
78
- "high",
79
- "xhigh",
80
- "max"
81
- ]
82
- },
83
- {
84
- "id": "gpt-6-sol",
85
- "provider": "openai",
86
- "modelIds": [
87
- "gpt-6-sol"
88
- ],
89
- "contextWindowTokens": 256000,
90
- "maxOutputTokens": 128000,
91
- "reasoning": true,
92
- "imageInput": true,
93
- "source": "openai-models",
94
- "reasoningEfforts": [
95
- "none",
96
- "low",
97
- "medium",
98
- "high",
99
- "xhigh",
100
- "max"
101
- ]
102
- },
103
- {
104
- "id": "gpt-6.1-sol",
105
- "provider": "openai",
106
- "modelIds": [
107
- "gpt-6.1-sol"
108
- ],
109
- "contextWindowTokens": 256000,
110
- "maxOutputTokens": 128000,
111
- "reasoning": true,
112
- "imageInput": true,
113
- "source": "openai-models",
114
- "reasoningEfforts": [
115
- "none",
116
- "low",
117
- "medium",
118
- "high",
119
- "xhigh",
120
- "max"
121
- ]
122
- },
123
- {
124
- "id": "gpt-6-astra",
125
- "provider": "openai",
126
- "modelIds": [
127
- "gpt-6-astra"
128
- ],
129
- "contextWindowTokens": 256000,
130
- "maxOutputTokens": 128000,
131
- "reasoning": true,
132
- "imageInput": true,
133
- "source": "openai-models",
134
- "reasoningEfforts": [
135
- "none",
136
- "low",
137
- "medium",
138
- "high",
139
- "xhigh",
140
- "max"
141
- ]
142
- }
143
- ]
144
- }
1
+ {
2
+ "updatedAt": "2026-11-03",
3
+ "notes": [
4
+ "Bundled metadata for current mainstream Claude models and supported OpenAI models.",
5
+ "Claude contextWindowTokens is neo's configured 256000-token usage ceiling, not the upstream model maximum or a pricing guarantee.",
6
+ "MODEL_CONTEXT_WINDOW_TOKENS or OPENAI_CONTEXT_WINDOW_TOKENS overrides contextWindowTokens at runtime.",
7
+ "Model IDs and aliases are matched case-insensitively. Availability depends on the connected API and account."
8
+ ],
9
+ "sources": {
10
+ "claude-models": "https://platform.claude.com/docs/en/models/overview",
11
+ "claude-effort": "https://platform.claude.com/docs/en/build-with-claude/effort",
12
+ "openai-models": "https://developers.openai.com/api/docs/models",
13
+ "openai-reasoning": "https://developers.openai.com/api/docs/guides/reasoning"
14
+ },
15
+ "models": [
16
+ {"id": "claude-fable-5-1", "provider": "anthropic", "protocols": ["anthropic"], "modelIds": ["claude-fable-5-1"], "contextWindowTokens": 256000, "maxOutputTokens": 128000, "knowledgeCutoff": "2026-06", "reasoning": true, "reasoningEfforts": ["low", "medium", "high", "xhigh", "max"], "imageInput": true, "source": "claude-models", "notes": "Adaptive thinking; thinking cannot be disabled."},
17
+ {"id": "claude-haiku-5-5", "provider": "anthropic", "protocols": ["anthropic"], "modelIds": ["claude-haiku-5-5"], "contextWindowTokens": 256000, "maxOutputTokens": 128000, "knowledgeCutoff": "2026-06", "reasoning": true, "reasoningEfforts": ["none", "low", "medium", "high", "xhigh", "max"], "imageInput": true, "source": "claude-models", "notes": "none disables thinking; other efforts use adaptive thinking."},
18
+ {"id": "claude-opus-5-5", "provider": "anthropic", "protocols": ["anthropic"], "modelIds": ["claude-opus-5-5"], "contextWindowTokens": 256000, "maxOutputTokens": 128000, "knowledgeCutoff": "2026-06", "reasoning": true, "reasoningEfforts": ["low", "medium", "high", "xhigh", "max"], "imageInput": true, "source": "claude-models", "notes": "Adaptive thinking; thinking cannot be disabled."},
19
+ {"id": "claude-sonnet-5-5", "provider": "anthropic", "protocols": ["anthropic"], "modelIds": ["claude-sonnet-5-5"], "contextWindowTokens": 256000, "maxOutputTokens": 128000, "knowledgeCutoff": "2026-06", "reasoning": true, "reasoningEfforts": ["low", "medium", "high", "xhigh", "max"], "imageInput": true, "source": "claude-models", "notes": "Adaptive thinking; thinking cannot be disabled."},
20
+ {
21
+ "id": "gpt-5.6-sol",
22
+ "provider": "openai",
23
+ "modelIds": [
24
+ "gpt-5.6-sol"
25
+ ],
26
+ "contextWindowTokens": 256000,
27
+ "maxOutputTokens": 128000,
28
+ "knowledgeCutoff": "2026-02-16",
29
+ "reasoning": true,
30
+ "imageInput": true,
31
+ "source": "openai-models",
32
+ "reasoningEfforts": [
33
+ "none",
34
+ "low",
35
+ "medium",
36
+ "high",
37
+ "xhigh",
38
+ "max"
39
+ ]
40
+ },
41
+ {
42
+ "id": "gpt-5.6-terra",
43
+ "provider": "openai",
44
+ "modelIds": [
45
+ "gpt-5.6-terra"
46
+ ],
47
+ "contextWindowTokens": 256000,
48
+ "maxOutputTokens": 128000,
49
+ "knowledgeCutoff": "2026-02-16",
50
+ "reasoning": true,
51
+ "imageInput": true,
52
+ "source": "openai-models",
53
+ "reasoningEfforts": [
54
+ "none",
55
+ "low",
56
+ "medium",
57
+ "high",
58
+ "xhigh",
59
+ "max"
60
+ ]
61
+ },
62
+ {
63
+ "id": "gpt-5.6-luna",
64
+ "provider": "openai",
65
+ "modelIds": [
66
+ "gpt-5.6-luna"
67
+ ],
68
+ "contextWindowTokens": 256000,
69
+ "maxOutputTokens": 128000,
70
+ "knowledgeCutoff": "2026-02-16",
71
+ "reasoning": true,
72
+ "imageInput": true,
73
+ "source": "openai-models",
74
+ "reasoningEfforts": [
75
+ "none",
76
+ "low",
77
+ "medium",
78
+ "high",
79
+ "xhigh",
80
+ "max"
81
+ ]
82
+ },
83
+ {
84
+ "id": "gpt-6-sol",
85
+ "provider": "openai",
86
+ "modelIds": [
87
+ "gpt-6-sol"
88
+ ],
89
+ "contextWindowTokens": 256000,
90
+ "maxOutputTokens": 128000,
91
+ "reasoning": true,
92
+ "imageInput": true,
93
+ "source": "openai-models",
94
+ "reasoningEfforts": [
95
+ "none",
96
+ "low",
97
+ "medium",
98
+ "high",
99
+ "xhigh",
100
+ "max"
101
+ ]
102
+ },
103
+ {
104
+ "id": "gpt-6.1-sol",
105
+ "provider": "openai",
106
+ "modelIds": [
107
+ "gpt-6.1-sol"
108
+ ],
109
+ "contextWindowTokens": 256000,
110
+ "maxOutputTokens": 128000,
111
+ "reasoning": true,
112
+ "imageInput": true,
113
+ "source": "openai-models",
114
+ "reasoningEfforts": [
115
+ "none",
116
+ "low",
117
+ "medium",
118
+ "high",
119
+ "xhigh",
120
+ "max"
121
+ ]
122
+ },
123
+ {
124
+ "id": "gpt-6-astra",
125
+ "provider": "openai",
126
+ "modelIds": [
127
+ "gpt-6-astra"
128
+ ],
129
+ "contextWindowTokens": 256000,
130
+ "maxOutputTokens": 128000,
131
+ "reasoning": true,
132
+ "imageInput": true,
133
+ "source": "openai-models",
134
+ "reasoningEfforts": [
135
+ "none",
136
+ "low",
137
+ "medium",
138
+ "high",
139
+ "xhigh",
140
+ "max"
141
+ ]
142
+ }
143
+ ]
144
+ }
@@ -952,6 +952,8 @@ export declare class WebRepl {
952
952
  private scheduleDeltaFlush;
953
953
  private flushDeltaOperations;
954
954
  private discardPendingDeltaOperations;
955
+ /** Snapshot for one subscriber; it already includes every currently queued delta operation. */
956
+ private sendSubscriberSnapshot;
955
957
  private dropInactiveTerminalOutput;
956
958
  private queueTerminalOutput;
957
959
  private flushTerminalOutput;
package/dist/web/index.js CHANGED
@@ -855,7 +855,7 @@ export class WebRepl {
855
855
  });
856
856
  if (clientInfo)
857
857
  this.send(subscriber, "client.version", clientInfo);
858
- this.send(subscriber, "sync", this.snapshot(true));
858
+ this.sendSubscriberSnapshot(subscriber, this.snapshot(true));
859
859
  this.publishRuntimeContext([subscriber]);
860
860
  reqKeepAlive(res);
861
861
  res.on("close", () => this.subscribers.delete(subscriber));
@@ -2707,7 +2707,7 @@ export class WebRepl {
2707
2707
  }
2708
2708
  if (subscriber.needsSync) {
2709
2709
  subscriber.needsSync = false;
2710
- this.send(subscriber, "sync", this.snapshot(false));
2710
+ this.sendSubscriberSnapshot(subscriber, this.snapshot(false));
2711
2711
  }
2712
2712
  if (subscriber.pendingFastModeFallback) {
2713
2713
  const payload = subscriber.pendingFastModeFallback;
@@ -2773,7 +2773,8 @@ export class WebRepl {
2773
2773
  this.pendingDeltaTimer = undefined;
2774
2774
  if (this.pendingDeltaOperations.length === 0 && !this.pendingDeltaStatus)
2775
2775
  return;
2776
- const operations = compactLineOperations(this.pendingDeltaOperations);
2776
+ const pending = this.pendingDeltaOperations;
2777
+ const operations = compactLineOperations(pending);
2777
2778
  this.pendingDeltaOperations = [];
2778
2779
  this.pendingDeltaStatus = false;
2779
2780
  const payload = {
@@ -2782,8 +2783,12 @@ export class WebRepl {
2782
2783
  operations,
2783
2784
  status: this.timedStatus(),
2784
2785
  };
2785
- for (const subscriber of this.subscribers)
2786
- this.send(subscriber, "delta", payload);
2786
+ for (const subscriber of this.subscribers) {
2787
+ const offset = subscriber.snapshotDeltaOffset ?? 0;
2788
+ subscriber.snapshotDeltaOffset = undefined;
2789
+ // Text appends are not idempotent: skip operations its own snapshot already contains.
2790
+ this.send(subscriber, "delta", offset > 0 ? { ...payload, operations: compactLineOperations(pending.slice(offset)) } : payload);
2791
+ }
2787
2792
  }
2788
2793
  discardPendingDeltaOperations() {
2789
2794
  if (this.pendingDeltaTimer)
@@ -2791,6 +2796,13 @@ export class WebRepl {
2791
2796
  this.pendingDeltaTimer = undefined;
2792
2797
  this.pendingDeltaOperations = [];
2793
2798
  this.pendingDeltaStatus = false;
2799
+ for (const subscriber of this.subscribers)
2800
+ subscriber.snapshotDeltaOffset = undefined;
2801
+ }
2802
+ /** Snapshot for one subscriber; it already includes every currently queued delta operation. */
2803
+ sendSubscriberSnapshot(subscriber, snapshot) {
2804
+ subscriber.snapshotDeltaOffset = this.pendingDeltaOperations.length;
2805
+ this.send(subscriber, "sync", snapshot);
2794
2806
  }
2795
2807
  dropInactiveTerminalOutput() {
2796
2808
  for (const sessionId of this.pendingTerminalOutput.keys()) {
@@ -4003,6 +4015,7 @@ function compactionReportFromBoundary(message) {
4003
4015
  charsFreed: 0,
4004
4016
  modelDriven: message.metadata.modelDriven === true,
4005
4017
  imageCount: Array.isArray(imageRegistry?.images) ? imageRegistry.images.length : 0,
4018
+ ...(typeof message.metadata.compactFallbackReason === "string" ? { fallbackReason: message.metadata.compactFallbackReason } : {}),
4006
4019
  };
4007
4020
  }
4008
4021
  function isCompactionReason(value) {