feat(companion): add HTTPS pairing and scoped device authority
This commit is contained in:
+11
-1
@@ -652,8 +652,18 @@ export class Runtime {
|
||||
if (signal.aborted) terminate();
|
||||
});
|
||||
}
|
||||
async stop(sessionId) {
|
||||
async stop(sessionId, expected = null) {
|
||||
const original = this.active.get(sessionId);
|
||||
const assertOriginal = () => {
|
||||
if (!expected) return;
|
||||
const session = this.store.session(sessionId);
|
||||
if (session.taskId !== expected.taskId || session.runId !== expected.runId || this.active.get(sessionId) && this.active.get(sessionId) !== original) {
|
||||
throw Object.assign(new Error('原停止请求的任务或运行已变化。'), { status: 409 });
|
||||
}
|
||||
};
|
||||
assertOriginal();
|
||||
await this.workers?.stopParent(sessionId);
|
||||
assertOriginal();
|
||||
const run = this.active.get(sessionId);
|
||||
if (!run) { await this.checks?.stop(sessionId); await this.deliveries?.stop(sessionId); await this.changeSets?.stop(sessionId); await this.workspaces?.stop(sessionId); await this.research?.stop(sessionId); await this.engines?.stop(sessionId); await this.browser?.stop(sessionId); await this.mcp?.stop(sessionId); await this.taskPlans?.settle(sessionId); return; }
|
||||
const session = this.store.session(sessionId);
|
||||
|
||||
Reference in New Issue
Block a user