@josephyulei/summon-foundation 0.1.13 → 0.1.14

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.
@@ -13,13 +13,13 @@ function scopeFields(value){
13
13
  export function createJourneyControl(readRecord, changed) {
14
14
  const children=new Map();let active=null,origin=null,choice=null,resolveChoice,rejectChoice,choiceTimer,viewRevision=0,submitting=0;
15
15
  const headers=owner=>({origin,'content-type':'application/json','x-foundation-journey':owner.token,'x-foundation-operation':readRecord().operationId});
16
- const request=async(owner,route,body)=>{
16
+ const request=async(owner,route,body,timeoutMs=body?120000:5000)=>{
17
17
  if(owner.child.exitCode!==null||owner.child.signalCode)throw Error('确认服务已退出,结果待核实');
18
18
  const ended=new AbortController();
19
19
  const onClose=()=>ended.abort(Error('确认服务已退出,结果待核实'));
20
20
  owner.child.once('close',onClose);
21
21
  try {
22
- const response=await fetch(owner.url+route,{method:body?'POST':'GET',headers:headers(owner),...(body?{body:JSON.stringify(body)}:{}),redirect:'error',signal:AbortSignal.any([ended.signal,AbortSignal.timeout(body?120000:5000)])});
22
+ const response=await fetch(owner.url+route,{method:body?'POST':'GET',headers:headers(owner),...(body?{body:JSON.stringify(body)}:{}),redirect:'error',signal:AbortSignal.any([ended.signal,AbortSignal.timeout(timeoutMs)])});
23
23
  return {status:response.status,body:await response.json()};
24
24
  } finally { owner.child.removeListener('close',onClose); }
25
25
  };
@@ -92,7 +92,11 @@ export function createJourneyControl(readRecord, changed) {
92
92
  Object.assign(readRecord(),{environment});changed({environment});
93
93
  if(environment.state!=='ready')throw Error('执行前环境复检未通过;没有提交确认,请核实当前工具环境');
94
94
  }
95
- const result=await request(a.owner,'__foundation/manager/confirm',{operationId:body.operationId,sessionId:s.sessionId,planHash:s.planHash,managerNonce:body.managerNonce,action:body.action});
95
+ // The installed manager may still verify and clean inputs after committing
96
+ // an update. Match observePlan's bounded lifetime; an unrelated 120s
97
+ // deadline can abort its final response after the mutation has succeeded.
98
+ const responseTimeout=Number.isSafeInteger(s.expiresAt)?Math.max(1,Math.min(16*60*1000,s.expiresAt-Date.now()+1000)):120000;
99
+ const result=await request(a.owner,'__foundation/manager/confirm',{operationId:body.operationId,sessionId:s.sessionId,planHash:s.planHash,managerNonce:body.managerNonce,action:body.action},responseTimeout);
96
100
  if(active===a&&result.body.state)a.view.session={...s,...result.body};changed();return result;
97
101
  }finally{submitting--;}
98
102
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@josephyulei/summon-foundation",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@josephyulei/summon-foundation",
9
- "version": "0.1.13",
9
+ "version": "0.1.14",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@sigstore/bundle": "4.0.0",
package/package.json CHANGED
@@ -1,14 +1,32 @@
1
1
  {
2
2
  "name": "@josephyulei/summon-foundation",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Prepare a verified Foundation release for an explicitly confirmed Codex installation",
5
5
  "type": "module",
6
- "bin": {"summon": "bin/summon.mjs"},
7
- "files": ["bin/", "lib/", "README.md", "LICENSE", "THIRD_PARTY_NOTICES.txt", "npm-shrinkwrap.json"],
6
+ "bin": {
7
+ "summon": "bin/summon.mjs"
8
+ },
9
+ "files": [
10
+ "bin/",
11
+ "lib/",
12
+ "README.md",
13
+ "LICENSE",
14
+ "THIRD_PARTY_NOTICES.txt",
15
+ "npm-shrinkwrap.json"
16
+ ],
8
17
  "license": "MIT",
9
- "engines": {"node": ">=22.9.0"},
10
- "repository": {"type": "git", "url": "git+https://github.com/y15801172513-lang/foundation.git", "directory": "distribution/summon-foundation"},
11
- "publishConfig": {"access": "public", "registry": "https://registry.npmjs.org/"},
18
+ "engines": {
19
+ "node": ">=22.9.0"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/y15801172513-lang/foundation.git",
24
+ "directory": "distribution/summon-foundation"
25
+ },
26
+ "publishConfig": {
27
+ "access": "public",
28
+ "registry": "https://registry.npmjs.org/"
29
+ },
12
30
  "dependencies": {
13
31
  "@sigstore/verify": "3.1.1",
14
32
  "@sigstore/bundle": "4.0.0",