thinkpool-pair 0.7.428 → 0.7.430
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/agent-notify.mjs +1 -1
- package/bridge.mjs +1 -1
- package/claude-session.mjs +1 -1
- package/code-automations.mjs +1 -0
- package/hermes-policy.mjs +1 -1
- package/package.json +2 -1
- package/publish-manifest.json +12 -11
- package/scheduled-runs.mjs +1 -1
- package/thinkpool-capabilities.json +28 -1
package/agent-notify.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const DEFAULT_MIN_TURN_MS=3e4;export const DEFAULT_PERM_GRACE_MS=2e4;export const SUMMARY_MAX=200;export function isUserFacingLane(e){return
|
|
1
|
+
export const DEFAULT_MIN_TURN_MS=3e4;export const DEFAULT_PERM_GRACE_MS=2e4;export const SUMMARY_MAX=200;export function isUserFacingLane(e){return!(!e||e.spawnedBy||e.flowTaskKey||e.scheduleRunId)}export function clipSummary(e,r=200){if(null==e)return"";const t=String(e).replace(/\s+/g," ").trim();return t.length<=r?t:t.slice(0,r).replace(/\s+\S*$/,"").trimEnd()+"…"}export function shouldNotifyTurnDone({entry:e,subtype:r,startedAt:t,now:n,minTurnMs:o=3e4}){return!!shouldRecordTurnDone({entry:e,subtype:r,startedAt:t,now:n})&&n-t>=o}export function shouldRecordTurnDone({entry:e,subtype:r,startedAt:t,now:n}){return!!isUserFacingLane(e)&&"aborted"!==r&&!!t&&Number.isFinite(n)}export function permissionSummary(e){const r=e||{},t=Array.isArray(r.questions)?r.questions.map(e=>e?.question).filter(Boolean):[];if(t.length)return clipSummary(t.join(" / "));if("plan"===r.risk)return clipSummary(r.plan?`Plan ready: ${r.plan}`:"A plan is ready for review");const n=r.input,o=n&&(n.command||n.file_path||n.path||n.pattern||n.url||n.query||n.description),i=r.toolName||"A tool";return clipSummary(o?`${i} ${o}`:i)}export function createPermNotifier({graceMs:e=2e4,onArm:r=()=>{},onFire:t=()=>{},onRetract:n=()=>{},onResolve:o=()=>{},setTimer:i=setTimeout,clearTimer:s=clearTimeout}={}){const a=new Map,u=(e,r,t)=>{try{e(r,t)}catch{}},c=e=>{const r=a.get(e);if(r){if(r.timer)try{s(r.timer)}catch{}a.delete(e),r.fired&&u(n,e,r.payload),u(o,e,r.payload)}};return{arm(n,o){if(!n||a.has(n))return;const s={timer:null,fired:!1,payload:o};u(r,n,o),s.timer=i(()=>{s.timer=null,s.fired=!0,u(t,n,o)},e);try{s.timer?.unref?.()}catch{}a.set(n,s)},resolve:c,clearAll(){for(const e of[...a.keys()])c(e)},size:()=>a.size,fired:e=>!!a.get(e)?.fired}}
|