@tech-leads-club/harness-toolkit 0.14.2 → 0.15.1

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.
Files changed (44) hide show
  1. package/README.md +2 -2
  2. package/capabilities/catalog.json +2 -2
  3. package/dist/compact-before.mjs +84 -84
  4. package/dist/doctor.mjs +89 -89
  5. package/dist/init-project.mjs +87 -87
  6. package/dist/install-runtime.mjs +86 -86
  7. package/dist/lessons-cli.mjs +83 -83
  8. package/dist/obs-cli.mjs +86 -86
  9. package/dist/price-lookup.mjs +1 -1
  10. package/dist/prompt-submit.mjs +84 -84
  11. package/dist/refresh-model-prices.mjs +88 -88
  12. package/dist/response-after.mjs +84 -84
  13. package/dist/run.mjs +84 -84
  14. package/dist/session-end.mjs +89 -89
  15. package/dist/session-start.mjs +91 -91
  16. package/dist/shim.mjs +85 -85
  17. package/dist/ship-gate.mjs +85 -85
  18. package/dist/stop.mjs +92 -92
  19. package/dist/subagent-start.mjs +84 -84
  20. package/dist/subagent-stop.mjs +85 -85
  21. package/dist/support.mjs +87 -87
  22. package/dist/tlc-cli.mjs +104 -104
  23. package/dist/tool-after.mjs +80 -80
  24. package/dist/tool-before.mjs +88 -88
  25. package/dist/tool-failure.mjs +84 -84
  26. package/dist/uninstall-runtime.mjs +4 -4
  27. package/docs/concepts.md +13 -7
  28. package/docs/diagnose.md +2 -2
  29. package/docs/log.md +6 -0
  30. package/package.json +1 -1
  31. package/src/core/core.facade.ts +20 -3
  32. package/src/core/gate/gate.artifact.ts +43 -7
  33. package/src/core/observability/observability.service.ts +1 -1
  34. package/src/core/presence/presence.service.ts +68 -0
  35. package/src/core/rules/rules.trigger.ts +89 -5
  36. package/src/core/turn/turn.activity.ts +14 -4
  37. package/src/entrypoints/run.ts +39 -2
  38. package/src/entrypoints/session-start.ts +1 -0
  39. package/src/entrypoints/stop.ts +14 -2
  40. package/src/entrypoints/support.ts +8 -1
  41. package/src/entrypoints/tool-before.ts +10 -2
  42. package/src/platform/paths.ts +4 -0
  43. package/src/providers/cursor/cursor.inbound.ts +22 -1
  44. package/tools/obs-cli.ts +12 -2
