@ai-workbench/connect 0.7.42 → 0.7.43
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/lib/connect.js +31 -18
- package/node_modules/argparse/CHANGELOG.md +216 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -130,3 +130,7 @@ Codex保持官方设备码登录,设备码在本设置行显示,网页用系
|
|
|
130
130
|
### DSH 子代理子会话的主机目录归属(0.7.42)
|
|
131
131
|
|
|
132
132
|
DSH 自带子代理(subagent/subagent_fork/workflow 等)创建的子会话不是工作区成员。主机目录核对员工归属时,L 沿 live 的 `parentSession` 找到最近一个登记在工作区里的祖先会话,按它的归属判断:新员工父会话派出的子会话可用,旧员工父会话的子会话照旧拒绝;祖先不在 live 会话中时保持原来的路径拒绝规则。不新增设置、限制或错误码;层数和并发由 DSH 自己的子代理设置决定。
|
|
133
|
+
|
|
134
|
+
### 同品牌并行轮的登录就绪核对(0.7.43)
|
|
135
|
+
|
|
136
|
+
DSH workflow/subagent 并行派出的多个子会话(以及同一员工同时进行的多个会话)每一轮开始前都要经 `ensureReady` 核对主机登录状态。旧实现每次调用各发一条主机状态命令,并按“最新一次为准”作废同品牌较早的检查,于是 N 路并行只有最后发起的一路成功,其余报 `AUTH_STATUS_INVALID`(`STATUS_SUPERSEDED`),DSH workflow 把它们记为 null。现在同品牌并发的 `ensureReady` 共用同一次进行中的核对,结果一致;结束后下一次调用照常重新核对。不新增设置、限制或错误码,不改登录、登出与授权流程。
|
package/lib/connect.js
CHANGED
|
@@ -57,6 +57,7 @@ export function createConnect(ports, emit, options = {}) {
|
|
|
57
57
|
let controller = new AbortController();
|
|
58
58
|
const loginFlights = new Map();
|
|
59
59
|
const logoutFlights = new Map();
|
|
60
|
+
const readyFlights = new Map();
|
|
60
61
|
const statusFlights = new Map();
|
|
61
62
|
let forgetFlight, quiesced = false;
|
|
62
63
|
const pending = new Set();
|
|
@@ -417,24 +418,36 @@ export function createConnect(ports, emit, options = {}) {
|
|
|
417
418
|
refreshLoginPrompts: async () => { await startup.check(); const s = startup.getState(); return s.phase === 'disposed' ? fail('DISPOSED') : s.phase === 'blocked' ? fail(s.technicalDetails.code ?? 'AUTH_STATUS_INVALID') : ok(s); },
|
|
418
419
|
login: async (provider) => { const request = await startup.request(provider, 'automatic'); if (!request.ok)
|
|
419
420
|
return request; return request.value.logins[provider] === true ? ok({ provider, loggedIn: true }) : fail('LOGIN_REQUIRED'); },
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
const
|
|
424
|
-
if (
|
|
425
|
-
return
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
421
|
+
// Concurrent turns of one brand (DSH workflow/subagent fan-out) share one readiness flight:
|
|
422
|
+
// separate same-brand checks supersede each other and all but the newest would fail.
|
|
423
|
+
ensureReady: provider => {
|
|
424
|
+
const prior = readyFlights.get(provider);
|
|
425
|
+
if (prior)
|
|
426
|
+
return prior;
|
|
427
|
+
const promise = track((async () => {
|
|
428
|
+
const checking = checkLogin(provider), g = generation;
|
|
429
|
+
const r = await checking;
|
|
430
|
+
const stale = invalid(g);
|
|
431
|
+
if (stale)
|
|
432
|
+
return stale;
|
|
433
|
+
if (!r.ok)
|
|
434
|
+
return r;
|
|
435
|
+
if (!r.value.loggedIn) {
|
|
436
|
+
const request = await startup.request(provider, 'automatic');
|
|
437
|
+
return invalid(g) ?? (!request.ok ? request : fail('LOGIN_REQUIRED'));
|
|
438
|
+
}
|
|
439
|
+
if (logoutFlights.has(provider))
|
|
440
|
+
return fail('ACTIVATION_CONFLICT');
|
|
441
|
+
const owner = startup.captureCheck(provider);
|
|
442
|
+
const connected = await connect(), current = startup.getState();
|
|
443
|
+
return invalid(g) ?? (logoutFlights.has(provider) || !startup.currentTicket(owner) || current.logins[provider] !== true || current.checkingProviders.includes(provider) || current.providerNeeds[provider] ? fail('AUTH_STATUS_INVALID') : connected);
|
|
444
|
+
})());
|
|
445
|
+
readyFlights.set(provider, promise);
|
|
446
|
+
const clear = () => { if (readyFlights.get(provider) === promise)
|
|
447
|
+
readyFlights.delete(provider); };
|
|
448
|
+
void promise.then(clear, clear);
|
|
449
|
+
return promise;
|
|
450
|
+
},
|
|
438
451
|
dispose: () => { if (disposal)
|
|
439
452
|
return disposal; let done; disposal = new Promise(resolve => done = resolve); disposed = true; generation++; startup.stop(); controller.abort(); const paused = ports.enrollment?.pause?.(); unsubscribe?.(); publish({ phase: 'disposed' }); setConnection('disposed'); connectionListeners.clear(); void Promise.allSettled([...pending, paused]).then(() => startup.dispose()).then(done); return disposal; },
|
|
440
453
|
};
|
|
@@ -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
|