{"_id":"@autonome-research/thread-phase","_rev":"14-24748f02da0da4cf30f09640d51e3f04","name":"@autonome-research/thread-phase","dist-tags":{"latest":"6.1.0"},"versions":{"3.0.0":{"name":"@autonome-research/thread-phase","version":"3.0.0","license":"MIT","_id":"@autonome-research/thread-phase@3.0.0","maintainers":[{"name":"velmoon222","email":"velvetmoon222999@gmail.com"}],"homepage":"https://github.com/Code4me2/thread-phase#readme","bugs":{"url":"https://github.com/Code4me2/thread-phase/issues"},"dist":{"shasum":"b76e65a2b79b7fa872f943c7b12feffedcda6ae8","tarball":"https://registry.npmjs.org/@autonome-research/thread-phase/-/thread-phase-3.0.0.tgz","fileCount":263,"integrity":"sha512-WEuGxAV+SFcHB46uvC9mCcBl+HTCavExnnFLSltP18Dz0GvyOV2PB6wl5bhObL43EFZnC/ZIN1MPfJJERs0nIA==","signatures":[{"sig":"MEUCIQClAOFlHhqYTHyCRsq++rongaUkTutRsVnfH7H9Z6T9YQIgbnzUyXKS699taS8X2wdnc65ZNIn4J4uDgpRi+HIclpM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":525423},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":"./dist/index.js","./tools":"./dist/tools/index.js","./agents":"./dist/agents/index.js","./context":"./dist/context/index.js","./session":"./dist/session/index.js","./patterns":"./dist/patterns/index.js","./triggers":"./dist/triggers/index.js","./agents/test-utils":"./dist/agents/test-utils/index.js"},"gitHead":"55bf33e4d720ed71f02c8aee3bce99e76a7949d7","scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","smoke":"tsx examples/smoke.ts","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"velmoon222","email":"velvetmoon222999@gmail.com"},"repository":{"url":"git+https://github.com/Code4me2/thread-phase.git","type":"git","directory":"packages/thread-phase"},"_npmVersion":"11.12.1","description":"TypeScript substrate for building automation workflows that coordinate AI agents. Phase ordering, typed shared state, persistence, fanout, event flow.","directories":{},"_nodeVersion":"24.15.0","dependencies":{"ajv":"^8.17.0","openai":"^4.77.0","better-sqlite3":"^11.5.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","vitest":"^2.1.0","typescript":"^5.6.0","@types/node":"^22.0.0","@honcho-ai/sdk":"^2.1.1","@types/better-sqlite3":"^7.6.11"},"peerDependencies":{"vitest":"^2.1.0","cron-parser":"^4.0.0 || ^5.0.0"},"peerDependenciesMeta":{"vitest":{"optional":true},"cron-parser":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/thread-phase_3.0.0_1779321959491_0.2538421738246479","host":"s3://npm-registry-packages-npm-production"}},"3.0.1":{"name":"@autonome-research/thread-phase","version":"3.0.1","license":"MIT","_id":"@autonome-research/thread-phase@3.0.1","maintainers":[{"name":"velmoon222","email":"velvetmoon222999@gmail.com"}],"homepage":"https://github.com/autonome-research/thread-phase#readme","bugs":{"url":"https://github.com/autonome-research/thread-phase/issues"},"dist":{"shasum":"03ce463c592a62f23bc509c5293bca6071565b1b","tarball":"https://registry.npmjs.org/@autonome-research/thread-phase/-/thread-phase-3.0.1.tgz","fileCount":263,"integrity":"sha512-G1C2CuI3t4CJZtVkjDrFnw/JWlZbCx9G2Dz3XhsXxg2tcCd8kr1xc5cqYy3SliCSD4lDUYBLnmz32CW2x4luZw==","signatures":[{"sig":"MEUCIQDmKSi7kCpKorUrI4WH4UdKmDiQa6PFIsVl9py2x2+gHAIgQjSzre6h5wOpS7qIluSl+RvaEbHkNKV2dFOTJCZUxQc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":525432},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":"./dist/index.js","./tools":"./dist/tools/index.js","./agents":"./dist/agents/index.js","./context":"./dist/context/index.js","./session":"./dist/session/index.js","./patterns":"./dist/patterns/index.js","./triggers":"./dist/triggers/index.js","./agents/test-utils":"./dist/agents/test-utils/index.js"},"gitHead":"f44aa41626bdb554c1629f72b318686091f8cbf5","scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","smoke":"tsx examples/smoke.ts","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"velmoon222","email":"velvetmoon222999@gmail.com"},"repository":{"url":"git+https://github.com/autonome-research/thread-phase.git","type":"git","directory":"packages/thread-phase"},"_npmVersion":"11.12.1","description":"TypeScript substrate for building automation workflows that coordinate AI agents. Phase ordering, typed shared state, persistence, fanout, event flow.","directories":{},"_nodeVersion":"24.15.0","dependencies":{"ajv":"^8.17.0","openai":"^4.77.0","better-sqlite3":"^11.5.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","vitest":"^2.1.0","typescript":"^5.6.0","@types/node":"^22.0.0","@honcho-ai/sdk":"^2.1.1","@types/better-sqlite3":"^7.6.11"},"peerDependencies":{"vitest":"^2.1.0","cron-parser":"^4.0.0 || ^5.0.0"},"peerDependenciesMeta":{"vitest":{"optional":true},"cron-parser":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/thread-phase_3.0.1_1779328144121_0.01840976088204971","host":"s3://npm-registry-packages-npm-production"}},"3.0.2":{"name":"@autonome-research/thread-phase","version":"3.0.2","license":"MIT","_id":"@autonome-research/thread-phase@3.0.2","maintainers":[{"name":"velmoon222","email":"velvetmoon222999@gmail.com"}],"homepage":"https://github.com/autonome-research/thread-phase#readme","bugs":{"url":"https://github.com/autonome-research/thread-phase/issues"},"dist":{"shasum":"5645aa854da7028eebd91780b3b4adbf38a691b9","tarball":"https://registry.npmjs.org/@autonome-research/thread-phase/-/thread-phase-3.0.2.tgz","fileCount":263,"integrity":"sha512-4ak96yXawBER7RGb89JPVQtnuMvaovIn+rIfJm5Yc+V4pjF3qbUtEGr3hhPu7Fw1+MrEYbZWrwHWqMBfgxnOww==","signatures":[{"sig":"MEYCIQCLCzal3KPGWD0sKNMRVC4n8EWE3F4RQaxFeQuog5QyVgIhAM/Wwl1IBBtoW/YhBB8B2xLYuazof+zB1ljmSwmfG9XM","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":525432},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":"./dist/index.js","./tools":"./dist/tools/index.js","./agents":"./dist/agents/index.js","./context":"./dist/context/index.js","./session":"./dist/session/index.js","./patterns":"./dist/patterns/index.js","./triggers":"./dist/triggers/index.js","./agents/test-utils":"./dist/agents/test-utils/index.js"},"gitHead":"e57418e284ca8c9bec7034e0960bf9e6aae8b475","scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","smoke":"tsx examples/smoke.ts","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"velmoon222","email":"velvetmoon222999@gmail.com"},"repository":{"url":"git+https://github.com/autonome-research/thread-phase.git","type":"git","directory":"packages/thread-phase"},"_npmVersion":"11.12.1","description":"TypeScript substrate for building automation workflows that coordinate AI agents. Phase ordering, typed shared state, persistence, fanout, event flow.","directories":{},"_nodeVersion":"24.15.0","dependencies":{"ajv":"^8.17.0","openai":"^4.77.0","better-sqlite3":"^11.5.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","vitest":"^2.1.0","typescript":"^5.6.0","@types/node":"^22.0.0","@honcho-ai/sdk":"^2.1.1","@types/better-sqlite3":"^7.6.11"},"peerDependencies":{"vitest":"^2.1.0","cron-parser":"^4.0.0 || ^5.0.0"},"peerDependenciesMeta":{"vitest":{"optional":true},"cron-parser":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/thread-phase_3.0.2_1779329985694_0.7820769738180764","host":"s3://npm-registry-packages-npm-production"}},"3.1.0":{"name":"@autonome-research/thread-phase","version":"3.1.0","license":"MIT","_id":"@autonome-research/thread-phase@3.1.0","maintainers":[{"name":"velmoon222","email":"velvetmoon222999@gmail.com"}],"homepage":"https://github.com/autonome-research/thread-phase#readme","bugs":{"url":"https://github.com/autonome-research/thread-phase/issues"},"dist":{"shasum":"4445614264f88534462e4da0f95c42ca8b587c57","tarball":"https://registry.npmjs.org/@autonome-research/thread-phase/-/thread-phase-3.1.0.tgz","fileCount":263,"integrity":"sha512-1a5UlyUmImYBW15rWX4hqpRFl8VJ7DrI240MR4Q+2F7eZ2n2n4Tu0t2HX0AA/GRwM4L5igzkIq9QMvtxYrYiBA==","signatures":[{"sig":"MEQCICdEf1jztA81J1JaqgH7eQigj6ishi6/4Wl0b432t44oAiBcMzZCBlVPwnjnDkaqorLXCxB+Q7hYEZKHvVObOpWrYA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":525432},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":"./dist/index.js","./tools":"./dist/tools/index.js","./agents":"./dist/agents/index.js","./context":"./dist/context/index.js","./session":"./dist/session/index.js","./patterns":"./dist/patterns/index.js","./triggers":"./dist/triggers/index.js","./agents/test-utils":"./dist/agents/test-utils/index.js"},"gitHead":"a608a5f814d3b2f4d96e6da1bf8404851a72503a","scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","smoke":"tsx examples/smoke.ts","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"velmoon222","email":"velvetmoon222999@gmail.com"},"repository":{"url":"git+https://github.com/autonome-research/thread-phase.git","type":"git","directory":"packages/thread-phase"},"_npmVersion":"11.12.1","description":"TypeScript substrate for building automation workflows that coordinate AI agents. Phase ordering, typed shared state, persistence, fanout, event flow.","directories":{},"_nodeVersion":"24.15.0","dependencies":{"ajv":"^8.17.0","openai":"^4.77.0","better-sqlite3":"^11.5.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","vitest":"^2.1.0","typescript":"^5.6.0","@types/node":"^22.0.0","@honcho-ai/sdk":"^2.1.1","@types/better-sqlite3":"^7.6.11"},"peerDependencies":{"vitest":"^2.1.0","cron-parser":"^4.0.0 || ^5.0.0"},"peerDependenciesMeta":{"vitest":{"optional":true},"cron-parser":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/thread-phase_3.1.0_1779395831406_0.03872677212525111","host":"s3://npm-registry-packages-npm-production"}},"3.2.0":{"name":"@autonome-research/thread-phase","version":"3.2.0","license":"MIT","_id":"@autonome-research/thread-phase@3.2.0","maintainers":[{"name":"velmoon222","email":"velvetmoon222999@gmail.com"}],"homepage":"https://github.com/autonome-research/thread-phase#readme","bugs":{"url":"https://github.com/autonome-research/thread-phase/issues"},"dist":{"shasum":"66a2b0c2f04112e35bf02099fd3eee14ab9e8490","tarball":"https://registry.npmjs.org/@autonome-research/thread-phase/-/thread-phase-3.2.0.tgz","fileCount":263,"integrity":"sha512-VEB+N+4soP5jfi7iKUmvCy9VIeLGDViK8gJkpV7foPjUuF9y4xoRgEheeEM5U78tOsAj1AzToRL7+t76KJsGPw==","signatures":[{"sig":"MEUCIQCkATxBo928klsn34pRkvT/Zjhw3FavFq3TAJEl96aeVgIgWuwBAsFNEchsdBuLafIYkebEQYJk6M636R4+jkU/01U=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":525432},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":"./dist/index.js","./tools":"./dist/tools/index.js","./agents":"./dist/agents/index.js","./context":"./dist/context/index.js","./session":"./dist/session/index.js","./patterns":"./dist/patterns/index.js","./triggers":"./dist/triggers/index.js","./agents/test-utils":"./dist/agents/test-utils/index.js"},"gitHead":"08e7ff5a9c01ebbe1b29ae787f0d49a36bc6f221","scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","smoke":"tsx examples/smoke.ts","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"velmoon222","email":"velvetmoon222999@gmail.com"},"repository":{"url":"git+https://github.com/autonome-research/thread-phase.git","type":"git","directory":"packages/thread-phase"},"_npmVersion":"11.12.1","description":"TypeScript substrate for building automation workflows that coordinate AI agents. Phase ordering, typed shared state, persistence, fanout, event flow.","directories":{},"_nodeVersion":"24.15.0","dependencies":{"ajv":"^8.17.0","openai":"^4.77.0","better-sqlite3":"^11.5.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","vitest":"^2.1.0","typescript":"^5.6.0","@types/node":"^22.0.0","@honcho-ai/sdk":"^2.1.1","@types/better-sqlite3":"^7.6.11"},"peerDependencies":{"vitest":"^2.1.0","cron-parser":"^4.0.0 || ^5.0.0"},"peerDependenciesMeta":{"vitest":{"optional":true},"cron-parser":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/thread-phase_3.2.0_1779398807014_0.6053568238122988","host":"s3://npm-registry-packages-npm-production"}},"3.2.1":{"name":"@autonome-research/thread-phase","version":"3.2.1","license":"MIT","_id":"@autonome-research/thread-phase@3.2.1","maintainers":[{"name":"velmoon222","email":"velvetmoon222999@gmail.com"}],"homepage":"https://github.com/autonome-research/thread-phase#readme","bugs":{"url":"https://github.com/autonome-research/thread-phase/issues"},"dist":{"shasum":"69aad84de3efadfbd6c85be4f0b5044d17ed650b","tarball":"https://registry.npmjs.org/@autonome-research/thread-phase/-/thread-phase-3.2.1.tgz","fileCount":263,"integrity":"sha512-pNjZHzlWBUQ9m5fH2Bj5uC0Y2zilDGIU/99JCBFUOCMwBUVa7MjAlODmWwLyCTJu7VnzNW5AcuzdjBjEVsab/Q==","signatures":[{"sig":"MEYCIQCeYZd+2Z2HcLmlVlCaiG/6liJqKrbREl+tzdPyPdmTrAIhANBuExcVDIVFSEjlItIl/FFVUKaFMCn8xtqh/pnhPxcV","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":525983},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":"./dist/index.js","./tools":"./dist/tools/index.js","./agents":"./dist/agents/index.js","./context":"./dist/context/index.js","./session":"./dist/session/index.js","./patterns":"./dist/patterns/index.js","./triggers":"./dist/triggers/index.js","./agents/test-utils":"./dist/agents/test-utils/index.js"},"gitHead":"ffa1d39ca2b0df57e5affddc9fb2a7380b679279","scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","smoke":"tsx examples/smoke.ts","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"velmoon222","email":"velvetmoon222999@gmail.com"},"repository":{"url":"git+https://github.com/autonome-research/thread-phase.git","type":"git","directory":"packages/thread-phase"},"_npmVersion":"11.12.1","description":"TypeScript substrate for building automation workflows that coordinate AI agents. Phase ordering, typed shared state, persistence, fanout, event flow.","directories":{},"_nodeVersion":"24.15.0","dependencies":{"ajv":"^8.17.0","openai":"^4.77.0","better-sqlite3":"^11.5.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","vitest":"^2.1.0","typescript":"^5.6.0","@types/node":"^22.0.0","@honcho-ai/sdk":"^2.1.1","@types/better-sqlite3":"^7.6.11"},"peerDependencies":{"vitest":"^2.1.0","cron-parser":"^4.0.0 || ^5.0.0"},"peerDependenciesMeta":{"vitest":{"optional":true},"cron-parser":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/thread-phase_3.2.1_1779399815373_0.3838936341705095","host":"s3://npm-registry-packages-npm-production"}},"3.2.2":{"name":"@autonome-research/thread-phase","version":"3.2.2","license":"MIT","_id":"@autonome-research/thread-phase@3.2.2","maintainers":[{"name":"velmoon222","email":"velvetmoon222999@gmail.com"}],"homepage":"https://github.com/autonome-research/thread-phase#readme","bugs":{"url":"https://github.com/autonome-research/thread-phase/issues"},"dist":{"shasum":"35d0088e9269bdf891c021d93847295c0d17a380","tarball":"https://registry.npmjs.org/@autonome-research/thread-phase/-/thread-phase-3.2.2.tgz","fileCount":263,"integrity":"sha512-yGFfqjNIAIyMWv2GB5GgSvhd8MR5xi0jdpy+uhHTyziwX5wXJrr7IDATJD9qJ+nKyy9UGHYWpibIAlGM3C41ew==","signatures":[{"sig":"MEUCIG+HxPx77sdla0WVguhVX2CeOEle8iiKi+WyyemjqPwLAiEA0aUdYlIlwY3uM0SaxnqbssATSJefMTkQrgfNemfB6k8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":525983},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":"./dist/index.js","./tools":"./dist/tools/index.js","./agents":"./dist/agents/index.js","./context":"./dist/context/index.js","./session":"./dist/session/index.js","./patterns":"./dist/patterns/index.js","./triggers":"./dist/triggers/index.js","./agents/test-utils":"./dist/agents/test-utils/index.js"},"gitHead":"f2f8dd19ce2547afa380cccc3d84c1d890ac3589","scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","smoke":"tsx examples/smoke.ts","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"velmoon222","email":"velvetmoon222999@gmail.com"},"repository":{"url":"git+https://github.com/autonome-research/thread-phase.git","type":"git","directory":"packages/thread-phase"},"_npmVersion":"11.12.1","description":"TypeScript substrate for building automation workflows that coordinate AI agents. Phase ordering, typed shared state, persistence, fanout, event flow.","directories":{},"_nodeVersion":"24.15.0","dependencies":{"ajv":"^8.17.0","openai":"^4.77.0","better-sqlite3":"^11.5.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","vitest":"^2.1.0","typescript":"^5.6.0","@types/node":"^22.0.0","@honcho-ai/sdk":"^2.1.1","@types/better-sqlite3":"^7.6.11"},"peerDependencies":{"vitest":"^2.1.0","cron-parser":"^4.0.0 || ^5.0.0"},"peerDependenciesMeta":{"vitest":{"optional":true},"cron-parser":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/thread-phase_3.2.2_1779400712104_0.4988006698210361","host":"s3://npm-registry-packages-npm-production"}},"3.3.0":{"name":"@autonome-research/thread-phase","version":"3.3.0","license":"MIT","_id":"@autonome-research/thread-phase@3.3.0","maintainers":[{"name":"velmoon222","email":"velvetmoon222999@gmail.com"}],"homepage":"https://github.com/autonome-research/thread-phase#readme","bugs":{"url":"https://github.com/autonome-research/thread-phase/issues"},"dist":{"shasum":"73b25578c886ef0204d88cedfd95ef21796adced","tarball":"https://registry.npmjs.org/@autonome-research/thread-phase/-/thread-phase-3.3.0.tgz","fileCount":267,"integrity":"sha512-A/JULRfA2sEQS9VfRp5aXo+43uqVpyVrVjy2KbkTLz8cqnfI2P7vQupZxntVhiOcLvVcmDxuwxsfgOULwKRZFw==","signatures":[{"sig":"MEYCIQCqGh+3VUnqqLgIkGzd4gwUDgFyDIPemhsHmr/wQv/5SQIhAIPN/N0skUrk9OMl+sXxYj8uxRSdM5zkDOH+DB0GbwFM","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":548216},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":"./dist/index.js","./tools":"./dist/tools/index.js","./agents":"./dist/agents/index.js","./context":"./dist/context/index.js","./session":"./dist/session/index.js","./patterns":"./dist/patterns/index.js","./triggers":"./dist/triggers/index.js","./agents/test-utils":"./dist/agents/test-utils/index.js"},"gitHead":"9834be282f923fa22e72fc55eb0aa19dc2322436","scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","smoke":"tsx examples/smoke.ts","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"velmoon222","email":"velvetmoon222999@gmail.com"},"repository":{"url":"git+https://github.com/autonome-research/thread-phase.git","type":"git","directory":"packages/thread-phase"},"_npmVersion":"11.12.1","description":"TypeScript substrate for building automation workflows that coordinate AI agents. Phase ordering, typed shared state, persistence, fanout, event flow.","directories":{},"_nodeVersion":"24.15.0","dependencies":{"ajv":"^8.17.0","openai":"^4.77.0","better-sqlite3":"^11.5.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","vitest":"^2.1.0","typescript":"^5.6.0","@types/node":"^22.0.0","@honcho-ai/sdk":"^2.1.1","@types/better-sqlite3":"^7.6.11"},"peerDependencies":{"vitest":"^2.1.0","cron-parser":"^4.0.0 || ^5.0.0"},"peerDependenciesMeta":{"vitest":{"optional":true},"cron-parser":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/thread-phase_3.3.0_1780212768776_0.8360038324594137","host":"s3://npm-registry-packages-npm-production"}},"3.4.0":{"name":"@autonome-research/thread-phase","version":"3.4.0","license":"MIT","_id":"@autonome-research/thread-phase@3.4.0","maintainers":[{"name":"velmoon222","email":"velvetmoon222999@gmail.com"}],"homepage":"https://github.com/autonome-research/thread-phase#readme","bugs":{"url":"https://github.com/autonome-research/thread-phase/issues"},"dist":{"shasum":"9a27480b9bbb6a27e9fa9dc9073db072ca72e38b","tarball":"https://registry.npmjs.org/@autonome-research/thread-phase/-/thread-phase-3.4.0.tgz","fileCount":271,"integrity":"sha512-l8C+uAkGBfY1Ez+Nwnw1bsP6E9g9smjUtfDOtInuZmijDs9GDE2buzSGMMeviA9bS57Ayj/VYeAlLVapVS/eMA==","signatures":[{"sig":"MEYCIQDKuN9WGQUdhb5+GCszlYLlyW3sNqky4/qNZSHi7v9ssQIhALpGHiiN6Iz8e2X+yukgl1GNtUZuURhC1HtloSh7pixC","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":568606},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":"./dist/index.js","./tools":"./dist/tools/index.js","./agents":"./dist/agents/index.js","./context":"./dist/context/index.js","./session":"./dist/session/index.js","./patterns":"./dist/patterns/index.js","./triggers":"./dist/triggers/index.js","./agents/test-utils":"./dist/agents/test-utils/index.js"},"gitHead":"25c2f02ff74d6e27515575c7b7e53defc9ef0ece","scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","smoke":"tsx examples/smoke.ts","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"velmoon222","email":"velvetmoon222999@gmail.com"},"repository":{"url":"git+https://github.com/autonome-research/thread-phase.git","type":"git","directory":"packages/thread-phase"},"_npmVersion":"11.12.1","description":"TypeScript substrate for building automation workflows that coordinate AI agents. Phase ordering, typed shared state, persistence, fanout, event flow.","directories":{},"_nodeVersion":"24.15.0","dependencies":{"ajv":"^8.17.0","openai":"^4.77.0","better-sqlite3":"^11.5.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","vitest":"^2.1.0","typescript":"^5.6.0","@types/node":"^22.0.0","@honcho-ai/sdk":"^2.1.1","@types/better-sqlite3":"^7.6.11"},"peerDependencies":{"vitest":"^2.1.0","cron-parser":"^4.0.0 || ^5.0.0"},"peerDependenciesMeta":{"vitest":{"optional":true},"cron-parser":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/thread-phase_3.4.0_1780450800510_0.37073041256271067","host":"s3://npm-registry-packages-npm-production"}},"4.0.0":{"name":"@autonome-research/thread-phase","version":"4.0.0","license":"MIT","_id":"@autonome-research/thread-phase@4.0.0","maintainers":[{"name":"velmoon222","email":"velvetmoon222999@gmail.com"}],"homepage":"https://github.com/autonome-research/thread-phase#readme","bugs":{"url":"https://github.com/autonome-research/thread-phase/issues"},"dist":{"shasum":"a0790b49593d4b46e596f4eb548aacb4c0668535","tarball":"https://registry.npmjs.org/@autonome-research/thread-phase/-/thread-phase-4.0.0.tgz","fileCount":275,"integrity":"sha512-wAtErIsGLVa1wBz+NbxydmYaCgZedmlxRqRitqh0r/lgZUf/0YljfKHrPKRe600zCKt/euS3fna3ocKLUPnd+A==","signatures":[{"sig":"MEUCIHJhT48pzwFJ1+PX109t6tEcpoA7ifhT+2qWmfZofcaFAiEAtn1Z83gfVn30B6VE8YfHlK1bHA+rc1ptU+IpHYHJy7I=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":575751},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":"./dist/index.js","./tools":"./dist/tools/index.js","./agents":"./dist/agents/index.js","./context":"./dist/context/index.js","./session":"./dist/session/index.js","./patterns":"./dist/patterns/index.js","./triggers":"./dist/triggers/index.js","./agents/authoring":"./dist/agents/authoring/index.js","./agents/test-utils":"./dist/agents/test-utils/index.js"},"gitHead":"3993700407012b9e0d47a86d0125df15fe07d21f","scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","smoke":"tsx examples/smoke.ts","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"velmoon222","email":"velvetmoon222999@gmail.com"},"repository":{"url":"git+https://github.com/autonome-research/thread-phase.git","type":"git","directory":"packages/thread-phase"},"_npmVersion":"11.12.1","description":"TypeScript substrate for building automation workflows that coordinate AI agents. Phase ordering, typed shared state, persistence, fanout, event flow.","directories":{},"_nodeVersion":"24.15.0","dependencies":{"ajv":"^8.17.0","openai":"^4.77.0","better-sqlite3":"^11.5.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","vitest":"^2.1.0","typescript":"^5.6.0","@types/node":"^22.0.0","@honcho-ai/sdk":"^2.1.1","@types/better-sqlite3":"^7.6.11"},"peerDependencies":{"vitest":"^2.1.0","cron-parser":"^4.0.0 || ^5.0.0"},"peerDependenciesMeta":{"vitest":{"optional":true},"cron-parser":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/thread-phase_4.0.0_1780454456280_0.8888317399594396","host":"s3://npm-registry-packages-npm-production"}},"4.1.0":{"name":"@autonome-research/thread-phase","version":"4.1.0","license":"MIT","_id":"@autonome-research/thread-phase@4.1.0","maintainers":[{"name":"velmoon222","email":"velvetmoon222999@gmail.com"}],"homepage":"https://github.com/autonome-research/thread-phase#readme","bugs":{"url":"https://github.com/autonome-research/thread-phase/issues"},"dist":{"shasum":"aa178e030dfa0a376e1445a330434a20a22f4673","tarball":"https://registry.npmjs.org/@autonome-research/thread-phase/-/thread-phase-4.1.0.tgz","fileCount":279,"integrity":"sha512-IngWYtnFBbgg92IOYawLQpIrn1CE1UL0OVqxkagRY4ERyHBEJkOixWkgjbl0Tr2s9IIe68rn1tugHE9yvVaybA==","signatures":[{"sig":"MEUCIQDg8H497LAymwIttLtF0jlE33vanTwq2MffF87pO86CyAIgMjXeo/EsOPiSvoTZSKXUOjumWxNe3BgUSdDMkb7XNRQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":612695},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":"./dist/index.js","./tools":"./dist/tools/index.js","./agents":"./dist/agents/index.js","./context":"./dist/context/index.js","./session":"./dist/session/index.js","./patterns":"./dist/patterns/index.js","./triggers":"./dist/triggers/index.js","./agents/authoring":"./dist/agents/authoring/index.js","./agents/test-utils":"./dist/agents/test-utils/index.js"},"gitHead":"a3095837a62acdeac1922eecfdf38890437eb116","scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","smoke":"tsx examples/smoke.ts","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"velmoon222","email":"velvetmoon222999@gmail.com"},"repository":{"url":"git+https://github.com/autonome-research/thread-phase.git","type":"git","directory":"packages/thread-phase"},"_npmVersion":"11.12.1","description":"TypeScript substrate for building automation workflows that coordinate AI agents. Phase ordering, typed shared state, persistence, fanout, event flow.","directories":{},"_nodeVersion":"24.15.0","dependencies":{"ajv":"^8.17.0","openai":"^4.77.0","better-sqlite3":"^11.5.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","vitest":"^2.1.0","typescript":"^5.6.0","@types/node":"^22.0.0","@honcho-ai/sdk":"^2.1.1","@types/better-sqlite3":"^7.6.11"},"peerDependencies":{"vitest":"^2.1.0","cron-parser":"^4.0.0 || ^5.0.0"},"peerDependenciesMeta":{"vitest":{"optional":true},"cron-parser":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/thread-phase_4.1.0_1780540636314_0.23718593194727777","host":"s3://npm-registry-packages-npm-production"}},"5.0.0":{"name":"@autonome-research/thread-phase","version":"5.0.0","license":"MIT","_id":"@autonome-research/thread-phase@5.0.0","maintainers":[{"name":"velmoon222","email":"velvetmoon222999@gmail.com"}],"homepage":"https://github.com/autonome-research/thread-phase#readme","bugs":{"url":"https://github.com/autonome-research/thread-phase/issues"},"dist":{"shasum":"b65bef53d5d36726cb37b98b575108305aff9a4d","tarball":"https://registry.npmjs.org/@autonome-research/thread-phase/-/thread-phase-5.0.0.tgz","fileCount":263,"integrity":"sha512-Utn4dMqH1GWZRAQQDbVy730M6jWHBpXl6YvmMXEASdZvoNPm7MZ+agGbLVa1xQwl3ombJ+8znpxgfg06B2bFdA==","signatures":[{"sig":"MEUCIEditMjaHp9ryz2RKEiZ4G5kaHNUaXpEg7uHnWQEvIAaAiEAvfZHgD32ToLR1Yr/+f8HmMluuIBhHXCFKjK2ER1MwD0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":625471},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":"20.x || 22.x || 23.x || 24.x || 25.x || 26.x"},"exports":{".":"./dist/index.js","./tools":"./dist/tools/index.js","./agents":"./dist/agents/index.js","./context":"./dist/context/index.js","./session":"./dist/session/index.js","./patterns":"./dist/patterns/index.js","./triggers":"./dist/triggers/index.js","./agents/authoring":"./dist/agents/authoring/index.js","./agents/test-utils":"./dist/agents/test-utils/index.js"},"gitHead":"e148f43e36f540a7bbeae5393c7d7585bc9beff2","scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","smoke":"tsx examples/smoke.ts","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"velmoon222","email":"velvetmoon222999@gmail.com"},"repository":{"url":"git+https://github.com/autonome-research/thread-phase.git","type":"git","directory":"packages/thread-phase"},"_npmVersion":"11.15.0","description":"TypeScript substrate for building automation workflows that coordinate AI agents. Phase ordering, typed shared state, persistence, fanout, event flow.","directories":{},"_nodeVersion":"26.1.0","dependencies":{"ajv":"^8.17.0","openai":"^6.46.0","better-sqlite3":"^12.11.1"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","vitest":"^4.1.10","typescript":"^5.6.0","@types/node":"^22.0.0","@honcho-ai/sdk":"^2.1.1","@types/better-sqlite3":"^7.6.11"},"peerDependencies":{"vitest":"^2.1.0 || ^3.0.0 || ^4.0.0","cron-parser":"^4.0.0 || ^5.0.0"},"peerDependenciesMeta":{"vitest":{"optional":true},"cron-parser":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/thread-phase_5.0.0_1784010481109_0.5021155800991504","host":"s3://npm-registry-packages-npm-production"}},"6.0.0":{"name":"@autonome-research/thread-phase","version":"6.0.0","license":"MIT","_id":"@autonome-research/thread-phase@6.0.0","maintainers":[{"name":"velmoon222","email":"velvetmoon222999@gmail.com"}],"homepage":"https://github.com/autonome-research/thread-phase#readme","bugs":{"url":"https://github.com/autonome-research/thread-phase/issues"},"dist":{"shasum":"b61d42ccb6f9d00e2339552b083da82ce9539286","tarball":"https://registry.npmjs.org/@autonome-research/thread-phase/-/thread-phase-6.0.0.tgz","fileCount":267,"integrity":"sha512-WFMo27xxb1fD9FmxoBh2FcrbdH59epZFZhRgJ8V53iFQ9SM4PSk2ssZfTLM4jWqYqvcOV3lQ1P5u7/wLmK2GEg==","signatures":[{"sig":"MEYCIQD+0iOMu5lmhhsr0R+XkolZpm33jf0ObFCsMaBoFQdC4wIhAJToYRkZnUnqoOeskpGrwBq42rd9iDmYGsQChbjPC5UL","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":638824},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22.5.0"},"exports":{".":"./dist/index.js","./tools":"./dist/tools/index.js","./agents":"./dist/agents/index.js","./context":"./dist/context/index.js","./session":"./dist/session/index.js","./patterns":"./dist/patterns/index.js","./triggers":"./dist/triggers/index.js","./package.json":"./package.json","./agents/authoring":"./dist/agents/authoring/index.js","./agents/test-utils":"./dist/agents/test-utils/index.js"},"gitHead":"dd9f9a739237ee3b47eb74a500ce51a867264e9c","scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","smoke":"tsx examples/smoke.ts","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"velmoon222","email":"velvetmoon222999@gmail.com"},"repository":{"url":"git+https://github.com/autonome-research/thread-phase.git","type":"git","directory":"packages/thread-phase"},"_npmVersion":"11.15.0","description":"TypeScript substrate for building automation workflows that coordinate AI agents. Phase ordering, typed shared state, persistence, fanout, event flow.","directories":{},"_nodeVersion":"26.1.0","dependencies":{"ajv":"^8.17.0","openai":"^6.46.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","vitest":"^4.1.10","typescript":"^5.6.0","@types/node":"^22.0.0","@honcho-ai/sdk":"^2.1.1"},"peerDependencies":{"vitest":"^2.1.0 || ^3.0.0 || ^4.0.0","cron-parser":"^4.0.0 || ^5.0.0"},"peerDependenciesMeta":{"vitest":{"optional":true},"cron-parser":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/thread-phase_6.0.0_1784324325701_0.6272147879340966","host":"s3://npm-registry-packages-npm-production"}},"6.1.0":{"name":"@autonome-research/thread-phase","version":"6.1.0","description":"TypeScript substrate for building automation workflows that coordinate AI agents. Phase ordering, typed shared state, persistence, fanout, event flow.","license":"MIT","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":"./dist/index.js","./patterns":"./dist/patterns/index.js","./context":"./dist/context/index.js","./session":"./dist/session/index.js","./tools":"./dist/tools/index.js","./agents":"./dist/agents/index.js","./agents/authoring":"./dist/agents/authoring/index.js","./agents/test-utils":"./dist/agents/test-utils/index.js","./triggers":"./dist/triggers/index.js","./package.json":"./package.json"},"scripts":{"build":"tsc -p tsconfig.json","test":"vitest run","test:watch":"vitest","typecheck":"tsc --noEmit && tsc -p test-d/tsconfig.json","smoke":"tsx examples/smoke.ts"},"dependencies":{"ajv":"^8.17.0","openai":"^6.46.0"},"devDependencies":{"@honcho-ai/sdk":"^2.1.1","@types/node":"^22.0.0","tsx":"^4.19.0","typescript":"^5.6.0","vitest":"^4.1.10"},"peerDependencies":{"cron-parser":"^4.0.0 || ^5.0.0","vitest":"^2.1.0 || ^3.0.0 || ^4.0.0"},"peerDependenciesMeta":{"cron-parser":{"optional":true},"vitest":{"optional":true}},"engines":{"node":">=22.5.0"},"repository":{"type":"git","url":"git+https://github.com/autonome-research/thread-phase.git","directory":"packages/thread-phase"},"gitHead":"5e404847f2bbfd7f19bb5b5a38be27bd984896d7","_id":"@autonome-research/thread-phase@6.1.0","bugs":{"url":"https://github.com/autonome-research/thread-phase/issues"},"homepage":"https://github.com/autonome-research/thread-phase#readme","_nodeVersion":"26.1.0","_npmVersion":"11.15.0","dist":{"integrity":"sha512-bZdyJnjWMgxuXAEZBnps00sdNQZyJQgu4R7KWuYBMCVbBneFxbGu3LR3sTAf5tcNOxbmfrb18l4QoFekskOQwQ==","shasum":"3dcda2fd8bf9aecb752be5f0e97ca25fa790186a","tarball":"https://registry.npmjs.org/@autonome-research/thread-phase/-/thread-phase-6.1.0.tgz","fileCount":267,"unpackedSize":725741,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIEJ21lv4aNjJj9MBiBMomktl+mMDuMgFEDgQkmoN4McKAiEAnKpH7vodcLTjLTvhWT1IXyB64Ux0xkii7NoOBdxh0OY="}]},"_npmUser":{"name":"velmoon222","email":"velvetmoon222999@gmail.com"},"directories":{},"maintainers":[{"name":"velmoon222","email":"velvetmoon222999@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/thread-phase_6.1.0_1784781801097_0.9971298174707361"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-21T00:05:59.330Z","modified":"2026-07-23T04:43:21.437Z","3.0.0":"2026-05-21T00:05:59.659Z","3.0.1":"2026-05-21T01:49:04.348Z","3.0.2":"2026-05-21T02:19:45.948Z","3.1.0":"2026-05-21T20:37:11.626Z","3.2.0":"2026-05-21T21:26:47.232Z","3.2.1":"2026-05-21T21:43:35.547Z","3.2.2":"2026-05-21T21:58:32.293Z","3.3.0":"2026-05-31T07:32:48.934Z","3.4.0":"2026-06-03T01:40:00.695Z","4.0.0":"2026-06-03T02:40:56.435Z","4.1.0":"2026-06-04T02:37:16.541Z","5.0.0":"2026-07-14T06:28:01.260Z","6.0.0":"2026-07-17T21:38:45.869Z","6.1.0":"2026-07-23T04:43:21.235Z"},"bugs":{"url":"https://github.com/autonome-research/thread-phase/issues"},"license":"MIT","homepage":"https://github.com/autonome-research/thread-phase#readme","repository":{"type":"git","url":"git+https://github.com/autonome-research/thread-phase.git","directory":"packages/thread-phase"},"description":"TypeScript substrate for building automation workflows that coordinate AI agents. Phase ordering, typed shared state, persistence, fanout, event flow.","maintainers":[{"name":"velmoon222","email":"velvetmoon222999@gmail.com"}],"readme":"# thread-phase\n\nA TypeScript framework that composes deterministic phases over **heterogeneous agents** — the iterated tool-use loop against OpenAI-compatible inference for raw model calls, the `AgentAdapter` protocol for delegating to ready agents (Claude Code, Hermes, Codex, OpenClaw, Anthropic SDK). Multi-phase pipelines with a typed shared context, persistent event logs, cancellation, checkpoints, and concurrency-capped fanout.\n\nThe workflow structure is deterministic: phase order, bounds, branching, retries, and terminal-state behavior are encoded in TypeScript. Agent output inside a phase remains probabilistic. thread-phase is a bounded execution substrate, not a distributed DAG scheduler or product UI.\n\n```bash\nnpm install @autonome-research/thread-phase\n```\n\n> **Generating thread-phase code with an LLM agent?** See [`AGENTS.md`](./AGENTS.md) — a self-contained reference covering the mental model, a copy-paste template, and explicit anti-patterns. Claude Code users can also install [`SKILL.md`](./SKILL.md) into `~/.claude/skills/thread-phase/` so the guidance auto-loads.\n\n## Use cases\n\nthread-phase is designed for two shapes:\n\n1. **Agent-authored automations.** When an autonomous agent (Claude Code, Hermes, Cursor, etc.) sets up a recurring task — a cron job, a systemd timer, a CI step — the structuring usually happens at prompt-write time but the execution still relies on the agent re-deriving its plan at run time. thread-phase gives the structuring agent a typed phase boundary to encode the deterministic parts of the pipeline (ordering, fan-out, ctx flow, post-condition checks) while leaving the run-time agent free to make judgment calls inside each phase. The cron line ends up being a plain `npx tsx ...` invocation; no prompt at run time. See [`examples/agent-authored-cron.ts`](./examples/agent-authored-cron.ts).\n\n2. **Mini-workflows inside larger DAG frameworks.** Temporal, LangGraph, Inngest, and similar frameworks are built for distributed DAG orchestration; they're heavyweight when a single node needs to run a small multi-step agent loop with its own concurrency cap, retry, and event log. thread-phase fits as the *inside* of one node — Temporal owns the workflow topology and durable state across machines; thread-phase owns the streaming tool-use loop and per-node phase composition. This composes cleanly because thread-phase's `runAgentWithTools` and `runPipeline` don't assume they own the event loop or persistence layer.\n\nIt's also useful as a standalone pipeline runner (`JobRunner` + sqlite event log + SSE streaming) for batch-processing workloads that don't need either of the above.\n\n## Out of scope\n\n- DAG / graph framework features (cross-node dependency graphs, declarative edge routing, distributed scheduling). Use Temporal/LangGraph/Inngest, embedding thread-phase inside their nodes.\n- Anthropic content-block model (vision, citations, extended thinking). Use the Anthropic SDK directly.\n- Multi-modal inputs.\n- Long-document summarization (the bundled compressor uses opaque markers for old tool results — known weakness for hierarchical summarization, see [ROADMAP](./ROADMAP.md)).\n\n## Quickstart\n\n```ts\nimport {\n  runAgentWithTools,\n  ToolRegistry,\n  createInferenceClient,\n} from '@autonome-research/thread-phase';\n\nconst tools = new ToolRegistry().register(\n  {\n    name: 'add',\n    description: 'Add two integers',\n    inputSchema: {\n      type: 'object',\n      properties: { a: { type: 'number' }, b: { type: 'number' } },\n      required: ['a', 'b'],\n      additionalProperties: false,\n    },\n  },\n  async (args) => String((args.a as number) + (args.b as number)),\n);\n\nconst result = await runAgentWithTools(\n  {\n    name: 'math',\n    systemPrompt: 'Use the add tool. Reply with just the number.',\n    model: 'qwen3.6-27b',\n    tools: tools.definitions(),\n    maxToolRounds: 5,\n    maxTokens: 256,\n  },\n  [{ role: 'user', content: 'What is 17 + 25?' }],\n  { client: createInferenceClient(), toolExecutor: tools },\n);\n\nresult.text;               // \"42\"\nresult.finishReason;       // \"stop\" | \"length\" | \"tool_calls\" | ...\nresult.usage;              // { promptTokens, completionTokens, totalTokens }\nresult.executedToolCalls;  // [{ id, name: 'add', input: { a: 17, b: 25 } }]\n```\n\n## Architecture\n\nThree primitives plus one extension surface.\n\n### `runAgentWithTools(config, messages, options) → AgentRunResult`\n\nThe streaming tool-use loop. Sends a chat-completions request with `stream: true`, accumulates content and tool-call deltas, dispatches tools through `options.toolExecutor`, loops until the model produces final text or hits `config.maxToolRounds`. Returns a structured result:\n\n- `text` — final text output\n- `finishReason` — `'stop' | 'length' | 'tool_calls' | 'content_filter' | 'function_call' | 'error' | 'unknown'`. Branch on `'length'` to detect truncation.\n- `usage` — `{ promptTokens, completionTokens, totalTokens }`, summed across rounds\n- `executedToolCalls` — every tool call the model actually executed (id, name, parsed args)\n- `activity` — string log of internal events\n\n`options.signal` propagates an `AbortSignal` into the inference call. `options.onStreamEvent` receives `content_delta`, `tool_call_started`, `tool_call_complete`, and `round_complete` events as they arrive. `options.verifyResult` is a hook that runs once before returning — it can transform the result or throw to mark the run as failed; use it to validate the agent's claimed output against `executedToolCalls`.\n\n### `Phase<TCtx>` + `runPipeline(phases, ctx)`\n\nA `Phase` is an async generator that reads from a shared `ctx`, yields events, and writes outputs back to `ctx`. A pipeline is an array of phases run in order:\n\n```ts\ninterface Phase<TCtx extends BasePipelineContext> {\n  readonly name: string;\n  run(ctx: TCtx): AsyncGenerator<PipelineEvent, void>;\n}\n\nfor await (const event of runPipeline([phaseA, phaseB, phaseC], ctx)) {\n  // each phase yields events; the orchestrator owns the terminal 'done' / 'error'\n}\n```\n\n`requireCtx(ctx, key, phaseName)` is the loud-precondition helper — fails with the field name if a prerequisite phase didn't populate the field. Use it at the top of every phase that reads from ctx.\n\n`ctx.stop = { reason }` halts the pipeline cleanly. Loops, conditional branches, and parallel sub-flows are composed in TypeScript rather than declared in a graph language; the [`patterns/`](./docs/patterns.md) module names the recurring shapes.\n\n### `JobRunner` + `JobStore`\n\n`JobRunner` wraps a pipeline run with a persistent event log (`JobStore`, sqlite-backed by default), live event emission for SSE consumers, and per-job cancellation:\n\n```ts\nconst runner = new JobRunner(new SqliteJobStore('./jobs.db'));\nconst jobId = await runner.create('my-pipeline', input);\n\n// wire SIGTERM to runner.cancel so a stuck inference call exits cleanly\nprocess.on('SIGTERM', () => runner.cancel(jobId, 'systemd timeout'));\n\nawait runner.run(jobId, [phaseA, phaseB], ctx);\n// events persisted; consumers can replay via store.getEvents(jobId, afterId)\n// or subscribe live via runner.on(`job:${jobId}`, ...)\n```\n\n`JobRunner` automatically composes its cancellation signal with any caller-provided signal and installs the result as `ctx.signal`. Phase code passes `ctx.signal` into `runAgentWithTools`, adapters, HTTP calls, or other abortable work. `runner.start(...)` returns an immediate run handle with `signal`, `cancel()`, and `result`; `signalFor(jobId)` remains available for existing integrations.\n\nLive `job:${jobId}` listeners are observational and cannot change authoritative lifecycle results: dispatch snapshots listeners, contains synchronous throws, and observes returned-promise rejections. Configure `onLiveEventError` on `JobRunner` to receive immutable `LiveEventListenerFailure` diagnostics; failures from that diagnostic callback are also contained.\n\n`JobStore` is asynchronous so SQLite, Postgres, Redis, and network-backed implementations share one consistency contract. The bundled `SqliteJobStore` uses Node's synchronous built-in `node:sqlite` hot path internally and exposes it through the same Promise-based interface. Node.js 22.5 or newer is required. On Node 22.5–22.12, start Node with `--experimental-sqlite` (for example, `NODE_OPTIONS=--experimental-sqlite`); Node 22.13+ exposes the module without that flag.\n\nThe v5.0.0 `JobStore` contract remains unchanged. The published contract already includes atomic owner-aware claiming and finalization, cancellation and abandonment transitions, owner-scoped heartbeat, and heartbeat enablement. Custom stores must implement that released interface. The provenance-backed declaration fixture under `test-d/fixtures/v5.0.0/` verifies the exact published shape.\n\nWith `heartbeatMs`, `JobRunner` schedules at most one automatic owner-scoped heartbeat at a time. `heartbeatTimeoutMs` requires and defaults to `heartbeatMs`; once configured, it bounds how long the runner waits for automatic attempts and manual `ctx.heartbeat()` calls. Manual-only runs cannot currently configure a timeout. Custom stores must still bound or cancel their own underlying I/O because the Promise-based `JobStore` contract has no abort parameter. Manual calls are caller-controlled and may overlap an automatic attempt. Ownership loss, timeout, or backend failure stops scheduling and fails the run without being misclassified as cancellation. Cancellation that was requested first—through either the caller signal or `runner.cancel()`—remains authoritative; otherwise the first pipeline or heartbeat failure wins. Bundled SQLite and updated custom stores use optional `refreshHeartbeat(jobId, ownerId)` for owner-observable repeated refresh, converting `false` into `JobOwnershipLostError`. Published-v5 stores instead use one-time `enableHeartbeat()` plus owner-scoped `heartbeat()` fallback; because v5 did not define repeated-enable boolean semantics and permitted mismatch no-ops, those legacy stores cannot always report ownership loss until upgraded. Unscoped refresh bypasses ownership checks; hosts should reserve `runner.heartbeatAsOperator(jobId)` for explicit recovery operations. The older `runner.heartbeat(jobId)` name remains as a deprecated compatibility alias.\n\n### `AgentAdapter` — the extension surface\n\n`AgentAdapter` is the protocol every ready-agent integration speaks. The in-tree `inferenceAgent` wraps `runAgentWithTools`; sibling implementations in [`@autonome-research/thread-phase-agents`](../thread-phase-agents) wrap `hermes`, `openclaw`, `claude`, the OpenAI Responses API (Codex), and the Anthropic SDK directly.\n\nEvery adapter returns the same shape:\n\n```ts\ninterface AgentRun {\n  readonly events: AsyncIterable<AgentEvent>;  // single-consumer stream\n  readonly result: Promise<AgentRunResult>;     // always resolves, never rejects\n  abort(reason?: string): void;\n}\n```\n\nCanonical events: `agent_start | text | thinking | tool_call | tool_result | turn_end | agent_end | error | native`. Every event carries a `source` field (the adapter's id) so heterogeneous adapter events flow through one `AgentEventBus` without losing provenance.\n\n`AgentEventBus.emit(event)` is synchronous and always returns `void`; it starts each subscriber in registration order without awaiting returned promises, so use the bus for observation rather than sequencing. A subscriber throw or rejection does not escape `emit` or stop healthy subscribers. The stable `AgentEventBus` contract remains emit/on-only so legacy implementations stay structurally compatible; `createEventBus()` returns the additive `ObservableAgentEventBus` subtype. Register `bus.onHandlerError(({ handler, event, error }) => ...)` on that factory-created bus to observe failures; non-`Error` values are normalized to `Error`. Error observers are also fire-and-forget, and their own failures are contained rather than recursively reported. Both `on` and `onHandlerError` return idempotent unsubscribe callbacks.\n\nAdapter-event persistence has two deliberately different bridges:\n\n```ts\nimport {\n  createAgentEventPersistenceBridge,\n  pipeAgentEventsToJobStore,\n} from '@autonome-research/thread-phase/agents';\n\n// Existing best-effort API: unchanged signature and unsubscribe return value.\n// Appends are fire-and-forget; sync throws and rejected appends are swallowed.\nconst unsubscribe = pipeAgentEventsToJobStore(bus, store, jobId, {\n  dropTypes: ['text'],\n});\n\n// Durable opt-in: finite ordered queue, deterministic drain, and failures.\nconst persistence = createAgentEventPersistenceBridge(bus, store, jobId, {\n  capacity: 256,\n  onFailure: ({ kind, event, error, occurrences }) =>\n    logPersistenceFailure(kind, event, error, occurrences),\n});\nawait persistence.flush(); // all events accepted before this call have settled\nawait persistence.close(); // unsubscribe and drain; safe to call repeatedly\n```\n\nUse `pipeAgentEventsToJobStore` only when best-effort telemetry is sufficient: it preserves the existing synchronous call shape but offers no delivery barrier or failure signal. Use `createAgentEventPersistenceBridge` when shutdown or terminal work must wait for accepted events. Its capacity counts queued and currently appending events; events emitted while full are rejected and reported as `overflow`, append failures are reported as `append`, and later accepted events continue draining in input order. Failure observers active or pending when `flush()` or `close()` is invoked are included in that barrier. Later failures cannot add another observer delivery to an existing barrier, though they may coalesce into the same already-required pending notification. Synchronous same-kind bursts are aggregated before delivery; if an asynchronous observer remains active, further failures of that kind are coalesced into at most one pending immutable notification. A notification already passed to an observer never changes, and repeated barriers never force concurrent same-kind observer calls. This keeps observer work finitely bounded even during an overflow storm while preserving stable `occurrences` values. Append and overflow failures use separate batches. Install `onFailure` when failures must be acted on.\n\nRegister generic asynchronous cleanup with `JobRunOptions.drains` when accepted work must settle before the job's terminal event and state are persisted:\n\n```ts\nawait runner.run(jobId, phases, ctx, finalResult, {\n  drains: [\n    () => persistence.close(),\n    () => outputWriter.flush(),\n  ],\n});\n```\n\nDrains run sequentially in registration order, and every drain is attempted, including when ownership acquisition returns false or rejects. They are callbacks rather than AgentEventBus-specific objects, so `JobRunner` remains independent of adapters and event delivery. A drain failure turns an otherwise successful run into `FAILED`. If pipeline or ownership-acquisition failure and drain failure coincide, the original failure remains primary; cancellation similarly takes precedence over drain failures. The rejected `AggregateError` exposes all accompanying drain failures, so cleanup loss is not silent. Terminal persistence and runner hook shutdown happen only after draining finishes.\n\nConversation state across phases lives in the `Thread` primitive — canonical events plus per-adapter resume tokens. Same-adapter chains (claude-code → claude-code) resume natively via the adapter's session; cross-adapter chains render events back to text via `threadToMessages`.\n\nMemory across runs is outsourced: `MemoryProvider` is just a TypeScript interface (`recall(scope, query?) / remember(scope, events)`). thread-phase ships no implementations; bind Honcho, Letta, Mem0, or a custom backend yourself. See [`examples/honcho-memory.ts`](./examples/honcho-memory.ts).\n\n### `Trigger` — the entry-point abstraction\n\n`Trigger<TInput>` is the protocol every signal source implements: timers, webhooks, queue consumers, file watchers, message brokers. Each trigger yields `TriggerEvent<TInput>` with `{ id, occurredAt, input, metadata }`. `runTrigger(trigger, factory, options)` is the canonical consumer — it reads events, dispatches pipelines (optionally through a `JobRunner`), enforces a concurrency cap with backpressure, and isolates per-event failures.\n\nCore ships two built-in triggers: `TimerTrigger` (interval-driven) and `CronTrigger` (cron-expression-driven, lazy-loaded). HTTP/queue/file-watch transports stay in `examples/triggers/` as recipes — wrap your favorite framework into the protocol, don't make thread-phase ship transports.\n\nFor most automation, reach for the higher-level helpers on the main index (`schedule`, `hook`, `oneShot`) — they construct the underlying trigger and wire it through `runTrigger` in one call. The lower-level API is below if you need it:\n\n```ts\nimport { TimerTrigger, runTrigger } from '@autonome-research/thread-phase/triggers';\n\nconst trigger = new TimerTrigger({ intervalMs: 15 * 60_000, name: 'every-15m' });\nconst handle = runTrigger(\n  trigger,\n  () => ({ phases: [myPipeline], ctx: { cache: new PipelineCache() } }),\n  { jobRunner: runner },\n);\n\nprocess.on('SIGTERM', () => void handle.stop());\nawait handle.done;\n```\n\nEquivalent with the helper (when you don't need the lower-level pieces):\n\n```ts\nimport { schedule } from '@autonome-research/thread-phase';\n\nexport default schedule({ intervalMs: 15 * 60_000 }, async () => {\n  await doStuff();\n});\n```\n\n## Patterns\n\nIn `@autonome-research/thread-phase/patterns`:\n\n| Pattern | Shape |\n|---|---|\n| `boundedFanout` | N items, free-function runner per item, capped concurrency, results in input order |\n| `boundedFanoutOf` | Same, but the runner is an `AgentAdapter` + buildConfig — automatic event-bus propagation |\n| `parallelPhases` | Several phases run concurrently as one composite |\n| `intentGate` | Cheap classifier decides whether the rest of the pipeline runs |\n| `whileCondition` | Loop a body of phases while an async predicate holds, with a max-iteration cap |\n| `match` | Keyed dispatch — route to one of N phase lists by selector key |\n| `withRetry` | Higher-order wrapper retrying a phase with exponential backoff on failure |\n\nSee [`docs/patterns.md`](./docs/patterns.md) for selection guidance (\"I want to do X\" → \"use Y\"). v3.0.0 trimmed five patterns (`parallelFanout`, `streamingBoundedFanout`, `preflightConfidence`, `synthesizeWithFollowup`, `spotCheck`) into composition recipes — see [`docs/recipes.md`](./docs/recipes.md) for paste-in equivalents.\n\n## Configuration\n\nEnvironment-driven by default (override in code via `loadInferenceConfig({ ... })`):\n\n```bash\nINFERENCE_BASE_URL=http://localhost:8000/v1\nINFERENCE_API_KEY=not-needed-for-local-vllm\nINFERENCE_MODEL=qwen3.6-27b\nINFERENCE_CONTEXT_LENGTH=131072\n```\n\nFor tool-using agents on vLLM, the server needs `--enable-auto-tool-choice --tool-call-parser <name>` matching the model's output format. If content shaped like a tool call arrives as plain text instead of structured `tool_calls`, the runner emits a `parser_mismatch_warning` activity entry.\n\n## Examples\n\nIn [`examples/`](./examples), runnable via `npx tsx examples/<name>.ts`:\n\n| File | Demonstrates |\n|---|---|\n| `bare-agent.ts` | Single tool, single agent call, structured result |\n| `multi-phase-pipeline.ts` | Linear pipeline with one parallel branch |\n| `streaming-consumer.ts` | Content + tool-call deltas as they stream |\n| `bounded-fanout.ts` | Per-item agent over a list, concurrency-capped |\n| `sse-server.ts` | `JobRunner` + `streamToSSE` in an HTTP handler |\n| `agent-authored-cron.ts` | End-to-end automation skeleton — fetch / triage / summarize / compose, with `verifyResult` and `JobRunner` |\n| `honcho-memory.ts` | `MemoryProvider` bound to Honcho — recall before an agent call, remember after |\n\n## Stability\n\nv1.0.0 onward follows semver:\n\n- **patch (1.0.x)** — bug fixes, no API changes\n- **minor (1.x.0)** — additive changes (new patterns, new optional fields)\n- **major (x.0.0)** — breaking changes\n\nItems marked `@internal` in their JSDoc (e.g. `consumeStream`, `toOpenAIMessages`) are reachable for advanced callers but **not** covered by semver.\n\n103 tests across 13 files. Validated in production by [`Code4me2/chiya-library`](https://github.com/Code4me2/chiya-library) — digest + librarian pipelines, hundreds of articles per day, on systemd timers.\n\n## Contributing\n\nIssues and PRs welcome. See [CONTRIBUTING.md](./CONTRIBUTING.md). For larger changes, open an issue first — the framework has a deliberately narrow scope and we'd rather discuss before code is written.\n\n## License\n\nMIT. See [LICENSE](./LICENSE).\n","readmeFilename":"README.md"}