@ai-workbench/connect 0.7.40 → 0.7.41
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 +4 -0
- package/helper/auth-status.cjs +15 -3
- package/lib/needs.js +1 -1
- package/node_modules/argparse/CHANGELOG.md +216 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -122,3 +122,7 @@ Codex保持官方设备码登录,设备码在本设置行显示,网页用系
|
|
|
122
122
|
“远程主机连接”跟随 DSH 当前界面语言,显示连接资料、公司主机连接、Codex、Claude四项真实状态及剩余步骤。已导入后显示员工标识,不再要求重复领取资料;检查中不显示可以开始使用。目录选择器、工作区文件来源和技术详情收在默认折叠的“高级”中。
|
|
123
123
|
|
|
124
124
|
登录区内联显示完整可选中/复制的公开链接;系统打开默认浏览器较慢或失败时,仍可复制链接自行打开,也可点打开按钮。Codex显示官方CLI提供的一次性设备码和复制按钮;没有verification_uri_complete时只用CLI原基础链接,不拼接附码URL。Claude粘贴框为等宽文本、适应可用宽度,不限制授权码长度,粘贴去首尾空白,空值不能提交。授权码仍只经受保护POST正文和主机CLI stdin交接,不写日志/状态/argv。成功自动收起;本次失败说明原因并可重新发起。不新增设置、检查、轮询、重试或时限。
|
|
125
|
+
|
|
126
|
+
### Claude 状态只读检查(0.7.41)
|
|
127
|
+
|
|
128
|
+
需要主机先部署 host 0.8.5 的 `lib/claude-auth-state.cjs`。连接与登录前后状态检查不再启动 `claude auth status`,只由员工本人读取自己的主机订阅存储,读取失败明确报未知,不自动重登。主机模型目录在官方五分钟续期窗口内暂不可用;正常 Claude 会话完成续期、离开窗口后重新打开模型菜单。登录取消、登出及正常会话回收不在本轮修复范围。
|
package/helper/auth-status.cjs
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Claude 状态只复用主机只读判断器;Codex 与显式登出仍走原 CLI 路径。
|
|
2
2
|
const {spawn}=require('node:child_process');const {StringDecoder}=require('node:string_decoder');const decoder=new StringDecoder('utf8'),errorDecoder=new StringDecoder('utf8');
|
|
3
3
|
const [provider,budgetText,action='status',...extra]=process.argv.slice(1),budget=Number(budgetText);
|
|
4
4
|
if(!['codex','claude'].includes(provider)||!Number.isSafeInteger(budget)||budget<1||!['status','logout'].includes(action)||extra.length)process.exit(2);
|
|
5
|
+
if(provider==='claude'&&action==='status'){
|
|
6
|
+
try{
|
|
7
|
+
const {readClaudeAuthState}=require('/usr/local/aw-host/lib/claude-auth-state.cjs');
|
|
8
|
+
const state=readClaudeAuthState({maxOutputBytes:budget});
|
|
9
|
+
if(!state||Object.keys(state).sort().join(',')!=='loggedIn,refreshDue'||typeof state.loggedIn!=='boolean'||typeof state.refreshDue!=='boolean')throw Error();
|
|
10
|
+
const exitCode=state.loggedIn?0:1;
|
|
11
|
+
process.stdout.write(JSON.stringify({protocolVersion:1,provider,exitCode,loggedIn:state.loggedIn})+'\n');process.exitCode=exitCode;
|
|
12
|
+
}catch{
|
|
13
|
+
process.stderr.write('EXECUTION_FAILED: 主机无法只读确认 Claude 登录状态;请管理员检查主机工具、员工凭据存储及钥匙串。\n');process.exitCode=2;
|
|
14
|
+
}
|
|
15
|
+
}else{
|
|
5
16
|
let stdout='',stderr='',size=0,invalid=false,finished=false;
|
|
6
|
-
const child=spawn(provider,action==='logout'?(provider==='codex'?['logout']:['auth','logout']):
|
|
17
|
+
const child=spawn(provider,action==='logout'?(provider==='codex'?['logout']:['auth','logout']):['login','status'],{stdio:['ignore','pipe','pipe']});
|
|
7
18
|
const stop=()=>{invalid=true;child.kill('SIGKILL');};
|
|
8
19
|
process.on('SIGHUP',stop);process.on('SIGTERM',stop);process.stdout.on('error',stop);child.once('error',()=>{invalid=true;});
|
|
9
20
|
for(const [stream,channel] of [[child.stdout,'out'],[child.stderr,'err']])stream.on('data',b=>{size+=b.length;if(size>budget){stop();return;}if(channel==='out')stdout+=decoder.write(b);else if(provider==='codex')stderr+=errorDecoder.write(b);});
|
|
@@ -12,8 +23,9 @@ function finish(exitCode){
|
|
|
12
23
|
stdout+=decoder.end();stderr+=errorDecoder.end();let loggedIn=null;
|
|
13
24
|
if(action==='logout'){process.exitCode=!invalid&&Number.isInteger(exitCode)&&exitCode>=0&&exitCode<=255?exitCode:1;return;}
|
|
14
25
|
if(!invalid&&provider==='codex'){if(exitCode===0)loggedIn=true;else if(exitCode===1&&stdout.trim()===''&&stderr.trim()==='Not logged in')loggedIn=false;}
|
|
15
|
-
if(!invalid&&provider==='claude')try{const v=JSON.parse(stdout);if(v&&typeof v==='object'&&!Array.isArray(v)&&typeof v.loggedIn==='boolean')loggedIn=v.loggedIn;}catch(error){process.stderr.write("AUTH_STATUS_JSON_INVALID:"+(error instanceof SyntaxError?"SyntaxError":"ParseError")+"\n");}
|
|
16
26
|
const code=Number.isInteger(exitCode)&&exitCode>=0&&exitCode<=255?exitCode:1;
|
|
17
27
|
process.stdout.write(JSON.stringify({protocolVersion:1,provider,exitCode,loggedIn})+'\n',()=>process.exit(code));
|
|
18
28
|
}
|
|
19
29
|
child.once('exit',code=>{if(invalid)finish(code);});child.once('close',finish);
|
|
30
|
+
|
|
31
|
+
}
|
package/lib/needs.js
CHANGED
|
@@ -42,7 +42,7 @@ const entries = {
|
|
|
42
42
|
CONNECTION_LOST: { layer: 'network', message: '连接中断,正在等待网络恢复信号,恢复后将重新连接。', requires: '网络恢复', actor: 'plugin', action: { id: 'await-network', label: '等待网络恢复', available: false } },
|
|
43
43
|
DEPENDENCY_REQUIRED: { layer: 'integration', message: '远程主机连接的连接组件没有装好,请联系管理员。', requires: '提供方契约与适配器', actor: 'administrator', action: { id: 'supply-dependency', label: '提供集成前置条件', available: false } },
|
|
44
44
|
SETTINGS_REQUIRED: { layer: 'settings', message: '远程主机连接设置暂不可用,请查看技术详情。', requires: '已确认的连接设置', actor: 'administrator', action: { id: 'configure-settings', label: '确认具名设置', available: false } },
|
|
45
|
-
AUTH_STATUS_INVALID: { layer: 'auth', message: '
|
|
45
|
+
AUTH_STATUS_INVALID: { layer: 'auth', message: '暂时无法读取主机上的登录状态,请联系管理员检查认证存储、钥匙串或连接。', requires: '可读取的主机登录状态', actor: 'administrator', action: { id: 'inspect-auth-status', label: '检查主机登录状态', available: false } },
|
|
46
46
|
LOGOUT_FAILED: { layer: 'auth', message: '主机账号登出未完成或结果无法确认,请重新检查;不会自动重试登出。', requires: '官方退出成功且同一主机员工状态为未登录', actor: 'employee', action: { id: 'check-login', label: '重新检查', available: true } },
|
|
47
47
|
LOGIN_FAILED: { layer: 'auth', message: '登录未完成,可以立即重新发起登录。', requires: '完成 AI 授权', actor: 'employee', action: { id: 'open-login', label: '重新授权', available: true } },
|
|
48
48
|
HOST_TRUST_REQUIRED: { layer: 'ssh', message: '远程主机连接还缺少可信的连接信息,请联系管理员。', requires: 'host.knownHosts', actor: 'administrator', action: { id: 'supply-host-trust', label: '提供主机信任材料', available: false } },
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## [2.0.1] - 2020-08-29
|
|
10
|
+
### Fixed
|
|
11
|
+
- Fix issue with `process.argv` when used with interpreters (`coffee`, `ts-node`, etc.), #150.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [2.0.0] - 2020-08-14
|
|
15
|
+
### Changed
|
|
16
|
+
- Full rewrite. Now port from python 3.9.0 & more precise following.
|
|
17
|
+
See [doc](./doc) for difference and migration info.
|
|
18
|
+
- node.js 10+ required
|
|
19
|
+
- Removed most of local docs in favour of original ones.
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [1.0.10] - 2018-02-15
|
|
23
|
+
### Fixed
|
|
24
|
+
- Use .concat instead of + for arrays, #122.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## [1.0.9] - 2016-09-29
|
|
28
|
+
### Changed
|
|
29
|
+
- Rerelease after 1.0.8 - deps cleanup.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## [1.0.8] - 2016-09-29
|
|
33
|
+
### Changed
|
|
34
|
+
- Maintenance (deps bump, fix node 6.5+ tests, coverage report).
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## [1.0.7] - 2016-03-17
|
|
38
|
+
### Changed
|
|
39
|
+
- Teach `addArgument` to accept string arg names. #97, @tomxtobin.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## [1.0.6] - 2016-02-06
|
|
43
|
+
### Changed
|
|
44
|
+
- Maintenance: moved to eslint & updated CS.
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
## [1.0.5] - 2016-02-05
|
|
48
|
+
### Changed
|
|
49
|
+
- Removed lodash dependency to significantly reduce install size.
|
|
50
|
+
Thanks to @mourner.
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
## [1.0.4] - 2016-01-17
|
|
54
|
+
### Changed
|
|
55
|
+
- Maintenance: lodash update to 4.0.0.
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## [1.0.3] - 2015-10-27
|
|
59
|
+
### Fixed
|
|
60
|
+
- Fix parse `=` in args: `--examplepath="C:\myfolder\env=x64"`. #84, @CatWithApple.
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
## [1.0.2] - 2015-03-22
|
|
64
|
+
### Changed
|
|
65
|
+
- Relaxed lodash version dependency.
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
## [1.0.1] - 2015-02-20
|
|
69
|
+
### Changed
|
|
70
|
+
- Changed dependencies to be compatible with ancient nodejs.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## [1.0.0] - 2015-02-19
|
|
74
|
+
### Changed
|
|
75
|
+
- Maintenance release.
|
|
76
|
+
- Replaced `underscore` with `lodash`.
|
|
77
|
+
- Bumped version to 1.0.0 to better reflect semver meaning.
|
|
78
|
+
- HISTORY.md -> CHANGELOG.md
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
## [0.1.16] - 2013-12-01
|
|
82
|
+
### Changed
|
|
83
|
+
- Maintenance release. Updated dependencies and docs.
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## [0.1.15] - 2013-05-13
|
|
87
|
+
### Fixed
|
|
88
|
+
- Fixed #55, @trebor89
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
## [0.1.14] - 2013-05-12
|
|
92
|
+
### Fixed
|
|
93
|
+
- Fixed #62, @maxtaco
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
## [0.1.13] - 2013-04-08
|
|
97
|
+
### Changed
|
|
98
|
+
- Added `.npmignore` to reduce package size
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
## [0.1.12] - 2013-02-10
|
|
102
|
+
### Fixed
|
|
103
|
+
- Fixed conflictHandler (#46), @hpaulj
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
## [0.1.11] - 2013-02-07
|
|
107
|
+
### Added
|
|
108
|
+
- Added 70+ tests (ported from python), @hpaulj
|
|
109
|
+
- Added conflictHandler, @applepicke
|
|
110
|
+
- Added fromfilePrefixChar, @hpaulj
|
|
111
|
+
|
|
112
|
+
### Fixed
|
|
113
|
+
- Multiple bugfixes, @hpaulj
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
## [0.1.10] - 2012-12-30
|
|
117
|
+
### Added
|
|
118
|
+
- Added [mutual exclusion](http://docs.python.org/dev/library/argparse.html#mutual-exclusion)
|
|
119
|
+
support, thanks to @hpaulj
|
|
120
|
+
|
|
121
|
+
### Fixed
|
|
122
|
+
- Fixed options check for `storeConst` & `appendConst` actions, thanks to @hpaulj
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
## [0.1.9] - 2012-12-27
|
|
126
|
+
### Fixed
|
|
127
|
+
- Fixed option dest interferens with other options (issue #23), thanks to @hpaulj
|
|
128
|
+
- Fixed default value behavior with `*` positionals, thanks to @hpaulj
|
|
129
|
+
- Improve `getDefault()` behavior, thanks to @hpaulj
|
|
130
|
+
- Improve negative argument parsing, thanks to @hpaulj
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
## [0.1.8] - 2012-12-01
|
|
134
|
+
### Fixed
|
|
135
|
+
- Fixed parser parents (issue #19), thanks to @hpaulj
|
|
136
|
+
- Fixed negative argument parse (issue #20), thanks to @hpaulj
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
## [0.1.7] - 2012-10-14
|
|
140
|
+
### Fixed
|
|
141
|
+
- Fixed 'choices' argument parse (issue #16)
|
|
142
|
+
- Fixed stderr output (issue #15)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
## [0.1.6] - 2012-09-09
|
|
146
|
+
### Fixed
|
|
147
|
+
- Fixed check for conflict of options (thanks to @tomxtobin)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
## [0.1.5] - 2012-09-03
|
|
151
|
+
### Fixed
|
|
152
|
+
- Fix parser #setDefaults method (thanks to @tomxtobin)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
## [0.1.4] - 2012-07-30
|
|
156
|
+
### Fixed
|
|
157
|
+
- Fixed pseudo-argument support (thanks to @CGamesPlay)
|
|
158
|
+
- Fixed addHelp default (should be true), if not set (thanks to @benblank)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
## [0.1.3] - 2012-06-27
|
|
162
|
+
### Fixed
|
|
163
|
+
- Fixed formatter api name: Formatter -> HelpFormatter
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
## [0.1.2] - 2012-05-29
|
|
167
|
+
### Fixed
|
|
168
|
+
- Removed excess whitespace in help
|
|
169
|
+
- Fixed error reporting, when parcer with subcommands
|
|
170
|
+
called with empty arguments
|
|
171
|
+
|
|
172
|
+
### Added
|
|
173
|
+
- Added basic tests
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
## [0.1.1] - 2012-05-23
|
|
177
|
+
### Fixed
|
|
178
|
+
- Fixed line wrapping in help formatter
|
|
179
|
+
- Added better error reporting on invalid arguments
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
## [0.1.0] - 2012-05-16
|
|
183
|
+
### Added
|
|
184
|
+
- First release.
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
[2.0.1]: https://github.com/nodeca/argparse/compare/2.0.0...2.0.1
|
|
188
|
+
[2.0.0]: https://github.com/nodeca/argparse/compare/1.0.10...2.0.0
|
|
189
|
+
[1.0.10]: https://github.com/nodeca/argparse/compare/1.0.9...1.0.10
|
|
190
|
+
[1.0.9]: https://github.com/nodeca/argparse/compare/1.0.8...1.0.9
|
|
191
|
+
[1.0.8]: https://github.com/nodeca/argparse/compare/1.0.7...1.0.8
|
|
192
|
+
[1.0.7]: https://github.com/nodeca/argparse/compare/1.0.6...1.0.7
|
|
193
|
+
[1.0.6]: https://github.com/nodeca/argparse/compare/1.0.5...1.0.6
|
|
194
|
+
[1.0.5]: https://github.com/nodeca/argparse/compare/1.0.4...1.0.5
|
|
195
|
+
[1.0.4]: https://github.com/nodeca/argparse/compare/1.0.3...1.0.4
|
|
196
|
+
[1.0.3]: https://github.com/nodeca/argparse/compare/1.0.2...1.0.3
|
|
197
|
+
[1.0.2]: https://github.com/nodeca/argparse/compare/1.0.1...1.0.2
|
|
198
|
+
[1.0.1]: https://github.com/nodeca/argparse/compare/1.0.0...1.0.1
|
|
199
|
+
[1.0.0]: https://github.com/nodeca/argparse/compare/0.1.16...1.0.0
|
|
200
|
+
[0.1.16]: https://github.com/nodeca/argparse/compare/0.1.15...0.1.16
|
|
201
|
+
[0.1.15]: https://github.com/nodeca/argparse/compare/0.1.14...0.1.15
|
|
202
|
+
[0.1.14]: https://github.com/nodeca/argparse/compare/0.1.13...0.1.14
|
|
203
|
+
[0.1.13]: https://github.com/nodeca/argparse/compare/0.1.12...0.1.13
|
|
204
|
+
[0.1.12]: https://github.com/nodeca/argparse/compare/0.1.11...0.1.12
|
|
205
|
+
[0.1.11]: https://github.com/nodeca/argparse/compare/0.1.10...0.1.11
|
|
206
|
+
[0.1.10]: https://github.com/nodeca/argparse/compare/0.1.9...0.1.10
|
|
207
|
+
[0.1.9]: https://github.com/nodeca/argparse/compare/0.1.8...0.1.9
|
|
208
|
+
[0.1.8]: https://github.com/nodeca/argparse/compare/0.1.7...0.1.8
|
|
209
|
+
[0.1.7]: https://github.com/nodeca/argparse/compare/0.1.6...0.1.7
|
|
210
|
+
[0.1.6]: https://github.com/nodeca/argparse/compare/0.1.5...0.1.6
|
|
211
|
+
[0.1.5]: https://github.com/nodeca/argparse/compare/0.1.4...0.1.5
|
|
212
|
+
[0.1.4]: https://github.com/nodeca/argparse/compare/0.1.3...0.1.4
|
|
213
|
+
[0.1.3]: https://github.com/nodeca/argparse/compare/0.1.2...0.1.3
|
|
214
|
+
[0.1.2]: https://github.com/nodeca/argparse/compare/0.1.1...0.1.2
|
|
215
|
+
[0.1.1]: https://github.com/nodeca/argparse/compare/0.1.0...0.1.1
|
|
216
|
+
[0.1.0]: https://github.com/nodeca/argparse/releases/tag/0.1.0
|