@@ -1,2 +1,2 @@
1
1
  import{createRequire as T}from"node:module";var _=T(import.meta.url);function C(P){let G=[],J=!1;for(let Q of P){if(Q==="--json"){J=!0;continue}G.push(Q)}return{json:J,rest:G}}function F(P,G=E){G(`${JSON.stringify(P)}
2
- `)}function E(P){process.stdout.write(P)}import{existsSync as z,readFileSync as f}from"node:fs";import{join as k}from"node:path";import{homedir as b}from"node:os";import{delimiter as r,dirname as n,join as D,resolve as t}from"node:path";function H(){return D(b(),".tlc","harness")}function S(P=process.env){return P.TLC_HOME??H()}function U(P=process.env){return P.TLC_HOME_FROM_ENV==="0"?H():S(P)}var j="litellm",p={"cursor-grok-4.5":"grok-4.5",auto:"auto-cost"};function x(P){if(!P)return{};let{_meta:G,...J}=P;return J}function L(P){return P.trim().toLowerCase().replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/[[\]]/g,"").replace(/[^a-z0-9.+]+/g,"-").replace(/^-+|-+$/g,"")}function g(P,G){let J=P.trim(),Q=[],Y=(V)=>{if(V&&!Q.includes(V))Q.push(V)};if(Y(J),Y(G[J]),Y(L(J)),Y(G[L(J)]),J.includes("/"))Y(J.slice(J.lastIndexOf("/")+1));let K=J.replace(/-(high|medium|low|max|fast|thinking)$/i,"");if(K!==J)Y(K),Y(G[K]),Y(L(K));return Q}function W(P,G){let J=P[G];if(J)return{key:G,entry:J};for(let[Q,Y]of Object.entries(P))if(G.startsWith(Q)||Q.startsWith(G))return{key:Q,entry:Y};return}function v(){return k(U(),"model-prices.json")}function y(){return k(U(),"model-prices.local.json")}var A=new Map;function N(P){if(!z(P))return A.delete(P),null;let G;try{G=f(P,"utf8")}catch{return A.delete(P),null}let J=A.get(P);if(J&&J.text===G)return J.value;let Q;try{Q=JSON.parse(G)}catch{return A.delete(P),null}return A.set(P,{text:G,value:Q}),Q}function u(){return N(v())??{}}function O(P,G){return x(P.planes?.[G]??null)}function M(P,G){let J=G.trim();if(!J)return;let Q=u(),Y=x(N(y())),K=P?O(Q,P):{},V=O(Q,j),B=g(J,p);for(let $ of B){let q=Y[$];if(q)return{entry:q,key:$,source:"override"}}for(let $ of B){let q=K[$];if(q)return{entry:q,key:$,source:"provider"}}for(let $ of B){let q=V[$];if(q)return{entry:q,key:$,source:"litellm"}}let Z=L(J),I=W(Y,Z);if(I)return{...I,source:"override"};let X=W(K,Z);if(X)return{...X,source:"provider"};let R=W(V,Z);if(R)return{...R,source:"litellm"};return}function w(P,G,J){let Q=J.inputTokens??0,Y=J.outputTokens??0,K=J.cacheReadTokens??0,V=J.cacheWriteTokens??0;if(!G||Q<=0&&Y<=0&&K<=0&&V<=0)return{costUsd:null,billing:"unknown",pool:"unknown",source:"missing"};let B=M(P,G);if(!B)return{costUsd:null,billing:"unknown",pool:"unknown",source:"missing"};let{entry:Z,key:I,source:X}=B,R=Z.pool??"unknown";if(Z.billing==="included")return{costUsd:null,billing:"included",pool:R,source:X,catalogKey:I};if(typeof Z.promptPer1M!=="number"||typeof Z.completionPer1M!=="number")return{costUsd:null,billing:Z.billing??"unknown",pool:R,source:X,catalogKey:I};let $=Q/1e6*Z.promptPer1M+Y/1e6*Z.completionPer1M;if(typeof Z.cacheReadPer1M==="number"&&K>0)$+=K/1e6*Z.cacheReadPer1M;if(typeof Z.cacheWritePer1M==="number"&&V>0)$+=V/1e6*Z.cacheWritePer1M;return{costUsd:$,billing:"metered",pool:R,source:X,catalogKey:I}}function m(P){let G=P[0];if(!G)return null;return{model:G,provider:P[1]??""}}function c(P){let G=M(P.provider,P.model),J=w(P.provider,P.model,{inputTokens:1e6,outputTokens:1e6});return{model:P.model,provider:P.provider,resolved:G,per1M:J}}function l(){let{json:P,rest:G}=C(process.argv.slice(2)),J=m(G);if(!J)console.error("usage: tlc harness prices lookup <model-id> [provider]"),console.error(" or: node --experimental-strip-types tools/price-lookup.ts <model-id> [provider] (dev)"),process.exit(1);let Q=c(J);if(P)F(Q);else console.log(JSON.stringify(Q,null,2));if(!Q.resolved)process.exit(2)}if(_.main==_.module)l();export{m as parsePriceLookupArgs,c as lookupPrice};
2
+ `)}function E(P){process.stdout.write(P)}import{existsSync as S,readFileSync as f}from"node:fs";import{join as k}from"node:path";import{homedir as b}from"node:os";import{delimiter as r,dirname as n,join as z,resolve as a}from"node:path";function H(){return z(b(),".tlc","harness")}function D(P=process.env){return P.TLC_HOME??H()}function U(P=process.env){return P.TLC_HOME_FROM_ENV==="0"?H():D(P)}var j="litellm",p={"cursor-grok-4.5":"grok-4.5",auto:"auto-cost"};function x(P){if(!P)return{};let{_meta:G,...J}=P;return J}function L(P){return P.trim().toLowerCase().replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/[[\]]/g,"").replace(/[^a-z0-9.+]+/g,"-").replace(/^-+|-+$/g,"")}function g(P,G){let J=P.trim(),Q=[],Y=(V)=>{if(V&&!Q.includes(V))Q.push(V)};if(Y(J),Y(G[J]),Y(L(J)),Y(G[L(J)]),J.includes("/"))Y(J.slice(J.lastIndexOf("/")+1));let K=J.replace(/-(high|medium|low|max|fast|thinking)$/i,"");if(K!==J)Y(K),Y(G[K]),Y(L(K));return Q}function W(P,G){let J=P[G];if(J)return{key:G,entry:J};for(let[Q,Y]of Object.entries(P))if(G.startsWith(Q)||Q.startsWith(G))return{key:Q,entry:Y};return}function v(){return k(U(),"model-prices.json")}function y(){return k(U(),"model-prices.local.json")}var A=new Map;function N(P){if(!S(P))return A.delete(P),null;let G;try{G=f(P,"utf8")}catch{return A.delete(P),null}let J=A.get(P);if(J&&J.text===G)return J.value;let Q;try{Q=JSON.parse(G)}catch{return A.delete(P),null}return A.set(P,{text:G,value:Q}),Q}function u(){return N(v())??{}}function O(P,G){return x(P.planes?.[G]??null)}function M(P,G){let J=G.trim();if(!J)return;let Q=u(),Y=x(N(y())),K=P?O(Q,P):{},V=O(Q,j),B=g(J,p);for(let $ of B){let q=Y[$];if(q)return{entry:q,key:$,source:"override"}}for(let $ of B){let q=K[$];if(q)return{entry:q,key:$,source:"provider"}}for(let $ of B){let q=V[$];if(q)return{entry:q,key:$,source:"litellm"}}let Z=L(J),I=W(Y,Z);if(I)return{...I,source:"override"};let X=W(K,Z);if(X)return{...X,source:"provider"};let R=W(V,Z);if(R)return{...R,source:"litellm"};return}function w(P,G,J){let Q=J.inputTokens??0,Y=J.outputTokens??0,K=J.cacheReadTokens??0,V=J.cacheWriteTokens??0;if(!G||Q<=0&&Y<=0&&K<=0&&V<=0)return{costUsd:null,billing:"unknown",pool:"unknown",source:"missing"};let B=M(P,G);if(!B)return{costUsd:null,billing:"unknown",pool:"unknown",source:"missing"};let{entry:Z,key:I,source:X}=B,R=Z.pool??"unknown";if(Z.billing==="included")return{costUsd:null,billing:"included",pool:R,source:X,catalogKey:I};if(typeof Z.promptPer1M!=="number"||typeof Z.completionPer1M!=="number")return{costUsd:null,billing:Z.billing??"unknown",pool:R,source:X,catalogKey:I};let $=Q/1e6*Z.promptPer1M+Y/1e6*Z.completionPer1M;if(typeof Z.cacheReadPer1M==="number"&&K>0)$+=K/1e6*Z.cacheReadPer1M;if(typeof Z.cacheWritePer1M==="number"&&V>0)$+=V/1e6*Z.cacheWritePer1M;return{costUsd:$,billing:"metered",pool:R,source:X,catalogKey:I}}function m(P){let G=P[0];if(!G)return null;return{model:G,provider:P[1]??""}}function c(P){let G=M(P.provider,P.model),J=w(P.provider,P.model,{inputTokens:1e6,outputTokens:1e6});return{model:P.model,provider:P.provider,resolved:G,per1M:J}}function l(){let{json:P,rest:G}=C(process.argv.slice(2)),J=m(G);if(!J)console.error("usage: tlc harness prices lookup <model-id> [provider]"),console.error(" or: node --experimental-strip-types tools/price-lookup.ts <model-id> [provider] (dev)"),process.exit(1);let Q=c(J);if(P)F(Q);else console.log(JSON.stringify(Q,null,2));if(!Q.resolved)process.exit(2)}if(_.main==_.module)l();export{m as parsePriceLookupArgs,c as lookupPrice};